[SCSI] qla2xxx: Code changes to support new dynamic logging infrastructure.
authorSaurav Kashyap <saurav.kashyap@qlogic.com>
Thu, 14 Jul 2011 19:00:13 +0000 (12:00 -0700)
committerJames Bottomley <JBottomley@Parallels.com>
Wed, 27 Jul 2011 10:16:17 +0000 (14:16 +0400)
The code is changed to support the new dynamic logging infrastructure.
Following are the levels added.
Default is 0 - no logging.  0x40000000 - Module Init & Probe.
0x20000000 - Mailbox Cmnds. 0x10000000 - Device Discovery.
0x08000000 - IO tracing.    0x04000000 - DPC Thread.
0x02000000 - Async events.  0x01000000 - Timer routines.
0x00800000 - User space.    0x00400000 - Task Management.
0x00200000 - AER/EEH.       0x00100000 - Multi Q.
0x00080000 - P3P Specific.  0x00040000 - Virtual Port.
0x00020000 - Buffer Dump.   0x00010000 - Misc.
0x7fffffff - For enabling all logs, can be too many logs.

Setting ql2xextended_error_logging module parameter to any of the above
value, will enable the debug for that particular level.
Do LOGICAL OR of the value to enable more than one level.

Signed-off-by: Saurav Kashyap <saurav.kashyap@qlogic.com>
Signed-off-by: Giridhar Malavali <giridhar.malavali@qlogic.com>
Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: Joe Carnuccio <joe.carnuccio@qlogic.com>
Signed-off-by: Chad Dupuis <chad.dupuis@qlogic.com>
Signed-off-by: Madhuranath Iyengar <Madhu.Iyengar@qlogic.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
15 files changed:
drivers/scsi/qla2xxx/qla_attr.c
drivers/scsi/qla2xxx/qla_bsg.c
drivers/scsi/qla2xxx/qla_dbg.c
drivers/scsi/qla2xxx/qla_dfs.c
drivers/scsi/qla2xxx/qla_gbl.h
drivers/scsi/qla2xxx/qla_gs.c
drivers/scsi/qla2xxx/qla_init.c
drivers/scsi/qla2xxx/qla_inline.h
drivers/scsi/qla2xxx/qla_iocb.c
drivers/scsi/qla2xxx/qla_isr.c
drivers/scsi/qla2xxx/qla_mbx.c
drivers/scsi/qla2xxx/qla_mid.c
drivers/scsi/qla2xxx/qla_nx.c
drivers/scsi/qla2xxx/qla_os.c
drivers/scsi/qla2xxx/qla_sup.c

index 532313e0725e3f731f9b936756fd64e0b6970fe8..7836eb01c7fcd16a583e2d55884da2eea035de47 100644 (file)
@@ -42,8 +42,8 @@ qla2x00_sysfs_write_fw_dump(struct file *filp, struct kobject *kobj,
        int reading;
 
        if (IS_QLA82XX(ha)) {
-               DEBUG2(qla_printk(KERN_INFO, ha,
-                       "Firmware dump not supported for ISP82xx\n"));
+               ql_dbg(ql_dbg_user, vha, 0x705b,
+                   "Firmware dump not supported for ISP82xx\n");
                return count;
        }
 
@@ -56,7 +56,7 @@ qla2x00_sysfs_write_fw_dump(struct file *filp, struct kobject *kobj,
                if (!ha->fw_dump_reading)
                        break;
 
-               qla_printk(KERN_INFO, ha,
+               ql_log(ql_log_info, vha, 0x705d,
                    "Firmware dump cleared on (%ld).\n", vha->host_no);
 
                ha->fw_dump_reading = 0;
@@ -66,7 +66,7 @@ qla2x00_sysfs_write_fw_dump(struct file *filp, struct kobject *kobj,
                if (ha->fw_dumped && !ha->fw_dump_reading) {
                        ha->fw_dump_reading = 1;
 
-                       qla_printk(KERN_INFO, ha,
+                       ql_log(ql_log_info, vha, 0x705e,
                            "Raw firmware dump ready for read on (%ld).\n",
                            vha->host_no);
                }
@@ -148,7 +148,7 @@ qla2x00_sysfs_write_nvram(struct file *filp, struct kobject *kobj,
        }
 
        if (qla2x00_wait_for_hba_online(vha) != QLA_SUCCESS) {
-               qla_printk(KERN_WARNING, ha,
+               ql_log(ql_log_warn, vha, 0x705f,
                    "HBA not online, failing NVRAM update.\n");
                return -EAGAIN;
        }
@@ -158,6 +158,8 @@ qla2x00_sysfs_write_nvram(struct file *filp, struct kobject *kobj,
        ha->isp_ops->read_nvram(vha, (uint8_t *)ha->nvram, ha->nvram_base,
            count);
 
+       ql_dbg(ql_dbg_user, vha, 0x7060,
+           "Setting ISP_ABORT_NEEDED\n");
        /* NVRAM settings take effect immediately. */
        set_bit(ISP_ABORT_NEEDED, &vha->dpc_flags);
        qla2xxx_wake_dpc(vha);
@@ -255,9 +257,9 @@ qla2x00_sysfs_write_optrom_ctl(struct file *filp, struct kobject *kobj,
 
                ha->optrom_state = QLA_SWAITING;
 
-               DEBUG2(qla_printk(KERN_INFO, ha,
+               ql_dbg(ql_dbg_user, vha, 0x7061,
                    "Freeing flash region allocation -- 0x%x bytes.\n",
-                   ha->optrom_region_size));
+                   ha->optrom_region_size);
 
                vfree(ha->optrom_buffer);
                ha->optrom_buffer = NULL;
@@ -273,7 +275,7 @@ qla2x00_sysfs_write_optrom_ctl(struct file *filp, struct kobject *kobj,
                ha->optrom_state = QLA_SREADING;
                ha->optrom_buffer = vmalloc(ha->optrom_region_size);
                if (ha->optrom_buffer == NULL) {
-                       qla_printk(KERN_WARNING, ha,
+                       ql_log(ql_log_warn, vha, 0x7062,
                            "Unable to allocate memory for optrom retrieval "
                            "(%x).\n", ha->optrom_region_size);
 
@@ -282,14 +284,14 @@ qla2x00_sysfs_write_optrom_ctl(struct file *filp, struct kobject *kobj,
                }
 
                if (qla2x00_wait_for_hba_online(vha) != QLA_SUCCESS) {
-                       qla_printk(KERN_WARNING, ha,
-                               "HBA not online, failing NVRAM update.\n");
+                       ql_log(ql_log_warn, vha, 0x7063,
+                           "HBA not online, failing NVRAM update.\n");
                        return -EAGAIN;
                }
 
-               DEBUG2(qla_printk(KERN_INFO, ha,
+               ql_dbg(ql_dbg_user, vha, 0x7064,
                    "Reading flash region -- 0x%x/0x%x.\n",
-                   ha->optrom_region_start, ha->optrom_region_size));
+                   ha->optrom_region_start, ha->optrom_region_size);
 
                memset(ha->optrom_buffer, 0, ha->optrom_region_size);
                ha->isp_ops->read_optrom(vha, ha->optrom_buffer,
@@ -328,7 +330,7 @@ qla2x00_sysfs_write_optrom_ctl(struct file *filp, struct kobject *kobj,
                else if (IS_QLA25XX(ha) || IS_QLA8XXX_TYPE(ha))
                        valid = 1;
                if (!valid) {
-                       qla_printk(KERN_WARNING, ha,
+                       ql_log(ql_log_warn, vha, 0x7065,
                            "Invalid start region 0x%x/0x%x.\n", start, size);
                        return -EINVAL;
                }
@@ -340,17 +342,17 @@ qla2x00_sysfs_write_optrom_ctl(struct file *filp, struct kobject *kobj,
                ha->optrom_state = QLA_SWRITING;
                ha->optrom_buffer = vmalloc(ha->optrom_region_size);
                if (ha->optrom_buffer == NULL) {
-                       qla_printk(KERN_WARNING, ha,
+                       ql_log(ql_log_warn, vha, 0x7066,
                            "Unable to allocate memory for optrom update "
-                           "(%x).\n", ha->optrom_region_size);
+                           "(%x)\n", ha->optrom_region_size);
 
                        ha->optrom_state = QLA_SWAITING;
                        return count;
                }
 
-               DEBUG2(qla_printk(KERN_INFO, ha,
+               ql_dbg(ql_dbg_user, vha, 0x7067,
                    "Staging flash region write -- 0x%x/0x%x.\n",
-                   ha->optrom_region_start, ha->optrom_region_size));
+                   ha->optrom_region_start, ha->optrom_region_size);
 
                memset(ha->optrom_buffer, 0, ha->optrom_region_size);
                break;
@@ -359,14 +361,14 @@ qla2x00_sysfs_write_optrom_ctl(struct file *filp, struct kobject *kobj,
                        break;
 
                if (qla2x00_wait_for_hba_online(vha) != QLA_SUCCESS) {
-                       qla_printk(KERN_WARNING, ha,
+                       ql_log(ql_log_warn, vha, 0x7068,
                            "HBA not online, failing flash update.\n");
                        return -EAGAIN;
                }
 
-               DEBUG2(qla_printk(KERN_INFO, ha,
+               ql_dbg(ql_dbg_user, vha, 0x7069,
                    "Writing flash region -- 0x%x/0x%x.\n",
-                   ha->optrom_region_start, ha->optrom_region_size));
+                   ha->optrom_region_start, ha->optrom_region_size);
 
                ha->isp_ops->write_optrom(vha, ha->optrom_buffer,
                    ha->optrom_region_start, ha->optrom_region_size);
@@ -425,7 +427,7 @@ qla2x00_sysfs_write_vpd(struct file *filp, struct kobject *kobj,
                return 0;
 
        if (qla2x00_wait_for_hba_online(vha) != QLA_SUCCESS) {
-               qla_printk(KERN_WARNING, ha,
+               ql_log(ql_log_warn, vha, 0x706a,
                    "HBA not online, failing VPD update.\n");
                return -EAGAIN;
        }
@@ -440,7 +442,7 @@ qla2x00_sysfs_write_vpd(struct file *filp, struct kobject *kobj,
 
        tmp_data = vmalloc(256);
        if (!tmp_data) {
-               qla_printk(KERN_WARNING, ha,
+               ql_log(ql_log_warn, vha, 0x706b,
                    "Unable to allocate memory for VPD information update.\n");
                goto done;
        }
@@ -480,7 +482,7 @@ qla2x00_sysfs_read_sfp(struct file *filp, struct kobject *kobj,
        ha->sfp_data = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL,
            &ha->sfp_data_dma);
        if (!ha->sfp_data) {
-               qla_printk(KERN_WARNING, ha,
+               ql_log(ql_log_warn, vha, 0x706c,
                    "Unable to allocate memory for SFP read-data.\n");
                return 0;
        }
@@ -499,9 +501,10 @@ do_read:
                rval = qla2x00_read_sfp(vha, ha->sfp_data_dma, ha->sfp_data,
                    addr, offset, SFP_BLOCK_SIZE, 0);
                if (rval != QLA_SUCCESS) {
-                       qla_printk(KERN_WARNING, ha,
+                       ql_log(ql_log_warn, vha, 0x706d,
                            "Unable to read SFP data (%x/%x/%x).\n", rval,
                            addr, offset);
+
                        count = 0;
                        break;
                }
@@ -538,8 +541,8 @@ qla2x00_sysfs_write_reset(struct file *filp, struct kobject *kobj,
        type = simple_strtol(buf, NULL, 10);
        switch (type) {
        case 0x2025c:
-               qla_printk(KERN_INFO, ha,
-                   "Issuing ISP reset on (%ld).\n", vha->host_no);
+               ql_log(ql_log_info, vha, 0x706e,
+                   "Issuing ISP reset.\n");
 
                scsi_block_requests(vha->host);
                set_bit(ISP_ABORT_NEEDED, &vha->dpc_flags);
@@ -551,8 +554,8 @@ qla2x00_sysfs_write_reset(struct file *filp, struct kobject *kobj,
                if (!IS_QLA81XX(ha))
                        break;
 
-               qla_printk(KERN_INFO, ha,
-                   "Issuing MPI reset on (%ld).\n", vha->host_no);
+               ql_log(ql_log_info, vha, 0x706f,
+                   "Issuing MPI reset.\n");
 
                /* Make sure FC side is not in reset */
                qla2x00_wait_for_hba_online(vha);
@@ -560,20 +563,19 @@ qla2x00_sysfs_write_reset(struct file *filp, struct kobject *kobj,
                /* Issue MPI reset */
                scsi_block_requests(vha->host);
                if (qla81xx_restart_mpi_firmware(vha) != QLA_SUCCESS)
-                       qla_printk(KERN_WARNING, ha,
-                           "MPI reset failed on (%ld).\n", vha->host_no);
+                       ql_log(ql_log_warn, vha, 0x7070,
+                           "MPI reset failed.\n");
                scsi_unblock_requests(vha->host);
                break;
        case 0x2025e:
                if (!IS_QLA82XX(ha) || vha != base_vha) {
-                       qla_printk(KERN_INFO, ha,
-                           "FCoE ctx reset not supported for host%ld.\n",
-                           vha->host_no);
+                       ql_log(ql_log_info, vha, 0x7071,
+                           "FCoE ctx reset no supported.\n");
                        return count;
                }
 
-               qla_printk(KERN_INFO, ha,
-                   "Issuing FCoE CTX reset on host%ld.\n", vha->host_no);
+               ql_log(ql_log_info, vha, 0x7072,
+                   "Issuing FCoE ctx reset.\n");
                set_bit(FCOE_CTX_RESET_NEEDED, &vha->dpc_flags);
                qla2xxx_wake_dpc(vha);
                qla2x00_wait_for_fcoe_ctx_reset(vha);
@@ -611,8 +613,8 @@ qla2x00_sysfs_write_edc(struct file *filp, struct kobject *kobj,
                ha->edc_data = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL,
                    &ha->edc_data_dma);
                if (!ha->edc_data) {
-                       DEBUG2(qla_printk(KERN_INFO, ha,
-                           "Unable to allocate memory for EDC write.\n"));
+                       ql_log(ql_log_warn, vha, 0x7073,
+                           "Unable to allocate memory for EDC write.\n");
                        return 0;
                }
        }
@@ -631,9 +633,9 @@ qla2x00_sysfs_write_edc(struct file *filp, struct kobject *kobj,
        rval = qla2x00_write_sfp(vha, ha->edc_data_dma, ha->edc_data,
            dev, adr, len, opt);
        if (rval != QLA_SUCCESS) {
-               DEBUG2(qla_printk(KERN_INFO, ha,
-                   "Unable to write EDC (%x) %02x:%02x:%04x:%02x:%02x.\n",
-                   rval, dev, adr, opt, len, buf[8]));
+               ql_log(ql_log_warn, vha, 0x7074,
+                   "Unable to write EDC (%x) %02x:%04x:%02x:%02x\n",
+                   rval, dev, adr, opt, len, buf[8]);
                return 0;
        }
 
@@ -669,8 +671,8 @@ qla2x00_sysfs_write_edc_status(struct file *filp, struct kobject *kobj,
                ha->edc_data = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL,
                    &ha->edc_data_dma);
                if (!ha->edc_data) {
-                       DEBUG2(qla_printk(KERN_INFO, ha,
-                           "Unable to allocate memory for EDC status.\n"));
+                       ql_log(ql_log_warn, vha, 0x708c,
+                           "Unable to allocate memory for EDC status.\n");
                        return 0;
                }
        }
@@ -688,9 +690,9 @@ qla2x00_sysfs_write_edc_status(struct file *filp, struct kobject *kobj,
        rval = qla2x00_read_sfp(vha, ha->edc_data_dma, ha->edc_data,
                        dev, adr, len, opt);
        if (rval != QLA_SUCCESS) {
-               DEBUG2(qla_printk(KERN_INFO, ha,
-                   "Unable to write EDC status (%x) %02x:%02x:%04x:%02x.\n",
-                   rval, dev, adr, opt, len));
+               ql_log(ql_log_info, vha, 0x7075,
+                   "Unable to write EDC status (%x) %02x:%04x:%02x.\n",
+                   rval, dev, adr, opt, len);
                return 0;
        }
 
@@ -749,7 +751,7 @@ qla2x00_sysfs_read_xgmac_stats(struct file *filp, struct kobject *kobj,
        ha->xgmac_data = dma_alloc_coherent(&ha->pdev->dev, XGMAC_DATA_SIZE,
            &ha->xgmac_data_dma, GFP_KERNEL);
        if (!ha->xgmac_data) {
-               qla_printk(KERN_WARNING, ha,
+               ql_log(ql_log_warn, vha, 0x7076,
                    "Unable to allocate memory for XGMAC read-data.\n");
                return 0;
        }
@@ -761,7 +763,7 @@ do_read:
        rval = qla2x00_get_xgmac_stats(vha, ha->xgmac_data_dma,
            XGMAC_DATA_SIZE, &actual_size);
        if (rval != QLA_SUCCESS) {
-               qla_printk(KERN_WARNING, ha,
+               ql_log(ql_log_warn, vha, 0x7077,
                    "Unable to read XGMAC data (%x).\n", rval);
                count = 0;
        }
@@ -801,7 +803,7 @@ qla2x00_sysfs_read_dcbx_tlv(struct file *filp, struct kobject *kobj,
        ha->dcbx_tlv = dma_alloc_coherent(&ha->pdev->dev, DCBX_TLV_DATA_SIZE,
            &ha->dcbx_tlv_dma, GFP_KERNEL);
        if (!ha->dcbx_tlv) {
-               qla_printk(KERN_WARNING, ha,
+               ql_log(ql_log_warn, vha, 0x7078,
                    "Unable to allocate memory for DCBX TLV read-data.\n");
                return 0;
        }
@@ -813,8 +815,8 @@ do_read:
        rval = qla2x00_get_dcbx_params(vha, ha->dcbx_tlv_dma,
            DCBX_TLV_DATA_SIZE);
        if (rval != QLA_SUCCESS) {
-               qla_printk(KERN_WARNING, ha,
-                   "Unable to read DCBX TLV data (%x).\n", rval);
+               ql_log(ql_log_warn, vha, 0x7079,
+                   "Unable to read DCBX TLV (%x).\n", rval);
                count = 0;
        }
 
@@ -869,9 +871,13 @@ qla2x00_alloc_sysfs_attr(scsi_qla_host_t *vha)
                ret = sysfs_create_bin_file(&host->shost_gendev.kobj,
                    iter->attr);
                if (ret)
-                       qla_printk(KERN_INFO, vha->hw,
-                           "Unable to create sysfs %s binary attribute "
-                           "(%d).\n", iter->name, ret);
+                       ql_log(ql_log_warn, vha, 0x00f3,
+                           "Unable to create sysfs %s binary attribute (%d).\n",
+                           iter->name, ret);
+               else
+                       ql_dbg(ql_dbg_init, vha, 0x00f4,
+                           "Successfully created sysfs %s binary attribure.\n",
+                           iter->name);
        }
 }
 
@@ -1126,7 +1132,7 @@ qla2x00_beacon_store(struct device *dev, struct device_attribute *attr,
                return -EPERM;
 
        if (test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags)) {
-               qla_printk(KERN_WARNING, ha,
+               ql_log(ql_log_warn, vha, 0x707a,
                    "Abort ISP active -- ignoring beacon request.\n");
                return -EBUSY;
        }
@@ -1322,9 +1328,8 @@ qla2x00_thermal_temp_show(struct device *dev,
        temp = frac = 0;
        if (test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags) ||
            test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags))
-               DEBUG2_3_11(printk(KERN_WARNING
-                   "%s(%ld): isp reset in progress.\n",
-                   __func__, vha->host_no));
+               ql_log(ql_log_warn, vha, 0x707b,
+                   "ISP reset active.\n");
        else if (!vha->hw->flags.eeh_busy)
                rval = qla2x00_get_thermal_temp(vha, &temp, &frac);
        if (rval != QLA_SUCCESS)
@@ -1343,8 +1348,8 @@ qla2x00_fw_state_show(struct device *dev, struct device_attribute *attr,
 
        if (test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags) ||
                test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags))
-               DEBUG2_3_11(printk("%s(%ld): isp reset in progress.\n",
-                       __func__, vha->host_no));
+               ql_log(ql_log_warn, vha, 0x707c,
+                   "ISP reset active.\n");
        else if (!vha->hw->flags.eeh_busy)
                rval = qla2x00_get_firmware_state(vha, state);
        if (rval != QLA_SUCCESS)
@@ -1645,8 +1650,8 @@ qla2x00_get_fc_host_stats(struct Scsi_Host *shost)
 
        stats = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &stats_dma);
        if (stats == NULL) {
-               DEBUG2_3_11(printk("%s(%ld): Failed to allocate memory.\n",
-                   __func__, base_vha->host_no));
+               ql_log(ql_log_warn, vha, 0x707d,
+                   "Failed to allocate memory for stats.\n");
                goto done;
        }
        memset(stats, 0, DMA_POOL_SIZE);
@@ -1746,15 +1751,14 @@ qla24xx_vport_create(struct fc_vport *fc_vport, bool disable)
 
        ret = qla24xx_vport_create_req_sanity_check(fc_vport);
        if (ret) {
-               DEBUG15(printk("qla24xx_vport_create_req_sanity_check failed, "
-                   "status %x\n", ret));
+               ql_log(ql_log_warn, vha, 0x707e,
+                   "Vport sanity check failed, status %x\n", ret);
                return (ret);
        }
 
        vha = qla24xx_create_vhost(fc_vport);
        if (vha == NULL) {
-               DEBUG15(printk ("qla24xx_create_vhost failed, vha = %p\n",
-                   vha));
+               ql_log(ql_log_warn, vha, 0x707f, "Vport create host failed.\n");
                return FC_VPORT_FAILED;
        }
        if (disable) {
@@ -1764,8 +1768,8 @@ qla24xx_vport_create(struct fc_vport *fc_vport, bool disable)
                atomic_set(&vha->vp_state, VP_FAILED);
 
        /* ready to create vport */
-       qla_printk(KERN_INFO, vha->hw, "VP entry id %d assigned.\n",
-                                                       vha->vp_idx);
+       ql_log(ql_log_info, vha, 0x7080,
+           "VP entry id %d assigned.\n", vha->vp_idx);
 
        /* initialized vport states */
        atomic_set(&vha->loop_state, LOOP_DOWN);
@@ -1775,8 +1779,8 @@ qla24xx_vport_create(struct fc_vport *fc_vport, bool disable)
        if (atomic_read(&base_vha->loop_state) == LOOP_DOWN ||
            atomic_read(&base_vha->loop_state) == LOOP_DEAD) {
                /* Don't retry or attempt login of this virtual port */
-               DEBUG15(printk ("scsi(%ld): pport loop_state is not UP.\n",
-                   base_vha->host_no));
+               ql_dbg(ql_dbg_user, vha, 0x7081,
+                   "Vport loop state is not UP.\n");
                atomic_set(&vha->loop_state, LOOP_DEAD);
                if (!disable)
                        fc_vport_set_state(fc_vport, FC_VPORT_LINKDOWN);
@@ -1785,9 +1789,8 @@ qla24xx_vport_create(struct fc_vport *fc_vport, bool disable)
        if ((IS_QLA25XX(ha) || IS_QLA81XX(ha)) && ql2xenabledif) {
                if (ha->fw_attributes & BIT_4) {
                        vha->flags.difdix_supported = 1;
-                       DEBUG18(qla_printk(KERN_INFO, ha,
-                           "Registering for DIF/DIX type 1 and 3"
-                           " protection.\n"));
+                       ql_dbg(ql_dbg_user, vha, 0x7082,
+                           "Registered for DIF/DIX type 1 and 3 protection.\n");
                        scsi_host_set_prot(vha->host,
                            SHOST_DIF_TYPE1_PROTECTION
                            | SHOST_DIF_TYPE2_PROTECTION
@@ -1802,8 +1805,8 @@ qla24xx_vport_create(struct fc_vport *fc_vport, bool disable)
 
        if (scsi_add_host_with_dma(vha->host, &fc_vport->dev,
                                   &ha->pdev->dev)) {
-               DEBUG15(printk("scsi(%ld): scsi_add_host failure for VP[%d].\n",
-                       vha->host_no, vha->vp_idx));
+               ql_dbg(ql_dbg_user, vha, 0x7083,
+                   "scsi_add_host failure for VP[%d].\n", vha->vp_idx);
                goto vport_create_failed_2;
        }
 
@@ -1820,6 +1823,10 @@ qla24xx_vport_create(struct fc_vport *fc_vport, bool disable)
 
        if (ha->flags.cpu_affinity_enabled) {
                req = ha->req_q_map[1];
+               ql_dbg(ql_dbg_multiq, vha, 0xc000,
+                   "Request queue %p attached with "
+                   "VP[%d], cpu affinity =%d\n",
+                   req, vha->vp_idx, ha->flags.cpu_affinity_enabled);
                goto vport_queue;
        } else if (ql2xmaxqueues == 1 || !ha->npiv_info)
                goto vport_queue;
@@ -1836,13 +1843,16 @@ qla24xx_vport_create(struct fc_vport *fc_vport, bool disable)
                ret = qla25xx_create_req_que(ha, options, vha->vp_idx, 0, 0,
                        qos);
                if (!ret)
-                       qla_printk(KERN_WARNING, ha,
-                       "Can't create request queue for vp_idx:%d\n",
-                       vha->vp_idx);
+                       ql_log(ql_log_warn, vha, 0x7084,
+                           "Can't create request queue for VP[%d]\n",
+                           vha->vp_idx);
                else {
-                       DEBUG2(qla_printk(KERN_INFO, ha,
-                       "Request Que:%d (QoS: %d) created for vp_idx:%d\n",
-                       ret, qos, vha->vp_idx));
+                       ql_dbg(ql_dbg_multiq, vha, 0xc001,
+                           "Request Que:%d Q0s: %d) created for VP[%d]\n",
+                           ret, qos, vha->vp_idx);
+                       ql_dbg(ql_dbg_user, vha, 0x7085,
+                           "Request Que:%d Q0s: %d) created for VP[%d]\n",
+                           ret, qos, vha->vp_idx);
                        req = ha->req_q_map[ret];
                }
        }
@@ -1882,12 +1892,13 @@ qla24xx_vport_delete(struct fc_vport *fc_vport)
 
        if (vha->timer_active) {
                qla2x00_vp_stop_timer(vha);
-               DEBUG15(printk(KERN_INFO "scsi(%ld): timer for the vport[%d]"
-               " = %p has stopped\n", vha->host_no, vha->vp_idx, vha));
+               ql_dbg(ql_dbg_user, vha, 0x7086,
+                   "Timer for the VP[%d] has stopped\n", vha->vp_idx);
        }
 
        /* No pending activities shall be there on the vha now */
-       DEBUG(msleep(random32()%10));  /* Just to see if something falls on
+       if (ql2xextended_error_logging & ql_dbg_user)
+               msleep(random32()%10);  /* Just to see if something falls on
                                        * the net we have placed below */
 
        BUG_ON(atomic_read(&vha->vref_count));
@@ -1901,12 +1912,12 @@ qla24xx_vport_delete(struct fc_vport *fc_vport)
 
        if (vha->req->id && !ha->flags.cpu_affinity_enabled) {
                if (qla25xx_delete_req_que(vha, vha->req) != QLA_SUCCESS)
-                       qla_printk(KERN_WARNING, ha,
-                               "Queue delete failed.\n");
+                       ql_log(ql_log_warn, vha, 0x7087,
+                           "Queue delete failed.\n");
        }
 
        scsi_host_put(vha->host);
-       qla_printk(KERN_INFO, ha, "vport %d deleted\n", id);
+       ql_log(ql_log_info, vha, 0x7088, "VP[%d] deleted.\n", id);
        return 0;
 }
 
index 8c10e2c4928e3ccbbbab85e63534cde0c97aa528..07d1767cd26b077bce15cfbd6a675595b32b7c99 100644 (file)
@@ -36,7 +36,8 @@ done:
 }
 
 int
-qla24xx_fcp_prio_cfg_valid(struct qla_fcp_prio_cfg *pri_cfg, uint8_t flag)
+qla24xx_fcp_prio_cfg_valid(scsi_qla_host_t *vha,
+       struct qla_fcp_prio_cfg *pri_cfg, uint8_t flag)
 {
        int i, ret, num_valid;
        uint8_t *bcode;
@@ -51,18 +52,17 @@ qla24xx_fcp_prio_cfg_valid(struct qla_fcp_prio_cfg *pri_cfg, uint8_t flag)
 
        if (bcode_val == 0xFFFFFFFF) {
                /* No FCP Priority config data in flash */
-               DEBUG2(printk(KERN_INFO
-                   "%s: No FCP priority config data.\n",
-                   __func__));
+               ql_dbg(ql_dbg_user, vha, 0x7051,
+                   "No FCP Priority config data.\n");
                return 0;
        }
 
        if (bcode[0] != 'H' || bcode[1] != 'Q' || bcode[2] != 'O' ||
                        bcode[3] != 'S') {
                /* Invalid FCP priority data header*/
-               DEBUG2(printk(KERN_ERR
-                   "%s: Invalid FCP Priority data header. bcode=0x%x\n",
-                   __func__, bcode_val));
+               ql_dbg(ql_dbg_user, vha, 0x7052,
+                   "Invalid FCP Priority data header. bcode=0x%x.\n",
+                   bcode_val);
                return 0;
        }
        if (flag != 1)
@@ -77,15 +77,14 @@ qla24xx_fcp_prio_cfg_valid(struct qla_fcp_prio_cfg *pri_cfg, uint8_t flag)
 
        if (num_valid == 0) {
                /* No valid FCP priority data entries */
-               DEBUG2(printk(KERN_ERR
-                   "%s: No valid FCP Priority data entries.\n",
-                   __func__));
+               ql_dbg(ql_dbg_user, vha, 0x7053,
+                   "No valid FCP Priority data entries.\n");
                ret = 0;
        } else {
                /* FCP priority data is valid */
-               DEBUG2(printk(KERN_INFO
-                   "%s: Valid FCP priority data. num entries = %d\n",
-                   __func__, num_valid));
+               ql_dbg(ql_dbg_user, vha, 0x7054,
+                   "Valid FCP priority data. num entries = %d.\n",
+                   num_valid);
        }
 
        return ret;
@@ -182,10 +181,9 @@ qla24xx_proc_fcp_prio_cfg_cmd(struct fc_bsg_job *bsg_job)
                if (!ha->fcp_prio_cfg) {
                        ha->fcp_prio_cfg = vmalloc(FCP_PRIO_CFG_SIZE);
                        if (!ha->fcp_prio_cfg) {
-                               qla_printk(KERN_WARNING, ha,
-                                       "Unable to allocate memory "
-                                       "for fcp prio config data (%x).\n",
-                                       FCP_PRIO_CFG_SIZE);
+                               ql_log(ql_log_warn, vha, 0x7050,
+                                   "Unable to allocate memory for fcp prio "
+                                   "config data (%x).\n", FCP_PRIO_CFG_SIZE);
                                bsg_job->reply->result = (DID_ERROR << 16);
                                ret = -ENOMEM;
                                goto exit_fcp_prio_cfg;
@@ -198,9 +196,9 @@ qla24xx_proc_fcp_prio_cfg_cmd(struct fc_bsg_job *bsg_job)
                        FCP_PRIO_CFG_SIZE);
 
                /* validate fcp priority data */
-               if (!qla24xx_fcp_prio_cfg_valid(
-                       (struct qla_fcp_prio_cfg *)
-                       ha->fcp_prio_cfg, 1)) {
+
+               if (!qla24xx_fcp_prio_cfg_valid(vha,
+                   (struct qla_fcp_prio_cfg *) ha->fcp_prio_cfg, 1)) {
                        bsg_job->reply->result = (DID_ERROR << 16);
                        ret = -EINVAL;
                        /* If buffer was invalidatic int
@@ -256,9 +254,8 @@ qla2x00_process_els(struct fc_bsg_job *bsg_job)
 
        /* pass through is supported only for ISP 4Gb or higher */
        if (!IS_FWI2_CAPABLE(ha)) {
-               DEBUG2(qla_printk(KERN_INFO, ha,
-                   "scsi(%ld):ELS passthru not supported for ISP23xx based "
-                   "adapters\n", vha->host_no));
+               ql_dbg(ql_dbg_user, vha, 0x7001,
+                   "ELS passthru not supported for ISP23xx based adapters.\n");
                rval = -EPERM;
                goto done;
        }
@@ -266,11 +263,11 @@ qla2x00_process_els(struct fc_bsg_job *bsg_job)
        /*  Multiple SG's are not supported for ELS requests */
        if (bsg_job->request_payload.sg_cnt > 1 ||
                bsg_job->reply_payload.sg_cnt > 1) {
-               DEBUG2(printk(KERN_INFO
-                       "multiple SG's are not supported for ELS requests"
-                       " [request_sg_cnt: %x reply_sg_cnt: %x]\n",
-                       bsg_job->request_payload.sg_cnt,
-                       bsg_job->reply_payload.sg_cnt));
+               ql_dbg(ql_dbg_user, vha, 0x7002,
+                   "Multiple SG's are not suppored for ELS requests, "
+                   "request_sg_cnt=%x reply_sg_cnt=%x.\n",
+                   bsg_job->request_payload.sg_cnt,
+                   bsg_job->reply_payload.sg_cnt);
                rval = -EPERM;
                goto done;
        }
@@ -281,9 +278,9 @@ qla2x00_process_els(struct fc_bsg_job *bsg_job)
                 * if not perform fabric login
                 */
                if (qla2x00_fabric_login(vha, fcport, &nextlid)) {
-                       DEBUG2(qla_printk(KERN_WARNING, ha,
-                       "failed to login port %06X for ELS passthru\n",
-                       fcport->d_id.b24));
+                       ql_dbg(ql_dbg_user, vha, 0x7003,
+                           "Failed to login port %06X for ELS passthru.\n",
+                           fcport->d_id.b24);
                        rval = -EIO;
                        goto done;
                }
@@ -314,8 +311,7 @@ qla2x00_process_els(struct fc_bsg_job *bsg_job)
        }
 
        if (!vha->flags.online) {
-               DEBUG2(qla_printk(KERN_WARNING, ha,
-               "host not online\n"));
+               ql_log(ql_log_warn, vha, 0x7005, "Host not online.\n");
                rval = -EIO;
                goto done;
        }
@@ -337,12 +333,11 @@ qla2x00_process_els(struct fc_bsg_job *bsg_job)
 
        if ((req_sg_cnt !=  bsg_job->request_payload.sg_cnt) ||
                (rsp_sg_cnt != bsg_job->reply_payload.sg_cnt)) {
-               DEBUG2(printk(KERN_INFO
-                       "dma mapping resulted in different sg counts \
-                       [request_sg_cnt: %x dma_request_sg_cnt: %x\
-                       reply_sg_cnt: %x dma_reply_sg_cnt: %x]\n",
-                       bsg_job->request_payload.sg_cnt, req_sg_cnt,
-                       bsg_job->reply_payload.sg_cnt, rsp_sg_cnt));
+               ql_log(ql_log_warn, vha, 0x7008,
+                   "dma mapping resulted in different sg counts, "
+                   "request_sg_cnt: %x dma_request_sg_cnt:%x reply_sg_cnt:%x "
+                   "dma_reply_sg_cnt:%x.\n", bsg_job->request_payload.sg_cnt,
+                   req_sg_cnt, bsg_job->reply_payload.sg_cnt, rsp_sg_cnt);
                rval = -EAGAIN;
                goto done_unmap_sg;
        }
@@ -363,15 +358,16 @@ qla2x00_process_els(struct fc_bsg_job *bsg_job)
                "bsg_els_rpt" : "bsg_els_hst");
        els->u.bsg_job = bsg_job;
 
-       DEBUG2(qla_printk(KERN_INFO, ha,
-               "scsi(%ld:%x): bsg rqst type: %s els type: %x - loop-id=%x "
-               "portid=%02x%02x%02x.\n", vha->host_no, sp->handle, type,
-               bsg_job->request->rqst_data.h_els.command_code,
-               fcport->loop_id, fcport->d_id.b.domain, fcport->d_id.b.area,
-               fcport->d_id.b.al_pa));
+       ql_dbg(ql_dbg_user, vha, 0x700a,
+           "bsg rqst type: %s els type: %x - loop-id=%x "
+           "portid=%-2x%02x%02x.\n", type,
+           bsg_job->request->rqst_data.h_els.command_code, fcport->loop_id,
+           fcport->d_id.b.domain, fcport->d_id.b.area, fcport->d_id.b.al_pa);
 
        rval = qla2x00_start_sp(sp);
        if (rval != QLA_SUCCESS) {
+               ql_log(ql_log_warn, vha, 0x700e,
+                   "qla2x00_start_sp failed = %d\n", rval);
                kfree(sp->ctx);
                mempool_free(sp, ha->srb_mempool);
                rval = -EIO;
@@ -411,6 +407,8 @@ qla2x00_process_ct(struct fc_bsg_job *bsg_job)
                dma_map_sg(&ha->pdev->dev, bsg_job->request_payload.sg_list,
                        bsg_job->request_payload.sg_cnt, DMA_TO_DEVICE);
        if (!req_sg_cnt) {
+               ql_log(ql_log_warn, vha, 0x700f,
+                   "dma_map_sg return %d for request\n", req_sg_cnt);
                rval = -ENOMEM;
                goto done;
        }
@@ -418,24 +416,25 @@ qla2x00_process_ct(struct fc_bsg_job *bsg_job)
        rsp_sg_cnt = dma_map_sg(&ha->pdev->dev, bsg_job->reply_payload.sg_list,
                bsg_job->reply_payload.sg_cnt, DMA_FROM_DEVICE);
        if (!rsp_sg_cnt) {
+               ql_log(ql_log_warn, vha, 0x7010,
+                   "dma_map_sg return %d for reply\n", rsp_sg_cnt);
                rval = -ENOMEM;
                goto done;
        }
 
        if ((req_sg_cnt !=  bsg_job->request_payload.sg_cnt) ||
            (rsp_sg_cnt != bsg_job->reply_payload.sg_cnt)) {
-               DEBUG2(qla_printk(KERN_WARNING, ha,
-                   "[request_sg_cnt: %x dma_request_sg_cnt: %x\
-                   reply_sg_cnt: %x dma_reply_sg_cnt: %x]\n",
-                   bsg_job->request_payload.sg_cnt, req_sg_cnt,
-                   bsg_job->reply_payload.sg_cnt, rsp_sg_cnt));
+               ql_log(ql_log_warn, vha, 0x7011,
+                   "request_sg_cnt: %x dma_request_sg_cnt: %x reply_sg_cnt:%x "
+                   "dma_reply_sg_cnt: %x\n", bsg_job->request_payload.sg_cnt,
+                   req_sg_cnt, bsg_job->reply_payload.sg_cnt, rsp_sg_cnt);
                rval = -EAGAIN;
                goto done_unmap_sg;
        }
 
        if (!vha->flags.online) {
-               DEBUG2(qla_printk(KERN_WARNING, ha,
-                       "host not online\n"));
+               ql_log(ql_log_warn, vha, 0x7012,
+                   "Host is not online.\n");
                rval = -EIO;
                goto done_unmap_sg;
        }
@@ -451,8 +450,8 @@ qla2x00_process_ct(struct fc_bsg_job *bsg_job)
                loop_id = vha->mgmt_svr_loop_id;
                break;
        default:
-               DEBUG2(qla_printk(KERN_INFO, ha,
-                   "Unknown loop id: %x\n", loop_id));
+               ql_dbg(ql_dbg_user, vha, 0x7013,
+                   "Unknown loop id: %x.\n", loop_id);
                rval = -EINVAL;
                goto done_unmap_sg;
        }
@@ -464,6 +463,8 @@ qla2x00_process_ct(struct fc_bsg_job *bsg_job)
         */
        fcport = qla2x00_alloc_fcport(vha, GFP_KERNEL);
        if (!fcport) {
+               ql_log(ql_log_warn, vha, 0x7014,
+                   "Failed to allocate fcport.\n");
                rval = -ENOMEM;
                goto done_unmap_sg;
        }
@@ -479,6 +480,8 @@ qla2x00_process_ct(struct fc_bsg_job *bsg_job)
        /* Alloc SRB structure */
        sp = qla2x00_get_ctx_bsg_sp(vha, fcport, sizeof(struct srb_ctx));
        if (!sp) {
+               ql_log(ql_log_warn, vha, 0x7015,
+                   "qla2x00_get_ctx_bsg_sp failed.\n");
                rval = -ENOMEM;
                goto done_free_fcport;
        }
@@ -488,15 +491,17 @@ qla2x00_process_ct(struct fc_bsg_job *bsg_job)
        ct->name = "bsg_ct";
        ct->u.bsg_job = bsg_job;
 
-       DEBUG2(qla_printk(KERN_INFO, ha,
-               "scsi(%ld:%x): bsg rqst type: %s els type: %x - loop-id=%x "
-               "portid=%02x%02x%02x.\n", vha->host_no, sp->handle, type,
-               (bsg_job->request->rqst_data.h_ct.preamble_word2 >> 16),
-               fcport->loop_id, fcport->d_id.b.domain, fcport->d_id.b.area,
-               fcport->d_id.b.al_pa));
+       ql_dbg(ql_dbg_user, vha, 0x7016,
+           "bsg rqst type: %s else type: %x - "
+           "loop-id=%x portid=%02x%02x%02x.\n", type,
+           (bsg_job->request->rqst_data.h_ct.preamble_word2 >> 16),
+           fcport->loop_id, fcport->d_id.b.domain, fcport->d_id.b.area,
+           fcport->d_id.b.al_pa);
 
        rval = qla2x00_start_sp(sp);
        if (rval != QLA_SUCCESS) {
+               ql_log(ql_log_warn, vha, 0x7017,
+                   "qla2x00_start_sp failed=%d.\n", rval);
                kfree(sp->ctx);
                mempool_free(sp, ha->srb_mempool);
                rval = -EIO;
@@ -535,9 +540,8 @@ qla81xx_set_internal_loopback(scsi_qla_host_t *vha, uint16_t *config,
        ha->notify_dcbx_comp = 1;
        ret = qla81xx_set_port_config(vha, new_config);
        if (ret != QLA_SUCCESS) {
-               DEBUG2(printk(KERN_ERR
-                   "%s(%lu): Set port config failed\n",
-                   __func__, vha->host_no));
+               ql_log(ql_log_warn, vha, 0x7021,
+                   "set port config failed.\n");
                ha->notify_dcbx_comp = 0;
                rval = -EINVAL;
                goto done_set_internal;
@@ -545,11 +549,11 @@ qla81xx_set_internal_loopback(scsi_qla_host_t *vha, uint16_t *config,
 
        /* Wait for DCBX complete event */
        if (!wait_for_completion_timeout(&ha->dcbx_comp, (20 * HZ))) {
-               DEBUG2(qla_printk(KERN_WARNING, ha,
-                   "State change notificaition not received.\n"));
+               ql_dbg(ql_dbg_user, vha, 0x7022,
+                   "State change notification not received.\n");
        } else
-               DEBUG2(qla_printk(KERN_INFO, ha,
-                   "State change RECEIVED\n"));
+               ql_dbg(ql_dbg_user, vha, 0x7023,
+                   "State change received.\n");
 
        ha->notify_dcbx_comp = 0;
 
@@ -581,9 +585,8 @@ qla81xx_reset_internal_loopback(scsi_qla_host_t *vha, uint16_t *config,
                ha->notify_dcbx_comp = wait;
                ret = qla81xx_set_port_config(vha, new_config);
                if (ret != QLA_SUCCESS) {
-                       DEBUG2(printk(KERN_ERR
-                           "%s(%lu): Set port config failed\n",
-                            __func__, vha->host_no));
+                       ql_log(ql_log_warn, vha, 0x7025,
+                           "Set port config failed.\n");
                        ha->notify_dcbx_comp = 0;
                        rval = -EINVAL;
                        goto done_reset_internal;
@@ -592,14 +595,14 @@ qla81xx_reset_internal_loopback(scsi_qla_host_t *vha, uint16_t *config,
                /* Wait for DCBX complete event */
                if (wait && !wait_for_completion_timeout(&ha->dcbx_comp,
                        (20 * HZ))) {
-                       DEBUG2(qla_printk(KERN_WARNING, ha,
-                           "State change notificaition not received.\n"));
+                       ql_dbg(ql_dbg_user, vha, 0x7026,
+                           "State change notification not received.\n");
                        ha->notify_dcbx_comp = 0;
                        rval = -EINVAL;
                        goto done_reset_internal;
                } else
-                       DEBUG2(qla_printk(KERN_INFO, ha,
-                           "State change RECEIVED\n"));
+                       ql_dbg(ql_dbg_user, vha, 0x7027,
+                           "State change received.\n");
 
                ha->notify_dcbx_comp = 0;
        }
@@ -629,11 +632,13 @@ qla2x00_process_loopback(struct fc_bsg_job *bsg_job)
 
        if (test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags) ||
                test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags) ||
-               test_bit(ISP_ABORT_RETRY, &vha->dpc_flags))
+               test_bit(ISP_ABORT_RETRY, &vha->dpc_flags)) {
+               ql_log(ql_log_warn, vha, 0x7018, "Abort active or needed.\n");
                return -EBUSY;
+       }
 
        if (!vha->flags.online) {
-               DEBUG2(qla_printk(KERN_WARNING, ha, "host not online\n"));
+               ql_log(ql_log_warn, vha, 0x7019, "Host is not online.\n");
                return -EIO;
        }
 
@@ -641,26 +646,31 @@ qla2x00_process_loopback(struct fc_bsg_job *bsg_job)
                bsg_job->request_payload.sg_list, bsg_job->request_payload.sg_cnt,
                DMA_TO_DEVICE);
 
-       if (!elreq.req_sg_cnt)
+       if (!elreq.req_sg_cnt) {
+               ql_log(ql_log_warn, vha, 0x701a,
+                   "dma_map_sg returned %d for request.\n", elreq.req_sg_cnt);
                return -ENOMEM;
+       }
 
        elreq.rsp_sg_cnt = dma_map_sg(&ha->pdev->dev,
                bsg_job->reply_payload.sg_list, bsg_job->reply_payload.sg_cnt,
                DMA_FROM_DEVICE);
 
        if (!elreq.rsp_sg_cnt) {
+               ql_log(ql_log_warn, vha, 0x701b,
+                   "dma_map_sg returned %d for reply.\n", elreq.rsp_sg_cnt);
                rval = -ENOMEM;
                goto done_unmap_req_sg;
        }
 
        if ((elreq.req_sg_cnt !=  bsg_job->request_payload.sg_cnt) ||
                (elreq.rsp_sg_cnt != bsg_job->reply_payload.sg_cnt)) {
-               DEBUG2(printk(KERN_INFO
-                       "dma mapping resulted in different sg counts "
-                       "[request_sg_cnt: %x dma_request_sg_cnt: %x "
-                       "reply_sg_cnt: %x dma_reply_sg_cnt: %x]\n",
-                       bsg_job->request_payload.sg_cnt, elreq.req_sg_cnt,
-                       bsg_job->reply_payload.sg_cnt, elreq.rsp_sg_cnt));
+               ql_log(ql_log_warn, vha, 0x701c,
+                   "dma mapping resulted in different sg counts, "
+                   "request_sg_cnt: %x dma_request_sg_cnt: %x "
+                   "reply_sg_cnt: %x dma_reply_sg_cnt: %x.\n",
+                   bsg_job->request_payload.sg_cnt, elreq.req_sg_cnt,
+                   bsg_job->reply_payload.sg_cnt, elreq.rsp_sg_cnt);
                rval = -EAGAIN;
                goto done_unmap_sg;
        }
@@ -668,8 +678,8 @@ qla2x00_process_loopback(struct fc_bsg_job *bsg_job)
        req_data = dma_alloc_coherent(&ha->pdev->dev, req_data_len,
                &req_data_dma, GFP_KERNEL);
        if (!req_data) {
-               DEBUG2(printk(KERN_ERR "%s: dma alloc for req_data "
-                       "failed for host=%lu\n", __func__, vha->host_no));
+               ql_log(ql_log_warn, vha, 0x701d,
+                   "dma alloc failed for req_data.\n");
                rval = -ENOMEM;
                goto done_unmap_sg;
        }
@@ -677,8 +687,8 @@ qla2x00_process_loopback(struct fc_bsg_job *bsg_job)
        rsp_data = dma_alloc_coherent(&ha->pdev->dev, rsp_data_len,
                &rsp_data_dma, GFP_KERNEL);
        if (!rsp_data) {
-               DEBUG2(printk(KERN_ERR "%s: dma alloc for rsp_data "
-                       "failed for host=%lu\n", __func__, vha->host_no));
+               ql_log(ql_log_warn, vha, 0x7004,
+                   "dma alloc failed for rsp_data.\n");
                rval = -ENOMEM;
                goto done_free_dma_req;
        }
@@ -699,8 +709,8 @@ qla2x00_process_loopback(struct fc_bsg_job *bsg_job)
            && req_data_len == MAX_ELS_FRAME_PAYLOAD)) &&
                elreq.options == EXTERNAL_LOOPBACK) {
                type = "FC_BSG_HST_VENDOR_ECHO_DIAG";
-               DEBUG2(qla_printk(KERN_INFO, ha,
-                       "scsi(%ld) bsg rqst type: %s\n", vha->host_no, type));
+               ql_dbg(ql_dbg_user, vha, 0x701e,
+                   "BSG request type: %s.\n", type);
                command_sent = INT_DEF_LB_ECHO_CMD;
                rval = qla2x00_echo_test(vha, &elreq, response);
        } else {
@@ -708,9 +718,8 @@ qla2x00_process_loopback(struct fc_bsg_job *bsg_job)
                        memset(config, 0, sizeof(config));
                        memset(new_config, 0, sizeof(new_config));
                        if (qla81xx_get_port_config(vha, config)) {
-                               DEBUG2(printk(KERN_ERR
-                                       "%s(%lu): Get port config failed\n",
-                                       __func__, vha->host_no));
+                               ql_log(ql_log_warn, vha, 0x701f,
+                                   "Get port config failed.\n");
                                bsg_job->reply->reply_payload_rcv_len = 0;
                                bsg_job->reply->result = (DID_ERROR << 16);
                                rval = -EPERM;
@@ -718,11 +727,13 @@ qla2x00_process_loopback(struct fc_bsg_job *bsg_job)
                        }
 
                        if (elreq.options != EXTERNAL_LOOPBACK) {
-                               DEBUG2(qla_printk(KERN_INFO, ha,
-                                       "Internal: current port config = %x\n",
-                                       config[0]));
+                               ql_dbg(ql_dbg_user, vha, 0x7020,
+                                   "Internal: curent port config = %x\n",
+                                   config[0]);
                                if (qla81xx_set_internal_loopback(vha, config,
                                        new_config)) {
+                                       ql_log(ql_log_warn, vha, 0x7024,
+                                           "Internal loopback failed.\n");
                                        bsg_job->reply->reply_payload_rcv_len =
                                                0;
                                        bsg_job->reply->result =
@@ -746,9 +757,8 @@ qla2x00_process_loopback(struct fc_bsg_job *bsg_job)
                        }
 
                        type = "FC_BSG_HST_VENDOR_LOOPBACK";
-                       DEBUG2(qla_printk(KERN_INFO, ha,
-                               "scsi(%ld) bsg rqst type: %s\n",
-                               vha->host_no, type));
+                       ql_dbg(ql_dbg_user, vha, 0x7028,
+                           "BSG request type: %s.\n", type);
 
                        command_sent = INT_DEF_LB_LOOPBACK_CMD;
                        rval = qla2x00_loopback_test(vha, &elreq, response);
@@ -763,17 +773,16 @@ qla2x00_process_loopback(struct fc_bsg_job *bsg_job)
 
                        if (response[0] == MBS_COMMAND_ERROR &&
                                        response[1] == MBS_LB_RESET) {
-                               DEBUG2(printk(KERN_ERR "%s(%ld): ABORTing "
-                                       "ISP\n", __func__, vha->host_no));
+                               ql_log(ql_log_warn, vha, 0x7029,
+                                   "MBX command error, Aborting ISP.\n");
                                set_bit(ISP_ABORT_NEEDED, &vha->dpc_flags);
                                qla2xxx_wake_dpc(vha);
                                qla2x00_wait_for_chip_reset(vha);
                                /* Also reset the MPI */
                                if (qla81xx_restart_mpi_firmware(vha) !=
                                    QLA_SUCCESS) {
-                                       qla_printk(KERN_INFO, ha,
-                                           "MPI reset failed for host%ld.\n",
-                                           vha->host_no);
+                                       ql_log(ql_log_warn, vha, 0x702a,
+                                           "MPI reset failed.\n");
                                }
 
                                bsg_job->reply->reply_payload_rcv_len = 0;
@@ -783,17 +792,16 @@ qla2x00_process_loopback(struct fc_bsg_job *bsg_job)
                        }
                } else {
                        type = "FC_BSG_HST_VENDOR_LOOPBACK";
-                       DEBUG2(qla_printk(KERN_INFO, ha,
-                               "scsi(%ld) bsg rqst type: %s\n",
-                               vha->host_no, type));
+                       ql_dbg(ql_dbg_user, vha, 0x702b,
+                           "BSG request type: %s.\n", type);
                        command_sent = INT_DEF_LB_LOOPBACK_CMD;
                        rval = qla2x00_loopback_test(vha, &elreq, response);
                }
        }
 
        if (rval) {
-               DEBUG2(qla_printk(KERN_WARNING, ha, "scsi(%ld) Vendor "
-                   "request %s failed\n", vha->host_no, type));
+               ql_log(ql_log_warn, vha, 0x702c,
+                   "Vendor request %s failed.\n", type);
 
                fw_sts_ptr = ((uint8_t *)bsg_job->req->sense) +
                    sizeof(struct fc_bsg_reply);
@@ -805,8 +813,8 @@ qla2x00_process_loopback(struct fc_bsg_job *bsg_job)
                bsg_job->reply->reply_payload_rcv_len = 0;
                bsg_job->reply->result = (DID_ERROR << 16);
        } else {
-               DEBUG2(qla_printk(KERN_WARNING, ha, "scsi(%ld) Vendor "
-                       "request %s completed\n", vha->host_no, type));
+               ql_dbg(ql_dbg_user, vha, 0x702d,
+                   "Vendor request %s completed.\n", type);
 
                bsg_job->reply_len = sizeof(struct fc_bsg_reply) +
                        sizeof(response) + sizeof(uint8_t);
@@ -851,12 +859,13 @@ qla84xx_reset(struct fc_bsg_job *bsg_job)
 
        if (test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags) ||
            test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags) ||
-           test_bit(ISP_ABORT_RETRY, &vha->dpc_flags))
+           test_bit(ISP_ABORT_RETRY, &vha->dpc_flags)) {
+               ql_log(ql_log_warn, vha, 0x702e, "Abort active or needed.\n");
                return -EBUSY;
+       }
 
        if (!IS_QLA84XX(ha)) {
-               DEBUG2(qla_printk(KERN_WARNING, ha, "scsi(%ld): Not 84xx, "
-                  "exiting.\n", vha->host_no));
+               ql_dbg(ql_dbg_user, vha, 0x702f, "Not 84xx, exiting.\n");
                return -EINVAL;
        }
 
@@ -865,14 +874,14 @@ qla84xx_reset(struct fc_bsg_job *bsg_job)
        rval = qla84xx_reset_chip(vha, flag == A84_ISSUE_RESET_DIAG_FW);
 
        if (rval) {
-               DEBUG2(qla_printk(KERN_WARNING, ha, "scsi(%ld) Vendor "
-                   "request 84xx reset failed\n", vha->host_no));
+               ql_log(ql_log_warn, vha, 0x7030,
+                   "Vendor request 84xx reset failed.\n");
                rval = bsg_job->reply->reply_payload_rcv_len = 0;
                bsg_job->reply->result = (DID_ERROR << 16);
 
        } else {
-               DEBUG2(qla_printk(KERN_WARNING, ha, "scsi(%ld) Vendor "
-                   "request 84xx reset completed\n", vha->host_no));
+               ql_dbg(ql_dbg_user, vha, 0x7031,
+                   "Vendor request 84xx reset completed.\n");
                bsg_job->reply->result = DID_OK;
        }
 
@@ -902,21 +911,24 @@ qla84xx_updatefw(struct fc_bsg_job *bsg_job)
                return -EBUSY;
 
        if (!IS_QLA84XX(ha)) {
-               DEBUG2(qla_printk(KERN_WARNING, ha, "scsi(%ld): Not 84xx, "
-                       "exiting.\n", vha->host_no));
+               ql_dbg(ql_dbg_user, vha, 0x7032,
+                   "Not 84xx, exiting.\n");
                return -EINVAL;
        }
 
        sg_cnt = dma_map_sg(&ha->pdev->dev, bsg_job->request_payload.sg_list,
                bsg_job->request_payload.sg_cnt, DMA_TO_DEVICE);
-       if (!sg_cnt)
+       if (!sg_cnt) {
+               ql_log(ql_log_warn, vha, 0x7033,
+                   "dma_map_sg returned %d for request.\n", sg_cnt);
                return -ENOMEM;
+       }
 
        if (sg_cnt != bsg_job->request_payload.sg_cnt) {
-               DEBUG2(printk(KERN_INFO
-                       "dma mapping resulted in different sg counts "
-                       "request_sg_cnt: %x dma_request_sg_cnt: %x ",
-                       bsg_job->request_payload.sg_cnt, sg_cnt));
+               ql_log(ql_log_warn, vha, 0x7034,
+                   "DMA mapping resulted in different sg counts, "
+                   "request_sg_cnt: %x dma_request_sg_cnt: %x.\n",
+                   bsg_job->request_payload.sg_cnt, sg_cnt);
                rval = -EAGAIN;
                goto done_unmap_sg;
        }
@@ -925,8 +937,8 @@ qla84xx_updatefw(struct fc_bsg_job *bsg_job)
        fw_buf = dma_alloc_coherent(&ha->pdev->dev, data_len,
                &fw_dma, GFP_KERNEL);
        if (!fw_buf) {
-               DEBUG2(printk(KERN_ERR "%s: dma alloc for fw_buf "
-                       "failed for host=%lu\n", __func__, vha->host_no));
+               ql_log(ql_log_warn, vha, 0x7035,
+                   "DMA alloc failed for fw_buf.\n");
                rval = -ENOMEM;
                goto done_unmap_sg;
        }
@@ -936,8 +948,8 @@ qla84xx_updatefw(struct fc_bsg_job *bsg_job)
 
        mn = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &mn_dma);
        if (!mn) {
-               DEBUG2(printk(KERN_ERR "%s: dma alloc for fw buffer "
-                       "failed for host=%lu\n", __func__, vha->host_no));
+               ql_log(ql_log_warn, vha, 0x7036,
+                   "DMA alloc failed for fw buffer.\n");
                rval = -ENOMEM;
                goto done_free_fw_buf;
        }
@@ -965,15 +977,15 @@ qla84xx_updatefw(struct fc_bsg_job *bsg_job)
        rval = qla2x00_issue_iocb_timeout(vha, mn, mn_dma, 0, 120);
 
        if (rval) {
-               DEBUG2(qla_printk(KERN_WARNING, ha, "scsi(%ld) Vendor "
-                       "request 84xx updatefw failed\n", vha->host_no));
+               ql_log(ql_log_warn, vha, 0x7037,
+                   "Vendor request 84xx updatefw failed.\n");
 
                rval = bsg_job->reply->reply_payload_rcv_len = 0;
                bsg_job->reply->result = (DID_ERROR << 16);
 
        } else {
-               DEBUG2(qla_printk(KERN_WARNING, ha, "scsi(%ld) Vendor "
-                       "request 84xx updatefw completed\n", vha->host_no));
+               ql_dbg(ql_dbg_user, vha, 0x7038,
+                   "Vendor request 84xx updatefw completed.\n");
 
                bsg_job->reply_len = sizeof(struct fc_bsg_reply);
                bsg_job->reply->result = DID_OK;
@@ -1009,27 +1021,30 @@ qla84xx_mgmt_cmd(struct fc_bsg_job *bsg_job)
 
        if (test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags) ||
                test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags) ||
-               test_bit(ISP_ABORT_RETRY, &vha->dpc_flags))
+               test_bit(ISP_ABORT_RETRY, &vha->dpc_flags)) {
+               ql_log(ql_log_warn, vha, 0x7039,
+                   "Abort active or needed.\n");
                return -EBUSY;
+       }
 
        if (!IS_QLA84XX(ha)) {
-               DEBUG2(qla_printk(KERN_WARNING, ha, "scsi(%ld): Not 84xx, "
-                       "exiting.\n", vha->host_no));
+               ql_log(ql_log_warn, vha, 0x703a,
+                   "Not 84xx, exiting.\n");
                return -EINVAL;
        }
 
        ql84_mgmt = (struct qla_bsg_a84_mgmt *)((char *)bsg_job->request +
                sizeof(struct fc_bsg_request));
        if (!ql84_mgmt) {
-               DEBUG2(printk("%s(%ld): mgmt header not provided, exiting.\n",
-                       __func__, vha->host_no));
+               ql_log(ql_log_warn, vha, 0x703b,
+                   "MGMT header not provided, exiting.\n");
                return -EINVAL;
        }
 
        mn = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &mn_dma);
        if (!mn) {
-               DEBUG2(printk(KERN_ERR "%s: dma alloc for fw buffer "
-                       "failed for host=%lu\n", __func__, vha->host_no));
+               ql_log(ql_log_warn, vha, 0x703c,
+                   "DMA alloc failed for fw buffer.\n");
                return -ENOMEM;
        }
 
@@ -1044,6 +1059,8 @@ qla84xx_mgmt_cmd(struct fc_bsg_job *bsg_job)
                        bsg_job->reply_payload.sg_list,
                        bsg_job->reply_payload.sg_cnt, DMA_FROM_DEVICE);
                if (!sg_cnt) {
+                       ql_log(ql_log_warn, vha, 0x703d,
+                           "dma_map_sg returned %d for reply.\n", sg_cnt);
                        rval = -ENOMEM;
                        goto exit_mgmt;
                }
@@ -1051,10 +1068,10 @@ qla84xx_mgmt_cmd(struct fc_bsg_job *bsg_job)
                dma_direction = DMA_FROM_DEVICE;
 
                if (sg_cnt != bsg_job->reply_payload.sg_cnt) {
-                       DEBUG2(printk(KERN_INFO
-                               "dma mapping resulted in different sg counts "
-                               "reply_sg_cnt: %x dma_reply_sg_cnt: %x\n",
-                               bsg_job->reply_payload.sg_cnt, sg_cnt));
+                       ql_log(ql_log_warn, vha, 0x703e,
+                           "DMA mapping resulted in different sg counts, "
+                           "reply_sg_cnt: %x dma_reply_sg_cnt: %x.\n",
+                           bsg_job->reply_payload.sg_cnt, sg_cnt);
                        rval = -EAGAIN;
                        goto done_unmap_sg;
                }
@@ -1064,9 +1081,8 @@ qla84xx_mgmt_cmd(struct fc_bsg_job *bsg_job)
                mgmt_b = dma_alloc_coherent(&ha->pdev->dev, data_len,
                    &mgmt_dma, GFP_KERNEL);
                if (!mgmt_b) {
-                       DEBUG2(printk(KERN_ERR "%s: dma alloc for mgmt_b "
-                               "failed for host=%lu\n",
-                               __func__, vha->host_no));
+                       ql_log(ql_log_warn, vha, 0x703f,
+                           "DMA alloc failed for mgmt_b.\n");
                        rval = -ENOMEM;
                        goto done_unmap_sg;
                }
@@ -1094,6 +1110,8 @@ qla84xx_mgmt_cmd(struct fc_bsg_job *bsg_job)
                        bsg_job->request_payload.sg_cnt, DMA_TO_DEVICE);
 
                if (!sg_cnt) {
+                       ql_log(ql_log_warn, vha, 0x7040,
+                           "dma_map_sg returned %d.\n", sg_cnt);
                        rval = -ENOMEM;
                        goto exit_mgmt;
                }
@@ -1101,10 +1119,10 @@ qla84xx_mgmt_cmd(struct fc_bsg_job *bsg_job)
                dma_direction = DMA_TO_DEVICE;
 
                if (sg_cnt != bsg_job->request_payload.sg_cnt) {
-                       DEBUG2(printk(KERN_INFO
-                               "dma mapping resulted in different sg counts "
-                               "request_sg_cnt: %x dma_request_sg_cnt: %x ",
-                               bsg_job->request_payload.sg_cnt, sg_cnt));
+                       ql_log(ql_log_warn, vha, 0x7041,
+                           "DMA mapping resulted in different sg counts, "
+                           "request_sg_cnt: %x dma_request_sg_cnt: %x.\n",
+                           bsg_job->request_payload.sg_cnt, sg_cnt);
                        rval = -EAGAIN;
                        goto done_unmap_sg;
                }
@@ -1113,9 +1131,8 @@ qla84xx_mgmt_cmd(struct fc_bsg_job *bsg_job)
                mgmt_b = dma_alloc_coherent(&ha->pdev->dev, data_len,
                        &mgmt_dma, GFP_KERNEL);
                if (!mgmt_b) {
-                       DEBUG2(printk(KERN_ERR "%s: dma alloc for mgmt_b "
-                               "failed for host=%lu\n",
-                               __func__, vha->host_no));
+                       ql_log(ql_log_warn, vha, 0x7042,
+                           "DMA alloc failed for mgmt_b.\n");
                        rval = -ENOMEM;
                        goto done_unmap_sg;
                }
@@ -1156,15 +1173,15 @@ qla84xx_mgmt_cmd(struct fc_bsg_job *bsg_job)
        rval = qla2x00_issue_iocb(vha, mn, mn_dma, 0);
 
        if (rval) {
-               DEBUG2(qla_printk(KERN_WARNING, ha, "scsi(%ld) Vendor "
-                       "request 84xx mgmt failed\n", vha->host_no));
+               ql_log(ql_log_warn, vha, 0x7043,
+                   "Vendor request 84xx mgmt failed.\n");
 
                rval = bsg_job->reply->reply_payload_rcv_len = 0;
                bsg_job->reply->result = (DID_ERROR << 16);
 
        } else {
-               DEBUG2(qla_printk(KERN_WARNING, ha, "scsi(%ld) Vendor "
-                       "request 84xx mgmt completed\n", vha->host_no));
+               ql_dbg(ql_dbg_user, vha, 0x7044,
+                   "Vendor request 84xx mgmt completed.\n");
 
                bsg_job->reply_len = sizeof(struct fc_bsg_reply);
                bsg_job->reply->result = DID_OK;
@@ -1204,7 +1221,6 @@ qla24xx_iidma(struct fc_bsg_job *bsg_job)
 {
        struct Scsi_Host *host = bsg_job->shost;
        scsi_qla_host_t *vha = shost_priv(host);
-       struct qla_hw_data *ha = vha->hw;
        int rval = 0;
        struct qla_port_param *port_param = NULL;
        fc_port_t *fcport = NULL;
@@ -1215,26 +1231,27 @@ qla24xx_iidma(struct fc_bsg_job *bsg_job)
 
        if (test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags) ||
                test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags) ||
-               test_bit(ISP_ABORT_RETRY, &vha->dpc_flags))
+               test_bit(ISP_ABORT_RETRY, &vha->dpc_flags)) {
+               ql_log(ql_log_warn, vha, 0x7045, "abort active or needed.\n");
                return -EBUSY;
+       }
 
        if (!IS_IIDMA_CAPABLE(vha->hw)) {
-               DEBUG2(qla_printk(KERN_WARNING, ha, "%s(%lu): iiDMA not "
-                       "supported\n",  __func__, vha->host_no));
+               ql_log(ql_log_info, vha, 0x7046, "iiDMA not supported.\n");
                return -EINVAL;
        }
 
        port_param = (struct qla_port_param *)((char *)bsg_job->request +
                sizeof(struct fc_bsg_request));
        if (!port_param) {
-               DEBUG2(printk("%s(%ld): port_param header not provided, "
-                       "exiting.\n", __func__, vha->host_no));
+               ql_log(ql_log_warn, vha, 0x7047,
+                   "port_param header not provided.\n");
                return -EINVAL;
        }
 
        if (port_param->fc_scsi_addr.dest_type != EXT_DEF_TYPE_WWPN) {
-               DEBUG2(printk(KERN_ERR "%s(%ld): Invalid destination type\n",
-                       __func__, vha->host_no));
+               ql_log(ql_log_warn, vha, 0x7048,
+                   "Invalid destination type.\n");
                return -EINVAL;
        }
 
@@ -1249,21 +1266,20 @@ qla24xx_iidma(struct fc_bsg_job *bsg_job)
        }
 
        if (!fcport) {
-               DEBUG2(printk(KERN_ERR "%s(%ld): Failed to find port\n",
-                       __func__, vha->host_no));
+               ql_log(ql_log_warn, vha, 0x7049,
+                   "Failed to find port.\n");
                return -EINVAL;
        }
 
        if (atomic_read(&fcport->state) != FCS_ONLINE) {
-               DEBUG2(printk(KERN_ERR "%s(%ld): Port not online\n",
-                       __func__, vha->host_no));
+               ql_log(ql_log_warn, vha, 0x704a,
+                   "Port is not online.\n");
                return -EINVAL;
        }
 
        if (fcport->flags & FCF_LOGIN_NEEDED) {
-               DEBUG2(printk(KERN_ERR "%s(%ld): Remote port not logged in, "
-                   "flags = 0x%x\n",
-                   __func__, vha->host_no, fcport->flags));
+               ql_log(ql_log_warn, vha, 0x704b,
+                   "Remote port not logged in flags = 0x%x.\n", fcport->flags);
                return -EINVAL;
        }
 
@@ -1275,15 +1291,13 @@ qla24xx_iidma(struct fc_bsg_job *bsg_job)
                        &port_param->speed, mb);
 
        if (rval) {
-               DEBUG16(printk(KERN_ERR "scsi(%ld): iIDMA cmd failed for "
-                       "%02x%02x%02x%02x%02x%02x%02x%02x -- "
-                       "%04x %x %04x %04x.\n",
-                       vha->host_no, fcport->port_name[0],
-                       fcport->port_name[1],
-                       fcport->port_name[2], fcport->port_name[3],
-                       fcport->port_name[4], fcport->port_name[5],
-                       fcport->port_name[6], fcport->port_name[7], rval,
-                       fcport->fp_speed, mb[0], mb[1]));
+               ql_log(ql_log_warn, vha, 0x704c,
+                   "iIDMA cmd failed for %02x%02x%02x%02x%02x%02x%02x%02x -- "
+                   "%04x %x %04x %04x.\n", fcport->port_name[0],
+                   fcport->port_name[1], fcport->port_name[2],
+                   fcport->port_name[3], fcport->port_name[4],
+                   fcport->port_name[5], fcport->port_name[6],
+                   fcport->port_name[7], rval, fcport->fp_speed, mb[0], mb[1]);
                rval = 0;
                bsg_job->reply->result = (DID_ERROR << 16);
 
@@ -1307,11 +1321,12 @@ qla24xx_iidma(struct fc_bsg_job *bsg_job)
 }
 
 static int
-qla2x00_optrom_setup(struct fc_bsg_job *bsg_job, struct qla_hw_data *ha,
+qla2x00_optrom_setup(struct fc_bsg_job *bsg_job, scsi_qla_host_t *vha,
        uint8_t is_update)
 {
        uint32_t start = 0;
        int valid = 0;
+       struct qla_hw_data *ha = vha->hw;
 
        bsg_job->reply->reply_payload_rcv_len = 0;
 
@@ -1319,14 +1334,20 @@ qla2x00_optrom_setup(struct fc_bsg_job *bsg_job, struct qla_hw_data *ha,
                return -EINVAL;
 
        start = bsg_job->request->rqst_data.h_vendor.vendor_cmd[1];
-       if (start > ha->optrom_size)
+       if (start > ha->optrom_size) {
+               ql_log(ql_log_warn, vha, 0x7055,
+                   "start %d > optrom_size %d.\n", start, ha->optrom_size);
                return -EINVAL;
+       }
 
-       if (ha->optrom_state != QLA_SWAITING)
+       if (ha->optrom_state != QLA_SWAITING) {
+               ql_log(ql_log_info, vha, 0x7056,
+                   "optrom_state %d.\n", ha->optrom_state);
                return -EBUSY;
+       }
 
        ha->optrom_region_start = start;
-
+       ql_dbg(ql_dbg_user, vha, 0x7057, "is_update=%d.\n", is_update);
        if (is_update) {
                if (ha->optrom_size == OPTROM_SIZE_2300 && start == 0)
                        valid = 1;
@@ -1337,9 +1358,9 @@ qla2x00_optrom_setup(struct fc_bsg_job *bsg_job, struct qla_hw_data *ha,
                    IS_QLA8XXX_TYPE(ha))
                        valid = 1;
                if (!valid) {
-                       qla_printk(KERN_WARNING, ha,
-                           "Invalid start region 0x%x/0x%x.\n",
-                           start, bsg_job->request_payload.payload_len);
+                       ql_log(ql_log_warn, vha, 0x7058,
+                           "Invalid start region 0x%x/0x%x.\n", start,
+                           bsg_job->request_payload.payload_len);
                        return -EINVAL;
                }
 
@@ -1358,9 +1379,9 @@ qla2x00_optrom_setup(struct fc_bsg_job *bsg_job, struct qla_hw_data *ha,
 
        ha->optrom_buffer = vmalloc(ha->optrom_region_size);
        if (!ha->optrom_buffer) {
-               qla_printk(KERN_WARNING, ha,
+               ql_log(ql_log_warn, vha, 0x7059,
                    "Read: Unable to allocate memory for optrom retrieval "
-                   "(%x).\n", ha->optrom_region_size);
+                   "(%x)\n", ha->optrom_region_size);
 
                ha->optrom_state = QLA_SWAITING;
                return -ENOMEM;
@@ -1378,7 +1399,7 @@ qla2x00_read_optrom(struct fc_bsg_job *bsg_job)
        struct qla_hw_data *ha = vha->hw;
        int rval = 0;
 
-       rval = qla2x00_optrom_setup(bsg_job, ha, 0);
+       rval = qla2x00_optrom_setup(bsg_job, vha, 0);
        if (rval)
                return rval;
 
@@ -1406,7 +1427,7 @@ qla2x00_update_optrom(struct fc_bsg_job *bsg_job)
        struct qla_hw_data *ha = vha->hw;
        int rval = 0;
 
-       rval = qla2x00_optrom_setup(bsg_job, ha, 1);
+       rval = qla2x00_optrom_setup(bsg_job, vha, 1);
        if (rval)
                return rval;
 
@@ -1464,6 +1485,23 @@ int
 qla24xx_bsg_request(struct fc_bsg_job *bsg_job)
 {
        int ret = -EINVAL;
+       struct fc_rport *rport;
+       fc_port_t *fcport = NULL;
+       struct Scsi_Host *host;
+       scsi_qla_host_t *vha;
+
+       if (bsg_job->request->msgcode == FC_BSG_RPT_ELS) {
+               rport = bsg_job->rport;
+               fcport = *(fc_port_t **) rport->dd_data;
+               host = rport_to_shost(rport);
+               vha = shost_priv(host);
+       } else {
+               host = bsg_job->shost;
+               vha = shost_priv(host);
+       }
+
+       ql_dbg(ql_dbg_user, vha, 0x7000,
+           "Entered %s msgcode=%d.\n", __func__, bsg_job->request->msgcode);
 
        switch (bsg_job->request->msgcode) {
        case FC_BSG_RPT_ELS:
@@ -1480,7 +1518,7 @@ qla24xx_bsg_request(struct fc_bsg_job *bsg_job)
        case FC_BSG_HST_DEL_RPORT:
        case FC_BSG_RPT_CT:
        default:
-               DEBUG2(printk("qla2xxx: unsupported BSG request\n"));
+               ql_log(ql_log_warn, vha, 0x705a, "Unsupported BSG request.\n");
                break;
        }
        return ret;
@@ -1514,17 +1552,15 @@ qla24xx_bsg_timeout(struct fc_bsg_job *bsg_job)
                                        && (sp_bsg->u.bsg_job == bsg_job)) {
                                        spin_unlock_irqrestore(&ha->hardware_lock, flags);
                                        if (ha->isp_ops->abort_command(sp)) {
-                                               DEBUG2(qla_printk(KERN_INFO, ha,
-                                                   "scsi(%ld): mbx "
-                                                   "abort_command failed\n",
-                                                   vha->host_no));
+                                               ql_log(ql_log_warn, vha, 0x7089,
+                                                   "mbx abort_command "
+                                                   "failed.\n");
                                                bsg_job->req->errors =
                                                bsg_job->reply->result = -EIO;
                                        } else {
-                                               DEBUG2(qla_printk(KERN_INFO, ha,
-                                                   "scsi(%ld): mbx "
-                                                   "abort_command success\n",
-                                                   vha->host_no));
+                                               ql_dbg(ql_dbg_user, vha, 0x708a,
+                                                   "mbx abort_command "
+                                                   "success.\n");
                                                bsg_job->req->errors =
                                                bsg_job->reply->result = 0;
                                        }
@@ -1535,8 +1571,7 @@ qla24xx_bsg_timeout(struct fc_bsg_job *bsg_job)
                }
        }
        spin_unlock_irqrestore(&ha->hardware_lock, flags);
-       DEBUG2(qla_printk(KERN_INFO, ha,
-               "scsi(%ld) SRB not found to abort\n", vha->host_no));
+       ql_log(ql_log_info, vha, 0x708b, "SRB not found to abort.\n");
        bsg_job->req->errors = bsg_job->reply->result = -ENXIO;
        return 0;
 
index dba9eedc3ded02139cc08ab54cc2c90fa25d6b15..5c1e69f091e598f64c50a786e2d92e3894b5ee82 100644 (file)
  * -----------------------------------------------------
  * |             Level            |   Last Value Used  |
  * -----------------------------------------------------
- * | Module Init and Probe        |       0x0109       |
- * | Mailbox commands             |       0x1120       |
- * | Device Discovery             |       0x207d       |
- * | Queue Command and IO tracing |       0x304f       |
+ * | Module Init and Probe        |       0x0116       |
+ * | Mailbox commands             |       0x111e       |
+ * | Device Discovery             |       0x2083       |
+ * | Queue Command and IO tracing |       0x302e       |
  * | DPC Thread                   |       0x401c       |
- * | Async Events                 |       0x5058       |
+ * | Async Events                 |       0x5059       |
  * | Timer Routines               |       0x600d       |
- * | User Space Interactions      |       0x70a1       |
- * | Task Management              |       0x8032       |
- * | AER/EEH                      |       0x9010       |
+ * | User Space Interactions      |       0x709c       |
+ * | Task Management              |       0x8043       |
+ * | AER/EEH                      |       0x900f       |
  * | Virtual Port                 |       0xa007       |
- * | ISP82XX Specific             |       0xb028       |
+ * | ISP82XX Specific             |       0xb027       |
  * | MultiQ                       |       0xc00b       |
  * | Misc                         |       0xd00b       |
  * -----------------------------------------------------
@@ -409,11 +409,11 @@ qla2xxx_dump_post_process(scsi_qla_host_t *vha, int rval)
        struct qla_hw_data *ha = vha->hw;
 
        if (rval != QLA_SUCCESS) {
-               qla_printk(KERN_WARNING, ha,
-                   "Failed to dump firmware (%x)!!!\n", rval);
+               ql_log(ql_log_warn, vha, 0xd000,
+                   "Failed to dump firmware (%x).\n", rval);
                ha->fw_dumped = 0;
        } else {
-               qla_printk(KERN_INFO, ha,
+               ql_log(ql_log_info, vha, 0xd001,
                    "Firmware dump saved to temp buffer (%ld/%p).\n",
                    vha->host_no, ha->fw_dump);
                ha->fw_dumped = 1;
@@ -445,15 +445,16 @@ qla2300_fw_dump(scsi_qla_host_t *vha, int hardware_locked)
                spin_lock_irqsave(&ha->hardware_lock, flags);
 
        if (!ha->fw_dump) {
-               qla_printk(KERN_WARNING, ha,
-                   "No buffer available for dump!!!\n");
+               ql_log(ql_log_warn, vha, 0xd002,
+                   "No buffer available for dump.\n");
                goto qla2300_fw_dump_failed;
        }
 
        if (ha->fw_dumped) {
-               qla_printk(KERN_WARNING, ha,
-                   "Firmware has been previously dumped (%p) -- ignoring "
-                   "request...\n", ha->fw_dump);
+               ql_log(ql_log_warn, vha, 0xd003,
+                   "Firmware has been previously dumped (%p) "
+                   "-- ignoring request.\n",
+                   ha->fw_dump);
                goto qla2300_fw_dump_failed;
        }
        fw = &ha->fw_dump->isp.isp23;
@@ -608,15 +609,16 @@ qla2100_fw_dump(scsi_qla_host_t *vha, int hardware_locked)
                spin_lock_irqsave(&ha->hardware_lock, flags);
 
        if (!ha->fw_dump) {
-               qla_printk(KERN_WARNING, ha,
-                   "No buffer available for dump!!!\n");
+               ql_log(ql_log_warn, vha, 0xd004,
+                   "No buffer available for dump.\n");
                goto qla2100_fw_dump_failed;
        }
 
        if (ha->fw_dumped) {
-               qla_printk(KERN_WARNING, ha,
-                   "Firmware has been previously dumped (%p) -- ignoring "
-                   "request...\n", ha->fw_dump);
+               ql_log(ql_log_warn, vha, 0xd005,
+                   "Firmware has been previously dumped (%p) "
+                   "-- ignoring request.\n",
+                   ha->fw_dump);
                goto qla2100_fw_dump_failed;
        }
        fw = &ha->fw_dump->isp.isp21;
@@ -805,15 +807,16 @@ qla24xx_fw_dump(scsi_qla_host_t *vha, int hardware_locked)
                spin_lock_irqsave(&ha->hardware_lock, flags);
 
        if (!ha->fw_dump) {
-               qla_printk(KERN_WARNING, ha,
-                   "No buffer available for dump!!!\n");
+               ql_log(ql_log_warn, vha, 0xd006,
+                   "No buffer available for dump.\n");
                goto qla24xx_fw_dump_failed;
        }
 
        if (ha->fw_dumped) {
-               qla_printk(KERN_WARNING, ha,
-                   "Firmware has been previously dumped (%p) -- ignoring "
-                   "request...\n", ha->fw_dump);
+               ql_log(ql_log_warn, vha, 0xd007,
+                   "Firmware has been previously dumped (%p) "
+                   "-- ignoring request.\n",
+                   ha->fw_dump);
                goto qla24xx_fw_dump_failed;
        }
        fw = &ha->fw_dump->isp.isp24;
@@ -1043,15 +1046,16 @@ qla25xx_fw_dump(scsi_qla_host_t *vha, int hardware_locked)
                spin_lock_irqsave(&ha->hardware_lock, flags);
 
        if (!ha->fw_dump) {
-               qla_printk(KERN_WARNING, ha,
-                   "No buffer available for dump!!!\n");
+               ql_log(ql_log_warn, vha, 0xd008,
+                   "No buffer available for dump.\n");
                goto qla25xx_fw_dump_failed;
        }
 
        if (ha->fw_dumped) {
-               qla_printk(KERN_WARNING, ha,
-                   "Firmware has been previously dumped (%p) -- ignoring "
-                   "request...\n", ha->fw_dump);
+               ql_log(ql_log_warn, vha, 0xd009,
+                   "Firmware has been previously dumped (%p) "
+                   "-- ignoring request.\n",
+                   ha->fw_dump);
                goto qla25xx_fw_dump_failed;
        }
        fw = &ha->fw_dump->isp.isp25;
@@ -1354,15 +1358,16 @@ qla81xx_fw_dump(scsi_qla_host_t *vha, int hardware_locked)
                spin_lock_irqsave(&ha->hardware_lock, flags);
 
        if (!ha->fw_dump) {
-               qla_printk(KERN_WARNING, ha,
-                   "No buffer available for dump!!!\n");
+               ql_log(ql_log_warn, vha, 0xd00a,
+                   "No buffer available for dump.\n");
                goto qla81xx_fw_dump_failed;
        }
 
        if (ha->fw_dumped) {
-               qla_printk(KERN_WARNING, ha,
-                   "Firmware has been previously dumped (%p) -- ignoring "
-                   "request...\n", ha->fw_dump);
+               ql_log(ql_log_warn, vha, 0xd00b,
+                   "Firmware has been previously dumped (%p) "
+                   "-- ignoring request.\n",
+                   ha->fw_dump);
                goto qla81xx_fw_dump_failed;
        }
        fw = &ha->fw_dump->isp.isp81;
index a5a4e1275bf2cd32532dd2949a7197c7f0a2f194..0b4c2b794c6f281629fb59540f8d013e76b55694 100644 (file)
@@ -64,7 +64,7 @@ qla2x00_dfs_fce_open(struct inode *inode, struct file *file)
        /* Pause tracing to flush FCE buffers. */
        rval = qla2x00_disable_fce_trace(vha, &ha->fce_wr, &ha->fce_rd);
        if (rval)
-               qla_printk(KERN_WARNING, ha,
+               ql_dbg(ql_dbg_user, vha, 0x705c,
                    "DebugFS: Unable to disable FCE (%d).\n", rval);
 
        ha->flags.fce_enabled = 0;
@@ -92,7 +92,7 @@ qla2x00_dfs_fce_release(struct inode *inode, struct file *file)
        rval = qla2x00_enable_fce_trace(vha, ha->fce_dma, ha->fce_bufs,
            ha->fce_mb, &ha->fce_bufs);
        if (rval) {
-               qla_printk(KERN_WARNING, ha,
+               ql_dbg(ql_dbg_user, vha, 0x700d,
                    "DebugFS: Unable to reinitialize FCE (%d).\n", rval);
                ha->flags.fce_enabled = 0;
        }
@@ -125,8 +125,8 @@ qla2x00_dfs_setup(scsi_qla_host_t *vha)
        atomic_set(&qla2x00_dfs_root_count, 0);
        qla2x00_dfs_root = debugfs_create_dir(QLA2XXX_DRIVER_NAME, NULL);
        if (!qla2x00_dfs_root) {
-               qla_printk(KERN_NOTICE, ha,
-                   "DebugFS: Unable to create root directory.\n");
+               ql_log(ql_log_warn, vha, 0x00f7,
+                   "Unable to create debugfs root directory.\n");
                goto out;
        }
 
@@ -137,8 +137,8 @@ create_dir:
        mutex_init(&ha->fce_mutex);
        ha->dfs_dir = debugfs_create_dir(vha->host_str, qla2x00_dfs_root);
        if (!ha->dfs_dir) {
-               qla_printk(KERN_NOTICE, ha,
-                   "DebugFS: Unable to create ha directory.\n");
+               ql_log(ql_log_warn, vha, 0x00f8,
+                   "Unable to create debugfs ha directory.\n");
                goto out;
        }
 
@@ -148,8 +148,8 @@ create_nodes:
        ha->dfs_fce = debugfs_create_file("fce", S_IRUSR, ha->dfs_dir, vha,
            &dfs_fce_ops);
        if (!ha->dfs_fce) {
-               qla_printk(KERN_NOTICE, ha,
-                   "DebugFS: Unable to fce node.\n");
+               ql_log(ql_log_warn, vha, 0x00f9,
+                   "Unable to create debugfs fce node.\n");
                goto out;
        }
 out:
index 38aef5d0515ff247e54fdb40748491ae9f95dcb7..29b1a3e282318b80164241f61c2b5f8be1a33b60 100644 (file)
@@ -185,7 +185,7 @@ extern int qla24xx_start_scsi(srb_t *sp);
 int qla2x00_marker(struct scsi_qla_host *, struct req_que *, struct rsp_que *,
                                                uint16_t, uint16_t, uint8_t);
 extern int qla2x00_start_sp(srb_t *);
-extern uint16_t qla24xx_calc_iocbs(uint16_t);
+extern uint16_t qla24xx_calc_iocbs(scsi_qla_host_t *, uint16_t);
 extern void qla24xx_build_scsi_iocbs(srb_t *, struct cmd_type_7 *, uint16_t);
 extern int qla24xx_dif_start_scsi(srb_t *);
 
@@ -481,7 +481,8 @@ extern int qla2x00_loopback_test(scsi_qla_host_t *, struct msg_echo_lb *, uint16
 extern int qla2x00_echo_test(scsi_qla_host_t *,
        struct msg_echo_lb *, uint16_t *);
 extern int qla24xx_update_all_fcp_prio(scsi_qla_host_t *);
-extern int qla24xx_fcp_prio_cfg_valid(struct qla_fcp_prio_cfg *, uint8_t);
+extern int qla24xx_fcp_prio_cfg_valid(scsi_qla_host_t *,
+       struct qla_fcp_prio_cfg *, uint8_t);
 
 /*
  * Global Function Prototypes in qla_dfs.c source file.
index 8cd9066ad90663e676a2a97d878cb644aeb0c47e..37937aa3c3b8dc46a150137547314c5eeaadff9c 100644 (file)
@@ -121,11 +121,10 @@ qla2x00_chk_ms_status(scsi_qla_host_t *vha, ms_iocb_entry_t *ms_pkt,
 
        rval = QLA_FUNCTION_FAILED;
        if (ms_pkt->entry_status != 0) {
-               DEBUG2_3(printk(KERN_WARNING "scsi(%ld): %s failed, error status "
-                   "(%x) on port_id: %02x%02x%02x.\n",
-                   vha->host_no, routine, ms_pkt->entry_status,
-                   vha->d_id.b.domain, vha->d_id.b.area,
-                   vha->d_id.b.al_pa));
+               ql_dbg(ql_dbg_disc, vha, 0x2031,
+                   "%s failed, error status (%x) on port_id: %02x%02x%02x.\n",
+                   routine, ms_pkt->entry_status, vha->d_id.b.domain,
+                   vha->d_id.b.area, vha->d_id.b.al_pa);
        } else {
                if (IS_FWI2_CAPABLE(ha))
                        comp_status = le16_to_cpu(
@@ -138,24 +137,24 @@ qla2x00_chk_ms_status(scsi_qla_host_t *vha, ms_iocb_entry_t *ms_pkt,
                case CS_DATA_OVERRUN:           /* Overrun? */
                        if (ct_rsp->header.response !=
                            __constant_cpu_to_be16(CT_ACCEPT_RESPONSE)) {
-                               DEBUG2_3(printk("scsi(%ld): %s failed, "
-                                   "rejected request on port_id: %02x%02x%02x\n",
-                                   vha->host_no, routine,
+                               ql_dbg(ql_dbg_disc + ql_dbg_buffer, vha, 0x2077,
+                                   "%s failed rejected request on port_id: "
+                                   "%02x%02x%02x.\n", routine,
                                    vha->d_id.b.domain, vha->d_id.b.area,
-                                   vha->d_id.b.al_pa));
-                               DEBUG2_3(qla2x00_dump_buffer(
-                                   (uint8_t *)&ct_rsp->header,
-                                   sizeof(struct ct_rsp_hdr)));
+                                   vha->d_id.b.al_pa);
+                               ql_dump_buffer(ql_dbg_disc + ql_dbg_buffer, vha,
+                                   0x2078, (uint8_t *)&ct_rsp->header,
+                                   sizeof(struct ct_rsp_hdr));
                                rval = QLA_INVALID_COMMAND;
                        } else
                                rval = QLA_SUCCESS;
                        break;
                default:
-                       DEBUG2_3(printk("scsi(%ld): %s failed, completion "
-                           "status (%x) on port_id: %02x%02x%02x.\n",
-                           vha->host_no, routine, comp_status,
+                       ql_dbg(ql_dbg_disc, vha, 0x2033,
+                           "%s failed, completion status (%x) on port_id: "
+                           "%02x%02x%02x.\n", routine, comp_status,
                            vha->d_id.b.domain, vha->d_id.b.area,
-                           vha->d_id.b.al_pa));
+                           vha->d_id.b.al_pa);
                        break;
                }
        }
@@ -202,8 +201,8 @@ qla2x00_ga_nxt(scsi_qla_host_t *vha, fc_port_t *fcport)
            sizeof(ms_iocb_entry_t));
        if (rval != QLA_SUCCESS) {
                /*EMPTY*/
-               DEBUG2_3(printk("scsi(%ld): GA_NXT issue IOCB failed (%d).\n",
-                   vha->host_no, rval));
+               ql_dbg(ql_dbg_disc, vha, 0x2062,
+                   "GA_NXT issue IOCB failed (%d).\n", rval);
        } else if (qla2x00_chk_ms_status(vha, ms_pkt, ct_rsp, "GA_NXT") !=
            QLA_SUCCESS) {
                rval = QLA_FUNCTION_FAILED;
@@ -222,11 +221,10 @@ qla2x00_ga_nxt(scsi_qla_host_t *vha, fc_port_t *fcport)
                    ct_rsp->rsp.ga_nxt.port_type != NS_NL_PORT_TYPE)
                        fcport->d_id.b.domain = 0xf0;
 
-               DEBUG2_3(printk("scsi(%ld): GA_NXT entry - "
-                   "nn %02x%02x%02x%02x%02x%02x%02x%02x "
+               ql_dbg(ql_dbg_disc, vha, 0x2063,
+                   "GA_NXT entry - nn %02x%02x%02x%02x%02x%02x%02x%02x "
                    "pn %02x%02x%02x%02x%02x%02x%02x%02x "
-                   "portid=%02x%02x%02x.\n",
-                   vha->host_no,
+                   "port_id=%02x%02x%02x.\n",
                    fcport->node_name[0], fcport->node_name[1],
                    fcport->node_name[2], fcport->node_name[3],
                    fcport->node_name[4], fcport->node_name[5],
@@ -236,7 +234,7 @@ qla2x00_ga_nxt(scsi_qla_host_t *vha, fc_port_t *fcport)
                    fcport->port_name[4], fcport->port_name[5],
                    fcport->port_name[6], fcport->port_name[7],
                    fcport->d_id.b.domain, fcport->d_id.b.area,
-                   fcport->d_id.b.al_pa));
+                   fcport->d_id.b.al_pa);
        }
 
        return (rval);
@@ -287,8 +285,8 @@ qla2x00_gid_pt(scsi_qla_host_t *vha, sw_info_t *list)
            sizeof(ms_iocb_entry_t));
        if (rval != QLA_SUCCESS) {
                /*EMPTY*/
-               DEBUG2_3(printk("scsi(%ld): GID_PT issue IOCB failed (%d).\n",
-                   vha->host_no, rval));
+               ql_dbg(ql_dbg_disc, vha, 0x2055,
+                   "GID_PT issue IOCB failed (%d).\n", rval);
        } else if (qla2x00_chk_ms_status(vha, ms_pkt, ct_rsp, "GID_PT") !=
            QLA_SUCCESS) {
                rval = QLA_FUNCTION_FAILED;
@@ -364,8 +362,8 @@ qla2x00_gpn_id(scsi_qla_host_t *vha, sw_info_t *list)
                    sizeof(ms_iocb_entry_t));
                if (rval != QLA_SUCCESS) {
                        /*EMPTY*/
-                       DEBUG2_3(printk("scsi(%ld): GPN_ID issue IOCB failed "
-                           "(%d).\n", vha->host_no, rval));
+                       ql_dbg(ql_dbg_disc, vha, 0x2056,
+                           "GPN_ID issue IOCB failed (%d).\n", rval);
                } else if (qla2x00_chk_ms_status(vha, ms_pkt, ct_rsp,
                    "GPN_ID") != QLA_SUCCESS) {
                        rval = QLA_FUNCTION_FAILED;
@@ -424,8 +422,8 @@ qla2x00_gnn_id(scsi_qla_host_t *vha, sw_info_t *list)
                    sizeof(ms_iocb_entry_t));
                if (rval != QLA_SUCCESS) {
                        /*EMPTY*/
-                       DEBUG2_3(printk("scsi(%ld): GNN_ID issue IOCB failed "
-                           "(%d).\n", vha->host_no, rval));
+                       ql_dbg(ql_dbg_disc, vha, 0x2057,
+                           "GNN_ID issue IOCB failed (%d).\n", rval);
                } else if (qla2x00_chk_ms_status(vha, ms_pkt, ct_rsp,
                    "GNN_ID") != QLA_SUCCESS) {
                        rval = QLA_FUNCTION_FAILED;
@@ -434,11 +432,10 @@ qla2x00_gnn_id(scsi_qla_host_t *vha, sw_info_t *list)
                        memcpy(list[i].node_name,
                            ct_rsp->rsp.gnn_id.node_name, WWN_SIZE);
 
-                       DEBUG2_3(printk("scsi(%ld): GID_PT entry - "
-                           "nn %02x%02x%02x%02x%02x%02x%02x%02x "
-                           "pn %02x%02x%02x%02x%02x%02x%02x%02x "
+                       ql_dbg(ql_dbg_disc, vha, 0x2058,
+                           "GID_PT entry - nn %02x%02x%02x%02x%02x%02x%02X%02x "
+                           "pn %02x%02x%02x%02x%02x%02x%02X%02x "
                            "portid=%02x%02x%02x.\n",
-                           vha->host_no,
                            list[i].node_name[0], list[i].node_name[1],
                            list[i].node_name[2], list[i].node_name[3],
                            list[i].node_name[4], list[i].node_name[5],
@@ -448,7 +445,7 @@ qla2x00_gnn_id(scsi_qla_host_t *vha, sw_info_t *list)
                            list[i].port_name[4], list[i].port_name[5],
                            list[i].port_name[6], list[i].port_name[7],
                            list[i].d_id.b.domain, list[i].d_id.b.area,
-                           list[i].d_id.b.al_pa));
+                           list[i].d_id.b.al_pa);
                }
 
                /* Last device exit. */
@@ -499,14 +496,14 @@ qla2x00_rft_id(scsi_qla_host_t *vha)
            sizeof(ms_iocb_entry_t));
        if (rval != QLA_SUCCESS) {
                /*EMPTY*/
-               DEBUG2_3(printk("scsi(%ld): RFT_ID issue IOCB failed (%d).\n",
-                   vha->host_no, rval));
+               ql_dbg(ql_dbg_disc, vha, 0x2043,
+                   "RFT_ID issue IOCB failed (%d).\n", rval);
        } else if (qla2x00_chk_ms_status(vha, ms_pkt, ct_rsp, "RFT_ID") !=
            QLA_SUCCESS) {
                rval = QLA_FUNCTION_FAILED;
        } else {
-               DEBUG2(printk("scsi(%ld): RFT_ID exiting normally.\n",
-                   vha->host_no));
+               ql_dbg(ql_dbg_disc, vha, 0x2044,
+                   "RFT_ID exiting normally.\n");
        }
 
        return (rval);
@@ -528,8 +525,8 @@ qla2x00_rff_id(scsi_qla_host_t *vha)
        struct ct_sns_rsp       *ct_rsp;
 
        if (IS_QLA2100(ha) || IS_QLA2200(ha)) {
-               DEBUG2(printk("scsi(%ld): RFF_ID call unsupported on "
-                   "ISP2100/ISP2200.\n", vha->host_no));
+               ql_dbg(ql_dbg_disc, vha, 0x2046,
+                   "RFF_ID call not supported on ISP2100/ISP2200.\n");
                return (QLA_SUCCESS);
        }
 
@@ -556,14 +553,14 @@ qla2x00_rff_id(scsi_qla_host_t *vha)
            sizeof(ms_iocb_entry_t));
        if (rval != QLA_SUCCESS) {
                /*EMPTY*/
-               DEBUG2_3(printk("scsi(%ld): RFF_ID issue IOCB failed (%d).\n",
-                   vha->host_no, rval));
+               ql_dbg(ql_dbg_disc, vha, 0x2047,
+                   "RFF_ID issue IOCB failed (%d).\n", rval);
        } else if (qla2x00_chk_ms_status(vha, ms_pkt, ct_rsp, "RFF_ID") !=
            QLA_SUCCESS) {
                rval = QLA_FUNCTION_FAILED;
        } else {
-               DEBUG2(printk("scsi(%ld): RFF_ID exiting normally.\n",
-                   vha->host_no));
+               ql_dbg(ql_dbg_disc, vha, 0x2048,
+                   "RFF_ID exiting normally.\n");
        }
 
        return (rval);
@@ -609,14 +606,14 @@ qla2x00_rnn_id(scsi_qla_host_t *vha)
            sizeof(ms_iocb_entry_t));
        if (rval != QLA_SUCCESS) {
                /*EMPTY*/
-               DEBUG2_3(printk("scsi(%ld): RNN_ID issue IOCB failed (%d).\n",
-                   vha->host_no, rval));
+               ql_dbg(ql_dbg_disc, vha, 0x204d,
+                   "RNN_ID issue IOCB failed (%d).\n", rval);
        } else if (qla2x00_chk_ms_status(vha, ms_pkt, ct_rsp, "RNN_ID") !=
            QLA_SUCCESS) {
                rval = QLA_FUNCTION_FAILED;
        } else {
-               DEBUG2(printk("scsi(%ld): RNN_ID exiting normally.\n",
-                   vha->host_no));
+               ql_dbg(ql_dbg_disc, vha, 0x204e,
+                   "RNN_ID exiting normally.\n");
        }
 
        return (rval);
@@ -647,8 +644,8 @@ qla2x00_rsnn_nn(scsi_qla_host_t *vha)
        struct ct_sns_rsp       *ct_rsp;
 
        if (IS_QLA2100(ha) || IS_QLA2200(ha)) {
-               DEBUG2(printk("scsi(%ld): RSNN_ID call unsupported on "
-                   "ISP2100/ISP2200.\n", vha->host_no));
+               ql_dbg(ql_dbg_disc, vha, 0x2050,
+                   "RSNN_ID call unsupported on ISP2100/ISP2200.\n");
                return (QLA_SUCCESS);
        }
 
@@ -682,14 +679,14 @@ qla2x00_rsnn_nn(scsi_qla_host_t *vha)
            sizeof(ms_iocb_entry_t));
        if (rval != QLA_SUCCESS) {
                /*EMPTY*/
-               DEBUG2_3(printk("scsi(%ld): RSNN_NN issue IOCB failed (%d).\n",
-                   vha->host_no, rval));
+               ql_dbg(ql_dbg_disc, vha, 0x2051,
+                   "RSNN_NN issue IOCB failed (%d).\n", rval);
        } else if (qla2x00_chk_ms_status(vha, ms_pkt, ct_rsp, "RSNN_NN") !=
            QLA_SUCCESS) {
                rval = QLA_FUNCTION_FAILED;
        } else {
-               DEBUG2(printk("scsi(%ld): RSNN_NN exiting normally.\n",
-                   vha->host_no));
+               ql_dbg(ql_dbg_disc, vha, 0x2052,
+                   "RSNN_NN exiting normally.\n");
        }
 
        return (rval);
@@ -757,13 +754,14 @@ qla2x00_sns_ga_nxt(scsi_qla_host_t *vha, fc_port_t *fcport)
            sizeof(struct sns_cmd_pkt));
        if (rval != QLA_SUCCESS) {
                /*EMPTY*/
-               DEBUG2_3(printk("scsi(%ld): GA_NXT Send SNS failed (%d).\n",
-                   vha->host_no, rval));
+               ql_dbg(ql_dbg_disc, vha, 0x205f,
+                   "GA_NXT Send SNS failed (%d).\n", rval);
        } else if (sns_cmd->p.gan_data[8] != 0x80 ||
            sns_cmd->p.gan_data[9] != 0x02) {
-               DEBUG2_3(printk("scsi(%ld): GA_NXT failed, rejected request, "
-                   "ga_nxt_rsp:\n", vha->host_no));
-               DEBUG2_3(qla2x00_dump_buffer(sns_cmd->p.gan_data, 16));
+               ql_dbg(ql_dbg_disc + ql_dbg_buffer, vha, 0x207d,
+                   "GA_NXT failed, rejected request ga_nxt_rsp:\n");
+               ql_dump_buffer(ql_dbg_disc + ql_dbg_buffer, vha, 0x2074,
+                   sns_cmd->p.gan_data, 16);
                rval = QLA_FUNCTION_FAILED;
        } else {
                /* Populate fc_port_t entry. */
@@ -778,11 +776,10 @@ qla2x00_sns_ga_nxt(scsi_qla_host_t *vha, fc_port_t *fcport)
                    sns_cmd->p.gan_data[16] != NS_NL_PORT_TYPE)
                        fcport->d_id.b.domain = 0xf0;
 
-               DEBUG2_3(printk("scsi(%ld): GA_NXT entry - "
-                   "nn %02x%02x%02x%02x%02x%02x%02x%02x "
+               ql_dbg(ql_dbg_disc, vha, 0x2061,
+                   "GA_NXT entry - nn %02x%02x%02x%02x%02x%02x%02x%02x "
                    "pn %02x%02x%02x%02x%02x%02x%02x%02x "
-                   "portid=%02x%02x%02x.\n",
-                   vha->host_no,
+                   "port_id=%02x%02x%02x.\n",
                    fcport->node_name[0], fcport->node_name[1],
                    fcport->node_name[2], fcport->node_name[3],
                    fcport->node_name[4], fcport->node_name[5],
@@ -792,7 +789,7 @@ qla2x00_sns_ga_nxt(scsi_qla_host_t *vha, fc_port_t *fcport)
                    fcport->port_name[4], fcport->port_name[5],
                    fcport->port_name[6], fcport->port_name[7],
                    fcport->d_id.b.domain, fcport->d_id.b.area,
-                   fcport->d_id.b.al_pa));
+                   fcport->d_id.b.al_pa);
        }
 
        return (rval);
@@ -831,13 +828,14 @@ qla2x00_sns_gid_pt(scsi_qla_host_t *vha, sw_info_t *list)
            sizeof(struct sns_cmd_pkt));
        if (rval != QLA_SUCCESS) {
                /*EMPTY*/
-               DEBUG2_3(printk("scsi(%ld): GID_PT Send SNS failed (%d).\n",
-                   vha->host_no, rval));
+               ql_dbg(ql_dbg_disc, vha, 0x206d,
+                   "GID_PT Send SNS failed (%d).\n", rval);
        } else if (sns_cmd->p.gid_data[8] != 0x80 ||
            sns_cmd->p.gid_data[9] != 0x02) {
-               DEBUG2_3(printk("scsi(%ld): GID_PT failed, rejected request, "
-                   "gid_rsp:\n", vha->host_no));
-               DEBUG2_3(qla2x00_dump_buffer(sns_cmd->p.gid_data, 16));
+               ql_dbg(ql_dbg_disc, vha, 0x202f,
+                   "GID_PT failed, rejected request, gid_rsp:\n");
+               ql_dump_buffer(ql_dbg_disc + ql_dbg_buffer, vha, 0x2081,
+                   sns_cmd->p.gid_data, 16);
                rval = QLA_FUNCTION_FAILED;
        } else {
                /* Set port IDs in switch info list. */
@@ -900,13 +898,14 @@ qla2x00_sns_gpn_id(scsi_qla_host_t *vha, sw_info_t *list)
                    GPN_ID_SNS_CMD_SIZE / 2, sizeof(struct sns_cmd_pkt));
                if (rval != QLA_SUCCESS) {
                        /*EMPTY*/
-                       DEBUG2_3(printk("scsi(%ld): GPN_ID Send SNS failed "
-                           "(%d).\n", vha->host_no, rval));
+                       ql_dbg(ql_dbg_disc, vha, 0x2032,
+                           "GPN_ID Send SNS failed (%d).\n", rval);
                } else if (sns_cmd->p.gpn_data[8] != 0x80 ||
                    sns_cmd->p.gpn_data[9] != 0x02) {
-                       DEBUG2_3(printk("scsi(%ld): GPN_ID failed, rejected "
-                           "request, gpn_rsp:\n", vha->host_no));
-                       DEBUG2_3(qla2x00_dump_buffer(sns_cmd->p.gpn_data, 16));
+                       ql_dbg(ql_dbg_disc + ql_dbg_buffer, vha, 0x207e,
+                           "GPN_ID failed, rejected request, gpn_rsp:\n");
+                       ql_dump_buffer(ql_dbg_disc, vha, 0x207f,
+                           sns_cmd->p.gpn_data, 16);
                        rval = QLA_FUNCTION_FAILED;
                } else {
                        /* Save portname */
@@ -955,24 +954,24 @@ qla2x00_sns_gnn_id(scsi_qla_host_t *vha, sw_info_t *list)
                    GNN_ID_SNS_CMD_SIZE / 2, sizeof(struct sns_cmd_pkt));
                if (rval != QLA_SUCCESS) {
                        /*EMPTY*/
-                       DEBUG2_3(printk("scsi(%ld): GNN_ID Send SNS failed "
-                           "(%d).\n", vha->host_no, rval));
+                       ql_dbg(ql_dbg_disc, vha, 0x203f,
+                           "GNN_ID Send SNS failed (%d).\n", rval);
                } else if (sns_cmd->p.gnn_data[8] != 0x80 ||
                    sns_cmd->p.gnn_data[9] != 0x02) {
-                       DEBUG2_3(printk("scsi(%ld): GNN_ID failed, rejected "
-                           "request, gnn_rsp:\n", vha->host_no));
-                       DEBUG2_3(qla2x00_dump_buffer(sns_cmd->p.gnn_data, 16));
+                       ql_dbg(ql_dbg_disc + ql_dbg_buffer, vha, 0x2082,
+                           "GNN_ID failed, rejected request, gnn_rsp:\n");
+                       ql_dump_buffer(ql_dbg_disc + ql_dbg_buffer, vha, 0x207a,
+                           sns_cmd->p.gnn_data, 16);
                        rval = QLA_FUNCTION_FAILED;
                } else {
                        /* Save nodename */
                        memcpy(list[i].node_name, &sns_cmd->p.gnn_data[16],
                            WWN_SIZE);
 
-                       DEBUG2_3(printk("scsi(%ld): GID_PT entry - "
-                           "nn %02x%02x%02x%02x%02x%02x%02x%02x "
+                       ql_dbg(ql_dbg_disc, vha, 0x206e,
+                           "GID_PT entry - nn %02x%02x%02x%02x%02x%02x%02x%02x "
                            "pn %02x%02x%02x%02x%02x%02x%02x%02x "
-                           "portid=%02x%02x%02x.\n",
-                           vha->host_no,
+                           "port_id=%02x%02x%02x.\n",
                            list[i].node_name[0], list[i].node_name[1],
                            list[i].node_name[2], list[i].node_name[3],
                            list[i].node_name[4], list[i].node_name[5],
@@ -982,7 +981,7 @@ qla2x00_sns_gnn_id(scsi_qla_host_t *vha, sw_info_t *list)
                            list[i].port_name[4], list[i].port_name[5],
                            list[i].port_name[6], list[i].port_name[7],
                            list[i].d_id.b.domain, list[i].d_id.b.area,
-                           list[i].d_id.b.al_pa));
+                           list[i].d_id.b.al_pa);
                }
 
                /* Last device exit. */
@@ -1025,17 +1024,18 @@ qla2x00_sns_rft_id(scsi_qla_host_t *vha)
            sizeof(struct sns_cmd_pkt));
        if (rval != QLA_SUCCESS) {
                /*EMPTY*/
-               DEBUG2_3(printk("scsi(%ld): RFT_ID Send SNS failed (%d).\n",
-                   vha->host_no, rval));
+               ql_dbg(ql_dbg_disc, vha, 0x2060,
+                   "RFT_ID Send SNS failed (%d).\n", rval);
        } else if (sns_cmd->p.rft_data[8] != 0x80 ||
            sns_cmd->p.rft_data[9] != 0x02) {
-               DEBUG2_3(printk("scsi(%ld): RFT_ID failed, rejected request, "
-                   "rft_rsp:\n", vha->host_no));
-               DEBUG2_3(qla2x00_dump_buffer(sns_cmd->p.rft_data, 16));
+               ql_dbg(ql_dbg_disc + ql_dbg_buffer, vha, 0x2083,
+                   "RFT_ID failed, rejected request rft_rsp:\n");
+               ql_dump_buffer(ql_dbg_disc + ql_dbg_buffer, vha, 0x2080,
+                   sns_cmd->p.rft_data, 16);
                rval = QLA_FUNCTION_FAILED;
        } else {
-               DEBUG2(printk("scsi(%ld): RFT_ID exiting normally.\n",
-                   vha->host_no));
+               ql_dbg(ql_dbg_disc, vha, 0x2073,
+                   "RFT_ID exiting normally.\n");
        }
 
        return (rval);
@@ -1081,17 +1081,18 @@ qla2x00_sns_rnn_id(scsi_qla_host_t *vha)
            sizeof(struct sns_cmd_pkt));
        if (rval != QLA_SUCCESS) {
                /*EMPTY*/
-               DEBUG2_3(printk("scsi(%ld): RNN_ID Send SNS failed (%d).\n",
-                   vha->host_no, rval));
+               ql_dbg(ql_dbg_disc, vha, 0x204a,
+                   "RNN_ID Send SNS failed (%d).\n", rval);
        } else if (sns_cmd->p.rnn_data[8] != 0x80 ||
            sns_cmd->p.rnn_data[9] != 0x02) {
-               DEBUG2_3(printk("scsi(%ld): RNN_ID failed, rejected request, "
-                   "rnn_rsp:\n", vha->host_no));
-               DEBUG2_3(qla2x00_dump_buffer(sns_cmd->p.rnn_data, 16));
+               ql_dbg(ql_dbg_disc + ql_dbg_buffer, vha, 0x207b,
+                   "RNN_ID failed, rejected request, rnn_rsp:\n");
+               ql_dump_buffer(ql_dbg_disc + ql_dbg_buffer, vha, 0x207c,
+                   sns_cmd->p.rnn_data, 16);
                rval = QLA_FUNCTION_FAILED;
        } else {
-               DEBUG2(printk("scsi(%ld): RNN_ID exiting normally.\n",
-                   vha->host_no));
+               ql_dbg(ql_dbg_disc, vha, 0x204c,
+                   "RNN_ID exiting normally.\n");
        }
 
        return (rval);
@@ -1116,10 +1117,10 @@ qla2x00_mgmt_svr_login(scsi_qla_host_t *vha)
        ha->isp_ops->fabric_login(vha, vha->mgmt_svr_loop_id, 0xff, 0xff, 0xfa,
            mb, BIT_1|BIT_0);
        if (mb[0] != MBS_COMMAND_COMPLETE) {
-               DEBUG2_13(printk("%s(%ld): Failed MANAGEMENT_SERVER login: "
-                   "loop_id=%x mb[0]=%x mb[1]=%x mb[2]=%x mb[6]=%x mb[7]=%x\n",
-                   __func__, vha->host_no, vha->mgmt_svr_loop_id, mb[0], mb[1],
-                   mb[2], mb[6], mb[7]));
+               ql_dbg(ql_dbg_disc, vha, 0x2024,
+                   "Failed management_server login: loopid=%x mb[0]=%x "
+                   "mb[1]=%x mb[2]=%x mb[6]=%x mb[7]=%x.\n",
+                   vha->mgmt_svr_loop_id, mb[0], mb[1], mb[2], mb[6], mb[7]);
                ret = QLA_FUNCTION_FAILED;
        } else
                vha->flags.management_server_logged_in = 1;
@@ -1292,11 +1293,12 @@ qla2x00_fdmi_rhba(scsi_qla_host_t *vha)
        memcpy(eiter->a.node_name, vha->node_name, WWN_SIZE);
        size += 4 + WWN_SIZE;
 
-       DEBUG13(printk("%s(%ld): NODENAME=%02x%02x%02x%02x%02x%02x%02x%02x.\n",
-           __func__, vha->host_no,
-           eiter->a.node_name[0], eiter->a.node_name[1], eiter->a.node_name[2],
-           eiter->a.node_name[3], eiter->a.node_name[4], eiter->a.node_name[5],
-           eiter->a.node_name[6], eiter->a.node_name[7]));
+       ql_dbg(ql_dbg_disc, vha, 0x2025,
+           "NodeName = %02x%02x%02x%02x%02x%02x%02x%02x.\n",
+           eiter->a.node_name[0], eiter->a.node_name[1],
+           eiter->a.node_name[2], eiter->a.node_name[3],
+           eiter->a.node_name[4], eiter->a.node_name[5],
+           eiter->a.node_name[6], eiter->a.node_name[7]);
 
        /* Manufacturer. */
        eiter = (struct ct_fdmi_hba_attr *) (entries + size);
@@ -1307,8 +1309,8 @@ qla2x00_fdmi_rhba(scsi_qla_host_t *vha)
        eiter->len = cpu_to_be16(4 + alen);
        size += 4 + alen;
 
-       DEBUG13(printk("%s(%ld): MANUFACTURER=%s.\n", __func__, vha->host_no,
-           eiter->a.manufacturer));
+       ql_dbg(ql_dbg_disc, vha, 0x2026,
+           "Manufacturer = %s.\n", eiter->a.manufacturer);
 
        /* Serial number. */
        eiter = (struct ct_fdmi_hba_attr *) (entries + size);
@@ -1320,8 +1322,8 @@ qla2x00_fdmi_rhba(scsi_qla_host_t *vha)
        eiter->len = cpu_to_be16(4 + alen);
        size += 4 + alen;
 
-       DEBUG13(printk("%s(%ld): SERIALNO=%s.\n", __func__, vha->host_no,
-           eiter->a.serial_num));
+       ql_dbg(ql_dbg_disc, vha, 0x2027,
+           "Serial no. = %s.\n", eiter->a.serial_num);
 
        /* Model name. */
        eiter = (struct ct_fdmi_hba_attr *) (entries + size);
@@ -1332,8 +1334,8 @@ qla2x00_fdmi_rhba(scsi_qla_host_t *vha)
        eiter->len = cpu_to_be16(4 + alen);
        size += 4 + alen;
 
-       DEBUG13(printk("%s(%ld): MODEL_NAME=%s.\n", __func__, vha->host_no,
-           eiter->a.model));
+       ql_dbg(ql_dbg_disc, vha, 0x2028,
+           "Model Name = %s.\n", eiter->a.model);
 
        /* Model description. */
        eiter = (struct ct_fdmi_hba_attr *) (entries + size);
@@ -1345,8 +1347,8 @@ qla2x00_fdmi_rhba(scsi_qla_host_t *vha)
        eiter->len = cpu_to_be16(4 + alen);
        size += 4 + alen;
 
-       DEBUG13(printk("%s(%ld): MODEL_DESC=%s.\n", __func__, vha->host_no,
-           eiter->a.model_desc));
+       ql_dbg(ql_dbg_disc, vha, 0x2029,
+           "Model Desc = %s.\n", eiter->a.model_desc);
 
        /* Hardware version. */
        eiter = (struct ct_fdmi_hba_attr *) (entries + size);
@@ -1357,8 +1359,8 @@ qla2x00_fdmi_rhba(scsi_qla_host_t *vha)
        eiter->len = cpu_to_be16(4 + alen);
        size += 4 + alen;
 
-       DEBUG13(printk("%s(%ld): HARDWAREVER=%s.\n", __func__, vha->host_no,
-           eiter->a.hw_version));
+       ql_dbg(ql_dbg_disc, vha, 0x202a,
+           "Hardware ver = %s.\n", eiter->a.hw_version);
 
        /* Driver version. */
        eiter = (struct ct_fdmi_hba_attr *) (entries + size);
@@ -1369,8 +1371,8 @@ qla2x00_fdmi_rhba(scsi_qla_host_t *vha)
        eiter->len = cpu_to_be16(4 + alen);
        size += 4 + alen;
 
-       DEBUG13(printk("%s(%ld): DRIVERVER=%s.\n", __func__, vha->host_no,
-           eiter->a.driver_version));
+       ql_dbg(ql_dbg_disc, vha, 0x202b,
+           "Driver ver = %s.\n", eiter->a.driver_version);
 
        /* Option ROM version. */
        eiter = (struct ct_fdmi_hba_attr *) (entries + size);
@@ -1381,8 +1383,8 @@ qla2x00_fdmi_rhba(scsi_qla_host_t *vha)
        eiter->len = cpu_to_be16(4 + alen);
        size += 4 + alen;
 
-       DEBUG13(printk("%s(%ld): OPTROMVER=%s.\n", __func__, vha->host_no,
-           eiter->a.orom_version));
+       ql_dbg(ql_dbg_disc, vha , 0x202c,
+           "Optrom vers = %s.\n", eiter->a.orom_version);
 
        /* Firmware version */
        eiter = (struct ct_fdmi_hba_attr *) (entries + size);
@@ -1393,44 +1395,46 @@ qla2x00_fdmi_rhba(scsi_qla_host_t *vha)
        eiter->len = cpu_to_be16(4 + alen);
        size += 4 + alen;
 
-       DEBUG13(printk("%s(%ld): FIRMWAREVER=%s.\n", __func__, vha->host_no,
-           eiter->a.fw_version));
+       ql_dbg(ql_dbg_disc, vha, 0x202d,
+           "Firmware vers = %s.\n", eiter->a.fw_version);
 
        /* Update MS request size. */
        qla2x00_update_ms_fdmi_iocb(vha, size + 16);
 
-       DEBUG13(printk("%s(%ld): RHBA identifier="
-           "%02x%02x%02x%02x%02x%02x%02x%02x size=%d.\n", __func__,
-           vha->host_no, ct_req->req.rhba.hba_identifier[0],
+       ql_dbg(ql_dbg_disc, vha, 0x202e,
+           "RHBA identifier = "
+           "%02x%02x%02x%02x%02x%02x%02x%02x size=%d.\n",
+           ct_req->req.rhba.hba_identifier[0],
            ct_req->req.rhba.hba_identifier[1],
            ct_req->req.rhba.hba_identifier[2],
            ct_req->req.rhba.hba_identifier[3],
            ct_req->req.rhba.hba_identifier[4],
            ct_req->req.rhba.hba_identifier[5],
            ct_req->req.rhba.hba_identifier[6],
-           ct_req->req.rhba.hba_identifier[7], size));
-       DEBUG13(qla2x00_dump_buffer(entries, size));
+           ct_req->req.rhba.hba_identifier[7], size);
+       ql_dump_buffer(ql_dbg_disc + ql_dbg_buffer, vha, 0x2076,
+           entries, size);
 
        /* Execute MS IOCB */
        rval = qla2x00_issue_iocb(vha, ha->ms_iocb, ha->ms_iocb_dma,
            sizeof(ms_iocb_entry_t));
        if (rval != QLA_SUCCESS) {
                /*EMPTY*/
-               DEBUG2_3(printk("scsi(%ld): RHBA issue IOCB failed (%d).\n",
-                   vha->host_no, rval));
+               ql_dbg(ql_dbg_disc, vha, 0x2030,
+                   "RHBA issue IOCB failed (%d).\n", rval);
        } else if (qla2x00_chk_ms_status(vha, ms_pkt, ct_rsp, "RHBA") !=
            QLA_SUCCESS) {
                rval = QLA_FUNCTION_FAILED;
                if (ct_rsp->header.reason_code == CT_REASON_CANNOT_PERFORM &&
                    ct_rsp->header.explanation_code ==
                    CT_EXPL_ALREADY_REGISTERED) {
-                       DEBUG2_13(printk("%s(%ld): HBA already registered.\n",
-                           __func__, vha->host_no));
+                       ql_dbg(ql_dbg_disc, vha, 0x2034,
+                           "HBA already registered.\n");
                        rval = QLA_ALREADY_REGISTERED;
                }
        } else {
-               DEBUG2(printk("scsi(%ld): RHBA exiting normally.\n",
-                   vha->host_no));
+               ql_dbg(ql_dbg_disc, vha, 0x2035,
+                   "RHBA exiting normally.\n");
        }
 
        return rval;
@@ -1464,26 +1468,26 @@ qla2x00_fdmi_dhba(scsi_qla_host_t *vha)
        /* Prepare FDMI command arguments -- portname. */
        memcpy(ct_req->req.dhba.port_name, vha->port_name, WWN_SIZE);
 
-       DEBUG13(printk("%s(%ld): DHBA portname="
-           "%02x%02x%02x%02x%02x%02x%02x%02x.\n", __func__, vha->host_no,
+       ql_dbg(ql_dbg_disc, vha, 0x2036,
+           "DHBA portname = %02x%02x%02x%02x%02x%02x%02x%02x.\n",
            ct_req->req.dhba.port_name[0], ct_req->req.dhba.port_name[1],
            ct_req->req.dhba.port_name[2], ct_req->req.dhba.port_name[3],
            ct_req->req.dhba.port_name[4], ct_req->req.dhba.port_name[5],
-           ct_req->req.dhba.port_name[6], ct_req->req.dhba.port_name[7]));
+           ct_req->req.dhba.port_name[6], ct_req->req.dhba.port_name[7]);
 
        /* Execute MS IOCB */
        rval = qla2x00_issue_iocb(vha, ha->ms_iocb, ha->ms_iocb_dma,
            sizeof(ms_iocb_entry_t));
        if (rval != QLA_SUCCESS) {
                /*EMPTY*/
-               DEBUG2_3(printk("scsi(%ld): DHBA issue IOCB failed (%d).\n",
-                   vha->host_no, rval));
+               ql_dbg(ql_dbg_disc, vha, 0x2037,
+                   "DHBA issue IOCB failed (%d).\n", rval);
        } else if (qla2x00_chk_ms_status(vha, ms_pkt, ct_rsp, "DHBA") !=
            QLA_SUCCESS) {
                rval = QLA_FUNCTION_FAILED;
        } else {
-               DEBUG2(printk("scsi(%ld): DHBA exiting normally.\n",
-                   vha->host_no));
+               ql_dbg(ql_dbg_disc, vha, 0x2038,
+                   "DHBA exiting normally.\n");
        }
 
        return rval;
@@ -1534,9 +1538,10 @@ qla2x00_fdmi_rpa(scsi_qla_host_t *vha)
        eiter->a.fc4_types[2] = 0x01;
        size += 4 + 32;
 
-       DEBUG13(printk("%s(%ld): FC4_TYPES=%02x %02x.\n", __func__,
-               vha->host_no, eiter->a.fc4_types[2],
-               eiter->a.fc4_types[1]));
+       ql_dbg(ql_dbg_disc, vha, 0x2039,
+           "FC4_TYPES=%02x %02x.\n",
+           eiter->a.fc4_types[2],
+           eiter->a.fc4_types[1]);
 
        /* Supported speed. */
        eiter = (struct ct_fdmi_port_attr *) (entries + size);
@@ -1561,8 +1566,8 @@ qla2x00_fdmi_rpa(scsi_qla_host_t *vha)
                    FDMI_PORT_SPEED_1GB);
        size += 4 + 4;
 
-       DEBUG13(printk("%s(%ld): SUPPORTED_SPEED=%x.\n", __func__, vha->host_no,
-           eiter->a.sup_speed));
+       ql_dbg(ql_dbg_disc, vha, 0x203a,
+           "Supported_Speed=%x.\n", eiter->a.sup_speed);
 
        /* Current speed. */
        eiter = (struct ct_fdmi_port_attr *) (entries + size);
@@ -1596,8 +1601,8 @@ qla2x00_fdmi_rpa(scsi_qla_host_t *vha)
        }
        size += 4 + 4;
 
-       DEBUG13(printk("%s(%ld): CURRENT_SPEED=%x.\n", __func__, vha->host_no,
-           eiter->a.cur_speed));
+       ql_dbg(ql_dbg_disc, vha, 0x203b,
+           "Current_Speed=%x.\n", eiter->a.cur_speed);
 
        /* Max frame size. */
        eiter = (struct ct_fdmi_port_attr *) (entries + size);
@@ -1609,8 +1614,8 @@ qla2x00_fdmi_rpa(scsi_qla_host_t *vha)
        eiter->a.max_frame_size = cpu_to_be32(max_frame_size);
        size += 4 + 4;
 
-       DEBUG13(printk("%s(%ld): MAX_FRAME_SIZE=%x.\n", __func__, vha->host_no,
-           eiter->a.max_frame_size));
+       ql_dbg(ql_dbg_disc, vha, 0x203c,
+           "Max_Frame_Size=%x.\n", eiter->a.max_frame_size);
 
        /* OS device name. */
        eiter = (struct ct_fdmi_port_attr *) (entries + size);
@@ -1621,8 +1626,8 @@ qla2x00_fdmi_rpa(scsi_qla_host_t *vha)
        eiter->len = cpu_to_be16(4 + alen);
        size += 4 + alen;
 
-       DEBUG13(printk("%s(%ld): OS_DEVICE_NAME=%s.\n", __func__, vha->host_no,
-           eiter->a.os_dev_name));
+       ql_dbg(ql_dbg_disc, vha, 0x204b,
+           "OS_Device_Name=%s.\n", eiter->a.os_dev_name);
 
        /* Hostname. */
        if (strlen(fc_host_system_hostname(vha->host))) {
@@ -1637,35 +1642,36 @@ qla2x00_fdmi_rpa(scsi_qla_host_t *vha)
                eiter->len = cpu_to_be16(4 + alen);
                size += 4 + alen;
 
-               DEBUG13(printk("%s(%ld): HOSTNAME=%s.\n", __func__,
-                   vha->host_no, eiter->a.host_name));
+               ql_dbg(ql_dbg_disc, vha, 0x203d,
+                   "HostName=%s.\n", eiter->a.host_name);
        }
 
        /* Update MS request size. */
        qla2x00_update_ms_fdmi_iocb(vha, size + 16);
 
-       DEBUG13(printk("%s(%ld): RPA portname="
-           "%02x%02x%02x%02x%02x%02x%02x%02x size=%d.\n", __func__,
-           vha->host_no, ct_req->req.rpa.port_name[0],
-           ct_req->req.rpa.port_name[1], ct_req->req.rpa.port_name[2],
-           ct_req->req.rpa.port_name[3], ct_req->req.rpa.port_name[4],
-           ct_req->req.rpa.port_name[5], ct_req->req.rpa.port_name[6],
-           ct_req->req.rpa.port_name[7], size));
-       DEBUG13(qla2x00_dump_buffer(entries, size));
+       ql_dbg(ql_dbg_disc, vha, 0x203e,
+           "RPA portname= %02x%02x%02x%02x%02X%02x%02x%02x size=%d.\n",
+           ct_req->req.rpa.port_name[0], ct_req->req.rpa.port_name[1],
+           ct_req->req.rpa.port_name[2], ct_req->req.rpa.port_name[3],
+           ct_req->req.rpa.port_name[4], ct_req->req.rpa.port_name[5],
+           ct_req->req.rpa.port_name[6], ct_req->req.rpa.port_name[7],
+           size);
+       ql_dump_buffer(ql_dbg_disc + ql_dbg_buffer, vha, 0x2079,
+           entries, size);
 
        /* Execute MS IOCB */
        rval = qla2x00_issue_iocb(vha, ha->ms_iocb, ha->ms_iocb_dma,
            sizeof(ms_iocb_entry_t));
        if (rval != QLA_SUCCESS) {
                /*EMPTY*/
-               DEBUG2_3(printk("scsi(%ld): RPA issue IOCB failed (%d).\n",
-                   vha->host_no, rval));
+               ql_dbg(ql_dbg_disc, vha, 0x2040,
+                   "RPA issue IOCB failed (%d).\n", rval);
        } else if (qla2x00_chk_ms_status(vha, ms_pkt, ct_rsp, "RPA") !=
            QLA_SUCCESS) {
                rval = QLA_FUNCTION_FAILED;
        } else {
-               DEBUG2(printk("scsi(%ld): RPA exiting normally.\n",
-                   vha->host_no));
+               ql_dbg(ql_dbg_disc, vha, 0x2041,
+                   "RPA exiting nornally.\n");
        }
 
        return rval;
@@ -1749,8 +1755,8 @@ qla2x00_gfpn_id(scsi_qla_host_t *vha, sw_info_t *list)
                    sizeof(ms_iocb_entry_t));
                if (rval != QLA_SUCCESS) {
                        /*EMPTY*/
-                       DEBUG2_3(printk("scsi(%ld): GFPN_ID issue IOCB "
-                           "failed (%d).\n", vha->host_no, rval));
+                       ql_dbg(ql_dbg_disc, vha, 0x2023,
+                           "GFPN_ID issue IOCB failed (%d).\n", rval);
                } else if (qla2x00_chk_ms_status(vha, ms_pkt, ct_rsp,
                    "GFPN_ID") != QLA_SUCCESS) {
                        rval = QLA_FUNCTION_FAILED;
@@ -1860,8 +1866,8 @@ qla2x00_gpsc(scsi_qla_host_t *vha, sw_info_t *list)
                    sizeof(ms_iocb_entry_t));
                if (rval != QLA_SUCCESS) {
                        /*EMPTY*/
-                       DEBUG2_3(printk("scsi(%ld): GPSC issue IOCB "
-                           "failed (%d).\n", vha->host_no, rval));
+                       ql_dbg(ql_dbg_disc, vha, 0x2059,
+                           "GPSC issue IOCB failed (%d).\n", rval);
                } else if ((rval = qla2x00_chk_ms_status(vha, ms_pkt, ct_rsp,
                    "GPSC")) != QLA_SUCCESS) {
                        /* FM command unsupported? */
@@ -1870,9 +1876,9 @@ qla2x00_gpsc(scsi_qla_host_t *vha, sw_info_t *list)
                                CT_REASON_INVALID_COMMAND_CODE ||
                             ct_rsp->header.reason_code ==
                                CT_REASON_COMMAND_UNSUPPORTED)) {
-                               DEBUG2(printk("scsi(%ld): GPSC command "
-                                   "unsupported, disabling query...\n",
-                                   vha->host_no));
+                               ql_dbg(ql_dbg_disc, vha, 0x205a,
+                                   "GPSC command unsupported, disabling "
+                                   "query.\n");
                                ha->flags.gpsc_supported = 0;
                                rval = QLA_FUNCTION_FAILED;
                                break;
@@ -1898,9 +1904,10 @@ qla2x00_gpsc(scsi_qla_host_t *vha, sw_info_t *list)
                                break;
                        }
 
-                       DEBUG2_3(printk("scsi(%ld): GPSC ext entry - "
-                           "fpn %02x%02x%02x%02x%02x%02x%02x%02x speeds=%04x "
-                           "speed=%04x.\n", vha->host_no,
+                       ql_dbg(ql_dbg_disc, vha, 0x205b,
+                           "GPSC ext entry - fpn "
+                           "%02x%02x%02x%02x%02x%02x%02x%02x speeds=%04x "
+                           "speed=%04x.\n",
                            list[i].fabric_port_name[0],
                            list[i].fabric_port_name[1],
                            list[i].fabric_port_name[2],
@@ -1910,7 +1917,7 @@ qla2x00_gpsc(scsi_qla_host_t *vha, sw_info_t *list)
                            list[i].fabric_port_name[6],
                            list[i].fabric_port_name[7],
                            be16_to_cpu(ct_rsp->rsp.gpsc.speeds),
-                           be16_to_cpu(ct_rsp->rsp.gpsc.speed)));
+                           be16_to_cpu(ct_rsp->rsp.gpsc.speed));
                }
 
                /* Last device exit. */
@@ -1968,14 +1975,12 @@ qla2x00_gff_id(scsi_qla_host_t *vha, sw_info_t *list)
                   sizeof(ms_iocb_entry_t));
 
                if (rval != QLA_SUCCESS) {
-                       DEBUG2_3(printk(KERN_INFO
-                           "scsi(%ld): GFF_ID issue IOCB failed "
-                           "(%d).\n", vha->host_no, rval));
+                       ql_dbg(ql_dbg_disc, vha, 0x205c,
+                           "GFF_ID issue IOCB failed (%d).\n", rval);
                } else if (qla2x00_chk_ms_status(vha, ms_pkt, ct_rsp,
                               "GFF_ID") != QLA_SUCCESS) {
-                       DEBUG2_3(printk(KERN_INFO
-                           "scsi(%ld): GFF_ID IOCB status had a "
-                           "failure status code\n", vha->host_no));
+                       ql_dbg(ql_dbg_disc, vha, 0x205d,
+                           "GFF_ID IOCB status had a failure status code.\n");
                } else {
                        fcp_scsi_features =
                           ct_rsp->rsp.gff_id.fc4_features[GFF_FCP_SCSI_OFFSET];
index 3d0384506929727328449ba5d28889563277db2a..def694271bf79bf96cb6190878434b902381fb79 100644 (file)
@@ -153,11 +153,10 @@ qla2x00_async_iocb_timeout(srb_t *sp)
        fc_port_t *fcport = sp->fcport;
        struct srb_ctx *ctx = sp->ctx;
 
-       DEBUG2(printk(KERN_WARNING
-               "scsi(%ld:%x): Async-%s timeout - portid=%02x%02x%02x.\n",
-               fcport->vha->host_no, sp->handle,
-               ctx->name, fcport->d_id.b.domain,
-               fcport->d_id.b.area, fcport->d_id.b.al_pa));
+       ql_dbg(ql_dbg_disc, fcport->vha, 0x2071,
+           "Async-%s timeout - portid=%02x%02x%02x.\n",
+           ctx->name, fcport->d_id.b.domain, fcport->d_id.b.area,
+           fcport->d_id.b.al_pa);
 
        fcport->flags &= ~FCF_ASYNC_SENT;
        if (ctx->type == SRB_LOGIN_CMD) {
@@ -211,11 +210,10 @@ qla2x00_async_login(struct scsi_qla_host *vha, fc_port_t *fcport,
        if (rval != QLA_SUCCESS)
                goto done_free_sp;
 
-       DEBUG2(printk(KERN_DEBUG
-           "scsi(%ld:%x): Async-login - loop-id=%x portid=%02x%02x%02x "
-           "retries=%d.\n", fcport->vha->host_no, sp->handle, fcport->loop_id,
-           fcport->d_id.b.domain, fcport->d_id.b.area, fcport->d_id.b.al_pa,
-           fcport->login_retry));
+       ql_dbg(ql_dbg_disc, vha, 0x2072,
+           "Async-login - loopid=%x portid=%02x%02x%02x retries=%d.\n",
+           fcport->loop_id, fcport->d_id.b.domain, fcport->d_id.b.area,
+           fcport->d_id.b.al_pa, fcport->login_retry);
        return rval;
 
 done_free_sp:
@@ -259,10 +257,10 @@ qla2x00_async_logout(struct scsi_qla_host *vha, fc_port_t *fcport)
        if (rval != QLA_SUCCESS)
                goto done_free_sp;
 
-       DEBUG2(printk(KERN_DEBUG
-           "scsi(%ld:%x): Async-logout - loop-id=%x portid=%02x%02x%02x.\n",
-           fcport->vha->host_no, sp->handle, fcport->loop_id,
-           fcport->d_id.b.domain, fcport->d_id.b.area, fcport->d_id.b.al_pa));
+       ql_dbg(ql_dbg_disc, vha, 0x2070,
+           "Async-logout - loop-id=%x portid=%02x%02x%02x.\n",
+           fcport->loop_id, fcport->d_id.b.domain, fcport->d_id.b.area,
+           fcport->d_id.b.al_pa);
        return rval;
 
 done_free_sp:
@@ -309,11 +307,10 @@ qla2x00_async_adisc(struct scsi_qla_host *vha, fc_port_t *fcport,
        if (rval != QLA_SUCCESS)
                goto done_free_sp;
 
-       DEBUG2(printk(KERN_DEBUG
-           "scsi(%ld:%x): Async-adisc - loop-id=%x portid=%02x%02x%02x.\n",
-           fcport->vha->host_no, sp->handle, fcport->loop_id,
-           fcport->d_id.b.domain, fcport->d_id.b.area, fcport->d_id.b.al_pa));
-
+       ql_dbg(ql_dbg_disc, vha, 0x206f,
+           "Async-adisc - loopid=%x portid=%02x%02x%02x.\n",
+           fcport->loop_id, fcport->d_id.b.domain, fcport->d_id.b.area,
+           fcport->d_id.b.al_pa);
        return rval;
 
 done_free_sp:
@@ -362,11 +359,10 @@ qla2x00_async_tm_cmd(fc_port_t *fcport, uint32_t flags, uint32_t lun,
        if (rval != QLA_SUCCESS)
                goto done_free_sp;
 
-       DEBUG2(printk(KERN_DEBUG
-           "scsi(%ld:%x): Async-tmf - loop-id=%x portid=%02x%02x%02x.\n",
-           fcport->vha->host_no, sp->handle, fcport->loop_id,
-           fcport->d_id.b.domain, fcport->d_id.b.area, fcport->d_id.b.al_pa));
-
+       ql_dbg(ql_dbg_taskm, vha, 0x802f,
+           "Async-tmf loop-id=%x portid=%02x%02x%02x.\n",
+           fcport->loop_id, fcport->d_id.b.domain, fcport->d_id.b.area,
+           fcport->d_id.b.al_pa);
        return rval;
 
 done_free_sp:
@@ -471,9 +467,8 @@ qla2x00_async_tm_cmd_done(struct scsi_qla_host *vha, fc_port_t *fcport,
                flags == TCF_LUN_RESET ? MK_SYNC_ID_LUN : MK_SYNC_ID);
 
        if ((rval != QLA_SUCCESS) || iocb->u.tmf.data) {
-               DEBUG2_3_11(printk(KERN_WARNING
-                       "%s(%ld): TM IOCB failed (%x).\n",
-                       __func__, vha->host_no, rval));
+               ql_dbg(ql_dbg_taskm, vha, 0x8030,
+                   "TM IOCB failed (%x).\n", rval);
        }
 
        return;
@@ -519,11 +514,12 @@ qla2x00_initialize_adapter(scsi_qla_host_t *vha)
        set_bit(0, ha->req_qid_map);
        set_bit(0, ha->rsp_qid_map);
 
-       qla_printk(KERN_INFO, ha, "Configuring PCI space...\n");
+       ql_log(ql_log_info, vha, 0x0040,
+           "Configuring PCI space...\n");
        rval = ha->isp_ops->pci_config(vha);
        if (rval) {
-               DEBUG2(printk("scsi(%ld): Unable to configure PCI space.\n",
-                   vha->host_no));
+               ql_log(ql_log_warn, vha, 0x0044,
+                   "Unable to configure PCI space.\n");
                return (rval);
        }
 
@@ -531,20 +527,21 @@ qla2x00_initialize_adapter(scsi_qla_host_t *vha)
 
        rval = qla2xxx_get_flash_info(vha);
        if (rval) {
-               DEBUG2(printk("scsi(%ld): Unable to validate FLASH data.\n",
-                   vha->host_no));
+               ql_log(ql_log_fatal, vha, 0x004f,
+                   "Unable to validate FLASH data.\n");
                return (rval);
        }
 
        ha->isp_ops->get_flash_version(vha, req->ring);
-
-       qla_printk(KERN_INFO, ha, "Configure NVRAM parameters...\n");
+       ql_log(ql_log_info, vha, 0x0061,
+           "Configure NVRAM parameters...\n");
 
        ha->isp_ops->nvram_config(vha);
 
        if (ha->flags.disable_serdes) {
                /* Mask HBA via NVRAM settings? */
-               qla_printk(KERN_INFO, ha, "Masking HBA WWPN "
+               ql_log(ql_log_info, vha, 0x0077,
+                   "Masking HBA WWPN "
                    "%02x%02x%02x%02x%02x%02x%02x%02x (via NVRAM).\n",
                    vha->port_name[0], vha->port_name[1],
                    vha->port_name[2], vha->port_name[3],
@@ -553,7 +550,8 @@ qla2x00_initialize_adapter(scsi_qla_host_t *vha)
                return QLA_FUNCTION_FAILED;
        }
 
-       qla_printk(KERN_INFO, ha, "Verifying loaded RISC code...\n");
+       ql_log(ql_log_info, vha, 0x0078,
+           "Verifying loaded RISC code...\n");
 
        if (qla2x00_isp_firmware(vha) != QLA_SUCCESS) {
                rval = ha->isp_ops->chip_diag(vha);
@@ -567,7 +565,7 @@ qla2x00_initialize_adapter(scsi_qla_host_t *vha)
        if (IS_QLA84XX(ha)) {
                ha->cs84xx = qla84xx_get_chip(vha);
                if (!ha->cs84xx) {
-                       qla_printk(KERN_ERR, ha,
+                       ql_log(ql_log_warn, vha, 0x00d0,
                            "Unable to configure ISP84XX.\n");
                        return QLA_FUNCTION_FAILED;
                }
@@ -579,8 +577,8 @@ qla2x00_initialize_adapter(scsi_qla_host_t *vha)
                /* Issue verify 84xx FW IOCB to complete 84xx initialization */
                rval = qla84xx_init_chip(vha);
                if (rval != QLA_SUCCESS) {
-                       qla_printk(KERN_ERR, ha,
-                               "Unable to initialize ISP84XX.\n");
+                       ql_log(ql_log_warn, vha, 0x00d4,
+                           "Unable to initialize ISP84XX.\n");
                qla84xx_put_chip(vha);
                }
        }
@@ -797,9 +795,7 @@ qla2x00_isp_firmware(scsi_qla_host_t *vha)
        rval = QLA_FUNCTION_FAILED;
 
        if (ha->flags.disable_risc_code_load) {
-               DEBUG2(printk("scsi(%ld): RISC CODE NOT loaded\n",
-                   vha->host_no));
-               qla_printk(KERN_INFO, ha, "RISC CODE NOT loaded\n");
+               ql_log(ql_log_info, vha, 0x0079, "RISC CODE NOT loaded.\n");
 
                /* Verify checksum of loaded RISC code. */
                rval = qla2x00_verify_checksum(vha, ha->fw_srisc_address);
@@ -810,10 +806,9 @@ qla2x00_isp_firmware(scsi_qla_host_t *vha)
                }
        }
 
-       if (rval) {
-               DEBUG2_3(printk("scsi(%ld): **** Load RISC code ****\n",
-                   vha->host_no));
-       }
+       if (rval)
+               ql_dbg(ql_dbg_init, vha, 0x007a,
+                   "**** Load RISC code ****.\n");
 
        return (rval);
 }
@@ -1105,8 +1100,8 @@ qla2x00_chip_diag(scsi_qla_host_t *vha)
        /* Assume a failed state */
        rval = QLA_FUNCTION_FAILED;
 
-       DEBUG3(printk("scsi(%ld): Testing device at %lx.\n",
-           vha->host_no, (u_long)&reg->flash_address));
+       ql_dbg(ql_dbg_init, vha, 0x007b,
+           "Testing device at %lx.\n", (u_long)&reg->flash_address);
 
        spin_lock_irqsave(&ha->hardware_lock, flags);
 
@@ -1128,8 +1123,8 @@ qla2x00_chip_diag(scsi_qla_host_t *vha)
        if (!cnt)
                goto chip_diag_failed;
 
-       DEBUG3(printk("scsi(%ld): Reset register cleared by chip reset\n",
-           vha->host_no));
+       ql_dbg(ql_dbg_init, vha, 0x007c,
+           "Reset register cleared by chip reset.\n");
 
        /* Reset RISC processor. */
        WRT_REG_WORD(&reg->hccr, HCCR_RESET_RISC);
@@ -1150,7 +1145,7 @@ qla2x00_chip_diag(scsi_qla_host_t *vha)
                goto chip_diag_failed;
 
        /* Check product ID of chip */
-       DEBUG3(printk("scsi(%ld): Checking product ID of chip\n", vha->host_no));
+       ql_dbg(ql_dbg_init, vha, 0x007d, "Checking product Id of chip.\n");
 
        mb[1] = RD_MAILBOX_REG(ha, reg, 1);
        mb[2] = RD_MAILBOX_REG(ha, reg, 2);
@@ -1158,8 +1153,9 @@ qla2x00_chip_diag(scsi_qla_host_t *vha)
        mb[4] = qla2x00_debounce_register(MAILBOX_REG(ha, reg, 4));
        if (mb[1] != PROD_ID_1 || (mb[2] != PROD_ID_2 && mb[2] != PROD_ID_2a) ||
            mb[3] != PROD_ID_3) {
-               qla_printk(KERN_WARNING, ha,
-                   "Wrong product ID = 0x%x,0x%x,0x%x\n", mb[1], mb[2], mb[3]);
+               ql_log(ql_log_warn, vha, 0x0062,
+                   "Wrong product ID = 0x%x,0x%x,0x%x.\n",
+                   mb[1], mb[2], mb[3]);
 
                goto chip_diag_failed;
        }
@@ -1178,8 +1174,7 @@ qla2x00_chip_diag(scsi_qla_host_t *vha)
        if (IS_QLA2200(ha) &&
            RD_MAILBOX_REG(ha, reg, 7) == QLA2200A_RISC_ROM_VER) {
                /* Limit firmware transfer size with a 2200A */
-               DEBUG3(printk("scsi(%ld): Found QLA2200A chip.\n",
-                   vha->host_no));
+               ql_dbg(ql_dbg_init, vha, 0x007e, "Found QLA2200A Chip.\n");
 
                ha->device_type |= DT_ISP2200A;
                ha->fw_transfer_size = 128;
@@ -1188,24 +1183,20 @@ qla2x00_chip_diag(scsi_qla_host_t *vha)
        /* Wrap Incoming Mailboxes Test. */
        spin_unlock_irqrestore(&ha->hardware_lock, flags);
 
-       DEBUG3(printk("scsi(%ld): Checking mailboxes.\n", vha->host_no));
+       ql_dbg(ql_dbg_init, vha, 0x007f, "Checking mailboxes.\n");
        rval = qla2x00_mbx_reg_test(vha);
-       if (rval) {
-               DEBUG(printk("scsi(%ld): Failed mailbox send register test\n",
-                   vha->host_no));
-               qla_printk(KERN_WARNING, ha,
-                   "Failed mailbox send register test\n");
-       }
-       else {
+       if (rval)
+               ql_log(ql_log_warn, vha, 0x0080,
+                   "Failed mailbox send register test.\n");
+       else
                /* Flag a successful rval */
                rval = QLA_SUCCESS;
-       }
        spin_lock_irqsave(&ha->hardware_lock, flags);
 
 chip_diag_failed:
        if (rval)
-               DEBUG2_3(printk("scsi(%ld): Chip diagnostics **** FAILED "
-                   "****\n", vha->host_no));
+               ql_log(ql_log_info, vha, 0x0081,
+                   "Chip diagnostics **** FAILED ****.\n");
 
        spin_unlock_irqrestore(&ha->hardware_lock, flags);
 
@@ -1232,10 +1223,8 @@ qla24xx_chip_diag(scsi_qla_host_t *vha)
 
        rval = qla2x00_mbx_reg_test(vha);
        if (rval) {
-               DEBUG(printk("scsi(%ld): Failed mailbox send register test\n",
-                   vha->host_no));
-               qla_printk(KERN_WARNING, ha,
-                   "Failed mailbox send register test\n");
+               ql_log(ql_log_warn, vha, 0x0082,
+                   "Failed mailbox send register test.\n");
        } else {
                /* Flag a successful rval */
                rval = QLA_SUCCESS;
@@ -1257,8 +1246,8 @@ qla2x00_alloc_fw_dump(scsi_qla_host_t *vha)
        struct rsp_que *rsp = ha->rsp_q_map[0];
 
        if (ha->fw_dump) {
-               qla_printk(KERN_WARNING, ha,
-                   "Firmware dump previously allocated.\n");
+               ql_dbg(ql_dbg_init, vha, 0x00bd,
+                   "Firmware dump already allocated.\n");
                return;
        }
 
@@ -1288,8 +1277,9 @@ qla2x00_alloc_fw_dump(scsi_qla_host_t *vha)
                tc = dma_alloc_coherent(&ha->pdev->dev, FCE_SIZE, &tc_dma,
                    GFP_KERNEL);
                if (!tc) {
-                       qla_printk(KERN_WARNING, ha, "Unable to allocate "
-                           "(%d KB) for FCE.\n", FCE_SIZE / 1024);
+                       ql_log(ql_log_warn, vha, 0x00be,
+                           "Unable to allocate (%d KB) for FCE.\n",
+                           FCE_SIZE / 1024);
                        goto try_eft;
                }
 
@@ -1297,16 +1287,15 @@ qla2x00_alloc_fw_dump(scsi_qla_host_t *vha)
                rval = qla2x00_enable_fce_trace(vha, tc_dma, FCE_NUM_BUFFERS,
                    ha->fce_mb, &ha->fce_bufs);
                if (rval) {
-                       qla_printk(KERN_WARNING, ha, "Unable to initialize "
-                           "FCE (%d).\n", rval);
+                       ql_log(ql_log_warn, vha, 0x00bf,
+                           "Unable to initialize FCE (%d).\n", rval);
                        dma_free_coherent(&ha->pdev->dev, FCE_SIZE, tc,
                            tc_dma);
                        ha->flags.fce_enabled = 0;
                        goto try_eft;
                }
-
-               qla_printk(KERN_INFO, ha, "Allocated (%d KB) for FCE...\n",
-                   FCE_SIZE / 1024);
+               ql_log(ql_log_info, vha, 0x00c0,
+                   "Allocate (%d KB) for FCE...\n", FCE_SIZE / 1024);
 
                fce_size = sizeof(struct qla2xxx_fce_chain) + FCE_SIZE;
                ha->flags.fce_enabled = 1;
@@ -1317,23 +1306,23 @@ try_eft:
                tc = dma_alloc_coherent(&ha->pdev->dev, EFT_SIZE, &tc_dma,
                    GFP_KERNEL);
                if (!tc) {
-                       qla_printk(KERN_WARNING, ha, "Unable to allocate "
-                           "(%d KB) for EFT.\n", EFT_SIZE / 1024);
+                       ql_log(ql_log_warn, vha, 0x00c1,
+                           "Unable to allocate (%d KB) for EFT.\n",
+                           EFT_SIZE / 1024);
                        goto cont_alloc;
                }
 
                memset(tc, 0, EFT_SIZE);
                rval = qla2x00_enable_eft_trace(vha, tc_dma, EFT_NUM_BUFFERS);
                if (rval) {
-                       qla_printk(KERN_WARNING, ha, "Unable to initialize "
-                           "EFT (%d).\n", rval);
+                       ql_log(ql_log_warn, vha, 0x00c2,
+                           "Unable to initialize EFT (%d).\n", rval);
                        dma_free_coherent(&ha->pdev->dev, EFT_SIZE, tc,
                            tc_dma);
                        goto cont_alloc;
                }
-
-               qla_printk(KERN_INFO, ha, "Allocated (%d KB) for EFT...\n",
-                   EFT_SIZE / 1024);
+               ql_log(ql_log_info, vha, 0x00c3,
+                   "Allocated (%d KB) EFT ...\n", EFT_SIZE / 1024);
 
                eft_size = EFT_SIZE;
                ha->eft_dma = tc_dma;
@@ -1350,8 +1339,9 @@ cont_alloc:
 
        ha->fw_dump = vmalloc(dump_size);
        if (!ha->fw_dump) {
-               qla_printk(KERN_WARNING, ha, "Unable to allocate (%d KB) for "
-                   "firmware dump!!!\n", dump_size / 1024);
+               ql_log(ql_log_warn, vha, 0x00c4,
+                   "Unable to allocate (%d KB) for firmware dump.\n",
+                   dump_size / 1024);
 
                if (ha->fce) {
                        dma_free_coherent(&ha->pdev->dev, FCE_SIZE, ha->fce,
@@ -1368,8 +1358,8 @@ cont_alloc:
                }
                return;
        }
-       qla_printk(KERN_INFO, ha, "Allocated (%d KB) for firmware dump...\n",
-           dump_size / 1024);
+       ql_log(ql_log_info, vha, 0x00c5,
+           "Allocated (%d KB) for firmware dump.\n", dump_size / 1024);
 
        ha->fw_dump_len = dump_size;
        ha->fw_dump->signature[0] = 'Q';
@@ -1398,23 +1388,21 @@ qla81xx_mpi_sync(scsi_qla_host_t *vha)
        int rval;
        uint16_t dc;
        uint32_t dw;
-       struct qla_hw_data *ha = vha->hw;
 
        if (!IS_QLA81XX(vha->hw))
                return QLA_SUCCESS;
 
        rval = qla2x00_write_ram_word(vha, 0x7c00, 1);
        if (rval != QLA_SUCCESS) {
-               DEBUG2(qla_printk(KERN_WARNING, ha,
-                   "Sync-MPI: Unable to acquire semaphore.\n"));
+               ql_log(ql_log_warn, vha, 0x0105,
+                   "Unable to acquire semaphore.\n");
                goto done;
        }
 
        pci_read_config_word(vha->hw->pdev, 0x54, &dc);
        rval = qla2x00_read_ram_word(vha, 0x7a15, &dw);
        if (rval != QLA_SUCCESS) {
-               DEBUG2(qla_printk(KERN_WARNING, ha,
-                   "Sync-MPI: Unable to read sync.\n"));
+               ql_log(ql_log_warn, vha, 0x0067, "Unable to read sync.\n");
                goto done_release;
        }
 
@@ -1426,15 +1414,14 @@ qla81xx_mpi_sync(scsi_qla_host_t *vha)
        dw |= dc;
        rval = qla2x00_write_ram_word(vha, 0x7a15, dw);
        if (rval != QLA_SUCCESS) {
-               DEBUG2(qla_printk(KERN_WARNING, ha,
-                   "Sync-MPI: Unable to gain sync.\n"));
+               ql_log(ql_log_warn, vha, 0x0114, "Unable to gain sync.\n");
        }
 
 done_release:
        rval = qla2x00_write_ram_word(vha, 0x7c00, 0);
        if (rval != QLA_SUCCESS) {
-               DEBUG2(qla_printk(KERN_WARNING, ha,
-                   "Sync-MPI: Unable to release semaphore.\n"));
+               ql_log(ql_log_warn, vha, 0x006d,
+                   "Unable to release semaphore.\n");
        }
 
 done:
@@ -1479,14 +1466,14 @@ qla2x00_setup_chip(scsi_qla_host_t *vha)
        /* Load firmware sequences */
        rval = ha->isp_ops->load_risc(vha, &srisc_address);
        if (rval == QLA_SUCCESS) {
-               DEBUG(printk("scsi(%ld): Verifying Checksum of loaded RISC "
-                   "code.\n", vha->host_no));
+               ql_dbg(ql_dbg_init, vha, 0x00c9,
+                   "Verifying Checksum of loaded RISC code.\n");
 
                rval = qla2x00_verify_checksum(vha, srisc_address);
                if (rval == QLA_SUCCESS) {
                        /* Start firmware execution. */
-                       DEBUG(printk("scsi(%ld): Checksum OK, start "
-                           "firmware.\n", vha->host_no));
+                       ql_dbg(ql_dbg_init, vha, 0x00ca,
+                           "Starting firmware.\n");
 
                        rval = qla2x00_execute_fw(vha, srisc_address);
                        /* Retrieve firmware information. */
@@ -1522,9 +1509,9 @@ enable_82xx_npiv:
                                }
                        }
                } else {
-                       DEBUG2(printk(KERN_INFO
-                           "scsi(%ld): ISP Firmware failed checksum.\n",
-                           vha->host_no));
+                       ql_log(ql_log_fatal, vha, 0x00cd,
+                           "ISP Firmware failed checksum.\n");
+                       goto failed;
                }
        }
 
@@ -1549,7 +1536,7 @@ enable_82xx_npiv:
                        ha->flags.fac_supported = 1;
                        ha->fdt_block_size = size << 2;
                } else {
-                       qla_printk(KERN_ERR, ha,
+                       ql_log(ql_log_warn, vha, 0x00ce,
                            "Unsupported FAC firmware (%d.%02d.%02d).\n",
                            ha->fw_major_version, ha->fw_minor_version,
                            ha->fw_subminor_version);
@@ -1557,8 +1544,8 @@ enable_82xx_npiv:
        }
 failed:
        if (rval) {
-               DEBUG2_3(printk("scsi(%ld): Setup chip **** FAILED ****.\n",
-                   vha->host_no));
+               ql_log(ql_log_fatal, vha, 0x00cf,
+                   "Setup chip ****FAILED****.\n");
        }
 
        return (rval);
@@ -1608,10 +1595,11 @@ qla2x00_update_fw_options(scsi_qla_host_t *vha)
                return;
 
        /* Serial Link options. */
-       DEBUG3(printk("scsi(%ld): Serial link options:\n",
-           vha->host_no));
-       DEBUG3(qla2x00_dump_buffer((uint8_t *)&ha->fw_seriallink_options,
-           sizeof(ha->fw_seriallink_options)));
+       ql_dbg(ql_dbg_init + ql_dbg_buffer, vha, 0x0115,
+           "Serial link options.\n");
+       ql_dump_buffer(ql_dbg_init + ql_dbg_buffer, vha, 0x0109,
+           (uint8_t *)&ha->fw_seriallink_options,
+           sizeof(ha->fw_seriallink_options));
 
        ha->fw_options[1] &= ~FO1_SET_EMPHASIS_SWING;
        if (ha->fw_seriallink_options[3] & BIT_2) {
@@ -1688,7 +1676,7 @@ qla24xx_update_fw_options(scsi_qla_host_t *vha)
            le16_to_cpu(ha->fw_seriallink_options24[2]),
            le16_to_cpu(ha->fw_seriallink_options24[3]));
        if (rval != QLA_SUCCESS) {
-               qla_printk(KERN_WARNING, ha,
+               ql_log(ql_log_warn, vha, 0x0104,
                    "Unable to update Serial Link options (%x).\n", rval);
        }
 }
@@ -1746,8 +1734,9 @@ qla24xx_config_rings(struct scsi_qla_host *vha)
                icb->rid = __constant_cpu_to_le16(rid);
                if (ha->flags.msix_enabled) {
                        msix = &ha->msix_entries[1];
-                       DEBUG2_17(printk(KERN_INFO
-                       "Registering vector 0x%x for base que\n", msix->entry));
+                       ql_dbg(ql_dbg_init, vha, 0x00fd,
+                           "Registering vector 0x%x for base que.\n",
+                           msix->entry);
                        icb->msix = cpu_to_le16(msix->entry);
                }
                /* Use alternate PCI bus number */
@@ -1764,8 +1753,8 @@ qla24xx_config_rings(struct scsi_qla_host *vha)
                        icb->firmware_options_2 &=
                                __constant_cpu_to_le32(~BIT_22);
                        ha->flags.disable_msix_handshake = 1;
-                       qla_printk(KERN_INFO, ha,
-                               "MSIX Handshake Disable Mode turned on\n");
+                       ql_dbg(ql_dbg_init, vha, 0x00fe,
+                           "MSIX Handshake Disable Mode turned on.\n");
                } else {
                        icb->firmware_options_2 |=
                                __constant_cpu_to_le32(BIT_22);
@@ -1850,7 +1839,7 @@ qla2x00_init_rings(scsi_qla_host_t *vha)
        /* Update any ISP specific firmware options before initialization. */
        ha->isp_ops->update_fw_options(vha);
 
-       DEBUG(printk("scsi(%ld): Issue init firmware.\n", vha->host_no));
+       ql_dbg(ql_dbg_init, vha, 0x00d1, "Issue init firmware.\n");
 
        if (ha->flags.npiv_supported) {
                if (ha->operating_mode == LOOP)
@@ -1866,11 +1855,11 @@ qla2x00_init_rings(scsi_qla_host_t *vha)
 
        rval = qla2x00_init_firmware(vha, ha->init_cb_size);
        if (rval) {
-               DEBUG2_3(printk("scsi(%ld): Init firmware **** FAILED ****.\n",
-                   vha->host_no));
+               ql_log(ql_log_fatal, vha, 0x00d2,
+                   "Init Firmware **** FAILED ****.\n");
        } else {
-               DEBUG3(printk("scsi(%ld): Init firmware -- success.\n",
-                   vha->host_no));
+               ql_dbg(ql_dbg_init, vha, 0x00d3,
+                   "Init Firmware -- success.\n");
        }
 
        return (rval);
@@ -1913,10 +1902,8 @@ qla2x00_fw_ready(scsi_qla_host_t *vha)
 
        /* Wait for ISP to finish LIP */
        if (!vha->flags.init_done)
-               qla_printk(KERN_INFO, ha, "Waiting for LIP to complete...\n");
-
-       DEBUG3(printk("scsi(%ld): Waiting for LIP to complete...\n",
-           vha->host_no));
+               ql_log(ql_log_info, vha, 0x801e,
+                   "Waiting for LIP to complete.\n");
 
        do {
                rval = qla2x00_get_firmware_state(vha, state);
@@ -1925,30 +1912,35 @@ qla2x00_fw_ready(scsi_qla_host_t *vha)
                                vha->device_flags &= ~DFLG_NO_CABLE;
                        }
                        if (IS_QLA84XX(ha) && state[0] != FSTATE_READY) {
-                               DEBUG16(printk("scsi(%ld): fw_state=%x "
-                                   "84xx=%x.\n", vha->host_no, state[0],
-                                   state[2]));
+                               ql_dbg(ql_dbg_taskm, vha, 0x801f,
+                                   "fw_state=%x 84xx=%x.\n", state[0],
+                                   state[2]);
                                if ((state[2] & FSTATE_LOGGED_IN) &&
                                     (state[2] & FSTATE_WAITING_FOR_VERIFY)) {
-                                       DEBUG16(printk("scsi(%ld): Sending "
-                                           "verify iocb.\n", vha->host_no));
+                                       ql_dbg(ql_dbg_taskm, vha, 0x8028,
+                                           "Sending verify iocb.\n");
 
                                        cs84xx_time = jiffies;
                                        rval = qla84xx_init_chip(vha);
-                                       if (rval != QLA_SUCCESS)
+                                       if (rval != QLA_SUCCESS) {
+                                               ql_log(ql_log_warn,
+                                                   vha, 0x8043,
+                                                   "Init chip failed.\n");
                                                break;
+                                       }
 
                                        /* Add time taken to initialize. */
                                        cs84xx_time = jiffies - cs84xx_time;
                                        wtime += cs84xx_time;
                                        mtime += cs84xx_time;
-                                       DEBUG16(printk("scsi(%ld): Increasing "
-                                           "wait time by %ld. New time %ld\n",
-                                           vha->host_no, cs84xx_time, wtime));
+                                       ql_dbg(ql_dbg_taskm, vha, 0x8042,
+                                           "Increasing wait time by %ld. "
+                                           "New time %ld.\n", cs84xx_time,
+                                           wtime);
                                }
                        } else if (state[0] == FSTATE_READY) {
-                               DEBUG(printk("scsi(%ld): F/W Ready - OK \n",
-                                   vha->host_no));
+                               ql_dbg(ql_dbg_taskm, vha, 0x8037,
+                                   "F/W Ready - OK.\n");
 
                                qla2x00_get_retry_cnt(vha, &ha->retry_count,
                                    &ha->login_timeout, &ha->r_a_tov);
@@ -1965,7 +1957,7 @@ qla2x00_fw_ready(scsi_qla_host_t *vha)
                                 * other than Wait for Login.
                                 */
                                if (time_after_eq(jiffies, mtime)) {
-                                       qla_printk(KERN_INFO, ha,
+                                       ql_log(ql_log_info, vha, 0x8038,
                                            "Cable is unplugged...\n");
 
                                        vha->device_flags |= DFLG_NO_CABLE;
@@ -1985,17 +1977,17 @@ qla2x00_fw_ready(scsi_qla_host_t *vha)
                /* Delay for a while */
                msleep(500);
 
-               DEBUG3(printk("scsi(%ld): fw_state=%x curr time=%lx.\n",
-                   vha->host_no, state[0], jiffies));
+               ql_dbg(ql_dbg_taskm, vha, 0x8039,
+                   "fw_state=%x curr time=%lx.\n", state[0], jiffies);
        } while (1);
 
-       DEBUG(printk("scsi(%ld): fw_state=%x (%x, %x, %x, %x) curr time=%lx.\n",
-           vha->host_no, state[0], state[1], state[2], state[3], state[4],
-           jiffies));
+       ql_dbg(ql_dbg_taskm, vha, 0x803a,
+           "fw_state=%x (%x, %x, %x, %x) " "curr time=%lx.\n", state[0],
+           state[1], state[2], state[3], state[4], jiffies);
 
        if (rval) {
-               DEBUG2_3(printk("scsi(%ld): Firmware ready **** FAILED ****.\n",
-                   vha->host_no));
+               ql_log(ql_log_warn, vha, 0x803b,
+                   "Firmware ready **** FAILED ****.\n");
        }
 
        return (rval);
@@ -2034,19 +2026,19 @@ qla2x00_configure_hba(scsi_qla_host_t *vha)
                if (LOOP_TRANSITION(vha) || atomic_read(&ha->loop_down_timer) ||
                    IS_QLA8XXX_TYPE(ha) ||
                    (rval == QLA_COMMAND_ERROR && loop_id == 0x7)) {
-                       DEBUG2(printk("%s(%ld) Loop is in a transition state\n",
-                           __func__, vha->host_no));
+                       ql_dbg(ql_dbg_disc, vha, 0x2008,
+                           "Loop is in a transition state.\n");
                } else {
-                       qla_printk(KERN_WARNING, ha,
-                           "ERROR -- Unable to get host loop ID.\n");
+                       ql_log(ql_log_warn, vha, 0x2009,
+                           "Unable to get host loop ID.\n");
                        set_bit(ISP_ABORT_NEEDED, &vha->dpc_flags);
                }
                return (rval);
        }
 
        if (topo == 4) {
-               qla_printk(KERN_INFO, ha,
-                       "Cannot get topology - retrying.\n");
+               ql_log(ql_log_info, vha, 0x200a,
+                   "Cannot get topology - retrying.\n");
                return (QLA_FUNCTION_FAILED);
        }
 
@@ -2059,31 +2051,27 @@ qla2x00_configure_hba(scsi_qla_host_t *vha)
 
        switch (topo) {
        case 0:
-               DEBUG3(printk("scsi(%ld): HBA in NL topology.\n",
-                   vha->host_no));
+               ql_dbg(ql_dbg_disc, vha, 0x200b, "HBA in NL topology.\n");
                ha->current_topology = ISP_CFG_NL;
                strcpy(connect_type, "(Loop)");
                break;
 
        case 1:
-               DEBUG3(printk("scsi(%ld): HBA in FL topology.\n",
-                   vha->host_no));
+               ql_dbg(ql_dbg_disc, vha, 0x200c, "HBA in FL topology.\n");
                ha->switch_cap = sw_cap;
                ha->current_topology = ISP_CFG_FL;
                strcpy(connect_type, "(FL_Port)");
                break;
 
        case 2:
-               DEBUG3(printk("scsi(%ld): HBA in N P2P topology.\n",
-                   vha->host_no));
+               ql_dbg(ql_dbg_disc, vha, 0x200d, "HBA in N P2P topology.\n");
                ha->operating_mode = P2P;
                ha->current_topology = ISP_CFG_N;
                strcpy(connect_type, "(N_Port-to-N_Port)");
                break;
 
        case 3:
-               DEBUG3(printk("scsi(%ld): HBA in F P2P topology.\n",
-                   vha->host_no));
+               ql_dbg(ql_dbg_disc, vha, 0x200e, "HBA in F P2P topology.\n");
                ha->switch_cap = sw_cap;
                ha->operating_mode = P2P;
                ha->current_topology = ISP_CFG_F;
@@ -2091,9 +2079,8 @@ qla2x00_configure_hba(scsi_qla_host_t *vha)
                break;
 
        default:
-               DEBUG3(printk("scsi(%ld): HBA in unknown topology %x. "
-                   "Using NL.\n",
-                   vha->host_no, topo));
+               ql_dbg(ql_dbg_disc, vha, 0x200f,
+                   "HBA in unknown topology %x, using NL.\n", topo);
                ha->current_topology = ISP_CFG_NL;
                strcpy(connect_type, "(Loop)");
                break;
@@ -2106,14 +2093,16 @@ qla2x00_configure_hba(scsi_qla_host_t *vha)
        vha->d_id.b.al_pa = al_pa;
 
        if (!vha->flags.init_done)
-               qla_printk(KERN_INFO, ha,
-                   "Topology - %s, Host Loop address 0x%x\n",
+               ql_log(ql_log_info, vha, 0x2010,
+                   "Topology - %s, Host Loop address 0x%x.\n",
                    connect_type, vha->loop_id);
 
        if (rval) {
-               DEBUG2_3(printk("scsi(%ld): FAILED.\n", vha->host_no));
+               ql_log(ql_log_warn, vha, 0x2011,
+                   "%s FAILED\n", __func__);
        } else {
-               DEBUG3(printk("scsi(%ld): exiting normally.\n", vha->host_no));
+               ql_dbg(ql_dbg_disc, vha, 0x2012,
+                   "%s success\n", __func__);
        }
 
        return(rval);
@@ -2227,18 +2216,22 @@ qla2x00_nvram_config(scsi_qla_host_t *vha)
        for (cnt = 0, chksum = 0; cnt < ha->nvram_size; cnt++)
                chksum += *ptr++;
 
-       DEBUG5(printk("scsi(%ld): Contents of NVRAM\n", vha->host_no));
-       DEBUG5(qla2x00_dump_buffer((uint8_t *)nv, ha->nvram_size));
+       ql_dbg(ql_dbg_init + ql_dbg_buffer, vha, 0x010f,
+           "Contents of NVRAM.\n");
+       ql_dump_buffer(ql_dbg_init + ql_dbg_buffer, vha, 0x0110,
+           (uint8_t *)nv, ha->nvram_size);
 
        /* Bad NVRAM data, set defaults parameters. */
        if (chksum || nv->id[0] != 'I' || nv->id[1] != 'S' ||
            nv->id[2] != 'P' || nv->id[3] != ' ' || nv->nvram_version < 1) {
                /* Reset NVRAM data. */
-               qla_printk(KERN_WARNING, ha, "Inconsistent NVRAM detected: "
-                   "checksum=0x%x id=%c version=0x%x.\n", chksum, nv->id[0],
-                   nv->nvram_version);
-               qla_printk(KERN_WARNING, ha, "Falling back to functioning (yet "
-                   "invalid -- WWPN) defaults.\n");
+               ql_log(ql_log_warn, vha, 0x0064,
+                   "Inconisistent NVRAM "
+                   "detected: checksum=0x%x id=%c version=0x%x.\n",
+                   chksum, nv->id[0], nv->nvram_version);
+               ql_log(ql_log_warn, vha, 0x0065,
+                   "Falling back to "
+                   "functioning (yet invalid -- WWPN) defaults.\n");
 
                /*
                 * Set default initialization control block.
@@ -2493,10 +2486,7 @@ qla2x00_nvram_config(scsi_qla_host_t *vha)
                if (ha->zio_mode != QLA_ZIO_DISABLED) {
                        ha->zio_mode = QLA_ZIO_MODE_6;
 
-                       DEBUG2(printk("scsi(%ld): ZIO mode %d enabled; timer "
-                           "delay (%d us).\n", vha->host_no, ha->zio_mode,
-                           ha->zio_timer * 100));
-                       qla_printk(KERN_INFO, ha,
+                       ql_log(ql_log_info, vha, 0x0068,
                            "ZIO mode %d enabled; timer delay (%d us).\n",
                            ha->zio_mode, ha->zio_timer * 100);
 
@@ -2507,8 +2497,8 @@ qla2x00_nvram_config(scsi_qla_host_t *vha)
        }
 
        if (rval) {
-               DEBUG2_3(printk(KERN_WARNING
-                   "scsi(%ld): NVRAM configuration failed!\n", vha->host_no));
+               ql_log(ql_log_warn, vha, 0x0069,
+                   "NVRAM configuration failed.\n");
        }
        return (rval);
 }
@@ -2579,15 +2569,15 @@ qla2x00_configure_loop(scsi_qla_host_t *vha)
        if (test_bit(LOCAL_LOOP_UPDATE, &vha->dpc_flags)) {
                rval = qla2x00_configure_hba(vha);
                if (rval != QLA_SUCCESS) {
-                       DEBUG(printk("scsi(%ld): Unable to configure HBA.\n",
-                           vha->host_no));
+                       ql_dbg(ql_dbg_disc, vha, 0x2013,
+                           "Unable to configure HBA.\n");
                        return (rval);
                }
        }
 
        save_flags = flags = vha->dpc_flags;
-       DEBUG(printk("scsi(%ld): Configure loop -- dpc flags =0x%lx\n",
-           vha->host_no, flags));
+       ql_dbg(ql_dbg_disc, vha, 0x2014,
+           "Configure loop -- dpc flags = 0x%lx.\n", flags);
 
        /*
         * If we have both an RSCN and PORT UPDATE pending then handle them
@@ -2624,15 +2614,21 @@ qla2x00_configure_loop(scsi_qla_host_t *vha)
        }
 
        if (test_bit(LOCAL_LOOP_UPDATE, &flags)) {
-               if (test_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags))
+               if (test_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags)) {
+                       ql_dbg(ql_dbg_disc, vha, 0x2015,
+                           "Loop resync needed, failing.\n");
                        rval = QLA_FUNCTION_FAILED;
+               }
                else
                        rval = qla2x00_configure_local_loop(vha);
        }
 
        if (rval == QLA_SUCCESS && test_bit(RSCN_UPDATE, &flags)) {
-               if (LOOP_TRANSITION(vha))
+               if (LOOP_TRANSITION(vha)) {
+                       ql_dbg(ql_dbg_disc, vha, 0x201e,
+                           "Needs RSCN update and loop transition.\n");
                        rval = QLA_FUNCTION_FAILED;
+               }
                else
                        rval = qla2x00_configure_fabric(vha);
        }
@@ -2643,16 +2639,17 @@ qla2x00_configure_loop(scsi_qla_host_t *vha)
                        rval = QLA_FUNCTION_FAILED;
                } else {
                        atomic_set(&vha->loop_state, LOOP_READY);
-
-                       DEBUG(printk("scsi(%ld): LOOP READY\n", vha->host_no));
+                       ql_dbg(ql_dbg_disc, vha, 0x2069,
+                           "LOOP READY.\n");
                }
        }
 
        if (rval) {
-               DEBUG2_3(printk("%s(%ld): *** FAILED ***\n",
-                   __func__, vha->host_no));
+               ql_dbg(ql_dbg_disc, vha, 0x206a,
+                   "%s *** FAILED ***.\n", __func__);
        } else {
-               DEBUG3(printk("%s: exiting normally\n", __func__));
+               ql_dbg(ql_dbg_disc, vha, 0x206b,
+                   "%s: exiting normally.\n", __func__);
        }
 
        /* Restore state if a resync event occurred during processing */
@@ -2700,8 +2697,10 @@ qla2x00_configure_local_loop(scsi_qla_host_t *vha)
        new_fcport = NULL;
        entries = MAX_FIBRE_DEVICES;
 
-       DEBUG3(printk("scsi(%ld): Getting FCAL position map\n", vha->host_no));
-       DEBUG3(qla2x00_get_fcal_position_map(vha, NULL));
+       ql_dbg(ql_dbg_disc, vha, 0x2016,
+           "Getting FCAL position map.\n");
+       if (ql2xextended_error_logging & ql_dbg_disc)
+               qla2x00_get_fcal_position_map(vha, NULL);
 
        /* Get list of logged in devices. */
        memset(ha->gid_list, 0, GID_LIST_SIZE);
@@ -2710,14 +2709,17 @@ qla2x00_configure_local_loop(scsi_qla_host_t *vha)
        if (rval != QLA_SUCCESS)
                goto cleanup_allocation;
 
-       DEBUG3(printk("scsi(%ld): Entries in ID list (%d)\n",
-           vha->host_no, entries));
-       DEBUG3(qla2x00_dump_buffer((uint8_t *)ha->gid_list,
-           entries * sizeof(struct gid_list_info)));
+       ql_dbg(ql_dbg_disc, vha, 0x2017,
+           "Entries in ID list (%d).\n", entries);
+       ql_dump_buffer(ql_dbg_disc + ql_dbg_buffer, vha, 0x2075,
+           (uint8_t *)ha->gid_list,
+           entries * sizeof(struct gid_list_info));
 
        /* Allocate temporary fcport for any new fcports discovered. */
        new_fcport = qla2x00_alloc_fcport(vha, GFP_KERNEL);
        if (new_fcport == NULL) {
+               ql_log(ql_log_warn, vha, 0x2018,
+                   "Memory allocation failed for fcport.\n");
                rval = QLA_MEMORY_ALLOC_FAILED;
                goto cleanup_allocation;
        }
@@ -2731,9 +2733,9 @@ qla2x00_configure_local_loop(scsi_qla_host_t *vha)
                    fcport->port_type != FCT_BROADCAST &&
                    (fcport->flags & FCF_FABRIC_DEVICE) == 0) {
 
-                       DEBUG(printk("scsi(%ld): Marking port lost, "
-                           "loop_id=0x%04x\n",
-                           vha->host_no, fcport->loop_id));
+                       ql_dbg(ql_dbg_disc, vha, 0x2019,
+                           "Marking port lost loop_id=0x%04x.\n",
+                           fcport->loop_id);
 
                        qla2x00_set_fcport_state(fcport, FCS_DEVICE_LOST);
                }
@@ -2774,12 +2776,12 @@ qla2x00_configure_local_loop(scsi_qla_host_t *vha)
                new_fcport->vp_idx = vha->vp_idx;
                rval2 = qla2x00_get_port_database(vha, new_fcport, 0);
                if (rval2 != QLA_SUCCESS) {
-                       DEBUG2(printk("scsi(%ld): Failed to retrieve fcport "
-                           "information -- get_port_database=%x, "
-                           "loop_id=0x%04x\n",
-                           vha->host_no, rval2, new_fcport->loop_id));
-                       DEBUG2(printk("scsi(%ld): Scheduling resync...\n",
-                           vha->host_no));
+                       ql_dbg(ql_dbg_disc, vha, 0x201a,
+                           "Failed to retrieve fcport information "
+                           "-- get_port_database=%x, loop_id=0x%04x.\n",
+                           rval2, new_fcport->loop_id);
+                       ql_dbg(ql_dbg_disc, vha, 0x201b,
+                           "Scheduling resync.\n");
                        set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags);
                        continue;
                }
@@ -2815,6 +2817,8 @@ qla2x00_configure_local_loop(scsi_qla_host_t *vha)
                        fcport = new_fcport;
                        new_fcport = qla2x00_alloc_fcport(vha, GFP_KERNEL);
                        if (new_fcport == NULL) {
+                               ql_log(ql_log_warn, vha, 0x201c,
+                                   "Failed to allocate memory for fcport.\n");
                                rval = QLA_MEMORY_ALLOC_FAILED;
                                goto cleanup_allocation;
                        }
@@ -2833,8 +2837,8 @@ cleanup_allocation:
        kfree(new_fcport);
 
        if (rval != QLA_SUCCESS) {
-               DEBUG2(printk("scsi(%ld): Configure local loop error exit: "
-                   "rval=%x\n", vha->host_no, rval));
+               ql_dbg(ql_dbg_disc, vha, 0x201d,
+                   "Configure local loop error exit: rval=%x.\n", rval);
        }
 
        return (rval);
@@ -2863,27 +2867,27 @@ qla2x00_iidma_fcport(scsi_qla_host_t *vha, fc_port_t *fcport)
        rval = qla2x00_set_idma_speed(vha, fcport->loop_id, fcport->fp_speed,
            mb);
        if (rval != QLA_SUCCESS) {
-               DEBUG2(printk("scsi(%ld): Unable to adjust iIDMA "
-                   "%02x%02x%02x%02x%02x%02x%02x%02x -- %04x %x %04x %04x.\n",
-                   vha->host_no, fcport->port_name[0], fcport->port_name[1],
+               ql_dbg(ql_dbg_disc, vha, 0x2004,
+                   "Unable to adjust iIDMA "
+                   "%02x%02x%02x%02x%02x%02x%02x%02x -- %04x %x %04x "
+                   "%04x.\n", fcport->port_name[0], fcport->port_name[1],
                    fcport->port_name[2], fcport->port_name[3],
                    fcport->port_name[4], fcport->port_name[5],
                    fcport->port_name[6], fcport->port_name[7], rval,
-                   fcport->fp_speed, mb[0], mb[1]));
+                   fcport->fp_speed, mb[0], mb[1]);
        } else {
                link_speed = link_speeds[LS_UNKNOWN];
                if (fcport->fp_speed < 5)
                        link_speed = link_speeds[fcport->fp_speed];
                else if (fcport->fp_speed == 0x13)
                        link_speed = link_speeds[5];
-               DEBUG2(qla_printk(KERN_INFO, ha,
-                   "iIDMA adjusted to %s GB/s on "
-                   "%02x%02x%02x%02x%02x%02x%02x%02x.\n",
-                   link_speed, fcport->port_name[0],
-                   fcport->port_name[1], fcport->port_name[2],
-                   fcport->port_name[3], fcport->port_name[4],
-                   fcport->port_name[5], fcport->port_name[6],
-                   fcport->port_name[7]));
+               ql_dbg(ql_dbg_disc, vha, 0x2005,
+                   "iIDMA adjusted to %s GB/s "
+                   "on %02x%02x%02x%02x%02x%02x%02x%02x.\n", link_speed,
+                   fcport->port_name[0], fcport->port_name[1],
+                   fcport->port_name[2], fcport->port_name[3],
+                   fcport->port_name[4], fcport->port_name[5],
+                   fcport->port_name[6], fcport->port_name[7]);
        }
 }
 
@@ -2892,7 +2896,6 @@ qla2x00_reg_remote_port(scsi_qla_host_t *vha, fc_port_t *fcport)
 {
        struct fc_rport_identifiers rport_ids;
        struct fc_rport *rport;
-       struct qla_hw_data *ha = vha->hw;
        unsigned long flags;
 
        qla2x00_rport_del(fcport);
@@ -2904,8 +2907,8 @@ qla2x00_reg_remote_port(scsi_qla_host_t *vha, fc_port_t *fcport)
        rport_ids.roles = FC_RPORT_ROLE_UNKNOWN;
        fcport->rport = rport = fc_remote_port_add(vha->host, 0, &rport_ids);
        if (!rport) {
-               qla_printk(KERN_WARNING, ha,
-                   "Unable to allocate fc remote port!\n");
+               ql_log(ql_log_warn, vha, 0x2006,
+                   "Unable to allocate fc remote port.\n");
                return;
        }
        spin_lock_irqsave(fcport->vha->host->host_lock, flags);
@@ -2980,8 +2983,8 @@ qla2x00_configure_fabric(scsi_qla_host_t *vha)
                loop_id = SNS_FL_PORT;
        rval = qla2x00_get_port_name(vha, loop_id, vha->fabric_node_name, 1);
        if (rval != QLA_SUCCESS) {
-               DEBUG2(printk("scsi(%ld): MBC_GET_PORT_NAME Failed, No FL "
-                   "Port\n", vha->host_no));
+               ql_dbg(ql_dbg_disc, vha, 0x201f,
+                   "MBX_GET_PORT_NAME failed, No FL Port.\n");
 
                vha->device_flags &= ~SWITCH_FOUND;
                return (QLA_SUCCESS);
@@ -3008,32 +3011,32 @@ qla2x00_configure_fabric(scsi_qla_host_t *vha)
                ha->isp_ops->fabric_login(vha, loop_id, 0xff, 0xff,
                    0xfc, mb, BIT_1 | BIT_0);
                if (mb[0] != MBS_COMMAND_COMPLETE) {
-                       DEBUG2(qla_printk(KERN_INFO, ha,
-                           "Failed SNS login: loop_id=%x mb[0]=%x mb[1]=%x "
-                           "mb[2]=%x mb[6]=%x mb[7]=%x\n", loop_id,
-                           mb[0], mb[1], mb[2], mb[6], mb[7]));
+                       ql_dbg(ql_dbg_disc, vha, 0x2042,
+                           "Failed SNS login: loop_id=%x mb[0]=%x mb[1]=%x mb[2]=%x "
+                           "mb[6]=%x mb[7]=%x.\n", loop_id, mb[0], mb[1],
+                           mb[2], mb[6], mb[7]);
                        return (QLA_SUCCESS);
                }
 
                if (test_and_clear_bit(REGISTER_FC4_NEEDED, &vha->dpc_flags)) {
                        if (qla2x00_rft_id(vha)) {
                                /* EMPTY */
-                               DEBUG2(printk("scsi(%ld): Register FC-4 "
-                                   "TYPE failed.\n", vha->host_no));
+                               ql_dbg(ql_dbg_disc, vha, 0x2045,
+                                   "Register FC-4 TYPE failed.\n");
                        }
                        if (qla2x00_rff_id(vha)) {
                                /* EMPTY */
-                               DEBUG2(printk("scsi(%ld): Register FC-4 "
-                                   "Features failed.\n", vha->host_no));
+                               ql_dbg(ql_dbg_disc, vha, 0x2049,
+                                   "Register FC-4 Features failed.\n");
                        }
                        if (qla2x00_rnn_id(vha)) {
                                /* EMPTY */
-                               DEBUG2(printk("scsi(%ld): Register Node Name "
-                                   "failed.\n", vha->host_no));
+                               ql_dbg(ql_dbg_disc, vha, 0x204f,
+                                   "Register Node Name failed.\n");
                        } else if (qla2x00_rsnn_nn(vha)) {
                                /* EMPTY */
-                               DEBUG2(printk("scsi(%ld): Register Symbolic "
-                                   "Node Name failed.\n", vha->host_no));
+                               ql_dbg(ql_dbg_disc, vha, 0x2053,
+                                   "Register Symobilic Node Name failed.\n");
                        }
                }
 
@@ -3137,8 +3140,8 @@ qla2x00_configure_fabric(scsi_qla_host_t *vha)
        }
 
        if (rval) {
-               DEBUG2(printk("scsi(%ld): Configure fabric error exit: "
-                   "rval=%d\n", vha->host_no, rval));
+               ql_dbg(ql_dbg_disc, vha, 0x2068,
+                   "Configure fabric error exit rval=%d.\n", rval);
        }
 
        return (rval);
@@ -3180,8 +3183,8 @@ qla2x00_find_all_fabric_devs(scsi_qla_host_t *vha,
        swl = kcalloc(MAX_FIBRE_DEVICES, sizeof(sw_info_t), GFP_KERNEL);
        if (!swl) {
                /*EMPTY*/
-               DEBUG2(printk("scsi(%ld): GID_PT allocations failed, fallback "
-                   "on GA_NXT\n", vha->host_no));
+               ql_dbg(ql_dbg_disc, vha, 0x2054,
+                   "GID_PT allocations failed, fallback on GA_NXT.\n");
        } else {
                if (qla2x00_gid_pt(vha, swl) != QLA_SUCCESS) {
                        kfree(swl);
@@ -3206,6 +3209,8 @@ qla2x00_find_all_fabric_devs(scsi_qla_host_t *vha,
        /* Allocate temporary fcport for any new fcports discovered. */
        new_fcport = qla2x00_alloc_fcport(vha, GFP_KERNEL);
        if (new_fcport == NULL) {
+               ql_log(ql_log_warn, vha, 0x205e,
+                   "Failed to allocate memory for fcport.\n");
                kfree(swl);
                return (QLA_MEMORY_ALLOC_FAILED);
        }
@@ -3252,9 +3257,9 @@ qla2x00_find_all_fabric_devs(scsi_qla_host_t *vha,
                        /* Send GA_NXT to the switch */
                        rval = qla2x00_ga_nxt(vha, new_fcport);
                        if (rval != QLA_SUCCESS) {
-                               qla_printk(KERN_WARNING, ha,
-                                   "SNS scan failed -- assuming zero-entry "
-                                   "result...\n");
+                               ql_log(ql_log_warn, vha, 0x2064,
+                                   "SNS scan failed -- assuming "
+                                   "zero-entry result.\n");
                                list_for_each_entry_safe(fcport, fcptemp,
                                    new_fcports, list) {
                                        list_del(&fcport->list);
@@ -3270,9 +3275,11 @@ qla2x00_find_all_fabric_devs(scsi_qla_host_t *vha,
                        wrap.b24 = new_fcport->d_id.b24;
                        first_dev = 0;
                } else if (new_fcport->d_id.b24 == wrap.b24) {
-                       DEBUG2(printk("scsi(%ld): device wrap (%02x%02x%02x)\n",
-                           vha->host_no, new_fcport->d_id.b.domain,
-                           new_fcport->d_id.b.area, new_fcport->d_id.b.al_pa));
+                       ql_dbg(ql_dbg_disc, vha, 0x2065,
+                           "Device wrap (%02x%02x%02x).\n",
+                           new_fcport->d_id.b.domain,
+                           new_fcport->d_id.b.area,
+                           new_fcport->d_id.b.al_pa);
                        break;
                }
 
@@ -3377,6 +3384,8 @@ qla2x00_find_all_fabric_devs(scsi_qla_host_t *vha,
                nxt_d_id.b24 = new_fcport->d_id.b24;
                new_fcport = qla2x00_alloc_fcport(vha, GFP_KERNEL);
                if (new_fcport == NULL) {
+                       ql_log(ql_log_warn, vha, 0x2066,
+                           "Memory allocation failed for fcport.\n");
                        kfree(swl);
                        return (QLA_MEMORY_ALLOC_FAILED);
                }
@@ -3506,10 +3515,10 @@ qla2x00_device_resync(scsi_qla_host_t *vha)
                d_id.b.area = MSB(LSW(rscn_entry));
                d_id.b.al_pa = LSB(LSW(rscn_entry));
 
-               DEBUG(printk("scsi(%ld): RSCN queue entry[%d] = "
-                   "[%02x/%02x%02x%02x].\n",
-                   vha->host_no, vha->rscn_out_ptr, format, d_id.b.domain,
-                   d_id.b.area, d_id.b.al_pa));
+               ql_dbg(ql_dbg_disc, vha, 0x2020,
+                   "RSCN queue entry[%d] = [%02x/%02x%02x%02x].\n",
+                   vha->rscn_out_ptr, format, d_id.b.domain, d_id.b.area,
+                   d_id.b.al_pa);
 
                vha->rscn_out_ptr++;
                if (vha->rscn_out_ptr == MAX_RSCN_COUNT)
@@ -3525,17 +3534,17 @@ qla2x00_device_resync(scsi_qla_host_t *vha)
                        if (rscn_entry != vha->rscn_queue[rscn_out_iter])
                                break;
 
-                       DEBUG(printk("scsi(%ld): Skipping duplicate RSCN queue "
-                           "entry found at [%d].\n", vha->host_no,
-                           rscn_out_iter));
+                       ql_dbg(ql_dbg_disc, vha, 0x2021,
+                           "Skipping duplicate RSCN queue entry found at "
+                           "[%d].\n", rscn_out_iter);
 
                        vha->rscn_out_ptr = rscn_out_iter;
                }
 
                /* Queue overflow, set switch default case. */
                if (vha->flags.rscn_queue_overflow) {
-                       DEBUG(printk("scsi(%ld): device_resync: rscn "
-                           "overflow.\n", vha->host_no));
+                       ql_dbg(ql_dbg_disc, vha, 0x2022,
+                           "device_resync: rscn overflow.\n");
 
                        format = 3;
                        vha->flags.rscn_queue_overflow = 0;
@@ -3664,10 +3673,11 @@ qla2x00_fabric_login(scsi_qla_host_t *vha, fc_port_t *fcport,
        tmp_loopid = 0;
 
        for (;;) {
-               DEBUG(printk("scsi(%ld): Trying Fabric Login w/loop id 0x%04x "
-                   "for port %02x%02x%02x.\n",
-                   vha->host_no, fcport->loop_id, fcport->d_id.b.domain,
-                   fcport->d_id.b.area, fcport->d_id.b.al_pa));
+               ql_dbg(ql_dbg_disc, vha, 0x2000,
+                   "Trying Fabric Login w/loop id 0x%04x for port "
+                   "%02x%02x%02x.\n",
+                   fcport->loop_id, fcport->d_id.b.domain,
+                   fcport->d_id.b.area, fcport->d_id.b.al_pa);
 
                /* Login fcport on switch. */
                ha->isp_ops->fabric_login(vha, fcport->loop_id,
@@ -3685,10 +3695,11 @@ qla2x00_fabric_login(scsi_qla_host_t *vha, fc_port_t *fcport,
                        tmp_loopid = fcport->loop_id;
                        fcport->loop_id = mb[1];
 
-                       DEBUG(printk("Fabric Login: port in use - next "
-                           "loop id=0x%04x, port Id=%02x%02x%02x.\n",
+                       ql_dbg(ql_dbg_disc, vha, 0x2001,
+                           "Fabric Login: port in use - next loop "
+                           "id=0x%04x, port id= %02x%02x%02x.\n",
                            fcport->loop_id, fcport->d_id.b.domain,
-                           fcport->d_id.b.area, fcport->d_id.b.al_pa));
+                           fcport->d_id.b.area, fcport->d_id.b.al_pa);
 
                } else if (mb[0] == MBS_COMMAND_COMPLETE) {
                        /*
@@ -3749,11 +3760,11 @@ qla2x00_fabric_login(scsi_qla_host_t *vha, fc_port_t *fcport,
                        /*
                         * unrecoverable / not handled error
                         */
-                       DEBUG2(printk("%s(%ld): failed=%x port_id=%02x%02x%02x "
-                           "loop_id=%x jiffies=%lx.\n",
-                           __func__, vha->host_no, mb[0],
-                           fcport->d_id.b.domain, fcport->d_id.b.area,
-                           fcport->d_id.b.al_pa, fcport->loop_id, jiffies));
+                       ql_dbg(ql_dbg_disc, vha, 0x2002,
+                           "Failed=%x port_id=%02x%02x%02x loop_id=%x "
+                           "jiffies=%lx.\n", mb[0], fcport->d_id.b.domain,
+                           fcport->d_id.b.area, fcport->d_id.b.al_pa,
+                           fcport->loop_id, jiffies);
 
                        *next_loopid = fcport->loop_id;
                        ha->isp_ops->fabric_logout(vha, fcport->loop_id,
@@ -3857,7 +3868,8 @@ qla2x00_loop_resync(scsi_qla_host_t *vha)
                return (QLA_FUNCTION_FAILED);
 
        if (rval)
-               DEBUG2_3(printk("%s(): **** FAILED ****\n", __func__));
+               ql_dbg(ql_dbg_disc, vha, 0x206c,
+                   "%s *** FAILED ***.\n", __func__);
 
        return (rval);
 }
@@ -3934,8 +3946,8 @@ qla82xx_quiescent_state_cleanup(scsi_qla_host_t *vha)
        struct qla_hw_data *ha = vha->hw;
        struct scsi_qla_host *vp;
 
-       qla_printk(KERN_INFO, ha,
-                       "Performing ISP error recovery - ha= %p.\n", ha);
+       ql_dbg(ql_dbg_p3p, vha, 0xb002,
+           "Performing ISP error recovery - ha=%p.\n", ha);
 
        atomic_set(&ha->loop_down_timer, LOOP_DOWN_TIME);
        if (atomic_read(&vha->loop_state) != LOOP_DOWN) {
@@ -3969,8 +3981,8 @@ qla2x00_abort_isp_cleanup(scsi_qla_host_t *vha)
        clear_bit(ISP_ABORT_NEEDED, &vha->dpc_flags);
        ha->qla_stats.total_isp_aborts++;
 
-       qla_printk(KERN_INFO, ha,
-           "Performing ISP error recovery - ha= %p.\n", ha);
+       ql_log(ql_log_info, vha, 0x00af,
+           "Performing ISP error recovery - ha=%p.\n", ha);
 
        /* For ISP82XX, reset_chip is just disabling interrupts.
         * Driver waits for the completion of the commands.
@@ -4021,6 +4033,8 @@ qla2x00_abort_isp_cleanup(scsi_qla_host_t *vha)
                /* Make sure for ISP 82XX IO DMA is complete */
                if (IS_QLA82XX(ha)) {
                        qla82xx_chip_reset_cleanup(vha);
+                       ql_log(ql_log_info, vha, 0x00b4,
+                           "Done chip reset cleanup.\n");
 
                        /* Done waiting for pending commands.
                         * Reset the online flag.
@@ -4102,7 +4116,7 @@ qla2x00_abort_isp(scsi_qla_host_t *vha)
                                    ha->fce_dma, ha->fce_bufs, ha->fce_mb,
                                    &ha->fce_bufs);
                                if (rval) {
-                                       qla_printk(KERN_WARNING, ha,
+                                       ql_log(ql_log_warn, vha, 0x8033,
                                            "Unable to reinitialize FCE "
                                            "(%d).\n", rval);
                                        ha->flags.fce_enabled = 0;
@@ -4114,7 +4128,7 @@ qla2x00_abort_isp(scsi_qla_host_t *vha)
                                rval = qla2x00_enable_eft_trace(vha,
                                    ha->eft_dma, EFT_NUM_BUFFERS);
                                if (rval) {
-                                       qla_printk(KERN_WARNING, ha,
+                                       ql_log(ql_log_warn, vha, 0x8034,
                                            "Unable to reinitialize EFT "
                                            "(%d).\n", rval);
                                }
@@ -4123,9 +4137,9 @@ qla2x00_abort_isp(scsi_qla_host_t *vha)
                        vha->flags.online = 1;
                        if (test_bit(ISP_ABORT_RETRY, &vha->dpc_flags)) {
                                if (ha->isp_abort_cnt == 0) {
-                                       qla_printk(KERN_WARNING, ha,
-                                           "ISP error recovery failed - "
-                                           "board disabled\n");
+                                       ql_log(ql_log_fatal, vha, 0x8035,
+                                           "ISP error recover failed - "
+                                           "board disabled.\n");
                                        /*
                                         * The next call disables the board
                                         * completely.
@@ -4137,16 +4151,16 @@ qla2x00_abort_isp(scsi_qla_host_t *vha)
                                        status = 0;
                                } else { /* schedule another ISP abort */
                                        ha->isp_abort_cnt--;
-                                       DEBUG(printk("qla%ld: ISP abort - "
-                                           "retry remaining %d\n",
-                                           vha->host_no, ha->isp_abort_cnt));
+                                       ql_dbg(ql_dbg_taskm, vha, 0x8020,
+                                           "ISP abort - retry remaining %d.\n",
+                                           ha->isp_abort_cnt);
                                        status = 1;
                                }
                        } else {
                                ha->isp_abort_cnt = MAX_RETRIES_OF_ISP_ABORT;
-                               DEBUG(printk("qla2x00(%ld): ISP error recovery "
-                                   "- retrying (%d) more times\n",
-                                   vha->host_no, ha->isp_abort_cnt));
+                               ql_dbg(ql_dbg_taskm, vha, 0x8021,
+                                   "ISP error recovery - retrying (%d) "
+                                   "more times.\n", ha->isp_abort_cnt);
                                set_bit(ISP_ABORT_RETRY, &vha->dpc_flags);
                                status = 1;
                        }
@@ -4155,9 +4169,7 @@ qla2x00_abort_isp(scsi_qla_host_t *vha)
        }
 
        if (!status) {
-               DEBUG(printk(KERN_INFO
-                               "qla2x00_abort_isp(%ld): succeeded.\n",
-                               vha->host_no));
+               ql_dbg(ql_dbg_taskm, vha, 0x8022, "%s succeeded.\n", __func__);
 
                spin_lock_irqsave(&ha->vport_slock, flags);
                list_for_each_entry(vp, &ha->vp_list, list) {
@@ -4174,8 +4186,7 @@ qla2x00_abort_isp(scsi_qla_host_t *vha)
                spin_unlock_irqrestore(&ha->vport_slock, flags);
 
        } else {
-               qla_printk(KERN_INFO, ha,
-                       "qla2x00_abort_isp: **** FAILED ****\n");
+               ql_log(ql_log_warn, vha, 0x8023, "%s **** FAILED ****.\n");
        }
 
        return(status);
@@ -4216,8 +4227,8 @@ qla2x00_restart_isp(scsi_qla_host_t *vha)
 
                status = qla2x00_fw_ready(vha);
                if (!status) {
-                       DEBUG(printk("%s(): Start configure loop, "
-                           "status = %d\n", __func__, status));
+                       ql_dbg(ql_dbg_taskm, vha, 0x8031,
+                           "Start configure loop status = %d.\n", status);
 
                        /* Issue a marker after FW becomes ready. */
                        qla2x00_marker(vha, req, rsp, 0, 0, MK_SYNC_ALL);
@@ -4239,9 +4250,8 @@ qla2x00_restart_isp(scsi_qla_host_t *vha)
                if ((vha->device_flags & DFLG_NO_CABLE))
                        status = 0;
 
-               DEBUG(printk("%s(): Configure loop done, status = 0x%x\n",
-                               __func__,
-                               status));
+               ql_dbg(ql_dbg_taskm, vha, 0x8032,
+                   "Configure loop done, status = 0x%x.\n", status);
        }
        return (status);
 }
@@ -4261,13 +4271,13 @@ qla25xx_init_queues(struct qla_hw_data *ha)
                        rsp->options &= ~BIT_0;
                        ret = qla25xx_init_rsp_que(base_vha, rsp);
                        if (ret != QLA_SUCCESS)
-                               DEBUG2_17(printk(KERN_WARNING
-                                       "%s Rsp que:%d init failed\n", __func__,
-                                               rsp->id));
+                               ql_dbg(ql_dbg_init, base_vha, 0x00ff,
+                                   "%s Rsp que: %d init failed.\n",
+                                   __func__, rsp->id);
                        else
-                               DEBUG2_17(printk(KERN_INFO
-                                       "%s Rsp que:%d inited\n", __func__,
-                                               rsp->id));
+                               ql_dbg(ql_dbg_init, base_vha, 0x0100,
+                                   "%s Rsp que: %d inited.\n",
+                                   __func__, rsp->id);
                }
        }
        for (i = 1; i < ha->max_req_queues; i++) {
@@ -4277,13 +4287,13 @@ qla25xx_init_queues(struct qla_hw_data *ha)
                        req->options &= ~BIT_0;
                        ret = qla25xx_init_req_que(base_vha, req);
                        if (ret != QLA_SUCCESS)
-                               DEBUG2_17(printk(KERN_WARNING
-                                       "%s Req que:%d init failed\n", __func__,
-                                               req->id));
+                               ql_dbg(ql_dbg_init, base_vha, 0x0101,
+                                   "%s Req que: %d init failed.\n",
+                                   __func__, req->id);
                        else
-                               DEBUG2_17(printk(KERN_WARNING
-                                       "%s Req que:%d inited\n", __func__,
-                                               req->id));
+                               ql_dbg(ql_dbg_init, base_vha, 0x0102,
+                                   "%s Req que: %d inited.\n",
+                                   __func__, req->id);
                }
        }
        return ret;
@@ -4402,19 +4412,22 @@ qla24xx_nvram_config(scsi_qla_host_t *vha)
        for (cnt = 0, chksum = 0; cnt < ha->nvram_size >> 2; cnt++)
                chksum += le32_to_cpu(*dptr++);
 
-       DEBUG5(printk("scsi(%ld): Contents of NVRAM\n", vha->host_no));
-       DEBUG5(qla2x00_dump_buffer((uint8_t *)nv, ha->nvram_size));
+       ql_dbg(ql_dbg_init + ql_dbg_buffer, vha, 0x006a,
+           "Contents of NVRAM\n");
+       ql_dump_buffer(ql_dbg_init + ql_dbg_buffer, vha, 0x010d,
+           (uint8_t *)nv, ha->nvram_size);
 
        /* Bad NVRAM data, set defaults parameters. */
        if (chksum || nv->id[0] != 'I' || nv->id[1] != 'S' || nv->id[2] != 'P'
            || nv->id[3] != ' ' ||
            nv->nvram_version < __constant_cpu_to_le16(ICB_VERSION)) {
                /* Reset NVRAM data. */
-               qla_printk(KERN_WARNING, ha, "Inconsistent NVRAM detected: "
-                   "checksum=0x%x id=%c version=0x%x.\n", chksum, nv->id[0],
-                   le16_to_cpu(nv->nvram_version));
-               qla_printk(KERN_WARNING, ha, "Falling back to functioning (yet "
-                   "invalid -- WWPN) defaults.\n");
+               ql_log(ql_log_warn, vha, 0x006b,
+                   "Inconisistent NVRAM detected: checksum=0x%x id=%c "
+                   "version=0x%x.\n", chksum, nv->id[0], nv->nvram_version);
+               ql_log(ql_log_warn, vha, 0x006c,
+                   "Falling back to functioning (yet invalid -- WWPN) "
+                   "defaults.\n");
 
                /*
                 * Set default initialization control block.
@@ -4592,10 +4605,7 @@ qla24xx_nvram_config(scsi_qla_host_t *vha)
        if (ha->zio_mode != QLA_ZIO_DISABLED) {
                ha->zio_mode = QLA_ZIO_MODE_6;
 
-               DEBUG2(printk("scsi(%ld): ZIO mode %d enabled; timer delay "
-                   "(%d us).\n", vha->host_no, ha->zio_mode,
-                   ha->zio_timer * 100));
-               qla_printk(KERN_INFO, ha,
+               ql_log(ql_log_info, vha, 0x006f,
                    "ZIO mode %d enabled; timer delay (%d us).\n",
                    ha->zio_mode, ha->zio_timer * 100);
 
@@ -4606,8 +4616,8 @@ qla24xx_nvram_config(scsi_qla_host_t *vha)
        }
 
        if (rval) {
-               DEBUG2_3(printk(KERN_WARNING
-                   "scsi(%ld): NVRAM configuration failed!\n", vha->host_no));
+               ql_log(ql_log_warn, vha, 0x0070,
+                   "NVRAM configuration failed.\n");
        }
        return (rval);
 }
@@ -4625,8 +4635,8 @@ qla24xx_load_risc_flash(scsi_qla_host_t *vha, uint32_t *srisc_addr,
        struct qla_hw_data *ha = vha->hw;
        struct req_que *req = ha->req_q_map[0];
 
-       qla_printk(KERN_INFO, ha,
-           "FW: Loading from flash (%x)...\n", faddr);
+       ql_dbg(ql_dbg_init, vha, 0x008b,
+           "Loading firmware from flash (%x).\n", faddr);
 
        rval = QLA_SUCCESS;
 
@@ -4642,11 +4652,12 @@ qla24xx_load_risc_flash(scsi_qla_host_t *vha, uint32_t *srisc_addr,
            dcode[2] == 0xffffffff && dcode[3] == 0xffffffff) ||
            (dcode[0] == 0 && dcode[1] == 0 && dcode[2] == 0 &&
                dcode[3] == 0)) {
-               qla_printk(KERN_WARNING, ha,
-                   "Unable to verify integrity of flash firmware image!\n");
-               qla_printk(KERN_WARNING, ha,
-                   "Firmware data: %08x %08x %08x %08x!\n", dcode[0],
-                   dcode[1], dcode[2], dcode[3]);
+               ql_log(ql_log_fatal, vha, 0x008c,
+                   "Unable to verify the integrity of flash firmware "
+                   "image.\n");
+               ql_log(ql_log_fatal, vha, 0x008d,
+                   "Firmware data: %08x %08x %08x %08x.\n",
+                   dcode[0], dcode[1], dcode[2], dcode[3]);
 
                return QLA_FUNCTION_FAILED;
        }
@@ -4665,9 +4676,10 @@ qla24xx_load_risc_flash(scsi_qla_host_t *vha, uint32_t *srisc_addr,
                        if (dlen > risc_size)
                                dlen = risc_size;
 
-                       DEBUG7(printk("scsi(%ld): Loading risc segment@ risc "
-                           "addr %x, number of dwords 0x%x, offset 0x%x.\n",
-                           vha->host_no, risc_addr, dlen, faddr));
+                       ql_dbg(ql_dbg_init, vha, 0x008e,
+                           "Loading risc segment@ risc addr %x "
+                           "number of dwords 0x%x offset 0x%x.\n",
+                           risc_addr, dlen, faddr);
 
                        qla24xx_read_flash_data(vha, dcode, faddr, dlen);
                        for (i = 0; i < dlen; i++)
@@ -4676,12 +4688,9 @@ qla24xx_load_risc_flash(scsi_qla_host_t *vha, uint32_t *srisc_addr,
                        rval = qla2x00_load_ram(vha, req->dma, risc_addr,
                            dlen);
                        if (rval) {
-                               DEBUG(printk("scsi(%ld):[ERROR] Failed to load "
-                                   "segment %d of firmware\n", vha->host_no,
-                                   fragment));
-                               qla_printk(KERN_WARNING, ha,
-                                   "[ERROR] Failed to load segment %d of "
-                                   "firmware\n", fragment);
+                               ql_log(ql_log_fatal, vha, 0x008f,
+                                   "Failed to load segment %d of firmware.\n",
+                                   fragment);
                                break;
                        }
 
@@ -4714,9 +4723,10 @@ qla2x00_load_risc(scsi_qla_host_t *vha, uint32_t *srisc_addr)
        /* Load firmware blob. */
        blob = qla2x00_request_firmware(vha);
        if (!blob) {
-               qla_printk(KERN_ERR, ha, "Firmware image unavailable.\n");
-               qla_printk(KERN_ERR, ha, "Firmware images can be retrieved "
-                   "from: " QLA_FW_URL ".\n");
+               ql_log(ql_log_info, vha, 0x0083,
+                   "Fimware image unavailable.\n");
+               ql_log(ql_log_info, vha, 0x0084,
+                   "Firmware images can be retrieved from: "QLA_FW_URL ".\n");
                return QLA_FUNCTION_FAILED;
        }
 
@@ -4729,8 +4739,8 @@ qla2x00_load_risc(scsi_qla_host_t *vha, uint32_t *srisc_addr)
 
        /* Validate firmware image by checking version. */
        if (blob->fw->size < 8 * sizeof(uint16_t)) {
-               qla_printk(KERN_WARNING, ha,
-                   "Unable to verify integrity of firmware image (%Zd)!\n",
+               ql_log(ql_log_fatal, vha, 0x0085,
+                   "Unable to verify integrity of firmware image (%Zd).\n",
                    blob->fw->size);
                goto fail_fw_integrity;
        }
@@ -4739,11 +4749,11 @@ qla2x00_load_risc(scsi_qla_host_t *vha, uint32_t *srisc_addr)
        if ((wcode[0] == 0xffff && wcode[1] == 0xffff && wcode[2] == 0xffff &&
            wcode[3] == 0xffff) || (wcode[0] == 0 && wcode[1] == 0 &&
                wcode[2] == 0 && wcode[3] == 0)) {
-               qla_printk(KERN_WARNING, ha,
-                   "Unable to verify integrity of firmware image!\n");
-               qla_printk(KERN_WARNING, ha,
-                   "Firmware data: %04x %04x %04x %04x!\n", wcode[0],
-                   wcode[1], wcode[2], wcode[3]);
+               ql_log(ql_log_fatal, vha, 0x0086,
+                   "Unable to verify integrity of firmware image.\n");
+               ql_log(ql_log_fatal, vha, 0x0087,
+                   "Firmware data: %04x %04x %04x %04x.\n",
+                   wcode[0], wcode[1], wcode[2], wcode[3]);
                goto fail_fw_integrity;
        }
 
@@ -4756,9 +4766,9 @@ qla2x00_load_risc(scsi_qla_host_t *vha, uint32_t *srisc_addr)
                /* Validate firmware image size. */
                fwclen += risc_size * sizeof(uint16_t);
                if (blob->fw->size < fwclen) {
-                       qla_printk(KERN_WARNING, ha,
+                       ql_log(ql_log_fatal, vha, 0x0088,
                            "Unable to verify integrity of firmware image "
-                           "(%Zd)!\n", blob->fw->size);
+                           "(%Zd).\n", blob->fw->size);
                        goto fail_fw_integrity;
                }
 
@@ -4767,10 +4777,9 @@ qla2x00_load_risc(scsi_qla_host_t *vha, uint32_t *srisc_addr)
                        wlen = (uint16_t)(ha->fw_transfer_size >> 1);
                        if (wlen > risc_size)
                                wlen = risc_size;
-
-                       DEBUG7(printk("scsi(%ld): Loading risc segment@ risc "
-                           "addr %x, number of words 0x%x.\n", vha->host_no,
-                           risc_addr, wlen));
+                       ql_dbg(ql_dbg_init, vha, 0x0089,
+                           "Loading risc segment@ risc addr %x number of "
+                           "words 0x%x.\n", risc_addr, wlen);
 
                        for (i = 0; i < wlen; i++)
                                wcode[i] = swab16(fwcode[i]);
@@ -4778,12 +4787,9 @@ qla2x00_load_risc(scsi_qla_host_t *vha, uint32_t *srisc_addr)
                        rval = qla2x00_load_ram(vha, req->dma, risc_addr,
                            wlen);
                        if (rval) {
-                               DEBUG(printk("scsi(%ld):[ERROR] Failed to load "
-                                   "segment %d of firmware\n", vha->host_no,
-                                   fragment));
-                               qla_printk(KERN_WARNING, ha,
-                                   "[ERROR] Failed to load segment %d of "
-                                   "firmware\n", fragment);
+                               ql_log(ql_log_fatal, vha, 0x008a,
+                                   "Failed to load segment %d of firmware.\n",
+                                   fragment);
                                break;
                        }
 
@@ -4819,15 +4825,17 @@ qla24xx_load_risc_blob(scsi_qla_host_t *vha, uint32_t *srisc_addr)
        /* Load firmware blob. */
        blob = qla2x00_request_firmware(vha);
        if (!blob) {
-               qla_printk(KERN_ERR, ha, "Firmware image unavailable.\n");
-               qla_printk(KERN_ERR, ha, "Firmware images can be retrieved "
-                   "from: " QLA_FW_URL ".\n");
+               ql_log(ql_log_warn, vha, 0x0090,
+                   "Fimware image unavailable.\n");
+               ql_log(ql_log_warn, vha, 0x0091,
+                   "Firmware images can be retrieved from: "
+                   QLA_FW_URL ".\n");
 
                return QLA_FUNCTION_FAILED;
        }
 
-       qla_printk(KERN_INFO, ha,
-           "FW: Loading via request-firmware...\n");
+       ql_log(ql_log_info, vha, 0x0092,
+           "Loading via request-firmware.\n");
 
        rval = QLA_SUCCESS;
 
@@ -4839,8 +4847,8 @@ qla24xx_load_risc_blob(scsi_qla_host_t *vha, uint32_t *srisc_addr)
 
        /* Validate firmware image by checking version. */
        if (blob->fw->size < 8 * sizeof(uint32_t)) {
-               qla_printk(KERN_WARNING, ha,
-                   "Unable to verify integrity of firmware image (%Zd)!\n",
+               ql_log(ql_log_fatal, vha, 0x0093,
+                   "Unable to verify integrity of firmware image (%Zd).\n",
                    blob->fw->size);
                goto fail_fw_integrity;
        }
@@ -4850,11 +4858,12 @@ qla24xx_load_risc_blob(scsi_qla_host_t *vha, uint32_t *srisc_addr)
            dcode[2] == 0xffffffff && dcode[3] == 0xffffffff) ||
            (dcode[0] == 0 && dcode[1] == 0 && dcode[2] == 0 &&
                dcode[3] == 0)) {
-               qla_printk(KERN_WARNING, ha,
-                   "Unable to verify integrity of firmware image!\n");
-               qla_printk(KERN_WARNING, ha,
-                   "Firmware data: %08x %08x %08x %08x!\n", dcode[0],
-                   dcode[1], dcode[2], dcode[3]);
+               ql_log(ql_log_fatal, vha, 0x0094,
+                   "Unable to verify integrity of firmware image (%Zd).\n",
+                   blob->fw->size);
+               ql_log(ql_log_fatal, vha, 0x0095,
+                   "Firmware data: %08x %08x %08x %08x.\n",
+                   dcode[0], dcode[1], dcode[2], dcode[3]);
                goto fail_fw_integrity;
        }
 
@@ -4866,9 +4875,9 @@ qla24xx_load_risc_blob(scsi_qla_host_t *vha, uint32_t *srisc_addr)
                /* Validate firmware image size. */
                fwclen += risc_size * sizeof(uint32_t);
                if (blob->fw->size < fwclen) {
-                       qla_printk(KERN_WARNING, ha,
+                       ql_log(ql_log_fatal, vha, 0x0096,
                            "Unable to verify integrity of firmware image "
-                           "(%Zd)!\n", blob->fw->size);
+                           "(%Zd).\n", blob->fw->size);
 
                        goto fail_fw_integrity;
                }
@@ -4879,9 +4888,9 @@ qla24xx_load_risc_blob(scsi_qla_host_t *vha, uint32_t *srisc_addr)
                        if (dlen > risc_size)
                                dlen = risc_size;
 
-                       DEBUG7(printk("scsi(%ld): Loading risc segment@ risc "
-                           "addr %x, number of dwords 0x%x.\n", vha->host_no,
-                           risc_addr, dlen));
+                       ql_dbg(ql_dbg_init, vha, 0x0097,
+                           "Loading risc segment@ risc addr %x "
+                           "number of dwords 0x%x.\n", risc_addr, dlen);
 
                        for (i = 0; i < dlen; i++)
                                dcode[i] = swab32(fwcode[i]);
@@ -4889,12 +4898,9 @@ qla24xx_load_risc_blob(scsi_qla_host_t *vha, uint32_t *srisc_addr)
                        rval = qla2x00_load_ram(vha, req->dma, risc_addr,
                            dlen);
                        if (rval) {
-                               DEBUG(printk("scsi(%ld):[ERROR] Failed to load "
-                                   "segment %d of firmware\n", vha->host_no,
-                                   fragment));
-                               qla_printk(KERN_WARNING, ha,
-                                   "[ERROR] Failed to load segment %d of "
-                                   "firmware\n", fragment);
+                               ql_log(ql_log_fatal, vha, 0x0098,
+                                   "Failed to load segment %d of firmware.\n",
+                                   fragment);
                                break;
                        }
 
@@ -4958,14 +4964,13 @@ try_blob_fw:
        if (rval == QLA_SUCCESS || !ha->flt_region_gold_fw)
                return rval;
 
-       qla_printk(KERN_ERR, ha,
-           "FW: Attempting to fallback to golden firmware...\n");
+       ql_log(ql_log_info, vha, 0x0099,
+           "Attempting to fallback to golden firmware.\n");
        rval = qla24xx_load_risc_flash(vha, srisc_addr, ha->flt_region_gold_fw);
        if (rval != QLA_SUCCESS)
                return rval;
 
-       qla_printk(KERN_ERR, ha,
-           "FW: Please update operational firmware...\n");
+       ql_log(ql_log_info, vha, 0x009a, "Update operational firmware.\n");
        ha->flags.running_gold_fw = 1;
 
        return rval;
@@ -4992,8 +4997,8 @@ qla2x00_try_to_stop_firmware(scsi_qla_host_t *vha)
                        continue;
                if (qla2x00_setup_chip(vha) != QLA_SUCCESS)
                        continue;
-               qla_printk(KERN_INFO, ha,
-                   "Attempting retry of stop-firmware command...\n");
+               ql_log(ql_log_info, vha, 0x8015,
+                   "Attempting retry of stop-firmware command.\n");
                ret = qla2x00_stop_firmware(vha);
        }
 }
@@ -5028,10 +5033,10 @@ qla24xx_configure_vhba(scsi_qla_host_t *vha)
        /* Login to SNS first */
        ha->isp_ops->fabric_login(vha, NPH_SNS, 0xff, 0xff, 0xfc, mb, BIT_1);
        if (mb[0] != MBS_COMMAND_COMPLETE) {
-               DEBUG15(qla_printk(KERN_INFO, ha,
-                   "Failed SNS login: loop_id=%x mb[0]=%x mb[1]=%x "
-                   "mb[2]=%x mb[6]=%x mb[7]=%x\n", NPH_SNS,
-                   mb[0], mb[1], mb[2], mb[6], mb[7]));
+               ql_dbg(ql_dbg_init, vha, 0x0103,
+                   "Failed SNS login: loop_id=%x mb[0]=%x mb[1]=%x mb[2]=%x "
+                   "mb[6]=%x mb[7]=%x.\n",
+                   NPH_SNS, mb[0], mb[1], mb[2], mb[6], mb[7]);
                return (QLA_FUNCTION_FAILED);
        }
 
@@ -5151,19 +5156,23 @@ qla81xx_nvram_config(scsi_qla_host_t *vha)
        for (cnt = 0, chksum = 0; cnt < ha->nvram_size >> 2; cnt++)
                chksum += le32_to_cpu(*dptr++);
 
-       DEBUG5(printk("scsi(%ld): Contents of NVRAM\n", vha->host_no));
-       DEBUG5(qla2x00_dump_buffer((uint8_t *)nv, ha->nvram_size));
+       ql_dbg(ql_dbg_init + ql_dbg_buffer, vha, 0x0111,
+           "Contents of NVRAM:\n");
+       ql_dump_buffer(ql_dbg_init + ql_dbg_buffer, vha, 0x0112,
+           (uint8_t *)nv, ha->nvram_size);
 
        /* Bad NVRAM data, set defaults parameters. */
        if (chksum || nv->id[0] != 'I' || nv->id[1] != 'S' || nv->id[2] != 'P'
            || nv->id[3] != ' ' ||
            nv->nvram_version < __constant_cpu_to_le16(ICB_VERSION)) {
                /* Reset NVRAM data. */
-               qla_printk(KERN_WARNING, ha, "Inconsistent NVRAM detected: "
-                   "checksum=0x%x id=%c version=0x%x.\n", chksum, nv->id[0],
+               ql_log(ql_log_info, vha, 0x0073,
+                   "Inconisistent NVRAM detected: checksum=0x%x id=%c "
+                   "version=0x%x.\n", chksum, nv->id[0],
                    le16_to_cpu(nv->nvram_version));
-               qla_printk(KERN_WARNING, ha, "Falling back to functioning (yet "
-                   "invalid -- WWPN) defaults.\n");
+               ql_log(ql_log_info, vha, 0x0074,
+                   "Falling back to functioning (yet invalid -- WWPN) "
+                   "defaults.\n");
 
                /*
                 * Set default initialization control block.
@@ -5355,12 +5364,10 @@ qla81xx_nvram_config(scsi_qla_host_t *vha)
        if (ha->zio_mode != QLA_ZIO_DISABLED) {
                ha->zio_mode = QLA_ZIO_MODE_6;
 
-               DEBUG2(printk("scsi(%ld): ZIO mode %d enabled; timer delay "
-                   "(%d us).\n", vha->host_no, ha->zio_mode,
-                   ha->zio_timer * 100));
-               qla_printk(KERN_INFO, ha,
+               ql_log(ql_log_info, vha, 0x0075,
                    "ZIO mode %d enabled; timer delay (%d us).\n",
-                   ha->zio_mode, ha->zio_timer * 100);
+                   ha->zio_mode,
+                   ha->zio_timer * 100);
 
                icb->firmware_options_2 |= cpu_to_le32(
                    (uint32_t)ha->zio_mode);
@@ -5369,8 +5376,8 @@ qla81xx_nvram_config(scsi_qla_host_t *vha)
        }
 
        if (rval) {
-               DEBUG2_3(printk(KERN_WARNING
-                   "scsi(%ld): NVRAM configuration failed!\n", vha->host_no));
+               ql_log(ql_log_warn, vha, 0x0076,
+                   "NVRAM configuration failed.\n");
        }
        return (rval);
 }
@@ -5393,9 +5400,8 @@ qla82xx_restart_isp(scsi_qla_host_t *vha)
 
                status = qla2x00_fw_ready(vha);
                if (!status) {
-                       qla_printk(KERN_INFO, ha,
-                       "%s(): Start configure loop, "
-                       "status = %d\n", __func__, status);
+                       ql_log(ql_log_info, vha, 0x803c,
+                           "Start configure loop, status =%d.\n", status);
 
                        /* Issue a marker after FW becomes ready. */
                        qla2x00_marker(vha, req, rsp, 0, 0, MK_SYNC_ALL);
@@ -5417,9 +5423,8 @@ qla82xx_restart_isp(scsi_qla_host_t *vha)
                if ((vha->device_flags & DFLG_NO_CABLE))
                        status = 0;
 
-               qla_printk(KERN_INFO, ha,
-                       "%s(): Configure loop done, status = 0x%x\n",
-                       __func__, status);
+               ql_log(ql_log_info, vha, 0x803d,
+                   "Configure loop done, status = 0x%x.\n", status);
        }
 
        if (!status) {
@@ -5455,9 +5460,9 @@ qla82xx_restart_isp(scsi_qla_host_t *vha)
                            ha->fce_dma, ha->fce_bufs, ha->fce_mb,
                            &ha->fce_bufs);
                        if (rval) {
-                               qla_printk(KERN_WARNING, ha,
-                                   "Unable to reinitialize FCE "
-                                   "(%d).\n", rval);
+                               ql_log(ql_log_warn, vha, 0x803e,
+                                   "Unable to reinitialize FCE (%d).\n",
+                                   rval);
                                ha->flags.fce_enabled = 0;
                        }
                }
@@ -5467,17 +5472,16 @@ qla82xx_restart_isp(scsi_qla_host_t *vha)
                        rval = qla2x00_enable_eft_trace(vha,
                            ha->eft_dma, EFT_NUM_BUFFERS);
                        if (rval) {
-                               qla_printk(KERN_WARNING, ha,
-                                   "Unable to reinitialize EFT "
-                                   "(%d).\n", rval);
+                               ql_log(ql_log_warn, vha, 0x803f,
+                                   "Unable to reinitialize EFT (%d).\n",
+                                   rval);
                        }
                }
        }
 
        if (!status) {
-               DEBUG(printk(KERN_INFO
-                       "qla82xx_restart_isp(%ld): succeeded.\n",
-                       vha->host_no));
+               ql_dbg(ql_dbg_taskm, vha, 0x8040,
+                   "qla82xx_restart_isp succeeded.\n");
 
                spin_lock_irqsave(&ha->vport_slock, flags);
                list_for_each_entry(vp, &ha->vp_list, list) {
@@ -5494,8 +5498,8 @@ qla82xx_restart_isp(scsi_qla_host_t *vha)
                spin_unlock_irqrestore(&ha->vport_slock, flags);
 
        } else {
-               qla_printk(KERN_INFO, ha,
-                       "qla82xx_restart_isp: **** FAILED ****\n");
+               ql_log(ql_log_warn, vha, 0x8041,
+                   "qla82xx_restart_isp **** FAILED ****.\n");
        }
 
        return status;
@@ -5645,9 +5649,8 @@ qla24xx_update_fcport_fcp_prio(scsi_qla_host_t *vha, fc_port_t *fcport)
        if (ret == QLA_SUCCESS)
                fcport->fcp_prio = priority;
        else
-               DEBUG2(printk(KERN_WARNING
-                       "scsi(%ld): Unable to activate fcp priority, "
-                       " ret=0x%x\n", vha->host_no, ret));
+               ql_dbg(ql_dbg_user, vha, 0x704f,
+                   "Unable to activate fcp priority, ret=0x%x.\n", ret);
 
        return  ret;
 }
index 4c8167e11f69e6ebf7d5658cac18675529237015..d2e904bc21c018606d3a40bf40f34ba3437d6159 100644 (file)
@@ -94,11 +94,11 @@ qla2x00_set_fcport_state(fc_port_t *fcport, int state)
 
        /* Don't print state transitions during initial allocation of fcport */
        if (old_state && old_state != state) {
-               DEBUG(qla_printk(KERN_WARNING, fcport->vha->hw,
-                   "scsi(%ld): FCPort state transitioned from %s to %s - "
-                   "portid=%02x%02x%02x.\n", fcport->vha->host_no,
+               ql_dbg(ql_dbg_disc, fcport->vha, 0x207d,
+                   "FCPort state transitioned from %s to %s - "
+                   "portid=%02x%02x%02x.\n",
                    port_state_str[old_state], port_state_str[state],
                    fcport->d_id.b.domain, fcport->d_id.b.area,
-                   fcport->d_id.b.al_pa));
+                   fcport->d_id.b.al_pa);
        }
 }
index 7bac3cd109d60740628c00a33aabc9345414e975..49d6906af886e06649494ba2eab37b8bddeac3aa 100644 (file)
@@ -150,7 +150,8 @@ qla24xx_configure_prot_mode(srb_t *sp, uint16_t *fw_prot_opts)
 
        /* We only support T10 DIF right now */
        if (guard != SHOST_DIX_GUARD_CRC) {
-               DEBUG2(printk(KERN_ERR "Unsupported guard: %d\n", guard));
+               ql_dbg(ql_dbg_io, sp->fcport->vha, 0x3007,
+                   "Unsupported guard: %d for cmd=%p.\n", guard, sp->cmd);
                return 0;
        }
 
@@ -343,9 +344,10 @@ qla2x00_start_scsi(srb_t *sp)
 
        /* Send marker if required */
        if (vha->marker_needed != 0) {
-               if (qla2x00_marker(vha, req, rsp, 0, 0, MK_SYNC_ALL)
-                                                       != QLA_SUCCESS)
+               if (qla2x00_marker(vha, req, rsp, 0, 0, MK_SYNC_ALL) !=
+                   QLA_SUCCESS) {
                        return (QLA_FUNCTION_FAILED);
+               }
                vha->marker_needed = 0;
        }
 
@@ -490,8 +492,8 @@ __qla2x00_marker(struct scsi_qla_host *vha, struct req_que *req,
        mrk24 = NULL;
        mrk = (mrk_entry_t *)qla2x00_alloc_iocbs(vha, 0);
        if (mrk == NULL) {
-               DEBUG2_3(printk("%s(%ld): failed to allocate Marker IOCB.\n",
-                   __func__, base_vha->host_no));
+               ql_log(ql_log_warn, base_vha, 0x3026,
+                   "Failed to allocate Marker IOCB.\n");
 
                return (QLA_FUNCTION_FAILED);
        }
@@ -547,9 +549,10 @@ qla2x00_isp_cmd(struct scsi_qla_host *vha, struct req_que *req)
        device_reg_t __iomem *reg = ISP_QUE_REG(ha, req->id);
        struct device_reg_2xxx __iomem *ioreg = &ha->iobase->isp;
 
-       DEBUG5(printk("%s(): IOCB data:\n", __func__));
-       DEBUG5(qla2x00_dump_buffer(
-           (uint8_t *)req->ring_ptr, REQUEST_ENTRY_SIZE));
+       ql_dbg(ql_dbg_io + ql_dbg_buffer, vha, 0x302d,
+           "IOCB data:\n");
+       ql_dump_buffer(ql_dbg_io + ql_dbg_buffer, vha, 0x302e,
+           (uint8_t *)req->ring_ptr, REQUEST_ENTRY_SIZE);
 
        /* Adjust ring index. */
        req->ring_index++;
@@ -604,7 +607,7 @@ qla2x00_isp_cmd(struct scsi_qla_host *vha, struct req_que *req)
  * Returns the number of IOCB entries needed to store @dsds.
  */
 inline uint16_t
-qla24xx_calc_iocbs(uint16_t dsds)
+qla24xx_calc_iocbs(scsi_qla_host_t *vha, uint16_t dsds)
 {
        uint16_t iocbs;
 
@@ -614,8 +617,6 @@ qla24xx_calc_iocbs(uint16_t dsds)
                if ((dsds - 1) % 5)
                        iocbs++;
        }
-       DEBUG3(printk(KERN_DEBUG "%s(): Required PKT(s) = %d\n",
-           __func__, iocbs));
        return iocbs;
 }
 
@@ -712,6 +713,7 @@ qla24xx_set_t10dif_tags(struct scsi_cmnd *cmd, struct fw_dif_context *pkt,
     unsigned int protcnt)
 {
        struct sd_dif_tuple *spt;
+       scsi_qla_host_t *vha = shost_priv(cmd->device->host);
        unsigned char op = scsi_get_prot_op(cmd);
 
        switch (scsi_get_prot_type(cmd)) {
@@ -768,9 +770,9 @@ qla24xx_set_t10dif_tags(struct scsi_cmnd *cmd, struct fw_dif_context *pkt,
                    op == SCSI_PROT_WRITE_PASS)) {
                        spt = page_address(sg_page(scsi_prot_sglist(cmd))) +
                            scsi_prot_sglist(cmd)[0].offset;
-                       DEBUG18(printk(KERN_DEBUG
-                           "%s(): LBA from user %p, lba = 0x%x\n",
-                           __func__, spt, (int)spt->ref_tag));
+                       ql_dbg(ql_dbg_io, vha, 0x3008,
+                           "LBA from user %p, lba = 0x%x for cmd=%p.\n",
+                           spt, (int)spt->ref_tag, cmd);
                        pkt->ref_tag = swab32(spt->ref_tag);
                        pkt->app_tag_mask[0] = 0x0;
                        pkt->app_tag_mask[1] = 0x0;
@@ -789,11 +791,11 @@ qla24xx_set_t10dif_tags(struct scsi_cmnd *cmd, struct fw_dif_context *pkt,
                break;
        }
 
-       DEBUG18(printk(KERN_DEBUG
-           "%s(): Setting protection Tags: (BIG) ref tag = 0x%x,"
-           " app tag = 0x%x, prot SG count %d , cmd lba 0x%x,"
-           " prot_type=%u\n", __func__, pkt->ref_tag, pkt->app_tag, protcnt,
-           (int)scsi_get_lba(cmd), scsi_get_prot_type(cmd)));
+       ql_dbg(ql_dbg_io, vha, 0x3009,
+           "Setting protection Tags: (BIG) ref tag = 0x%x, app tag = 0x%x, "
+           "prot SG count %d, cmd lba 0x%x, prot_type=%u cmd=%p.\n",
+           pkt->ref_tag, pkt->app_tag, protcnt, (int)scsi_get_lba(cmd),
+           scsi_get_prot_type(cmd), cmd);
 }
 
 
@@ -809,6 +811,7 @@ qla24xx_walk_and_build_sglist(struct qla_hw_data *ha, srb_t *sp, uint32_t *dsd,
        uint32_t *cur_dsd = dsd;
        int     i;
        uint16_t        used_dsds = tot_dsds;
+       scsi_qla_host_t *vha = shost_priv(sp->cmd->device->host);
 
        uint8_t         *cp;
 
@@ -853,9 +856,10 @@ qla24xx_walk_and_build_sglist(struct qla_hw_data *ha, srb_t *sp, uint32_t *dsd,
                        cur_dsd = (uint32_t *)next_dsd;
                }
                sle_dma = sg_dma_address(sg);
-               DEBUG18(printk("%s(): %p, sg entry %d - addr =0x%x 0x%x,"
-                   " len =%d\n", __func__ , cur_dsd, i, LSD(sle_dma),
-                   MSD(sle_dma), sg_dma_len(sg)));
+               ql_dbg(ql_dbg_io, vha, 0x300a,
+                   "sg entry %d - addr=0x%x 0x%x, " "len=%d for cmd=%p.\n",
+                   cur_dsd, i, LSD(sle_dma), MSD(sle_dma), sg_dma_len(sg),
+                   sp->cmd);
                *cur_dsd++ = cpu_to_le32(LSD(sle_dma));
                *cur_dsd++ = cpu_to_le32(MSD(sle_dma));
                *cur_dsd++ = cpu_to_le32(sg_dma_len(sg));
@@ -863,8 +867,8 @@ qla24xx_walk_and_build_sglist(struct qla_hw_data *ha, srb_t *sp, uint32_t *dsd,
 
                if (scsi_get_prot_op(sp->cmd) == SCSI_PROT_WRITE_PASS) {
                        cp = page_address(sg_page(sg)) + sg->offset;
-                       DEBUG18(printk("%s(): User Data buffer= %p:\n",
-                           __func__ , cp));
+                       ql_dbg(ql_dbg_io, vha, 0x300b,
+                           "User data buffer=%p for cmd=%p.\n", cp, sp->cmd);
                }
        }
        /* Null termination */
@@ -888,7 +892,7 @@ qla24xx_walk_and_build_prot_sglist(struct qla_hw_data *ha, srb_t *sp,
        struct scsi_cmnd *cmd;
        uint32_t *cur_dsd = dsd;
        uint16_t        used_dsds = tot_dsds;
-
+       scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev);
        uint8_t         *cp;
 
 
@@ -935,10 +939,11 @@ qla24xx_walk_and_build_prot_sglist(struct qla_hw_data *ha, srb_t *sp,
                }
                sle_dma = sg_dma_address(sg);
                if (scsi_get_prot_op(sp->cmd) == SCSI_PROT_WRITE_PASS) {
-                       DEBUG18(printk(KERN_DEBUG
-                           "%s(): %p, sg entry %d - addr =0x%x"
-                           "0x%x, len =%d\n", __func__ , cur_dsd, i,
-                           LSD(sle_dma), MSD(sle_dma), sg_dma_len(sg)));
+                       ql_dbg(ql_dbg_io, vha, 0x3027,
+                           "%s(): %p, sg_entry %d - "
+                           "addr=0x%x0x%x, len=%d.\n",
+                           __func__, cur_dsd, i,
+                           LSD(sle_dma), MSD(sle_dma), sg_dma_len(sg));
                }
                *cur_dsd++ = cpu_to_le32(LSD(sle_dma));
                *cur_dsd++ = cpu_to_le32(MSD(sle_dma));
@@ -946,8 +951,9 @@ qla24xx_walk_and_build_prot_sglist(struct qla_hw_data *ha, srb_t *sp,
 
                if (scsi_get_prot_op(sp->cmd) == SCSI_PROT_WRITE_PASS) {
                        cp = page_address(sg_page(sg)) + sg->offset;
-                       DEBUG18(printk("%s(): Protection Data buffer = %p:\n",
-                           __func__ , cp));
+                       ql_dbg(ql_dbg_io, vha, 0x3028,
+                           "%s(): Protection Data buffer = %p.\n", __func__,
+                           cp);
                }
                avail_dsds--;
        }
@@ -996,22 +1002,16 @@ qla24xx_build_scsi_crc_2_iocbs(srb_t *sp, struct cmd_type_crc_2 *cmd_pkt,
        *((uint32_t *)(&cmd_pkt->entry_type)) =
            __constant_cpu_to_le32(COMMAND_TYPE_CRC_2);
 
+       vha = sp->fcport->vha;
+       ha = vha->hw;
+
        /* No data transfer */
        data_bytes = scsi_bufflen(cmd);
        if (!data_bytes || cmd->sc_data_direction == DMA_NONE) {
-               DEBUG18(printk(KERN_INFO "%s: Zero data bytes or DMA-NONE %d\n",
-                   __func__, data_bytes));
                cmd_pkt->byte_count = __constant_cpu_to_le32(0);
                return QLA_SUCCESS;
        }
 
-       vha = sp->fcport->vha;
-       ha = vha->hw;
-
-       DEBUG18(printk(KERN_DEBUG
-           "%s(%ld): Executing cmd sp %p, prot_op=%u.\n", __func__,
-           vha->host_no, sp, scsi_get_prot_op(sp->cmd)));
-
        cmd_pkt->vp_index = sp->fcport->vp_idx;
 
        /* Set transfer direction */
@@ -1056,8 +1056,6 @@ qla24xx_build_scsi_crc_2_iocbs(srb_t *sp, struct cmd_type_crc_2 *cmd_pkt,
 
        /* Determine SCSI command length -- align to 4 byte boundary */
        if (cmd->cmd_len > 16) {
-               DEBUG18(printk(KERN_INFO "%s(): **** SCSI CMD > 16\n",
-                   __func__));
                additional_fcpcdb_len = cmd->cmd_len - 16;
                if ((cmd->cmd_len % 4) != 0) {
                        /* SCSI cmd > 16 bytes must be multiple of 4 */
@@ -1108,11 +1106,6 @@ qla24xx_build_scsi_crc_2_iocbs(srb_t *sp, struct cmd_type_crc_2 *cmd_pkt,
 
        cmd_pkt->fcp_rsp_dseg_len = 0; /* Let response come in status iocb */
 
-       DEBUG18(printk(KERN_INFO "%s(%ld): Total SG(s) Entries %d, Data"
-           "entries %d, data bytes %d, Protection entries %d\n",
-           __func__, vha->host_no, tot_dsds, (tot_dsds-tot_prot_dsds),
-           data_bytes, tot_prot_dsds));
-
        /* Compute dif len and adjust data len to incude protection */
        total_bytes = data_bytes;
        dif_bytes = 0;
@@ -1150,14 +1143,7 @@ qla24xx_build_scsi_crc_2_iocbs(srb_t *sp, struct cmd_type_crc_2 *cmd_pkt,
            additional_fcpcdb_len);
        *fcp_dl = htonl(total_bytes);
 
-       DEBUG18(printk(KERN_INFO "%s(%ld): dif bytes = 0x%x (%d), total bytes"
-           " = 0x%x (%d), dat block size =0x%x (%d)\n", __func__,
-           vha->host_no, dif_bytes, dif_bytes, total_bytes, total_bytes,
-           crc_ctx_pkt->blk_size, crc_ctx_pkt->blk_size));
-
        if (!data_bytes || cmd->sc_data_direction == DMA_NONE) {
-               DEBUG18(printk(KERN_INFO "%s: Zero data bytes or DMA-NONE %d\n",
-                   __func__, data_bytes));
                cmd_pkt->byte_count = __constant_cpu_to_le32(0);
                return QLA_SUCCESS;
        }
@@ -1182,8 +1168,6 @@ qla24xx_build_scsi_crc_2_iocbs(srb_t *sp, struct cmd_type_crc_2 *cmd_pkt,
        return QLA_SUCCESS;
 
 crc_queuing_error:
-       DEBUG18(qla_printk(KERN_INFO, ha,
-           "CMD sent FAILED crc_q error:sp = %p\n", sp));
        /* Cleanup will be performed by the caller */
 
        return QLA_FUNCTION_FAILED;
@@ -1225,8 +1209,8 @@ qla24xx_start_scsi(srb_t *sp)
 
        /* Send marker if required */
        if (vha->marker_needed != 0) {
-               if (qla2x00_marker(vha, req, rsp, 0, 0, MK_SYNC_ALL)
-                                                       != QLA_SUCCESS)
+               if (qla2x00_marker(vha, req, rsp, 0, 0, MK_SYNC_ALL) !=
+                   QLA_SUCCESS)
                        return QLA_FUNCTION_FAILED;
                vha->marker_needed = 0;
        }
@@ -1243,8 +1227,9 @@ qla24xx_start_scsi(srb_t *sp)
                if (!req->outstanding_cmds[handle])
                        break;
        }
-       if (index == MAX_OUTSTANDING_COMMANDS)
+       if (index == MAX_OUTSTANDING_COMMANDS) {
                goto queuing_error;
+       }
 
        /* Map the sg table so we have an accurate count of sg entries needed */
        if (scsi_sg_count(cmd)) {
@@ -1256,8 +1241,7 @@ qla24xx_start_scsi(srb_t *sp)
                nseg = 0;
 
        tot_dsds = nseg;
-
-       req_cnt = qla24xx_calc_iocbs(tot_dsds);
+       req_cnt = qla24xx_calc_iocbs(vha, tot_dsds);
        if (req->cnt < (req_cnt + 2)) {
                cnt = RD_REG_DWORD_RELAXED(req->req_q_out);
 
@@ -1322,7 +1306,6 @@ qla24xx_start_scsi(srb_t *sp)
        /* Specify response queue number where completion should happen */
        cmd_pkt->entry_status = (uint8_t) rsp->id;
        wmb();
-
        /* Adjust ring index. */
        req->ring_index++;
        if (req->ring_index == req->length) {
@@ -1534,9 +1517,6 @@ queuing_error:
        /* Cleanup will be performed by the caller (queuecommand) */
 
        spin_unlock_irqrestore(&ha->hardware_lock, flags);
-
-       DEBUG18(qla_printk(KERN_INFO, ha,
-           "CMD sent FAILED SCSI prot_op:%02x\n", scsi_get_prot_op(cmd)));
        return QLA_FUNCTION_FAILED;
 }
 
@@ -1581,8 +1561,11 @@ qla2x00_alloc_iocbs(scsi_qla_host_t *vha, srb_t *sp)
                if (!req->outstanding_cmds[handle])
                        break;
        }
-       if (index == MAX_OUTSTANDING_COMMANDS)
+       if (index == MAX_OUTSTANDING_COMMANDS) {
+               ql_log(ql_log_warn, vha, 0x700b,
+                   "No room on oustanding cmd array.\n");
                goto queuing_error;
+       }
 
        /* Prep command array. */
        req->current_outstanding_cmd = handle;
@@ -1999,8 +1982,11 @@ qla2x00_start_sp(srb_t *sp)
        rval = QLA_FUNCTION_FAILED;
        spin_lock_irqsave(&ha->hardware_lock, flags);
        pkt = qla2x00_alloc_iocbs(sp->fcport->vha, sp);
-       if (!pkt)
+       if (!pkt) {
+               ql_log(ql_log_warn, sp->fcport->vha, 0x700c,
+                   "qla2x00_alloc_iocbs failed.\n");
                goto done;
+       }
 
        rval = QLA_SUCCESS;
        switch (ctx->type) {
index ae8e298746bae1f02d25473ecbde6bcf3e8b52db..b16b7725dee001ee791b359a270d5a8792311957 100644 (file)
@@ -45,7 +45,7 @@ qla2100_intr_handler(int irq, void *dev_id)
        rsp = (struct rsp_que *) dev_id;
        if (!rsp) {
                printk(KERN_INFO
-                   "%s(): NULL response queue pointer\n", __func__);
+                   "%s(): NULL response queue pointer.\n", __func__);
                return (IRQ_NONE);
        }
 
@@ -91,9 +91,9 @@ qla2100_intr_handler(int irq, void *dev_id)
                                qla2x00_async_event(vha, rsp, mb);
                        } else {
                                /*EMPTY*/
-                               DEBUG2(printk("scsi(%ld): Unrecognized "
-                                   "interrupt type (%d).\n",
-                                   vha->host_no, mb[0]));
+                               ql_dbg(ql_dbg_async, vha, 0x5025,
+                                   "Unrecognized interrupt type (%d).\n",
+                                   mb[0]);
                        }
                        /* Release mailbox registers. */
                        WRT_REG_WORD(&reg->semaphore, 0);
@@ -142,7 +142,7 @@ qla2300_intr_handler(int irq, void *dev_id)
        rsp = (struct rsp_que *) dev_id;
        if (!rsp) {
                printk(KERN_INFO
-                   "%s(): NULL response queue pointer\n", __func__);
+                   "%s(): NULL response queue pointer.\n", __func__);
                return (IRQ_NONE);
        }
 
@@ -160,11 +160,13 @@ qla2300_intr_handler(int irq, void *dev_id)
 
                        hccr = RD_REG_WORD(&reg->hccr);
                        if (hccr & (BIT_15 | BIT_13 | BIT_11 | BIT_8))
-                               qla_printk(KERN_INFO, ha, "Parity error -- "
-                                   "HCCR=%x, Dumping firmware!\n", hccr);
+                               ql_log(ql_log_warn, vha, 0x5026,
+                                   "Parity error -- HCCR=%x, Dumping "
+                                   "firmware.\n", hccr);
                        else
-                               qla_printk(KERN_INFO, ha, "RISC paused -- "
-                                   "HCCR=%x, Dumping firmware!\n", hccr);
+                               ql_log(ql_log_warn, vha, 0x5027,
+                                   "RISC paused -- HCCR=%x, Dumping "
+                                   "firmware.\n", hccr);
 
                        /*
                         * Issue a "HARD" reset in order for the RISC
@@ -213,9 +215,8 @@ qla2300_intr_handler(int irq, void *dev_id)
                        qla2x00_async_event(vha, rsp, mb);
                        break;
                default:
-                       DEBUG2(printk("scsi(%ld): Unrecognized interrupt type "
-                           "(%d).\n",
-                           vha->host_no, stat & 0xff));
+                       ql_dbg(ql_dbg_async, vha, 0x5028,
+                           "Unrecognized interrupt type (%d).\n", stat & 0xff);
                        break;
                }
                WRT_REG_WORD(&reg->hccr, HCCR_CLR_RISC_INT);
@@ -262,11 +263,11 @@ qla2x00_mbx_completion(scsi_qla_host_t *vha, uint16_t mb0)
        }
 
        if (ha->mcp) {
-               DEBUG3(printk("%s(%ld): Got mailbox completion. cmd=%x.\n",
-                   __func__, vha->host_no, ha->mcp->mb[0]));
+               ql_dbg(ql_dbg_async, vha, 0x5000,
+                   "Got mbx completion. cmd=%x.\n", ha->mcp->mb[0]);
        } else {
-               DEBUG2_3(printk("%s(%ld): MBX pointer ERROR!\n",
-                   __func__, vha->host_no));
+               ql_dbg(ql_dbg_async, vha, 0x5001,
+                   "MBX pointer ERROR.\n");
        }
 }
 
@@ -285,22 +286,24 @@ qla81xx_idc_event(scsi_qla_host_t *vha, uint16_t aen, uint16_t descr)
        for (cnt = 0; cnt < QLA_IDC_ACK_REGS; cnt++, wptr++)
                mb[cnt] = RD_REG_WORD(wptr);
 
-       DEBUG2(printk("scsi(%ld): Inter-Driver Commucation %s -- "
-           "%04x %04x %04x %04x %04x %04x %04x.\n", vha->host_no,
-           event[aen & 0xff],
-           mb[0], mb[1], mb[2], mb[3], mb[4], mb[5], mb[6]));
+       ql_dbg(ql_dbg_async, vha, 0x5021,
+           "Inter-Driver Commucation %s -- "
+           "%04x %04x %04x %04x %04x %04x %04x.\n",
+           event[aen & 0xff], mb[0], mb[1], mb[2], mb[3],
+           mb[4], mb[5], mb[6]);
 
        /* Acknowledgement needed? [Notify && non-zero timeout]. */
        timeout = (descr >> 8) & 0xf;
        if (aen != MBA_IDC_NOTIFY || !timeout)
                return;
 
-       DEBUG2(printk("scsi(%ld): Inter-Driver Commucation %s -- "
-           "ACK timeout=%d.\n", vha->host_no, event[aen & 0xff], timeout));
+       ql_dbg(ql_dbg_async, vha, 0x5022,
+           "Inter-Driver Commucation %s -- ACK timeout=%d.\n",
+           vha->host_no, event[aen & 0xff], timeout);
 
        rval = qla2x00_post_idc_ack_work(vha, mb);
        if (rval != QLA_SUCCESS)
-               qla_printk(KERN_WARNING, vha->hw,
+               ql_log(ql_log_warn, vha, 0x5023,
                    "IDC failed to post ACK.\n");
 }
 
@@ -393,15 +396,15 @@ skip_rio:
                break;
 
        case MBA_RESET:                 /* Reset */
-               DEBUG2(printk("scsi(%ld): Asynchronous RESET.\n",
-                       vha->host_no));
+               ql_dbg(ql_dbg_async, vha, 0x5002,
+                   "Asynchronous RESET.\n");
 
                set_bit(RESET_MARKER_NEEDED, &vha->dpc_flags);
                break;
 
        case MBA_SYSTEM_ERR:            /* System Error */
                mbx = IS_QLA81XX(ha) ? RD_REG_WORD(&reg24->mailbox7) : 0;
-               qla_printk(KERN_INFO, ha,
+               ql_log(ql_log_warn, vha, 0x5003,
                    "ISP System Error - mbx1=%xh mbx2=%xh mbx3=%xh "
                    "mbx7=%xh.\n", mb[1], mb[2], mb[3], mbx);
 
@@ -409,7 +412,7 @@ skip_rio:
 
                if (IS_FWI2_CAPABLE(ha)) {
                        if (mb[1] == 0 && mb[2] == 0) {
-                               qla_printk(KERN_ERR, ha,
+                               ql_log(ql_log_fatal, vha, 0x5004,
                                    "Unrecoverable Hardware Error: adapter "
                                    "marked OFFLINE!\n");
                                vha->flags.online = 0;
@@ -422,7 +425,7 @@ skip_rio:
                                set_bit(ISP_ABORT_NEEDED, &vha->dpc_flags);
                        }
                } else if (mb[1] == 0) {
-                       qla_printk(KERN_INFO, ha,
+                       ql_log(ql_log_fatal, vha, 0x5005,
                            "Unrecoverable Hardware Error: adapter marked "
                            "OFFLINE!\n");
                        vha->flags.online = 0;
@@ -431,31 +434,27 @@ skip_rio:
                break;
 
        case MBA_REQ_TRANSFER_ERR:      /* Request Transfer Error */
-               DEBUG2(printk("scsi(%ld): ISP Request Transfer Error (%x).\n",
-                   vha->host_no, mb[1]));
-               qla_printk(KERN_WARNING, ha,
-                   "ISP Request Transfer Error (%x).\n", mb[1]);
+               ql_log(ql_log_warn, vha, 0x5006,
+                   "ISP Request Transfer Error (%x).\n",  mb[1]);
 
                set_bit(ISP_ABORT_NEEDED, &vha->dpc_flags);
                break;
 
        case MBA_RSP_TRANSFER_ERR:      /* Response Transfer Error */
-               DEBUG2(printk("scsi(%ld): ISP Response Transfer Error.\n",
-                   vha->host_no));
-               qla_printk(KERN_WARNING, ha, "ISP Response Transfer Error.\n");
+               ql_log(ql_log_warn, vha, 0x5007,
+                   "ISP Response Transfer Error.\n");
 
                set_bit(ISP_ABORT_NEEDED, &vha->dpc_flags);
                break;
 
        case MBA_WAKEUP_THRES:          /* Request Queue Wake-up */
-               DEBUG2(printk("scsi(%ld): Asynchronous WAKEUP_THRES.\n",
-                   vha->host_no));
+               ql_dbg(ql_dbg_async, vha, 0x5008,
+                   "Asynchronous WAKEUP_THRES.\n");
                break;
 
        case MBA_LIP_OCCURRED:          /* Loop Initialization Procedure */
-               DEBUG2(printk("scsi(%ld): LIP occurred (%x).\n", vha->host_no,
-                   mb[1]));
-               qla_printk(KERN_INFO, ha, "LIP occurred (%x).\n", mb[1]);
+               ql_log(ql_log_info, vha, 0x5009,
+                   "LIP occurred (%x).\n", mb[1]);
 
                if (atomic_read(&vha->loop_state) != LOOP_DOWN) {
                        atomic_set(&vha->loop_state, LOOP_DOWN);
@@ -488,10 +487,8 @@ skip_rio:
                        ha->link_data_rate = mb[1];
                }
 
-               DEBUG2(printk("scsi(%ld): Asynchronous LOOP UP (%s Gbps).\n",
-                   vha->host_no, link_speed));
-               qla_printk(KERN_INFO, ha, "LOOP UP detected (%s Gbps).\n",
-                   link_speed);
+               ql_log(ql_log_info, vha, 0x500a,
+                   "LOOP UP detected (%s Gbps).\n", link_speed);
 
                vha->flags.management_server_logged_in = 0;
                qla2x00_post_aen_work(vha, FCH_EVT_LINKUP, ha->link_data_rate);
@@ -500,12 +497,9 @@ skip_rio:
        case MBA_LOOP_DOWN:             /* Loop Down Event */
                mbx = IS_QLA81XX(ha) ? RD_REG_WORD(&reg24->mailbox4) : 0;
                mbx = IS_QLA82XX(ha) ? RD_REG_WORD(&reg82->mailbox_out[4]) : mbx;
-               DEBUG2(printk("scsi(%ld): Asynchronous LOOP DOWN "
-                   "(%x %x %x %x).\n", vha->host_no, mb[1], mb[2], mb[3],
-                   mbx));
-               qla_printk(KERN_INFO, ha,
-                   "LOOP DOWN detected (%x %x %x %x).\n", mb[1], mb[2], mb[3],
-                   mbx);
+               ql_log(ql_log_info, vha, 0x500b,
+                   "LOOP DOWN detected (%x %x %x %x).\n",
+                   mb[1], mb[2], mb[3], mbx);
 
                if (atomic_read(&vha->loop_state) != LOOP_DOWN) {
                        atomic_set(&vha->loop_state, LOOP_DOWN);
@@ -525,9 +519,7 @@ skip_rio:
                break;
 
        case MBA_LIP_RESET:             /* LIP reset occurred */
-               DEBUG2(printk("scsi(%ld): Asynchronous LIP RESET (%x).\n",
-                   vha->host_no, mb[1]));
-               qla_printk(KERN_INFO, ha,
+               ql_log(ql_log_info, vha, 0x500c,
                    "LIP reset occurred (%x).\n", mb[1]);
 
                if (atomic_read(&vha->loop_state) != LOOP_DOWN) {
@@ -554,14 +546,15 @@ skip_rio:
                        break;
 
                if (IS_QLA8XXX_TYPE(ha)) {
-                       DEBUG2(printk("scsi(%ld): DCBX Completed -- %04x %04x "
-                           "%04x\n", vha->host_no, mb[1], mb[2], mb[3]));
+                       ql_dbg(ql_dbg_async, vha, 0x500d,
+                           "DCBX Completed -- %04x %04x %04x.\n",
+                           mb[1], mb[2], mb[3]);
                        if (ha->notify_dcbx_comp)
                                complete(&ha->dcbx_comp);
 
                } else
-                       DEBUG2(printk("scsi(%ld): Asynchronous P2P MODE "
-                           "received.\n", vha->host_no));
+                       ql_dbg(ql_dbg_async, vha, 0x500e,
+                           "Asynchronous P2P MODE received.\n");
 
                /*
                 * Until there's a transition from loop down to loop up, treat
@@ -594,10 +587,7 @@ skip_rio:
                if (IS_QLA2100(ha))
                        break;
 
-               DEBUG2(printk("scsi(%ld): Asynchronous Change In Connection "
-                   "received.\n",
-                   vha->host_no));
-               qla_printk(KERN_INFO, ha,
+               ql_log(ql_log_info, vha, 0x500f,
                    "Configuration change detected: value=%x.\n", mb[1]);
 
                if (atomic_read(&vha->loop_state) != LOOP_DOWN) {
@@ -640,11 +630,9 @@ skip_rio:
 
                /* Global event -- port logout or port unavailable. */
                if (mb[1] == 0xffff && mb[2] == 0x7) {
-                       DEBUG2(printk("scsi(%ld): Asynchronous PORT UPDATE.\n",
-                           vha->host_no));
-                       DEBUG(printk(KERN_INFO
-                           "scsi(%ld): Port unavailable %04x %04x %04x.\n",
-                           vha->host_no, mb[1], mb[2], mb[3]));
+                       ql_dbg(ql_dbg_async, vha, 0x5010,
+                           "Port unavailable %04x %04x %04x.\n",
+                           mb[1], mb[2], mb[3]);
 
                        if (atomic_read(&vha->loop_state) != LOOP_DOWN) {
                                atomic_set(&vha->loop_state, LOOP_DOWN);
@@ -674,17 +662,15 @@ skip_rio:
                atomic_set(&vha->loop_down_timer, 0);
                if (atomic_read(&vha->loop_state) != LOOP_DOWN &&
                    atomic_read(&vha->loop_state) != LOOP_DEAD) {
-                       DEBUG2(printk("scsi(%ld): Asynchronous PORT UPDATE "
-                           "ignored %04x/%04x/%04x.\n", vha->host_no, mb[1],
-                           mb[2], mb[3]));
+                       ql_dbg(ql_dbg_async, vha, 0x5011,
+                           "Asynchronous PORT UPDATE ignored %04x/%04x/%04x.\n",
+                           mb[1], mb[2], mb[3]);
                        break;
                }
 
-               DEBUG2(printk("scsi(%ld): Asynchronous PORT UPDATE.\n",
-                   vha->host_no));
-               DEBUG(printk(KERN_INFO
-                   "scsi(%ld): Port database changed %04x %04x %04x.\n",
-                   vha->host_no, mb[1], mb[2], mb[3]));
+               ql_dbg(ql_dbg_async, vha, 0x5012,
+                   "Port database changed %04x %04x %04x.\n",
+                   mb[1], mb[2], mb[3]);
 
                /*
                 * Mark all devices as missing so we will login again.
@@ -707,20 +693,17 @@ skip_rio:
                if (ha->flags.npiv_supported && vha->vp_idx != (mb[3] & 0xff))
                        break;
 
-               DEBUG2(printk("scsi(%ld): Asynchronous RSCR UPDATE.\n",
-                   vha->host_no));
-               DEBUG(printk(KERN_INFO
-                   "scsi(%ld): RSCN database changed -- %04x %04x %04x.\n",
-                   vha->host_no, mb[1], mb[2], mb[3]));
+               ql_dbg(ql_dbg_async, vha, 0x5013,
+                   "RSCN database changed -- %04x %04x %04x.\n",
+                   mb[1], mb[2], mb[3]);
 
                rscn_entry = ((mb[1] & 0xff) << 16) | mb[2];
                host_pid = (vha->d_id.b.domain << 16) | (vha->d_id.b.area << 8)
                                | vha->d_id.b.al_pa;
                if (rscn_entry == host_pid) {
-                       DEBUG(printk(KERN_INFO
-                           "scsi(%ld): Ignoring RSCN update to local host "
-                           "port ID (%06x)\n",
-                           vha->host_no, host_pid));
+                       ql_dbg(ql_dbg_async, vha, 0x5014,
+                           "Ignoring RSCN update to local host "
+                           "port ID (%06x).\n", host_pid);
                        break;
                }
 
@@ -747,8 +730,8 @@ skip_rio:
 
        /* case MBA_RIO_RESPONSE: */
        case MBA_ZIO_RESPONSE:
-               DEBUG3(printk("scsi(%ld): [R|Z]IO update completion.\n",
-                   vha->host_no));
+               ql_dbg(ql_dbg_async, vha, 0x5015,
+                   "[R|Z]IO update completion.\n");
 
                if (IS_FWI2_CAPABLE(ha))
                        qla24xx_process_response_queue(vha, rsp);
@@ -757,61 +740,68 @@ skip_rio:
                break;
 
        case MBA_DISCARD_RND_FRAME:
-               DEBUG2(printk("scsi(%ld): Discard RND Frame -- %04x %04x "
-                   "%04x.\n", vha->host_no, mb[1], mb[2], mb[3]));
+               ql_dbg(ql_dbg_async, vha, 0x5016,
+                   "Discard RND Frame -- %04x %04x %04x.\n",
+                   mb[1], mb[2], mb[3]);
                break;
 
        case MBA_TRACE_NOTIFICATION:
-               DEBUG2(printk("scsi(%ld): Trace Notification -- %04x %04x.\n",
-               vha->host_no, mb[1], mb[2]));
+               ql_dbg(ql_dbg_async, vha, 0x5017,
+                   "Trace Notification -- %04x %04x.\n", mb[1], mb[2]);
                break;
 
        case MBA_ISP84XX_ALERT:
-               DEBUG2(printk("scsi(%ld): ISP84XX Alert Notification -- "
-                   "%04x %04x %04x\n", vha->host_no, mb[1], mb[2], mb[3]));
+               ql_dbg(ql_dbg_async, vha, 0x5018,
+                   "ISP84XX Alert Notification -- %04x %04x %04x.\n",
+                   mb[1], mb[2], mb[3]);
 
                spin_lock_irqsave(&ha->cs84xx->access_lock, flags);
                switch (mb[1]) {
                case A84_PANIC_RECOVERY:
-                       qla_printk(KERN_INFO, ha, "Alert 84XX: panic recovery "
-                           "%04x %04x\n", mb[2], mb[3]);
+                       ql_log(ql_log_info, vha, 0x5019,
+                           "Alert 84XX: panic recovery %04x %04x.\n",
+                           mb[2], mb[3]);
                        break;
                case A84_OP_LOGIN_COMPLETE:
                        ha->cs84xx->op_fw_version = mb[3] << 16 | mb[2];
-                       DEBUG2(qla_printk(KERN_INFO, ha, "Alert 84XX:"
-                           "firmware version %x\n", ha->cs84xx->op_fw_version));
+                       ql_log(ql_log_info, vha, 0x501a,
+                           "Alert 84XX: firmware version %x.\n",
+                           ha->cs84xx->op_fw_version);
                        break;
                case A84_DIAG_LOGIN_COMPLETE:
                        ha->cs84xx->diag_fw_version = mb[3] << 16 | mb[2];
-                       DEBUG2(qla_printk(KERN_INFO, ha, "Alert 84XX:"
-                           "diagnostic firmware version %x\n",
-                           ha->cs84xx->diag_fw_version));
+                       ql_log(ql_log_info, vha, 0x501b,
+                           "Alert 84XX: diagnostic firmware version %x.\n",
+                           ha->cs84xx->diag_fw_version);
                        break;
                case A84_GOLD_LOGIN_COMPLETE:
                        ha->cs84xx->diag_fw_version = mb[3] << 16 | mb[2];
                        ha->cs84xx->fw_update = 1;
-                       DEBUG2(qla_printk(KERN_INFO, ha, "Alert 84XX: gold "
-                           "firmware version %x\n",
-                           ha->cs84xx->gold_fw_version));
+                       ql_log(ql_log_info, vha, 0x501c,
+                           "Alert 84XX: gold firmware version %x.\n",
+                           ha->cs84xx->gold_fw_version);
                        break;
                default:
-                       qla_printk(KERN_ERR, ha,
-                           "Alert 84xx: Invalid Alert %04x %04x %04x\n",
+                       ql_log(ql_log_warn, vha, 0x501d,
+                           "Alert 84xx: Invalid Alert %04x %04x %04x.\n",
                            mb[1], mb[2], mb[3]);
                }
                spin_unlock_irqrestore(&ha->cs84xx->access_lock, flags);
                break;
        case MBA_DCBX_START:
-               DEBUG2(printk("scsi(%ld): DCBX Started -- %04x %04x %04x\n",
-                   vha->host_no, mb[1], mb[2], mb[3]));
+               ql_dbg(ql_dbg_async, vha, 0x501e,
+                   "DCBX Started -- %04x %04x %04x.\n",
+                   mb[1], mb[2], mb[3]);
                break;
        case MBA_DCBX_PARAM_UPDATE:
-               DEBUG2(printk("scsi(%ld): DCBX Parameters Updated -- "
-                   "%04x %04x %04x\n", vha->host_no, mb[1], mb[2], mb[3]));
+               ql_dbg(ql_dbg_async, vha, 0x501f,
+                   "DCBX Parameters Updated -- %04x %04x %04x.\n",
+                   mb[1], mb[2], mb[3]);
                break;
        case MBA_FCF_CONF_ERR:
-               DEBUG2(printk("scsi(%ld): FCF Configuration Error -- "
-                   "%04x %04x %04x\n", vha->host_no, mb[1], mb[2], mb[3]));
+               ql_dbg(ql_dbg_async, vha, 0x5020,
+                   "FCF Configuration Error -- %04x %04x %04x.\n",
+                   mb[1], mb[2], mb[3]);
                break;
        case MBA_IDC_COMPLETE:
        case MBA_IDC_NOTIFY:
@@ -838,10 +828,8 @@ qla2x00_process_completed_request(struct scsi_qla_host *vha,
 
        /* Validate handle. */
        if (index >= MAX_OUTSTANDING_COMMANDS) {
-               DEBUG2(printk("scsi(%ld): Invalid SCSI completion handle %d.\n",
-                   vha->host_no, index));
-               qla_printk(KERN_WARNING, ha,
-                   "Invalid SCSI completion handle %d.\n", index);
+               ql_log(ql_log_warn, vha, 0x3014,
+                   "Invalid SCSI command index (%x).\n", index);
 
                if (IS_QLA82XX(ha))
                        set_bit(FCOE_CTX_RESET_NEEDED, &vha->dpc_flags);
@@ -859,10 +847,7 @@ qla2x00_process_completed_request(struct scsi_qla_host *vha,
                sp->cmd->result = DID_OK << 16;
                qla2x00_sp_compl(ha, sp);
        } else {
-               DEBUG2(printk("scsi(%ld) Req:%d: Invalid ISP SCSI completion"
-                       " handle(0x%x)\n", vha->host_no, req->id, index));
-               qla_printk(KERN_WARNING, ha,
-                   "Invalid ISP SCSI completion handle\n");
+               ql_log(ql_log_warn, vha, 0x3016, "Invalid SCSI SRB.\n");
 
                if (IS_QLA82XX(ha))
                        set_bit(FCOE_CTX_RESET_NEEDED, &vha->dpc_flags);
@@ -882,8 +867,8 @@ qla2x00_get_sp_from_handle(scsi_qla_host_t *vha, const char *func,
 
        index = LSW(pkt->handle);
        if (index >= MAX_OUTSTANDING_COMMANDS) {
-               qla_printk(KERN_WARNING, ha,
-                   "%s: Invalid completion handle (%x).\n", func, index);
+               ql_log(ql_log_warn, vha, 0x5031,
+                   "Invalid command index (%x).\n", index);
                if (IS_QLA82XX(ha))
                        set_bit(FCOE_CTX_RESET_NEEDED, &vha->dpc_flags);
                else
@@ -892,15 +877,13 @@ qla2x00_get_sp_from_handle(scsi_qla_host_t *vha, const char *func,
        }
        sp = req->outstanding_cmds[index];
        if (!sp) {
-               qla_printk(KERN_WARNING, ha,
-                   "%s: Invalid completion handle (%x) -- timed-out.\n", func,
-                   index);
+               ql_log(ql_log_warn, vha, 0x5032,
+                   "Invalid completion handle (%x) -- timed-out.\n", index);
                return sp;
        }
        if (sp->handle != index) {
-               qla_printk(KERN_WARNING, ha,
-                   "%s: SRB handle (%x) mismatch %x.\n", func, sp->handle,
-                   index);
+               ql_log(ql_log_warn, vha, 0x5033,
+                   "SRB handle (%x) mismatch %x.\n", sp->handle, index);
                return NULL;
        }
 
@@ -937,17 +920,17 @@ qla2x00_mbx_iocb_entry(scsi_qla_host_t *vha, struct req_que *req,
        data[1] = lio->u.logio.flags & SRB_LOGIN_RETRIED ?
            QLA_LOGIO_LOGIN_RETRIED : 0;
        if (mbx->entry_status) {
-               DEBUG2(printk(KERN_WARNING
-                   "scsi(%ld:%x): Async-%s error entry - portid=%02x%02x%02x "
+               ql_dbg(ql_dbg_async, vha, 0x5043,
+                   "Async-%s error entry - portid=%02x%02x%02x "
                    "entry-status=%x status=%x state-flag=%x "
                    "status-flags=%x.\n",
-                   fcport->vha->host_no, sp->handle, type,
-                   fcport->d_id.b.domain, fcport->d_id.b.area,
+                   type, fcport->d_id.b.domain, fcport->d_id.b.area,
                    fcport->d_id.b.al_pa, mbx->entry_status,
                    le16_to_cpu(mbx->status), le16_to_cpu(mbx->state_flags),
-                   le16_to_cpu(mbx->status_flags)));
+                   le16_to_cpu(mbx->status_flags));
 
-               DEBUG2(qla2x00_dump_buffer((uint8_t *)mbx, sizeof(*mbx)));
+               ql_dump_buffer(ql_dbg_async + ql_dbg_buffer, vha, 0x5057,
+                   (uint8_t *)mbx, sizeof(*mbx));
 
                goto logio_done;
        }
@@ -957,12 +940,10 @@ qla2x00_mbx_iocb_entry(scsi_qla_host_t *vha, struct req_que *req,
            le16_to_cpu(mbx->mb0) == MBS_COMMAND_COMPLETE)
                status = 0;
        if (!status && le16_to_cpu(mbx->mb0) == MBS_COMMAND_COMPLETE) {
-               DEBUG2(printk(KERN_DEBUG
-                   "scsi(%ld:%x): Async-%s complete - portid=%02x%02x%02x "
-                   "mbx1=%x.\n",
-                   fcport->vha->host_no, sp->handle, type,
-                   fcport->d_id.b.domain, fcport->d_id.b.area,
-                   fcport->d_id.b.al_pa, le16_to_cpu(mbx->mb1)));
+               ql_dbg(ql_dbg_async, vha, 0x5045,
+                   "Async-%s complete - portid=%02x%02x%02x mbx1=%x.\n",
+                   type, fcport->d_id.b.domain, fcport->d_id.b.area,
+                   fcport->d_id.b.al_pa, le16_to_cpu(mbx->mb1));
 
                data[0] = MBS_COMMAND_COMPLETE;
                if (ctx->type == SRB_LOGIN_CMD) {
@@ -987,14 +968,14 @@ qla2x00_mbx_iocb_entry(scsi_qla_host_t *vha, struct req_que *req,
                break;
        }
 
-       DEBUG2(printk(KERN_WARNING
-           "scsi(%ld:%x): Async-%s failed - portid=%02x%02x%02x status=%x "
+       ql_log(ql_log_warn, vha, 0x5046,
+           "Async-%s failed - portid=%02x%02x%02x status=%x "
            "mb0=%x mb1=%x mb2=%x mb6=%x mb7=%x.\n",
-           fcport->vha->host_no, sp->handle, type, fcport->d_id.b.domain,
+           type, fcport->d_id.b.domain,
            fcport->d_id.b.area, fcport->d_id.b.al_pa, status,
            le16_to_cpu(mbx->mb0), le16_to_cpu(mbx->mb1),
            le16_to_cpu(mbx->mb2), le16_to_cpu(mbx->mb6),
-           le16_to_cpu(mbx->mb7)));
+           le16_to_cpu(mbx->mb7));
 
 logio_done:
        lio->done(sp);
@@ -1025,9 +1006,8 @@ qla2x00_ct_entry(scsi_qla_host_t *vha, struct req_que *req,
                type = "ct pass-through";
                break;
        default:
-               qla_printk(KERN_WARNING, ha,
-                   "%s: Unrecognized SRB: (%p) type=%d.\n", func, sp,
-                   sp_bsg->type);
+               ql_log(ql_log_warn, vha, 0x5047,
+                   "Unrecognized SRB: (%p) type=%d.\n", sp, sp_bsg->type);
                return;
        }
 
@@ -1045,20 +1025,20 @@ qla2x00_ct_entry(scsi_qla_host_t *vha, struct req_que *req,
                        bsg_job->reply->reply_payload_rcv_len =
                            le16_to_cpu(((sts_entry_t *)pkt)->rsp_info_len);
 
-                       DEBUG2(qla_printk(KERN_WARNING, ha,
-                           "scsi(%ld): CT pass-through-%s error "
+                       ql_log(ql_log_warn, vha, 0x5048,
+                           "CT pass-through-%s error "
                            "comp_status-status=0x%x total_byte = 0x%x.\n",
-                           vha->host_no, type, comp_status,
-                           bsg_job->reply->reply_payload_rcv_len));
+                           type, comp_status,
+                           bsg_job->reply->reply_payload_rcv_len);
                } else {
-                       DEBUG2(qla_printk(KERN_WARNING, ha,
-                           "scsi(%ld): CT pass-through-%s error "
-                           "comp_status-status=0x%x.\n",
-                           vha->host_no, type, comp_status));
+                       ql_log(ql_log_warn, vha, 0x5049,
+                           "CT pass-through-%s error "
+                           "comp_status-status=0x%x.\n", type, comp_status);
                        bsg_job->reply->result = DID_ERROR << 16;
                        bsg_job->reply->reply_payload_rcv_len = 0;
                }
-               DEBUG2(qla2x00_dump_buffer((uint8_t *)pkt, sizeof(*pkt)));
+               ql_dump_buffer(ql_dbg_async + ql_dbg_buffer, vha, 0x5058,
+                   (uint8_t *)pkt, sizeof(*pkt));
        } else {
                bsg_job->reply->result =  DID_OK << 16;
                bsg_job->reply->reply_payload_rcv_len =
@@ -1110,9 +1090,8 @@ qla24xx_els_ct_entry(scsi_qla_host_t *vha, struct req_que *req,
                type = "ct pass-through";
                break;
        default:
-               qla_printk(KERN_WARNING, ha,
-                   "%s: Unrecognized SRB: (%p) type=%d.\n", func, sp,
-                   sp_bsg->type);
+               ql_log(ql_log_warn, vha, 0x503e,
+                   "Unrecognized SRB: (%p) type=%d.\n", sp, sp_bsg->type);
                return;
        }
 
@@ -1132,27 +1111,31 @@ qla24xx_els_ct_entry(scsi_qla_host_t *vha, struct req_que *req,
                        bsg_job->reply->reply_payload_rcv_len =
                                le16_to_cpu(((struct els_sts_entry_24xx*)pkt)->total_byte_count);
 
-                       DEBUG2(qla_printk(KERN_WARNING, ha,
-                           "scsi(%ld:0x%x): ELS-CT pass-through-%s error comp_status-status=0x%x "
+                       ql_log(ql_log_info, vha, 0x503f,
+                           "ELS-CT pass-through-%s error comp_status-status=0x%x "
                            "error subcode 1=0x%x error subcode 2=0x%x total_byte = 0x%x.\n",
-                               vha->host_no, sp->handle, type, comp_status, fw_status[1], fw_status[2],
-                               le16_to_cpu(((struct els_sts_entry_24xx*)pkt)->total_byte_count)));
+                           type, comp_status, fw_status[1], fw_status[2],
+                           le16_to_cpu(((struct els_sts_entry_24xx *)
+                               pkt)->total_byte_count));
                        fw_sts_ptr = ((uint8_t*)bsg_job->req->sense) + sizeof(struct fc_bsg_reply);
                        memcpy( fw_sts_ptr, fw_status, sizeof(fw_status));
                }
                else {
-                       DEBUG2(qla_printk(KERN_WARNING, ha,
-                           "scsi(%ld:0x%x): ELS-CT pass-through-%s error comp_status-status=0x%x "
+                       ql_log(ql_log_info, vha, 0x5040,
+                           "ELS-CT pass-through-%s error comp_status-status=0x%x "
                            "error subcode 1=0x%x error subcode 2=0x%x.\n",
-                               vha->host_no, sp->handle, type, comp_status,
-                               le16_to_cpu(((struct els_sts_entry_24xx*)pkt)->error_subcode_1),
-                               le16_to_cpu(((struct els_sts_entry_24xx*)pkt)->error_subcode_2)));
+                           type, comp_status,
+                           le16_to_cpu(((struct els_sts_entry_24xx *)
+                               pkt)->error_subcode_1),
+                           le16_to_cpu(((struct els_sts_entry_24xx *)
+                                   pkt)->error_subcode_2));
                        bsg_job->reply->result = DID_ERROR << 16;
                        bsg_job->reply->reply_payload_rcv_len = 0;
                        fw_sts_ptr = ((uint8_t*)bsg_job->req->sense) + sizeof(struct fc_bsg_reply);
                        memcpy( fw_sts_ptr, fw_status, sizeof(fw_status));
                }
-               DEBUG2(qla2x00_dump_buffer((uint8_t *)pkt, sizeof(*pkt)));
+               ql_dump_buffer(ql_dbg_async + ql_dbg_buffer, vha, 0x5056,
+                               (uint8_t *)pkt, sizeof(*pkt));
        }
        else {
                bsg_job->reply->result =  DID_OK << 16;
@@ -1201,25 +1184,24 @@ qla24xx_logio_entry(scsi_qla_host_t *vha, struct req_que *req,
        data[1] = lio->u.logio.flags & SRB_LOGIN_RETRIED ?
                QLA_LOGIO_LOGIN_RETRIED : 0;
        if (logio->entry_status) {
-               DEBUG2(printk(KERN_WARNING
-                   "scsi(%ld:%x): Async-%s error entry - "
+               ql_log(ql_log_warn, vha, 0x5034,
+                   "Async-%s error entry - "
                    "portid=%02x%02x%02x entry-status=%x.\n",
-                   fcport->vha->host_no, sp->handle, type,
-                   fcport->d_id.b.domain, fcport->d_id.b.area,
-                   fcport->d_id.b.al_pa, logio->entry_status));
-               DEBUG2(qla2x00_dump_buffer((uint8_t *)logio, sizeof(*logio)));
+                   type, fcport->d_id.b.domain, fcport->d_id.b.area,
+                   fcport->d_id.b.al_pa, logio->entry_status);
+               ql_dump_buffer(ql_dbg_async + ql_dbg_buffer, vha, 0x5059,
+                   (uint8_t *)logio, sizeof(*logio));
 
                goto logio_done;
        }
 
        if (le16_to_cpu(logio->comp_status) == CS_COMPLETE) {
-               DEBUG2(printk(KERN_DEBUG
-                   "scsi(%ld:%x): Async-%s complete - portid=%02x%02x%02x "
+               ql_dbg(ql_dbg_async, vha, 0x5036,
+                   "Async-%s complete - portid=%02x%02x%02x "
                    "iop0=%x.\n",
-                   fcport->vha->host_no, sp->handle, type,
-                   fcport->d_id.b.domain, fcport->d_id.b.area,
+                   type, fcport->d_id.b.domain, fcport->d_id.b.area,
                    fcport->d_id.b.al_pa,
-                   le32_to_cpu(logio->io_parameter[0])));
+                   le32_to_cpu(logio->io_parameter[0]));
 
                data[0] = MBS_COMMAND_COMPLETE;
                if (ctx->type != SRB_LOGIN_CMD)
@@ -1256,14 +1238,14 @@ qla24xx_logio_entry(scsi_qla_host_t *vha, struct req_que *req,
                break;
        }
 
-       DEBUG2(printk(KERN_WARNING
-           "scsi(%ld:%x): Async-%s failed - portid=%02x%02x%02x comp=%x "
+       ql_dbg(ql_dbg_async, vha, 0x5037,
+           "Async-%s failed - portid=%02x%02x%02x comp=%x "
            "iop0=%x iop1=%x.\n",
-           fcport->vha->host_no, sp->handle, type, fcport->d_id.b.domain,
+           type, fcport->d_id.b.domain,
            fcport->d_id.b.area, fcport->d_id.b.al_pa,
            le16_to_cpu(logio->comp_status),
            le32_to_cpu(logio->io_parameter[0]),
-           le32_to_cpu(logio->io_parameter[1])));
+           le32_to_cpu(logio->io_parameter[1]));
 
 logio_done:
        lio->done(sp);
@@ -1292,38 +1274,34 @@ qla24xx_tm_iocb_entry(scsi_qla_host_t *vha, struct req_que *req,
        fcport = sp->fcport;
 
        if (sts->entry_status) {
-               DEBUG2(printk(KERN_WARNING
-                   "scsi(%ld:%x): Async-%s error - entry-status(%x).\n",
-                   fcport->vha->host_no, sp->handle, type,
-                   sts->entry_status));
+               ql_log(ql_log_warn, vha, 0x5038,
+                   "Async-%s error - entry-status(%x).\n",
+                   type, sts->entry_status);
        } else if (sts->comp_status != __constant_cpu_to_le16(CS_COMPLETE)) {
-               DEBUG2(printk(KERN_WARNING
-                   "scsi(%ld:%x): Async-%s error - completion status(%x).\n",
-                   fcport->vha->host_no, sp->handle, type,
-                   sts->comp_status));
+               ql_log(ql_log_warn, vha, 0x5039,
+                   "Async-%s error - completion status(%x).\n",
+                   type, sts->comp_status);
        } else if (!(le16_to_cpu(sts->scsi_status) &
            SS_RESPONSE_INFO_LEN_VALID)) {
-               DEBUG2(printk(KERN_WARNING
-                   "scsi(%ld:%x): Async-%s error - no response info(%x).\n",
-                   fcport->vha->host_no, sp->handle, type,
-                   sts->scsi_status));
+               ql_log(ql_log_warn, vha, 0x503a,
+                   "Async-%s error - no response info(%x).\n",
+                   type, sts->scsi_status);
        } else if (le32_to_cpu(sts->rsp_data_len) < 4) {
-               DEBUG2(printk(KERN_WARNING
-                   "scsi(%ld:%x): Async-%s error - not enough response(%d).\n",
-                   fcport->vha->host_no, sp->handle, type,
-                   sts->rsp_data_len));
+               ql_log(ql_log_warn, vha, 0x503b,
+                   "Async-%s error - not enough response(%d).\n",
+                   type, sts->rsp_data_len);
        } else if (sts->data[3]) {
-               DEBUG2(printk(KERN_WARNING
-                   "scsi(%ld:%x): Async-%s error - response(%x).\n",
-                   fcport->vha->host_no, sp->handle, type,
-                   sts->data[3]));
+               ql_log(ql_log_warn, vha, 0x503c,
+                   "Async-%s error - response(%x).\n",
+                   type, sts->data[3]);
        } else {
                error = 0;
        }
 
        if (error) {
                iocb->u.tmf.data = error;
-               DEBUG2(qla2x00_dump_buffer((uint8_t *)sts, sizeof(*sts)));
+               ql_dump_buffer(ql_dbg_async + ql_dbg_buffer, vha, 0x5055,
+                   (uint8_t *)sts, sizeof(*sts));
        }
 
        iocb->done(sp);
@@ -1360,8 +1338,8 @@ qla2x00_process_response_queue(struct rsp_que *rsp)
                }
 
                if (pkt->entry_status != 0) {
-                       DEBUG3(printk(KERN_INFO
-                           "scsi(%ld): Process error entry.\n", vha->host_no));
+                       ql_log(ql_log_warn, vha, 0x5035,
+                           "Process error entry.\n");
 
                        qla2x00_error_entry(vha, rsp, pkt);
                        ((response_t *)pkt)->signature = RESPONSE_PROCESSED;
@@ -1399,10 +1377,10 @@ qla2x00_process_response_queue(struct rsp_que *rsp)
                        break;
                default:
                        /* Type Not Supported. */
-                       DEBUG4(printk(KERN_WARNING
-                           "scsi(%ld): Received unknown response pkt type %x "
+                       ql_log(ql_log_warn, vha, 0x504a,
+                           "Received unknown response pkt type %x "
                            "entry status=%x.\n",
-                           vha->host_no, pkt->entry_type, pkt->entry_status));
+                           pkt->entry_type, pkt->entry_status);
                        break;
                }
                ((response_t *)pkt)->signature = RESPONSE_PROCESSED;
@@ -1418,6 +1396,7 @@ static inline void
 qla2x00_handle_sense(srb_t *sp, uint8_t *sense_data, uint32_t par_sense_len,
     uint32_t sense_len, struct rsp_que *rsp)
 {
+       struct scsi_qla_host *vha = sp->fcport->vha;
        struct scsi_cmnd *cp = sp->cmd;
 
        if (sense_len >= SCSI_SENSE_BUFFERSIZE)
@@ -1435,11 +1414,13 @@ qla2x00_handle_sense(srb_t *sp, uint8_t *sense_data, uint32_t par_sense_len,
        if (sp->request_sense_length != 0)
                rsp->status_srb = sp;
 
-       DEBUG5(printk("%s(): Check condition Sense data, scsi(%ld:%d:%d:%d) "
-           "cmd=%p\n", __func__, sp->fcport->vha->host_no,
-           cp->device->channel, cp->device->id, cp->device->lun, cp));
+       ql_dbg(ql_dbg_io, vha, 0x301c,
+           "Check condition Sense data, scsi(%ld:%d:%d:%d) cmd=%p.\n",
+           sp->fcport->vha->host_no, cp->device->channel, cp->device->id,
+           cp->device->lun, cp);
        if (sense_len)
-               DEBUG5(qla2x00_dump_buffer(cp->sense_buffer, sense_len));
+               ql_dump_buffer(ql_dbg_io + ql_dbg_buffer, vha, 0x302b,
+                   cp->sense_buffer, sense_len);
 }
 
 struct scsi_dif_tuple {
@@ -1457,6 +1438,7 @@ struct scsi_dif_tuple {
 static inline void
 qla2x00_handle_dif_error(srb_t *sp, struct sts_entry_24xx *sts24)
 {
+       struct scsi_qla_host *vha = sp->fcport->vha;
        struct scsi_cmnd *cmd = sp->cmd;
        struct scsi_dif_tuple   *ep =
                        (struct scsi_dif_tuple *)&sts24->data[20];
@@ -1473,15 +1455,15 @@ qla2x00_handle_dif_error(srb_t *sp, struct sts_entry_24xx *sts24)
        e_guard = be16_to_cpu(ep->guard);
        a_guard = be16_to_cpu(ap->guard);
 
-       DEBUG18(printk(KERN_DEBUG
-           "%s(): iocb(s) %p Returned STATUS\n", __func__, sts24));
+       ql_dbg(ql_dbg_io, vha, 0x3023,
+           "iocb(s) %p Returned STATUS.\n", sts24);
 
-       DEBUG18(printk(KERN_ERR "DIF ERROR in cmd 0x%x lba 0x%llx act ref"
+       ql_dbg(ql_dbg_io, vha, 0x3024,
+           "DIF ERROR in cmd 0x%x lba 0x%llx act ref"
            " tag=0x%x, exp ref_tag=0x%x, act app tag=0x%x, exp app"
-           " tag=0x%x, act guard=0x%x, exp guard=0x%x\n",
+           " tag=0x%x, act guard=0x%x, exp guard=0x%x.\n",
            cmd->cmnd[0], (u64)scsi_get_lba(cmd), a_ref_tag, e_ref_tag,
-           a_app_tag, e_app_tag, a_guard, e_guard));
-
+           a_app_tag, e_app_tag, a_guard, e_guard);
 
        /* check guard */
        if (e_guard != a_guard) {
@@ -1569,9 +1551,8 @@ qla2x00_status_entry(scsi_qla_host_t *vha, struct rsp_que *rsp, void *pkt)
                sp = NULL;
 
        if (sp == NULL) {
-               qla_printk(KERN_WARNING, ha,
-                   "scsi(%ld): Invalid status handle (0x%x).\n", vha->host_no,
-                   sts->handle);
+               ql_log(ql_log_warn, vha, 0x3017,
+                   "Invalid status handle (0x%x).\n", sts->handle);
 
                if (IS_QLA82XX(ha))
                        set_bit(FCOE_CTX_RESET_NEEDED, &vha->dpc_flags);
@@ -1582,9 +1563,9 @@ qla2x00_status_entry(scsi_qla_host_t *vha, struct rsp_que *rsp, void *pkt)
        }
        cp = sp->cmd;
        if (cp == NULL) {
-               qla_printk(KERN_WARNING, ha,
-                   "scsi(%ld): Command already returned (0x%x/%p).\n",
-                   vha->host_no, sts->handle, sp);
+               ql_log(ql_log_warn, vha, 0x3018,
+                   "Command already returned (0x%x/%p).\n",
+                   sts->handle, sp);
 
                return;
        }
@@ -1629,10 +1610,9 @@ qla2x00_status_entry(scsi_qla_host_t *vha, struct rsp_que *rsp, void *pkt)
                        par_sense_len -= rsp_info_len;
                }
                if (rsp_info_len > 3 && rsp_info[3]) {
-                       DEBUG2(qla_printk(KERN_INFO, ha,
-                           "scsi(%ld:%d:%d): FCP I/O protocol failure "
-                           "(0x%x/0x%x).\n", vha->host_no, cp->device->id,
-                           cp->device->lun, rsp_info_len, rsp_info[3]));
+                       ql_log(ql_log_warn, vha, 0x3019,
+                           "FCP I/O protocol failure (0x%x/0x%x).\n",
+                           rsp_info_len, rsp_info[3]);
 
                        cp->result = DID_BUS_BUSY << 16;
                        goto out;
@@ -1661,11 +1641,10 @@ qla2x00_status_entry(scsi_qla_host_t *vha, struct rsp_que *rsp, void *pkt)
                        if (!lscsi_status &&
                            ((unsigned)(scsi_bufflen(cp) - resid) <
                             cp->underflow)) {
-                               qla_printk(KERN_INFO, ha,
-                                   "scsi(%ld:%d:%d): Mid-layer underflow "
+                               ql_log(ql_log_warn, vha, 0x301a,
+                                   "Mid-layer underflow "
                                    "detected (0x%x of 0x%x bytes).\n",
-                                   vha->host_no, cp->device->id,
-                                   cp->device->lun, resid, scsi_bufflen(cp));
+                                   resid, scsi_bufflen(cp));
 
                                cp->result = DID_ERROR << 16;
                                break;
@@ -1674,9 +1653,8 @@ qla2x00_status_entry(scsi_qla_host_t *vha, struct rsp_que *rsp, void *pkt)
                cp->result = DID_OK << 16 | lscsi_status;
 
                if (lscsi_status == SAM_STAT_TASK_SET_FULL) {
-                       DEBUG2(qla_printk(KERN_INFO, ha,
-                           "scsi(%ld:%d:%d) QUEUE FULL detected.\n",
-                           vha->host_no, cp->device->id, cp->device->lun));
+                       ql_log(ql_log_warn, vha, 0x301b,
+                           "QUEUE FULL detected.\n");
                        break;
                }
                logit = 0;
@@ -1697,11 +1675,10 @@ qla2x00_status_entry(scsi_qla_host_t *vha, struct rsp_que *rsp, void *pkt)
                scsi_set_resid(cp, resid);
                if (scsi_status & SS_RESIDUAL_UNDER) {
                        if (IS_FWI2_CAPABLE(ha) && fw_resid_len != resid_len) {
-                               DEBUG2(qla_printk(KERN_INFO, ha,
-                                   "scsi(%ld:%d:%d) Dropped frame(s) detected "
-                                   "(0x%x of 0x%x bytes).\n", vha->host_no,
-                                   cp->device->id, cp->device->lun, resid,
-                                   scsi_bufflen(cp)));
+                               ql_log(ql_log_warn, vha, 0x301d,
+                                   "Dropped frame(s) detected "
+                                   "(0x%x of 0x%x bytes).\n",
+                                   resid, scsi_bufflen(cp));
 
                                cp->result = DID_ERROR << 16 | lscsi_status;
                                break;
@@ -1710,20 +1687,18 @@ qla2x00_status_entry(scsi_qla_host_t *vha, struct rsp_que *rsp, void *pkt)
                        if (!lscsi_status &&
                            ((unsigned)(scsi_bufflen(cp) - resid) <
                            cp->underflow)) {
-                               qla_printk(KERN_INFO, ha,
-                                   "scsi(%ld:%d:%d): Mid-layer underflow "
+                               ql_log(ql_log_warn, vha, 0x301e,
+                                   "Mid-layer underflow "
                                    "detected (0x%x of 0x%x bytes).\n",
-                                   vha->host_no, cp->device->id,
-                                   cp->device->lun, resid, scsi_bufflen(cp));
+                                   resid, scsi_bufflen(cp));
 
                                cp->result = DID_ERROR << 16;
                                break;
                        }
                } else {
-                       DEBUG2(qla_printk(KERN_INFO, ha,
-                           "scsi(%ld:%d:%d) Dropped frame(s) detected (0x%x "
-                           "of 0x%x bytes).\n", vha->host_no, cp->device->id,
-                           cp->device->lun, resid, scsi_bufflen(cp)));
+                       ql_log(ql_log_warn, vha, 0x301f,
+                           "Dropped frame(s) detected (0x%x "
+                           "of 0x%x bytes).\n", resid, scsi_bufflen(cp));
 
                        cp->result = DID_ERROR << 16 | lscsi_status;
                        goto check_scsi_status;
@@ -1739,10 +1714,8 @@ check_scsi_status:
                 */
                if (lscsi_status != 0) {
                        if (lscsi_status == SAM_STAT_TASK_SET_FULL) {
-                               DEBUG2(qla_printk(KERN_INFO, ha,
-                                   "scsi(%ld:%d:%d) QUEUE FULL detected.\n",
-                                   vha->host_no, cp->device->id,
-                                   cp->device->lun));
+                               ql_log(ql_log_warn, vha, 0x3020,
+                                   "QUEUE FULL detected.\n");
                                logit = 1;
                                break;
                        }
@@ -1781,10 +1754,9 @@ check_scsi_status:
                                break;
                }
 
-               DEBUG2(qla_printk(KERN_INFO, ha,
-                       "scsi(%ld:%d:%d) Port down status: port-state=0x%x\n",
-                       vha->host_no, cp->device->id, cp->device->lun,
-                       atomic_read(&fcport->state)));
+               ql_dbg(ql_dbg_io, vha, 0x3021,
+                   "Port down status: port-state=0x%x.\n",
+                   atomic_read(&fcport->state));
 
                if (atomic_read(&fcport->state) == FCS_ONLINE)
                        qla2x00_mark_device_lost(fcport->vha, fcport, 1, 1);
@@ -1804,15 +1776,13 @@ check_scsi_status:
 
 out:
        if (logit)
-               DEBUG2(qla_printk(KERN_INFO, ha,
-                   "scsi(%ld:%d:%d) FCP command status: 0x%x-0x%x (0x%x) "
-                   "portid=%02x%02x%02x oxid=0x%x cdb=%02x%02x%02x len=0x%x "
-                   "rsp_info=0x%x resid=0x%x fw_resid=0x%x\n", vha->host_no,
-                   cp->device->id, cp->device->lun, comp_status, scsi_status,
-                   cp->result, fcport->d_id.b.domain, fcport->d_id.b.area,
-                   fcport->d_id.b.al_pa, ox_id, cp->cmnd[0], cp->cmnd[1],
-                   cp->cmnd[2], scsi_bufflen(cp), rsp_info_len, resid_len,
-                   fw_resid_len));
+               ql_dbg(ql_dbg_io, vha, 0x3022,
+                   "FCP command status: 0x%x-0x%x (0x%x) "
+                   "oxid=0x%x cdb=%02x%02x%02x len=0x%x "
+                   "rsp_info=0x%x resid=0x%x fw_resid=0x%x.\n",
+                   comp_status, scsi_status, cp->result, ox_id, cp->cmnd[0],
+                   cp->cmnd[1], cp->cmnd[2], scsi_bufflen(cp), rsp_info_len,
+                   resid_len, fw_resid_len);
 
        if (rsp->status_srb == NULL)
                qla2x00_sp_compl(ha, sp);
@@ -1830,16 +1800,15 @@ qla2x00_status_cont_entry(struct rsp_que *rsp, sts_cont_entry_t *pkt)
 {
        uint8_t         sense_sz = 0;
        struct qla_hw_data *ha = rsp->hw;
+       struct scsi_qla_host *vha = pci_get_drvdata(ha->pdev);
        srb_t           *sp = rsp->status_srb;
        struct scsi_cmnd *cp;
 
        if (sp != NULL && sp->request_sense_length != 0) {
                cp = sp->cmd;
                if (cp == NULL) {
-                       DEBUG2(printk("%s(): Cmd already returned back to OS "
-                           "sp=%p.\n", __func__, sp));
-                       qla_printk(KERN_INFO, ha,
-                           "cmd is NULL: already returned to OS (sp=%p)\n",
+                       ql_log(ql_log_warn, vha, 0x3025,
+                           "cmd is NULL: already returned to OS (sp=%p).\n",
                            sp);
 
                        rsp->status_srb = NULL;
@@ -1856,7 +1825,8 @@ qla2x00_status_cont_entry(struct rsp_que *rsp, sts_cont_entry_t *pkt)
                if (IS_FWI2_CAPABLE(ha))
                        host_to_fcp_swap(pkt->data, sizeof(pkt->data));
                memcpy(sp->request_sense_ptr, pkt->data, sense_sz);
-               DEBUG5(qla2x00_dump_buffer(sp->request_sense_ptr, sense_sz));
+               ql_dump_buffer(ql_dbg_io + ql_dbg_buffer, vha, 0x302c,
+                       sp->request_sense_ptr, sense_sz);
 
                sp->request_sense_ptr += sense_sz;
                sp->request_sense_length -= sense_sz;
@@ -1882,21 +1852,25 @@ qla2x00_error_entry(scsi_qla_host_t *vha, struct rsp_que *rsp, sts_entry_t *pkt)
        uint32_t handle = LSW(pkt->handle);
        uint16_t que = MSW(pkt->handle);
        struct req_que *req = ha->req_q_map[que];
-#if defined(QL_DEBUG_LEVEL_2)
+
        if (pkt->entry_status & RF_INV_E_ORDER)
-               qla_printk(KERN_ERR, ha, "%s: Invalid Entry Order\n", __func__);
+               ql_dbg(ql_dbg_async, vha, 0x502a,
+                   "Invalid Entry Order.\n");
        else if (pkt->entry_status & RF_INV_E_COUNT)
-               qla_printk(KERN_ERR, ha, "%s: Invalid Entry Count\n", __func__);
+               ql_dbg(ql_dbg_async, vha, 0x502b,
+                   "Invalid Entry Count.\n");
        else if (pkt->entry_status & RF_INV_E_PARAM)
-               qla_printk(KERN_ERR, ha,
-                   "%s: Invalid Entry Parameter\n", __func__);
+               ql_dbg(ql_dbg_async, vha, 0x502c,
+                   "Invalid Entry Parameter.\n");
        else if (pkt->entry_status & RF_INV_E_TYPE)
-               qla_printk(KERN_ERR, ha, "%s: Invalid Entry Type\n", __func__);
+               ql_dbg(ql_dbg_async, vha, 0x502d,
+                   "Invalid Entry Type.\n");
        else if (pkt->entry_status & RF_BUSY)
-               qla_printk(KERN_ERR, ha, "%s: Busy\n", __func__);
+               ql_dbg(ql_dbg_async, vha, 0x502e,
+                   "Busy.\n");
        else
-               qla_printk(KERN_ERR, ha, "%s: UNKNOWN flag error\n", __func__);
-#endif
+               ql_dbg(ql_dbg_async, vha, 0x502f,
+                   "UNKNOWN flag error.\n");
 
        /* Validate handle. */
        if (handle < MAX_OUTSTANDING_COMMANDS)
@@ -1923,10 +1897,8 @@ qla2x00_error_entry(scsi_qla_host_t *vha, struct rsp_que *rsp, sts_entry_t *pkt)
        } else if (pkt->entry_type == COMMAND_A64_TYPE || pkt->entry_type ==
                COMMAND_TYPE || pkt->entry_type == COMMAND_TYPE_7
                || pkt->entry_type == COMMAND_TYPE_6) {
-               DEBUG2(printk("scsi(%ld): Error entry - invalid handle\n",
-                       vha->host_no));
-               qla_printk(KERN_WARNING, ha,
-                       "Error entry - invalid handle\n");
+               ql_log(ql_log_warn, vha, 0x5030,
+                   "Error entry - invalid handle.\n");
 
                if (IS_QLA82XX(ha))
                        set_bit(FCOE_CTX_RESET_NEEDED, &vha->dpc_flags);
@@ -1960,11 +1932,11 @@ qla24xx_mbx_completion(scsi_qla_host_t *vha, uint16_t mb0)
        }
 
        if (ha->mcp) {
-               DEBUG3(printk("%s(%ld): Got mailbox completion. cmd=%x.\n",
-                   __func__, vha->host_no, ha->mcp->mb[0]));
+               ql_dbg(ql_dbg_async, vha, 0x504d,
+                   "Got mailbox completion. cmd=%x.\n", ha->mcp->mb[0]);
        } else {
-               DEBUG2_3(printk("%s(%ld): MBX pointer ERROR!\n",
-                   __func__, vha->host_no));
+               ql_dbg(ql_dbg_async, vha, 0x504e,
+                   "MBX pointer ERROR.\n");
        }
 }
 
@@ -1993,8 +1965,8 @@ void qla24xx_process_response_queue(struct scsi_qla_host *vha,
                }
 
                if (pkt->entry_status != 0) {
-                       DEBUG3(printk(KERN_INFO
-                           "scsi(%ld): Process error entry.\n", vha->host_no));
+                       ql_dbg(ql_dbg_async, vha, 0x5029,
+                           "Process error entry.\n");
 
                        qla2x00_error_entry(vha, rsp, (sts_entry_t *) pkt);
                        ((response_t *)pkt)->signature = RESPONSE_PROCESSED;
@@ -2030,10 +2002,10 @@ void qla24xx_process_response_queue(struct scsi_qla_host *vha,
                        break;
                default:
                        /* Type Not Supported. */
-                       DEBUG4(printk(KERN_WARNING
-                           "scsi(%ld): Received unknown response pkt type %x "
+                       ql_dbg(ql_dbg_async, vha, 0x5042,
+                           "Received unknown response pkt type %x "
                            "entry status=%x.\n",
-                           vha->host_no, pkt->entry_type, pkt->entry_status));
+                           pkt->entry_type, pkt->entry_status);
                        break;
                }
                ((response_t *)pkt)->signature = RESPONSE_PROCESSED;
@@ -2088,7 +2060,8 @@ qla2xxx_check_risc_status(scsi_qla_host_t *vha)
 
 next_test:
        if (RD_REG_DWORD(&reg->iobase_c8) & BIT_3)
-               qla_printk(KERN_INFO, ha, "Additional code -- 0x55AA.\n");
+               ql_log(ql_log_info, vha, 0x504c,
+                   "Additional code -- 0x55AA.\n");
 
 done:
        WRT_REG_DWORD(&reg->iobase_window, 0x0000);
@@ -2121,7 +2094,7 @@ qla24xx_intr_handler(int irq, void *dev_id)
        rsp = (struct rsp_que *) dev_id;
        if (!rsp) {
                printk(KERN_INFO
-                   "%s(): NULL response queue pointer\n", __func__);
+                   "%s(): NULL response queue pointer.\n", __func__);
                return IRQ_NONE;
        }
 
@@ -2142,8 +2115,9 @@ qla24xx_intr_handler(int irq, void *dev_id)
 
                        hccr = RD_REG_DWORD(&reg->hccr);
 
-                       qla_printk(KERN_INFO, ha, "RISC paused -- HCCR=%x, "
-                           "Dumping firmware!\n", hccr);
+                       ql_log(ql_log_warn, vha, 0x504b,
+                           "RISC paused -- HCCR=%x, Dumping firmware.\n",
+                           hccr);
 
                        qla2xxx_check_risc_status(vha);
 
@@ -2174,9 +2148,8 @@ qla24xx_intr_handler(int irq, void *dev_id)
                        qla24xx_process_response_queue(vha, rsp);
                        break;
                default:
-                       DEBUG2(printk("scsi(%ld): Unrecognized interrupt type "
-                           "(%d).\n",
-                           vha->host_no, stat & 0xff));
+                       ql_dbg(ql_dbg_async, vha, 0x504f,
+                           "Unrecognized interrupt type (%d).\n", stat * 0xff);
                        break;
                }
                WRT_REG_DWORD(&reg->hccr, HCCRX_CLR_RISC_INT);
@@ -2205,7 +2178,7 @@ qla24xx_msix_rsp_q(int irq, void *dev_id)
        rsp = (struct rsp_que *) dev_id;
        if (!rsp) {
                printk(KERN_INFO
-               "%s(): NULL response queue pointer\n", __func__);
+               "%s(): NULL response queue pointer.\n", __func__);
                return IRQ_NONE;
        }
        ha = rsp->hw;
@@ -2235,7 +2208,7 @@ qla25xx_msix_rsp_q(int irq, void *dev_id)
        rsp = (struct rsp_que *) dev_id;
        if (!rsp) {
                printk(KERN_INFO
-                       "%s(): NULL response queue pointer\n", __func__);
+                       "%s(): NULL response queue pointer.\n", __func__);
                return IRQ_NONE;
        }
        ha = rsp->hw;
@@ -2268,8 +2241,8 @@ qla24xx_msix_default(int irq, void *dev_id)
 
        rsp = (struct rsp_que *) dev_id;
        if (!rsp) {
-               DEBUG(printk(
-               "%s(): NULL response queue pointer\n", __func__));
+               printk(KERN_INFO
+                       "%s(): NULL response queue pointer.\n", __func__);
                return IRQ_NONE;
        }
        ha = rsp->hw;
@@ -2286,8 +2259,9 @@ qla24xx_msix_default(int irq, void *dev_id)
 
                        hccr = RD_REG_DWORD(&reg->hccr);
 
-                       qla_printk(KERN_INFO, ha, "RISC paused -- HCCR=%x, "
-                           "Dumping firmware!\n", hccr);
+                       ql_log(ql_log_info, vha, 0x5050,
+                           "RISC paused -- HCCR=%x, Dumping firmware.\n",
+                           hccr);
 
                        qla2xxx_check_risc_status(vha);
 
@@ -2318,9 +2292,8 @@ qla24xx_msix_default(int irq, void *dev_id)
                        qla24xx_process_response_queue(vha, rsp);
                        break;
                default:
-                       DEBUG2(printk("scsi(%ld): Unrecognized interrupt type "
-                           "(%d).\n",
-                           vha->host_no, stat & 0xff));
+                       ql_dbg(ql_dbg_async, vha, 0x5051,
+                           "Unrecognized interrupt type (%d).\n", stat & 0xff);
                        break;
                }
                WRT_REG_DWORD(&reg->hccr, HCCRX_CLR_RISC_INT);
@@ -2358,6 +2331,7 @@ qla24xx_disable_msix(struct qla_hw_data *ha)
 {
        int i;
        struct qla_msix_entry *qentry;
+       scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev);
 
        for (i = 0; i < ha->msix_count; i++) {
                qentry = &ha->msix_entries[i];
@@ -2368,6 +2342,8 @@ qla24xx_disable_msix(struct qla_hw_data *ha)
        kfree(ha->msix_entries);
        ha->msix_entries = NULL;
        ha->flags.msix_enabled = 0;
+       ql_dbg(ql_dbg_init, vha, 0x0042,
+           "Disabled the MSI.\n");
 }
 
 static int
@@ -2377,11 +2353,15 @@ qla24xx_enable_msix(struct qla_hw_data *ha, struct rsp_que *rsp)
        int i, ret;
        struct msix_entry *entries;
        struct qla_msix_entry *qentry;
+       scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev);
 
        entries = kzalloc(sizeof(struct msix_entry) * ha->msix_count,
                        GFP_KERNEL);
-       if (!entries)
+       if (!entries) {
+               ql_log(ql_log_warn, vha, 0x00bc,
+                   "Failed to allocate memory for msix_entry.\n");
                return -ENOMEM;
+       }
 
        for (i = 0; i < ha->msix_count; i++)
                entries[i].entry = i;
@@ -2391,16 +2371,18 @@ qla24xx_enable_msix(struct qla_hw_data *ha, struct rsp_que *rsp)
                if (ret < MIN_MSIX_COUNT)
                        goto msix_failed;
 
-               qla_printk(KERN_WARNING, ha,
-                       "MSI-X: Failed to enable support -- %d/%d\n"
-                       " Retry with %d vectors\n", ha->msix_count, ret, ret);
+               ql_log(ql_log_warn, vha, 0x00c6,
+                   "MSI-X: Failed to enable support "
+                   "-- %d/%d\n Retry with %d vectors.\n",
+                   ha->msix_count, ret, ret);
                ha->msix_count = ret;
                ret = pci_enable_msix(ha->pdev, entries, ha->msix_count);
                if (ret) {
 msix_failed:
-                       qla_printk(KERN_WARNING, ha, "MSI-X: Failed to enable"
-                               " support, giving up -- %d/%d\n",
-                               ha->msix_count, ret);
+                       ql_log(ql_log_fatal, vha, 0x00c7,
+                           "MSI-X: Failed to enable support, "
+                           "giving   up -- %d/%d.\n",
+                           ha->msix_count, ret);
                        goto msix_out;
                }
                ha->max_rsp_queues = ha->msix_count - 1;
@@ -2408,6 +2390,8 @@ msix_failed:
        ha->msix_entries = kzalloc(sizeof(struct qla_msix_entry) *
                                ha->msix_count, GFP_KERNEL);
        if (!ha->msix_entries) {
+               ql_log(ql_log_fatal, vha, 0x00c8,
+                   "Failed to allocate memory for ha->msix_entries.\n");
                ret = -ENOMEM;
                goto msix_out;
        }
@@ -2434,9 +2418,9 @@ msix_failed:
                                0, msix_entries[i].name, rsp);
                }
                if (ret) {
-                       qla_printk(KERN_WARNING, ha,
-                       "MSI-X: Unable to register handler -- %x/%d.\n",
-                       qentry->vector, ret);
+                       ql_log(ql_log_fatal, vha, 0x00cb,
+                           "MSI-X: unable to register handler -- %x/%d.\n",
+                           qentry->vector, ret);
                        qla24xx_disable_msix(ha);
                        ha->mqenable = 0;
                        goto msix_out;
@@ -2449,6 +2433,12 @@ msix_failed:
        /* Enable MSI-X vector for response queue update for queue 0 */
        if (ha->mqiobase &&  (ha->max_rsp_queues > 1 || ha->max_req_queues > 1))
                ha->mqenable = 1;
+       ql_dbg(ql_dbg_multiq, vha, 0xc005,
+           "mqiobase=%p, max_rsp_queues=%d, max_req_queues=%d.\n",
+           ha->mqiobase, ha->max_rsp_queues, ha->max_req_queues);
+       ql_dbg(ql_dbg_init, vha, 0x0055,
+           "mqiobase=%p, max_rsp_queues=%d, max_req_queues=%d.\n",
+           ha->mqiobase, ha->max_rsp_queues, ha->max_req_queues);
 
 msix_out:
        kfree(entries);
@@ -2460,6 +2450,7 @@ qla2x00_request_irqs(struct qla_hw_data *ha, struct rsp_que *rsp)
 {
        int ret;
        device_reg_t __iomem *reg = ha->iobase;
+       scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev);
 
        /* If possible, enable MSI-X. */
        if (!IS_QLA2432(ha) && !IS_QLA2532(ha) &&
@@ -2470,30 +2461,30 @@ qla2x00_request_irqs(struct qla_hw_data *ha, struct rsp_que *rsp)
                (ha->pdev->subsystem_device == 0x7040 ||
                ha->pdev->subsystem_device == 0x7041 ||
                ha->pdev->subsystem_device == 0x1705)) {
-               DEBUG2(qla_printk(KERN_WARNING, ha,
-                       "MSI-X: Unsupported ISP2432 SSVID/SSDID (0x%X,0x%X).\n",
+               ql_log(ql_log_warn, vha, 0x0034,
+                   "MSI-X: Unsupported ISP 2432 SSVID/SSDID (0x%X,0x%X).\n",
                        ha->pdev->subsystem_vendor,
-                       ha->pdev->subsystem_device));
+                       ha->pdev->subsystem_device);
                goto skip_msi;
        }
 
        if (IS_QLA2432(ha) && (ha->pdev->revision < QLA_MSIX_CHIP_REV_24XX ||
                !QLA_MSIX_FW_MODE_1(ha->fw_attributes))) {
-               DEBUG2(qla_printk(KERN_WARNING, ha,
-               "MSI-X: Unsupported ISP2432 (0x%X, 0x%X).\n",
-                       ha->pdev->revision, ha->fw_attributes));
+               ql_log(ql_log_warn, vha, 0x0035,
+                   "MSI-X; Unsupported ISP2432 (0x%X, 0x%X).\n",
+                   ha->pdev->revision, ha->fw_attributes);
                goto skip_msix;
        }
 
        ret = qla24xx_enable_msix(ha, rsp);
        if (!ret) {
-               DEBUG2(qla_printk(KERN_INFO, ha,
-                   "MSI-X: Enabled (0x%X, 0x%X).\n", ha->chip_revision,
-                   ha->fw_attributes));
+               ql_dbg(ql_dbg_init, vha, 0x0036,
+                   "MSI-X: Enabled (0x%X, 0x%X).\n",
+                   ha->chip_revision, ha->fw_attributes);
                goto clear_risc_ints;
        }
-       qla_printk(KERN_WARNING, ha,
-           "MSI-X: Falling back-to MSI mode -- %d.\n", ret);
+       ql_log(ql_log_info, vha, 0x0037,
+           "MSI-X Falling back-to MSI mode -%d.\n", ret);
 skip_msix:
 
        if (!IS_QLA24XX(ha) && !IS_QLA2532(ha) && !IS_QLA8432(ha) &&
@@ -2502,18 +2493,19 @@ skip_msix:
 
        ret = pci_enable_msi(ha->pdev);
        if (!ret) {
-               DEBUG2(qla_printk(KERN_INFO, ha, "MSI: Enabled.\n"));
+               ql_dbg(ql_dbg_init, vha, 0x0038,
+                   "MSI: Enabled.\n");
                ha->flags.msi_enabled = 1;
        } else
-               qla_printk(KERN_WARNING, ha,
-                   "MSI-X: Falling back-to INTa mode -- %d.\n", ret);
+               ql_log(ql_log_warn, vha, 0x0039,
+                   "MSI-X; Falling back-to INTa mode -- %d.\n", ret);
 skip_msi:
 
        ret = request_irq(ha->pdev->irq, ha->isp_ops->intr_handler,
            ha->flags.msi_enabled ? 0 : IRQF_SHARED,
            QLA2XXX_DRIVER_NAME, rsp);
        if (ret) {
-               qla_printk(KERN_WARNING, ha,
+               ql_log(ql_log_warn, vha, 0x003a,
                    "Failed to reserve interrupt %d already in use.\n",
                    ha->pdev->irq);
                goto fail;
@@ -2563,13 +2555,14 @@ int qla25xx_request_irq(struct rsp_que *rsp)
        struct qla_hw_data *ha = rsp->hw;
        struct qla_init_msix_entry *intr = &msix_entries[2];
        struct qla_msix_entry *msix = rsp->msix;
+       scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev);
        int ret;
 
        ret = request_irq(msix->vector, intr->handler, 0, intr->name, rsp);
        if (ret) {
-               qla_printk(KERN_WARNING, ha,
-                       "MSI-X: Unable to register handler -- %x/%d.\n",
-                       msix->vector, ret);
+               ql_log(ql_log_fatal, vha, 0x00e6,
+                   "MSI-X: Unable to register handler -- %x/%d.\n",
+                   msix->vector, ret);
                return ret;
        }
        msix->have_irq = 1;
index c26f0acdfeccd94a58edaa015772c0a81d6848b6..f7604ea1af836b58e10d587be15d15283301e3da 100644 (file)
@@ -46,14 +46,18 @@ qla2x00_mailbox_command(scsi_qla_host_t *vha, mbx_cmd_t *mcp)
        struct qla_hw_data *ha = vha->hw;
        scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev);
 
-       if (ha->pdev->error_state > pci_channel_io_frozen)
+       ql_dbg(ql_dbg_mbx, base_vha, 0x1000, "Entered %s.\n", __func__);
+
+       if (ha->pdev->error_state > pci_channel_io_frozen) {
+               ql_log(ql_log_warn, base_vha, 0x1001,
+                   "error_state is greater than pci_channel_io_frozen, "
+                   "exiting.\n");
                return QLA_FUNCTION_TIMEOUT;
+       }
 
        if (vha->device_flags & DFLG_DEV_FAILED) {
-               DEBUG2_3_11(qla_printk(KERN_WARNING, ha,
-                       "%s(%ld): Device in failed state, "
-                       "timeout MBX Exiting.\n",
-                       __func__, base_vha->host_no));
+               ql_log(ql_log_warn, base_vha, 0x1002,
+                   "Device in failed state, exiting.\n");
                return QLA_FUNCTION_TIMEOUT;
        }
 
@@ -63,17 +67,18 @@ qla2x00_mailbox_command(scsi_qla_host_t *vha, mbx_cmd_t *mcp)
        rval = QLA_SUCCESS;
        abort_active = test_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags);
 
-       DEBUG11(printk("%s(%ld): entered.\n", __func__, base_vha->host_no));
 
        if (ha->flags.pci_channel_io_perm_failure) {
-               DEBUG(printk("%s(%ld): Perm failure on EEH, timeout MBX "
-                            "Exiting.\n", __func__, vha->host_no));
+               ql_log(ql_log_warn, base_vha, 0x1003,
+                   "Perm failure on EEH timeout MBX, exiting.\n");
                return QLA_FUNCTION_TIMEOUT;
        }
 
        if (ha->flags.isp82xx_fw_hung) {
                /* Setting Link-Down error */
                mcp->mb[0] = MBS_LINK_DOWN_ERROR;
+               ql_log(ql_log_warn, base_vha, 0x1004,
+                   "FW hung = %d.\n", ha->flags.isp82xx_fw_hung);
                rval = QLA_FUNCTION_FAILED;
                goto premature_exit;
        }
@@ -85,8 +90,8 @@ qla2x00_mailbox_command(scsi_qla_host_t *vha, mbx_cmd_t *mcp)
         */
        if (!wait_for_completion_timeout(&ha->mbx_cmd_comp, mcp->tov * HZ)) {
                /* Timeout occurred. Return error. */
-               DEBUG2_3_11(printk("%s(%ld): cmd access timeout. "
-                   "Exiting.\n", __func__, base_vha->host_no));
+               ql_log(ql_log_warn, base_vha, 0x1005,
+                   "Cmd access timeout, Exiting.\n");
                return QLA_FUNCTION_TIMEOUT;
        }
 
@@ -94,8 +99,8 @@ qla2x00_mailbox_command(scsi_qla_host_t *vha, mbx_cmd_t *mcp)
        /* Save mailbox command for debug */
        ha->mcp = mcp;
 
-       DEBUG11(printk("scsi(%ld): prepare to issue mbox cmd=0x%x.\n",
-           base_vha->host_no, mcp->mb[0]));
+       ql_dbg(ql_dbg_mbx, base_vha, 0x1006,
+           "Prepare to issue mbox cmd=0x%x.\n", mcp->mb[0]);
 
        spin_lock_irqsave(&ha->hardware_lock, flags);
 
@@ -123,27 +128,30 @@ qla2x00_mailbox_command(scsi_qla_host_t *vha, mbx_cmd_t *mcp)
                iptr++;
        }
 
-#if defined(QL_DEBUG_LEVEL_1)
-       printk("%s(%ld): Loaded MBX registers (displayed in bytes) = \n",
-           __func__, base_vha->host_no);
-       qla2x00_dump_buffer((uint8_t *)mcp->mb, 16);
-       printk("\n");
-       qla2x00_dump_buffer(((uint8_t *)mcp->mb + 0x10), 16);
-       printk("\n");
-       qla2x00_dump_buffer(((uint8_t *)mcp->mb + 0x20), 8);
-       printk("\n");
-       printk("%s(%ld): I/O address = %p.\n", __func__, base_vha->host_no,
-               optr);
-       qla2x00_dump_regs(base_vha);
-#endif
+       ql_dbg(ql_dbg_mbx + ql_dbg_buffer, base_vha, 0x1111,
+           "Loaded MBX registers (displayed in bytes) =.\n");
+       ql_dump_buffer(ql_dbg_mbx + ql_dbg_buffer, base_vha, 0x1112,
+           (uint8_t *)mcp->mb, 16);
+       ql_dbg(ql_dbg_mbx + ql_dbg_buffer, base_vha, 0x1113,
+           ".\n");
+       ql_dump_buffer(ql_dbg_mbx + ql_dbg_buffer, base_vha, 0x1114,
+           ((uint8_t *)mcp->mb + 0x10), 16);
+       ql_dbg(ql_dbg_mbx + ql_dbg_buffer, base_vha, 0x1115,
+           ".\n");
+       ql_dump_buffer(ql_dbg_mbx + ql_dbg_buffer, base_vha, 0x1116,
+           ((uint8_t *)mcp->mb + 0x20), 8);
+       ql_dbg(ql_dbg_mbx + ql_dbg_buffer, base_vha, 0x1117,
+           "I/O Address = %p.\n", optr);
+       ql_dump_regs(ql_dbg_mbx + ql_dbg_buffer, base_vha, 0x100e);
 
        /* Issue set host interrupt command to send cmd out. */
        ha->flags.mbox_int = 0;
        clear_bit(MBX_INTERRUPT, &ha->mbx_cmd_flags);
 
        /* Unlock mbx registers and wait for interrupt */
-       DEBUG11(printk("%s(%ld): going to unlock irq & waiting for interrupt. "
-           "jiffies=%lx.\n", __func__, base_vha->host_no, jiffies));
+       ql_dbg(ql_dbg_mbx, base_vha, 0x100f,
+           "Going to unlock irq & waiting for interrupts. "
+           "jiffies=%lx.\n", jiffies);
 
        /* Wait for mbx cmd completion until timeout */
 
@@ -155,9 +163,8 @@ qla2x00_mailbox_command(scsi_qla_host_t *vha, mbx_cmd_t *mcp)
                                HINT_MBX_INT_PENDING) {
                                spin_unlock_irqrestore(&ha->hardware_lock,
                                        flags);
-                               DEBUG2_3_11(printk(KERN_INFO
-                                   "%s(%ld): Pending Mailbox timeout. "
-                                   "Exiting.\n", __func__, base_vha->host_no));
+                               ql_dbg(ql_dbg_mbx, base_vha, 0x1010,
+                                   "Pending mailbox timeout, exiting.\n");
                                rval = QLA_FUNCTION_TIMEOUT;
                                goto premature_exit;
                        }
@@ -173,17 +180,16 @@ qla2x00_mailbox_command(scsi_qla_host_t *vha, mbx_cmd_t *mcp)
                clear_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags);
 
        } else {
-               DEBUG3_11(printk("%s(%ld): cmd=%x POLLING MODE.\n", __func__,
-                   base_vha->host_no, command));
+               ql_dbg(ql_dbg_mbx, base_vha, 0x1011,
+                   "Cmd=%x Polling Mode.\n", command);
 
                if (IS_QLA82XX(ha)) {
                        if (RD_REG_DWORD(&reg->isp82.hint) &
                                HINT_MBX_INT_PENDING) {
                                spin_unlock_irqrestore(&ha->hardware_lock,
                                        flags);
-                               DEBUG2_3_11(printk(KERN_INFO
-                                   "%s(%ld): Pending Mailbox timeout. "
-                                   "Exiting.\n", __func__, base_vha->host_no));
+                               ql_dbg(ql_dbg_mbx, base_vha, 0x1012,
+                                   "Pending mailbox timeout, exiting.\n");
                                rval = QLA_FUNCTION_TIMEOUT;
                                goto premature_exit;
                        }
@@ -207,17 +213,17 @@ qla2x00_mailbox_command(scsi_qla_host_t *vha, mbx_cmd_t *mcp)
                            command == MBC_LOAD_RISC_RAM_EXTENDED))
                                msleep(10);
                } /* while */
-               DEBUG17(qla_printk(KERN_WARNING, ha,
-                       "Waited %d sec\n",
-                       (uint)((jiffies - (wait_time - (mcp->tov * HZ)))/HZ)));
+               ql_dbg(ql_dbg_mbx, base_vha, 0x1013,
+                   "Waited %d sec.\n",
+                   (uint)((jiffies - (wait_time - (mcp->tov * HZ)))/HZ));
        }
 
        /* Check whether we timed out */
        if (ha->flags.mbox_int) {
                uint16_t *iptr2;
 
-               DEBUG3_11(printk("%s(%ld): cmd %x completed.\n", __func__,
-                   base_vha->host_no, command));
+               ql_dbg(ql_dbg_mbx, base_vha, 0x1014,
+                   "Cmd=%x completed.\n", command);
 
                /* Got interrupt. Clear the flag. */
                ha->flags.mbox_int = 0;
@@ -229,6 +235,8 @@ qla2x00_mailbox_command(scsi_qla_host_t *vha, mbx_cmd_t *mcp)
                        mcp->mb[0] = MBS_LINK_DOWN_ERROR;
                        ha->mcp = NULL;
                        rval = QLA_FUNCTION_FAILED;
+                       ql_log(ql_log_warn, base_vha, 0x1015,
+                           "FW hung = %d.\n", ha->flags.isp82xx_fw_hung);
                        goto premature_exit;
                }
 
@@ -249,8 +257,6 @@ qla2x00_mailbox_command(scsi_qla_host_t *vha, mbx_cmd_t *mcp)
                }
        } else {
 
-#if defined(QL_DEBUG_LEVEL_2) || defined(QL_DEBUG_LEVEL_3) || \
-               defined(QL_DEBUG_LEVEL_11)
                uint16_t mb0;
                uint32_t ictrl;
 
@@ -261,14 +267,13 @@ qla2x00_mailbox_command(scsi_qla_host_t *vha, mbx_cmd_t *mcp)
                        mb0 = RD_MAILBOX_REG(ha, &reg->isp, 0);
                        ictrl = RD_REG_WORD(&reg->isp.ictrl);
                }
-               printk("%s(%ld): **** MB Command Timeout for cmd %x ****\n",
-                   __func__, base_vha->host_no, command);
-               printk("%s(%ld): icontrol=%x jiffies=%lx\n", __func__,
-                   base_vha->host_no, ictrl, jiffies);
-               printk("%s(%ld): *** mailbox[0] = 0x%x ***\n", __func__,
-                   base_vha->host_no, mb0);
-               qla2x00_dump_regs(base_vha);
-#endif
+               ql_dbg(ql_dbg_mbx + ql_dbg_buffer, base_vha, 0x1119,
+                   "MBX Command timeout for cmd %x.\n", command);
+               ql_dbg(ql_dbg_mbx + ql_dbg_buffer, base_vha, 0x111a,
+                   "iocontrol=%x jiffies=%lx.\n", ictrl, jiffies);
+               ql_dbg(ql_dbg_mbx + ql_dbg_buffer, base_vha, 0x111b,
+                   "mb[0] = 0x%x.\n", mb0);
+               ql_dump_regs(ql_dbg_mbx + ql_dbg_buffer, base_vha, 0x1019);
 
                rval = QLA_FUNCTION_TIMEOUT;
        }
@@ -279,8 +284,8 @@ qla2x00_mailbox_command(scsi_qla_host_t *vha, mbx_cmd_t *mcp)
        ha->mcp = NULL;
 
        if ((abort_active || !io_lock_on) && !IS_NOPOLLING_TYPE(ha)) {
-               DEBUG11(printk("%s(%ld): checking for additional resp "
-                   "interrupt.\n", __func__, base_vha->host_no));
+               ql_dbg(ql_dbg_mbx, base_vha, 0x101a,
+                   "Checking for additional resp interrupt.\n");
 
                /* polling mode for non isp_abort commands. */
                qla2x00_poll(ha->rsp_q_map[0]);
@@ -291,38 +296,32 @@ qla2x00_mailbox_command(scsi_qla_host_t *vha, mbx_cmd_t *mcp)
                if (!io_lock_on || (mcp->flags & IOCTL_CMD) ||
                    ha->flags.eeh_busy) {
                        /* not in dpc. schedule it for dpc to take over. */
-                       DEBUG(printk("%s(%ld): timeout schedule "
-                       "isp_abort_needed.\n", __func__,
-                       base_vha->host_no));
-                       DEBUG2_3_11(printk("%s(%ld): timeout schedule "
-                       "isp_abort_needed.\n", __func__,
-                       base_vha->host_no));
+                       ql_dbg(ql_dbg_mbx, base_vha, 0x101b,
+                           "Timeout, schedule isp_abort_needed.\n");
 
                        if (!test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags) &&
                            !test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags) &&
                            !test_bit(ISP_ABORT_RETRY, &vha->dpc_flags)) {
 
-                               qla_printk(KERN_WARNING, ha,
-                                   "Mailbox command timeout occurred. "
-                                   "Scheduling ISP " "abort. eeh_busy: 0x%x\n",
-                                   ha->flags.eeh_busy);
+                               ql_log(ql_log_info, base_vha, 0x101c,
+                                   "Mailbox cmd timeout occured. "
+                                   "Scheduling ISP abort eeh_busy=0x%x.\n",
+                                       ha->flags.eeh_busy);
                                set_bit(ISP_ABORT_NEEDED, &vha->dpc_flags);
                                qla2xxx_wake_dpc(vha);
                        }
                } else if (!abort_active) {
                        /* call abort directly since we are in the DPC thread */
-                       DEBUG(printk("%s(%ld): timeout calling abort_isp\n",
-                           __func__, base_vha->host_no));
-                       DEBUG2_3_11(printk("%s(%ld): timeout calling "
-                           "abort_isp\n", __func__, base_vha->host_no));
+                       ql_dbg(ql_dbg_mbx, base_vha, 0x101d,
+                           "Timeout, calling abort_isp.\n");
 
                        if (!test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags) &&
                            !test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags) &&
                            !test_bit(ISP_ABORT_RETRY, &vha->dpc_flags)) {
 
-                               qla_printk(KERN_WARNING, ha,
-                                   "Mailbox command timeout occurred. "
-                                   "Issuing ISP abort.\n");
+                               ql_log(ql_log_info, base_vha, 0x101e,
+                                   "Mailbox cmd timeout occured. "
+                                   "Scheduling ISP abort.\n");
 
                                set_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags);
                                clear_bit(ISP_ABORT_NEEDED, &vha->dpc_flags);
@@ -332,11 +331,8 @@ qla2x00_mailbox_command(scsi_qla_host_t *vha, mbx_cmd_t *mcp)
                                            &vha->dpc_flags);
                                }
                                clear_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags);
-                               DEBUG(printk("%s(%ld): finished abort_isp\n",
-                                   __func__, vha->host_no));
-                               DEBUG2_3_11(printk(
-                                   "%s(%ld): finished abort_isp\n",
-                                   __func__, vha->host_no));
+                               ql_dbg(ql_dbg_mbx, base_vha, 0x101f,
+                                   "Finished abort_isp.\n");
                        }
                }
        }
@@ -346,12 +342,11 @@ premature_exit:
        complete(&ha->mbx_cmd_comp);
 
        if (rval) {
-               DEBUG2_3_11(printk("%s(%ld): **** FAILED. mbx0=%x, mbx1=%x, "
-                   "mbx2=%x, cmd=%x ****\n", __func__, base_vha->host_no,
-                   mcp->mb[0], mcp->mb[1], mcp->mb[2], command));
+               ql_dbg(ql_dbg_mbx, base_vha, 0x1020,
+                   "**** Failed mbx[0]=%x, mb[1]=%x, mb[2]=%x, cmd=%x ****.\n",
+                   mcp->mb[0], mcp->mb[1], mcp->mb[2], command);
        } else {
-               DEBUG11(printk("%s(%ld): done.\n", __func__,
-               base_vha->host_no));
+               ql_dbg(ql_dbg_mbx, base_vha, 0x1021, "Done %s.\n", __func__);
        }
 
        return rval;
@@ -366,7 +361,7 @@ qla2x00_load_ram(scsi_qla_host_t *vha, dma_addr_t req_dma, uint32_t risc_addr,
        mbx_cmd_t mc;
        mbx_cmd_t *mcp = &mc;
 
-       DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no));
+       ql_dbg(ql_dbg_mbx, vha, 0x1022, "Entered %s.\n", __func__);
 
        if (MSW(risc_addr) || IS_FWI2_CAPABLE(ha)) {
                mcp->mb[0] = MBC_LOAD_RISC_RAM_EXTENDED;
@@ -397,10 +392,10 @@ qla2x00_load_ram(scsi_qla_host_t *vha, dma_addr_t req_dma, uint32_t risc_addr,
        rval = qla2x00_mailbox_command(vha, mcp);
 
        if (rval != QLA_SUCCESS) {
-               DEBUG2_3_11(printk("%s(%ld): failed=%x mb[0]=%x.\n", __func__,
-                   vha->host_no, rval, mcp->mb[0]));
+               ql_dbg(ql_dbg_mbx, vha, 0x1023,
+                   "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]);
        } else {
-               DEBUG11(printk("%s(%ld): done.\n", __func__, vha->host_no));
+               ql_dbg(ql_dbg_mbx, vha, 0x1024, "Done %s.\n", __func__);
        }
 
        return rval;
@@ -430,7 +425,7 @@ qla2x00_execute_fw(scsi_qla_host_t *vha, uint32_t risc_addr)
        mbx_cmd_t mc;
        mbx_cmd_t *mcp = &mc;
 
-       DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no));
+       ql_dbg(ql_dbg_mbx, vha, 0x1025, "Entered %s.\n", __func__);
 
        mcp->mb[0] = MBC_EXECUTE_FIRMWARE;
        mcp->out_mb = MBX_0;
@@ -461,15 +456,14 @@ qla2x00_execute_fw(scsi_qla_host_t *vha, uint32_t risc_addr)
        rval = qla2x00_mailbox_command(vha, mcp);
 
        if (rval != QLA_SUCCESS) {
-               DEBUG2_3_11(printk("%s(%ld): failed=%x mb[0]=%x.\n", __func__,
-                   vha->host_no, rval, mcp->mb[0]));
+               ql_dbg(ql_dbg_mbx, vha, 0x1026,
+                   "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]);
        } else {
                if (IS_FWI2_CAPABLE(ha)) {
-                       DEBUG11(printk("%s(%ld): done exchanges=%x.\n",
-                           __func__, vha->host_no, mcp->mb[1]));
+                       ql_dbg(ql_dbg_mbx, vha, 0x1027,
+                           "Done exchanges=%x.\n", mcp->mb[1]);
                } else {
-                       DEBUG11(printk("%s(%ld): done.\n", __func__,
-                           vha->host_no));
+                       ql_dbg(ql_dbg_mbx, vha, 0x1028, "Done %s.\n", __func__);
                }
        }
 
@@ -501,7 +495,7 @@ qla2x00_get_fw_version(scsi_qla_host_t *vha, uint16_t *major, uint16_t *minor,
        mbx_cmd_t       mc;
        mbx_cmd_t       *mcp = &mc;
 
-       DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no));
+       ql_dbg(ql_dbg_mbx, vha, 0x1029, "Entered %s.\n", __func__);
 
        mcp->mb[0] = MBC_GET_FIRMWARE_VERSION;
        mcp->out_mb = MBX_0;
@@ -535,11 +529,10 @@ qla2x00_get_fw_version(scsi_qla_host_t *vha, uint16_t *major, uint16_t *minor,
 failed:
        if (rval != QLA_SUCCESS) {
                /*EMPTY*/
-               DEBUG2_3_11(printk("%s(%ld): failed=%x.\n", __func__,
-                   vha->host_no, rval));
+               ql_dbg(ql_dbg_mbx, vha, 0x102a, "Failed=%x.\n", rval);
        } else {
                /*EMPTY*/
-               DEBUG11(printk("%s(%ld): done.\n", __func__, vha->host_no));
+               ql_dbg(ql_dbg_mbx, vha, 0x102b, "Done %s.\n", __func__);
        }
        return rval;
 }
@@ -565,7 +558,7 @@ qla2x00_get_fw_options(scsi_qla_host_t *vha, uint16_t *fwopts)
        mbx_cmd_t mc;
        mbx_cmd_t *mcp = &mc;
 
-       DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no));
+       ql_dbg(ql_dbg_mbx, vha, 0x102c, "Entered %s.\n", __func__);
 
        mcp->mb[0] = MBC_GET_FIRMWARE_OPTION;
        mcp->out_mb = MBX_0;
@@ -576,15 +569,14 @@ qla2x00_get_fw_options(scsi_qla_host_t *vha, uint16_t *fwopts)
 
        if (rval != QLA_SUCCESS) {
                /*EMPTY*/
-               DEBUG2_3_11(printk("%s(%ld): failed=%x.\n", __func__,
-                   vha->host_no, rval));
+               ql_dbg(ql_dbg_mbx, vha, 0x102d, "Failed=%x.\n", rval);
        } else {
                fwopts[0] = mcp->mb[0];
                fwopts[1] = mcp->mb[1];
                fwopts[2] = mcp->mb[2];
                fwopts[3] = mcp->mb[3];
 
-               DEBUG11(printk("%s(%ld): done.\n", __func__, vha->host_no));
+               ql_dbg(ql_dbg_mbx, vha, 0x102e, "Done %s.\n", __func__);
        }
 
        return rval;
@@ -612,7 +604,7 @@ qla2x00_set_fw_options(scsi_qla_host_t *vha, uint16_t *fwopts)
        mbx_cmd_t mc;
        mbx_cmd_t *mcp = &mc;
 
-       DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no));
+       ql_dbg(ql_dbg_mbx, vha, 0x102f, "Entered %s.\n", __func__);
 
        mcp->mb[0] = MBC_SET_FIRMWARE_OPTION;
        mcp->mb[1] = fwopts[1];
@@ -636,11 +628,11 @@ qla2x00_set_fw_options(scsi_qla_host_t *vha, uint16_t *fwopts)
 
        if (rval != QLA_SUCCESS) {
                /*EMPTY*/
-               DEBUG2_3_11(printk("%s(%ld): failed=%x (%x/%x).\n", __func__,
-                   vha->host_no, rval, mcp->mb[0], mcp->mb[1]));
+               ql_dbg(ql_dbg_mbx, vha, 0x1030,
+                   "Failed=%x (%x/%x).\n", rval, mcp->mb[0], mcp->mb[1]);
        } else {
                /*EMPTY*/
-               DEBUG11(printk("%s(%ld): done.\n", __func__, vha->host_no));
+               ql_dbg(ql_dbg_mbx, vha, 0x1031, "Done %s.\n", __func__);
        }
 
        return rval;
@@ -668,7 +660,7 @@ qla2x00_mbx_reg_test(scsi_qla_host_t *vha)
        mbx_cmd_t mc;
        mbx_cmd_t *mcp = &mc;
 
-       DEBUG11(printk("qla2x00_mbx_reg_test(%ld): entered.\n", vha->host_no));
+       ql_dbg(ql_dbg_mbx, vha, 0x1032, "Entered %s.\n", __func__);
 
        mcp->mb[0] = MBC_MAILBOX_REGISTER_TEST;
        mcp->mb[1] = 0xAAAA;
@@ -695,12 +687,10 @@ qla2x00_mbx_reg_test(scsi_qla_host_t *vha)
 
        if (rval != QLA_SUCCESS) {
                /*EMPTY*/
-               DEBUG2_3_11(printk("qla2x00_mbx_reg_test(%ld): failed=%x.\n",
-                   vha->host_no, rval));
+               ql_dbg(ql_dbg_mbx, vha, 0x1033, "Failed=%x.\n", rval);
        } else {
                /*EMPTY*/
-               DEBUG11(printk("qla2x00_mbx_reg_test(%ld): done.\n",
-                   vha->host_no));
+               ql_dbg(ql_dbg_mbx, vha, 0x1034, "Done %s.\n", __func__);
        }
 
        return rval;
@@ -728,7 +718,7 @@ qla2x00_verify_checksum(scsi_qla_host_t *vha, uint32_t risc_addr)
        mbx_cmd_t mc;
        mbx_cmd_t *mcp = &mc;
 
-       DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no));
+       ql_dbg(ql_dbg_mbx, vha, 0x1035, "Entered %s.\n", __func__);
 
        mcp->mb[0] = MBC_VERIFY_CHECKSUM;
        mcp->out_mb = MBX_0;
@@ -749,11 +739,11 @@ qla2x00_verify_checksum(scsi_qla_host_t *vha, uint32_t risc_addr)
        rval = qla2x00_mailbox_command(vha, mcp);
 
        if (rval != QLA_SUCCESS) {
-               DEBUG2_3_11(printk("%s(%ld): failed=%x chk sum=%x.\n", __func__,
-                   vha->host_no, rval, IS_FWI2_CAPABLE(vha->hw) ?
-                   (mcp->mb[2] << 16) | mcp->mb[1]: mcp->mb[1]));
+               ql_dbg(ql_dbg_mbx, vha, 0x1036,
+                   "Failed=%x chm sum=%x.\n", rval, IS_FWI2_CAPABLE(vha->hw) ?
+                   (mcp->mb[2] << 16) | mcp->mb[1] : mcp->mb[1]);
        } else {
-               DEBUG11(printk("%s(%ld): done.\n", __func__, vha->host_no));
+               ql_dbg(ql_dbg_mbx, vha, 0x1037, "Done %s.\n", __func__);
        }
 
        return rval;
@@ -785,6 +775,8 @@ qla2x00_issue_iocb_timeout(scsi_qla_host_t *vha, void *buffer,
        mbx_cmd_t       mc;
        mbx_cmd_t       *mcp = &mc;
 
+       ql_dbg(ql_dbg_mbx, vha, 0x1038, "Entered %s.\n", __func__);
+
        mcp->mb[0] = MBC_IOCB_COMMAND_A64;
        mcp->mb[1] = 0;
        mcp->mb[2] = MSW(phys_addr);
@@ -799,14 +791,14 @@ qla2x00_issue_iocb_timeout(scsi_qla_host_t *vha, void *buffer,
 
        if (rval != QLA_SUCCESS) {
                /*EMPTY*/
-               DEBUG(printk("qla2x00_issue_iocb(%ld): failed rval 0x%x\n",
-                   vha->host_no, rval));
+               ql_dbg(ql_dbg_mbx, vha, 0x1039, "Failed=%x.\n", rval);
        } else {
                sts_entry_t *sts_entry = (sts_entry_t *) buffer;
 
                /* Mask reserved bits. */
                sts_entry->entry_status &=
                    IS_FWI2_CAPABLE(vha->hw) ? RF_MASK_24XX : RF_MASK;
+               ql_dbg(ql_dbg_mbx, vha, 0x103a, "Done %s.\n", __func__);
        }
 
        return rval;
@@ -847,7 +839,7 @@ qla2x00_abort_command(srb_t *sp)
        struct qla_hw_data *ha = vha->hw;
        struct req_que *req = vha->req;
 
-       DEBUG11(printk("qla2x00_abort_command(%ld): entered.\n", vha->host_no));
+       ql_dbg(ql_dbg_mbx, vha, 0x103b, "Entered %s.\n", __func__);
 
        spin_lock_irqsave(&ha->hardware_lock, flags);
        for (handle = 1; handle < MAX_OUTSTANDING_COMMANDS; handle++) {
@@ -876,11 +868,9 @@ qla2x00_abort_command(srb_t *sp)
        rval = qla2x00_mailbox_command(vha, mcp);
 
        if (rval != QLA_SUCCESS) {
-               DEBUG2_3_11(printk("qla2x00_abort_command(%ld): failed=%x.\n",
-                   vha->host_no, rval));
+               ql_dbg(ql_dbg_mbx, vha, 0x103c, "Failed=%x.\n", rval);
        } else {
-               DEBUG11(printk("qla2x00_abort_command(%ld): done.\n",
-                   vha->host_no));
+               ql_dbg(ql_dbg_mbx, vha, 0x103d, "Done %s.\n", __func__);
        }
 
        return rval;
@@ -896,10 +886,11 @@ qla2x00_abort_target(struct fc_port *fcport, unsigned int l, int tag)
        struct req_que *req;
        struct rsp_que *rsp;
 
-       DEBUG11(printk("%s(%ld): entered.\n", __func__, fcport->vha->host_no));
-
        l = l;
        vha = fcport->vha;
+
+       ql_dbg(ql_dbg_mbx, vha, 0x103e, "Entered %s.\n", __func__);
+
        req = vha->hw->req_q_map[0];
        rsp = req->rsp;
        mcp->mb[0] = MBC_ABORT_TARGET;
@@ -919,18 +910,17 @@ qla2x00_abort_target(struct fc_port *fcport, unsigned int l, int tag)
        mcp->flags = 0;
        rval = qla2x00_mailbox_command(vha, mcp);
        if (rval != QLA_SUCCESS) {
-               DEBUG2_3_11(printk("%s(%ld): failed=%x.\n", __func__,
-                   vha->host_no, rval));
+               ql_dbg(ql_dbg_mbx, vha, 0x103f, "Failed=%x.\n", rval);
        }
 
        /* Issue marker IOCB. */
        rval2 = qla2x00_marker(vha, req, rsp, fcport->loop_id, 0,
                                                        MK_SYNC_ID);
        if (rval2 != QLA_SUCCESS) {
-               DEBUG2_3_11(printk("%s(%ld): failed to issue Marker IOCB "
-                   "(%x).\n", __func__, vha->host_no, rval2));
+               ql_dbg(ql_dbg_mbx, vha, 0x1040,
+                   "Failed to issue marker IOCB (%x).\n", rval2);
        } else {
-               DEBUG11(printk("%s(%ld): done.\n", __func__, vha->host_no));
+               ql_dbg(ql_dbg_mbx, vha, 0x1041, "Done %s.\n", __func__);
        }
 
        return rval;
@@ -946,9 +936,10 @@ qla2x00_lun_reset(struct fc_port *fcport, unsigned int l, int tag)
        struct req_que *req;
        struct rsp_que *rsp;
 
-       DEBUG11(printk("%s(%ld): entered.\n", __func__, fcport->vha->host_no));
-
        vha = fcport->vha;
+
+       ql_dbg(ql_dbg_mbx, vha, 0x1042, "Entered %s.\n", __func__);
+
        req = vha->hw->req_q_map[0];
        rsp = req->rsp;
        mcp->mb[0] = MBC_LUN_RESET;
@@ -966,18 +957,17 @@ qla2x00_lun_reset(struct fc_port *fcport, unsigned int l, int tag)
        mcp->flags = 0;
        rval = qla2x00_mailbox_command(vha, mcp);
        if (rval != QLA_SUCCESS) {
-               DEBUG2_3_11(printk("%s(%ld): failed=%x.\n", __func__,
-                   vha->host_no, rval));
+               ql_dbg(ql_dbg_mbx, vha, 0x1043, "Failed=%x.\n", rval);
        }
 
        /* Issue marker IOCB. */
        rval2 = qla2x00_marker(vha, req, rsp, fcport->loop_id, l,
                                                                MK_SYNC_ID_LUN);
        if (rval2 != QLA_SUCCESS) {
-               DEBUG2_3_11(printk("%s(%ld): failed to issue Marker IOCB "
-                   "(%x).\n", __func__, vha->host_no, rval2));
+               ql_dbg(ql_dbg_mbx, vha, 0x1044,
+                   "Failed to issue marker IOCB (%x).\n", rval2);
        } else {
-               DEBUG11(printk("%s(%ld): done.\n", __func__, vha->host_no));
+               ql_dbg(ql_dbg_mbx, vha, 0x1045, "Done %s.\n", __func__);
        }
 
        return rval;
@@ -1011,8 +1001,7 @@ qla2x00_get_adapter_id(scsi_qla_host_t *vha, uint16_t *id, uint8_t *al_pa,
        mbx_cmd_t mc;
        mbx_cmd_t *mcp = &mc;
 
-       DEBUG11(printk("qla2x00_get_adapter_id(%ld): entered.\n",
-           vha->host_no));
+       ql_dbg(ql_dbg_mbx, vha, 0x1046, "Entered %s.\n", __func__);
 
        mcp->mb[0] = MBC_GET_ADAPTER_LOOP_ID;
        mcp->mb[9] = vha->vp_idx;
@@ -1038,11 +1027,9 @@ qla2x00_get_adapter_id(scsi_qla_host_t *vha, uint16_t *id, uint8_t *al_pa,
 
        if (rval != QLA_SUCCESS) {
                /*EMPTY*/
-               DEBUG2_3_11(printk("qla2x00_get_adapter_id(%ld): failed=%x.\n",
-                   vha->host_no, rval));
+               ql_dbg(ql_dbg_mbx, vha, 0x1047, "Failed=%x.\n", rval);
        } else {
-               DEBUG11(printk("qla2x00_get_adapter_id(%ld): done.\n",
-                   vha->host_no));
+               ql_dbg(ql_dbg_mbx, vha, 0x1048, "Done %s.\n", __func__);
 
                if (IS_QLA8XXX_TYPE(vha->hw)) {
                        vha->fcoe_vlan_id = mcp->mb[9] & 0xfff;
@@ -1083,8 +1070,7 @@ qla2x00_get_retry_cnt(scsi_qla_host_t *vha, uint8_t *retry_cnt, uint8_t *tov,
        mbx_cmd_t mc;
        mbx_cmd_t *mcp = &mc;
 
-       DEBUG11(printk("qla2x00_get_retry_cnt(%ld): entered.\n",
-                       vha->host_no));
+       ql_dbg(ql_dbg_mbx, vha, 0x1049, "Entered %s.\n", __func__);
 
        mcp->mb[0] = MBC_GET_RETRY_COUNT;
        mcp->out_mb = MBX_0;
@@ -1095,8 +1081,8 @@ qla2x00_get_retry_cnt(scsi_qla_host_t *vha, uint8_t *retry_cnt, uint8_t *tov,
 
        if (rval != QLA_SUCCESS) {
                /*EMPTY*/
-               DEBUG2_3_11(printk("qla2x00_get_retry_cnt(%ld): failed = %x.\n",
-                   vha->host_no, mcp->mb[0]));
+               ql_dbg(ql_dbg_mbx, vha, 0x104a,
+                   "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]);
        } else {
                /* Convert returned data and check our values. */
                *r_a_tov = mcp->mb[3] / 2;
@@ -1107,8 +1093,8 @@ qla2x00_get_retry_cnt(scsi_qla_host_t *vha, uint8_t *retry_cnt, uint8_t *tov,
                        *tov = ratov;
                }
 
-               DEBUG11(printk("qla2x00_get_retry_cnt(%ld): done. mb3=%d "
-                   "ratov=%d.\n", vha->host_no, mcp->mb[3], ratov));
+               ql_dbg(ql_dbg_mbx, vha, 0x104b,
+                   "Done %s mb3=%d ratov=%d.\n", __func__, mcp->mb[3], ratov);
        }
 
        return rval;
@@ -1139,8 +1125,7 @@ qla2x00_init_firmware(scsi_qla_host_t *vha, uint16_t size)
        mbx_cmd_t *mcp = &mc;
        struct qla_hw_data *ha = vha->hw;
 
-       DEBUG11(printk("qla2x00_init_firmware(%ld): entered.\n",
-           vha->host_no));
+       ql_dbg(ql_dbg_mbx, vha, 0x104c, "Entered %s.\n", __func__);
 
        if (IS_QLA82XX(ha) && ql2xdbwr)
                qla82xx_wr_32(ha, ha->nxdb_wr_ptr,
@@ -1174,13 +1159,11 @@ qla2x00_init_firmware(scsi_qla_host_t *vha, uint16_t size)
 
        if (rval != QLA_SUCCESS) {
                /*EMPTY*/
-               DEBUG2_3_11(printk("qla2x00_init_firmware(%ld): failed=%x "
-                   "mb0=%x.\n",
-                   vha->host_no, rval, mcp->mb[0]));
+               ql_dbg(ql_dbg_mbx, vha, 0x104d,
+                   "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]);
        } else {
                /*EMPTY*/
-               DEBUG11(printk("qla2x00_init_firmware(%ld): done.\n",
-                   vha->host_no));
+               ql_dbg(ql_dbg_mbx, vha, 0x104e, "Done %s.\n", __func__);
        }
 
        return rval;
@@ -1213,13 +1196,13 @@ qla2x00_get_port_database(scsi_qla_host_t *vha, fc_port_t *fcport, uint8_t opt)
        dma_addr_t pd_dma;
        struct qla_hw_data *ha = vha->hw;
 
-       DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no));
+       ql_dbg(ql_dbg_mbx, vha, 0x104f, "Entered %s.\n", __func__);
 
        pd24 = NULL;
        pd = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &pd_dma);
        if (pd  == NULL) {
-               DEBUG2_3(printk("%s(%ld): failed to allocate Port Database "
-                   "structure.\n", __func__, vha->host_no));
+               ql_log(ql_log_warn, vha, 0x1050,
+                   "Failed to allocate port database structure.\n");
                return QLA_MEMORY_ALLOC_FAILED;
        }
        memset(pd, 0, max(PORT_DATABASE_SIZE, PORT_DATABASE_24XX_SIZE));
@@ -1261,12 +1244,10 @@ qla2x00_get_port_database(scsi_qla_host_t *vha, fc_port_t *fcport, uint8_t opt)
                /* Check for logged in state. */
                if (pd24->current_login_state != PDS_PRLI_COMPLETE &&
                    pd24->last_login_state != PDS_PRLI_COMPLETE) {
-                       DEBUG2(qla_printk(KERN_WARNING, ha,
-                          "scsi(%ld): Unable to verify login-state (%x/%x) "
-                          " - portid=%02x%02x%02x.\n", vha->host_no,
-                          pd24->current_login_state, pd24->last_login_state,
-                          fcport->d_id.b.domain, fcport->d_id.b.area,
-                          fcport->d_id.b.al_pa));
+                       ql_dbg(ql_dbg_mbx, vha, 0x1051,
+                           "Unable to verify login-state (%x/%x) for "
+                           "loop_id %x.\n", pd24->current_login_state,
+                           pd24->last_login_state, fcport->loop_id);
                        rval = QLA_FUNCTION_FAILED;
                        goto gpd_error_out;
                }
@@ -1290,12 +1271,11 @@ qla2x00_get_port_database(scsi_qla_host_t *vha, fc_port_t *fcport, uint8_t opt)
                /* Check for logged in state. */
                if (pd->master_state != PD_STATE_PORT_LOGGED_IN &&
                    pd->slave_state != PD_STATE_PORT_LOGGED_IN) {
-                       DEBUG2(qla_printk(KERN_WARNING, ha,
-                          "scsi(%ld): Unable to verify login-state (%x/%x) "
-                          " - portid=%02x%02x%02x.\n", vha->host_no,
-                          pd->master_state, pd->slave_state,
-                          fcport->d_id.b.domain, fcport->d_id.b.area,
-                          fcport->d_id.b.al_pa));
+                       ql_dbg(ql_dbg_mbx, vha, 0x100a,
+                           "Unable to verify login-state (%x/%x) - "
+                           "portid=%02x%02x%02x.\n", pd->master_state,
+                           pd->slave_state, fcport->d_id.b.domain,
+                           fcport->d_id.b.area, fcport->d_id.b.al_pa);
                        rval = QLA_FUNCTION_FAILED;
                        goto gpd_error_out;
                }
@@ -1325,10 +1305,11 @@ gpd_error_out:
        dma_pool_free(ha->s_dma_pool, pd, pd_dma);
 
        if (rval != QLA_SUCCESS) {
-               DEBUG2_3_11(printk("%s(%ld): failed=%x mb[0]=%x mb[1]=%x.\n",
-                   __func__, vha->host_no, rval, mcp->mb[0], mcp->mb[1]));
+               ql_dbg(ql_dbg_mbx, vha, 0x1052,
+                   "Failed=%x mb[0]=%x mb[1]=%x.\n", rval,
+                   mcp->mb[0], mcp->mb[1]);
        } else {
-               DEBUG11(printk("%s(%ld): done.\n", __func__, vha->host_no));
+               ql_dbg(ql_dbg_mbx, vha, 0x1053, "Done %s.\n", __func__);
        }
 
        return rval;
@@ -1357,8 +1338,7 @@ qla2x00_get_firmware_state(scsi_qla_host_t *vha, uint16_t *states)
        mbx_cmd_t mc;
        mbx_cmd_t *mcp = &mc;
 
-       DEBUG11(printk("qla2x00_get_firmware_state(%ld): entered.\n",
-           vha->host_no));
+       ql_dbg(ql_dbg_mbx, vha, 0x1054, "Entered %s.\n", __func__);
 
        mcp->mb[0] = MBC_GET_FIRMWARE_STATE;
        mcp->out_mb = MBX_0;
@@ -1381,12 +1361,10 @@ qla2x00_get_firmware_state(scsi_qla_host_t *vha, uint16_t *states)
 
        if (rval != QLA_SUCCESS) {
                /*EMPTY*/
-               DEBUG2_3_11(printk("qla2x00_get_firmware_state(%ld): "
-                   "failed=%x.\n", vha->host_no, rval));
+               ql_dbg(ql_dbg_mbx, vha, 0x1055, "Failed=%x.\n", rval);
        } else {
                /*EMPTY*/
-               DEBUG11(printk("qla2x00_get_firmware_state(%ld): done.\n",
-                   vha->host_no));
+               ql_dbg(ql_dbg_mbx, vha, 0x1056, "Done %s.\n", __func__);
        }
 
        return rval;
@@ -1418,8 +1396,7 @@ qla2x00_get_port_name(scsi_qla_host_t *vha, uint16_t loop_id, uint8_t *name,
        mbx_cmd_t mc;
        mbx_cmd_t *mcp = &mc;
 
-       DEBUG11(printk("qla2x00_get_port_name(%ld): entered.\n",
-           vha->host_no));
+       ql_dbg(ql_dbg_mbx, vha, 0x1057, "Entered %s.\n", __func__);
 
        mcp->mb[0] = MBC_GET_PORT_NAME;
        mcp->mb[9] = vha->vp_idx;
@@ -1439,8 +1416,7 @@ qla2x00_get_port_name(scsi_qla_host_t *vha, uint16_t loop_id, uint8_t *name,
 
        if (rval != QLA_SUCCESS) {
                /*EMPTY*/
-               DEBUG2_3_11(printk("qla2x00_get_port_name(%ld): failed=%x.\n",
-                   vha->host_no, rval));
+               ql_dbg(ql_dbg_mbx, vha, 0x1058, "Failed=%x.\n", rval);
        } else {
                if (name != NULL) {
                        /* This function returns name in big endian. */
@@ -1454,8 +1430,7 @@ qla2x00_get_port_name(scsi_qla_host_t *vha, uint16_t loop_id, uint8_t *name,
                        name[7] = LSB(mcp->mb[7]);
                }
 
-               DEBUG11(printk("qla2x00_get_port_name(%ld): done.\n",
-                   vha->host_no));
+               ql_dbg(ql_dbg_mbx, vha, 0x1059, "Done %s.\n", __func__);
        }
 
        return rval;
@@ -1483,7 +1458,7 @@ qla2x00_lip_reset(scsi_qla_host_t *vha)
        mbx_cmd_t mc;
        mbx_cmd_t *mcp = &mc;
 
-       DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no));
+       ql_dbg(ql_dbg_mbx, vha, 0x105a, "Entered %s.\n", __func__);
 
        if (IS_QLA8XXX_TYPE(vha->hw)) {
                /* Logout across all FCFs. */
@@ -1517,11 +1492,10 @@ qla2x00_lip_reset(scsi_qla_host_t *vha)
 
        if (rval != QLA_SUCCESS) {
                /*EMPTY*/
-               DEBUG2_3_11(printk("%s(%ld): failed=%x.\n",
-                   __func__, vha->host_no, rval));
+               ql_dbg(ql_dbg_mbx, vha, 0x105b, "Failed=%x.\n", rval);
        } else {
                /*EMPTY*/
-               DEBUG11(printk("%s(%ld): done.\n", __func__, vha->host_no));
+               ql_dbg(ql_dbg_mbx, vha, 0x105c, "Done %s.\n", __func__);
        }
 
        return rval;
@@ -1553,12 +1527,11 @@ qla2x00_send_sns(scsi_qla_host_t *vha, dma_addr_t sns_phys_address,
        mbx_cmd_t mc;
        mbx_cmd_t *mcp = &mc;
 
-       DEBUG11(printk("qla2x00_send_sns(%ld): entered.\n",
-           vha->host_no));
+       ql_dbg(ql_dbg_mbx, vha, 0x105d, "Entered %s.\n", __func__);
 
-       DEBUG11(printk("qla2x00_send_sns: retry cnt=%d ratov=%d total "
-               "tov=%d.\n", vha->hw->retry_count, vha->hw->login_timeout,
-               mcp->tov));
+       ql_dbg(ql_dbg_mbx, vha, 0x105e,
+           "Retry cnt=%d ratov=%d total tov=%d.\n",
+           vha->hw->retry_count, vha->hw->login_timeout, mcp->tov);
 
        mcp->mb[0] = MBC_SEND_SNS_COMMAND;
        mcp->mb[1] = cmd_size;
@@ -1575,13 +1548,12 @@ qla2x00_send_sns(scsi_qla_host_t *vha, dma_addr_t sns_phys_address,
 
        if (rval != QLA_SUCCESS) {
                /*EMPTY*/
-               DEBUG(printk("qla2x00_send_sns(%ld): failed=%x mb[0]=%x "
-                   "mb[1]=%x.\n", vha->host_no, rval, mcp->mb[0], mcp->mb[1]));
-               DEBUG2_3_11(printk("qla2x00_send_sns(%ld): failed=%x mb[0]=%x "
-                   "mb[1]=%x.\n", vha->host_no, rval, mcp->mb[0], mcp->mb[1]));
+               ql_dbg(ql_dbg_mbx, vha, 0x105f,
+                   "Failed=%x mb[0]=%x mb[1]=%x.\n",
+                   rval, mcp->mb[0], mcp->mb[1]);
        } else {
                /*EMPTY*/
-               DEBUG11(printk("qla2x00_send_sns(%ld): done.\n", vha->host_no));
+               ql_dbg(ql_dbg_mbx, vha, 0x1060, "Done %s.\n", __func__);
        }
 
        return rval;
@@ -1600,7 +1572,7 @@ qla24xx_login_fabric(scsi_qla_host_t *vha, uint16_t loop_id, uint8_t domain,
        struct req_que *req;
        struct rsp_que *rsp;
 
-       DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no));
+       ql_dbg(ql_dbg_mbx, vha, 0x1061, "Entered %s.\n", __func__);
 
        if (ha->flags.cpu_affinity_enabled)
                req = ha->req_q_map[0];
@@ -1610,8 +1582,8 @@ qla24xx_login_fabric(scsi_qla_host_t *vha, uint16_t loop_id, uint8_t domain,
 
        lg = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &lg_dma);
        if (lg == NULL) {
-               DEBUG2_3(printk("%s(%ld): failed to allocate Login IOCB.\n",
-                   __func__, vha->host_no));
+               ql_log(ql_log_warn, vha, 0x1062,
+                   "Failed to allocate login IOCB.\n");
                return QLA_MEMORY_ALLOC_FAILED;
        }
        memset(lg, 0, sizeof(struct logio_entry_24xx));
@@ -1631,21 +1603,21 @@ qla24xx_login_fabric(scsi_qla_host_t *vha, uint16_t loop_id, uint8_t domain,
        lg->vp_index = vha->vp_idx;
        rval = qla2x00_issue_iocb(vha, lg, lg_dma, 0);
        if (rval != QLA_SUCCESS) {
-               DEBUG2_3_11(printk("%s(%ld): failed to issue Login IOCB "
-                   "(%x).\n", __func__, vha->host_no, rval));
+               ql_dbg(ql_dbg_mbx, vha, 0x1063,
+                   "Failed to issue login IOCB (%x).\n", rval);
        } else if (lg->entry_status != 0) {
-               DEBUG2_3_11(printk("%s(%ld): failed to complete IOCB "
-                   "-- error status (%x).\n", __func__, vha->host_no,
-                   lg->entry_status));
+               ql_dbg(ql_dbg_mbx, vha, 0x1064,
+                   "Failed to complete IOCB -- error status (%x).\n",
+                   lg->entry_status);
                rval = QLA_FUNCTION_FAILED;
        } else if (lg->comp_status != __constant_cpu_to_le16(CS_COMPLETE)) {
                iop[0] = le32_to_cpu(lg->io_parameter[0]);
                iop[1] = le32_to_cpu(lg->io_parameter[1]);
 
-               DEBUG2_3_11(printk("%s(%ld): failed to complete IOCB "
-                   "-- completion status (%x)  ioparam=%x/%x.\n", __func__,
-                   vha->host_no, le16_to_cpu(lg->comp_status), iop[0],
-                   iop[1]));
+               ql_dbg(ql_dbg_mbx, vha, 0x1065,
+                   "Failed to complete IOCB -- completion  status (%x) "
+                   "ioparam=%x/%x.\n", le16_to_cpu(lg->comp_status),
+                   iop[0], iop[1]);
 
                switch (iop[0]) {
                case LSC_SCODE_PORTID_USED:
@@ -1673,7 +1645,7 @@ qla24xx_login_fabric(scsi_qla_host_t *vha, uint16_t loop_id, uint8_t domain,
                        break;
                }
        } else {
-               DEBUG11(printk("%s(%ld): done.\n", __func__, vha->host_no));
+               ql_dbg(ql_dbg_mbx, vha, 0x1066, "Done %s.\n", __func__);
 
                iop[0] = le32_to_cpu(lg->io_parameter[0]);
 
@@ -1728,7 +1700,7 @@ qla2x00_login_fabric(scsi_qla_host_t *vha, uint16_t loop_id, uint8_t domain,
        mbx_cmd_t *mcp = &mc;
        struct qla_hw_data *ha = vha->hw;
 
-       DEBUG11(printk("qla2x00_login_fabric(%ld): entered.\n", vha->host_no));
+       ql_dbg(ql_dbg_mbx, vha, 0x1067, "Entered %s.\n", __func__);
 
        mcp->mb[0] = MBC_LOGIN_FABRIC_PORT;
        mcp->out_mb = MBX_3|MBX_2|MBX_1|MBX_0;
@@ -1771,13 +1743,12 @@ qla2x00_login_fabric(scsi_qla_host_t *vha, uint16_t loop_id, uint8_t domain,
                        rval = QLA_SUCCESS;
 
                /*EMPTY*/
-               DEBUG2_3_11(printk("qla2x00_login_fabric(%ld): failed=%x "
-                   "mb[0]=%x mb[1]=%x mb[2]=%x.\n", vha->host_no, rval,
-                   mcp->mb[0], mcp->mb[1], mcp->mb[2]));
+               ql_dbg(ql_dbg_mbx, vha, 0x1068,
+                   "Failed=%x mb[0]=%x mb[1]=%x mb[2]=%x.\n",
+                   rval, mcp->mb[0], mcp->mb[1], mcp->mb[2]);
        } else {
                /*EMPTY*/
-               DEBUG11(printk("qla2x00_login_fabric(%ld): done.\n",
-                   vha->host_no));
+               ql_dbg(ql_dbg_mbx, vha, 0x1069, "Done %s.\n", __func__);
        }
 
        return rval;
@@ -1808,13 +1779,13 @@ qla2x00_login_local_device(scsi_qla_host_t *vha, fc_port_t *fcport,
        mbx_cmd_t *mcp = &mc;
        struct qla_hw_data *ha = vha->hw;
 
+       ql_dbg(ql_dbg_mbx, vha, 0x106a, "Entered %s.\n", __func__);
+
        if (IS_FWI2_CAPABLE(ha))
                return qla24xx_login_fabric(vha, fcport->loop_id,
                    fcport->d_id.b.domain, fcport->d_id.b.area,
                    fcport->d_id.b.al_pa, mb_ret, opt);
 
-       DEBUG3(printk("%s(%ld): entered.\n", __func__, vha->host_no));
-
        mcp->mb[0] = MBC_LOGIN_LOOP_PORT;
        if (HAS_EXTENDED_IDS(ha))
                mcp->mb[1] = fcport->loop_id;
@@ -1845,15 +1816,12 @@ qla2x00_login_local_device(scsi_qla_host_t *vha, fc_port_t *fcport,
                if (mcp->mb[0] == 0x4005 || mcp->mb[0] == 0x4006)
                        rval = QLA_SUCCESS;
 
-               DEBUG(printk("%s(%ld): failed=%x mb[0]=%x mb[1]=%x "
-                   "mb[6]=%x mb[7]=%x.\n", __func__, vha->host_no, rval,
-                   mcp->mb[0], mcp->mb[1], mcp->mb[6], mcp->mb[7]));
-               DEBUG2_3(printk("%s(%ld): failed=%x mb[0]=%x mb[1]=%x "
-                   "mb[6]=%x mb[7]=%x.\n", __func__, vha->host_no, rval,
-                   mcp->mb[0], mcp->mb[1], mcp->mb[6], mcp->mb[7]));
+               ql_dbg(ql_dbg_mbx, vha, 0x106b,
+                   "Failed=%x mb[0]=%x mb[1]=%x mb[6]=%x mb[7]=%x.\n",
+                   rval, mcp->mb[0], mcp->mb[1], mcp->mb[6], mcp->mb[7]);
        } else {
                /*EMPTY*/
-               DEBUG3(printk("%s(%ld): done.\n", __func__, vha->host_no));
+               ql_dbg(ql_dbg_mbx, vha, 0x106c, "Done %s.\n", __func__);
        }
 
        return (rval);
@@ -1870,12 +1838,12 @@ qla24xx_fabric_logout(scsi_qla_host_t *vha, uint16_t loop_id, uint8_t domain,
        struct req_que *req;
        struct rsp_que *rsp;
 
-       DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no));
+       ql_dbg(ql_dbg_mbx, vha, 0x106d, "Entered %s.\n", __func__);
 
        lg = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &lg_dma);
        if (lg == NULL) {
-               DEBUG2_3(printk("%s(%ld): failed to allocate Logout IOCB.\n",
-                   __func__, vha->host_no));
+               ql_log(ql_log_warn, vha, 0x106e,
+                   "Failed to allocate logout IOCB.\n");
                return QLA_MEMORY_ALLOC_FAILED;
        }
        memset(lg, 0, sizeof(struct logio_entry_24xx));
@@ -1899,22 +1867,22 @@ qla24xx_fabric_logout(scsi_qla_host_t *vha, uint16_t loop_id, uint8_t domain,
 
        rval = qla2x00_issue_iocb(vha, lg, lg_dma, 0);
        if (rval != QLA_SUCCESS) {
-               DEBUG2_3_11(printk("%s(%ld): failed to issue Logout IOCB "
-                   "(%x).\n", __func__, vha->host_no, rval));
+               ql_dbg(ql_dbg_mbx, vha, 0x106f,
+                   "Failed to issue logout IOCB (%x).\n", rval);
        } else if (lg->entry_status != 0) {
-               DEBUG2_3_11(printk("%s(%ld): failed to complete IOCB "
-                   "-- error status (%x).\n", __func__, vha->host_no,
-                   lg->entry_status));
+               ql_dbg(ql_dbg_mbx, vha, 0x1070,
+                   "Failed to complete IOCB -- error status (%x).\n",
+                   lg->entry_status);
                rval = QLA_FUNCTION_FAILED;
        } else if (lg->comp_status != __constant_cpu_to_le16(CS_COMPLETE)) {
-               DEBUG2_3_11(printk("%s(%ld %d): failed to complete IOCB "
-                   "-- completion status (%x)  ioparam=%x/%x.\n", __func__,
-                   vha->host_no, vha->vp_idx, le16_to_cpu(lg->comp_status),
+               ql_dbg(ql_dbg_mbx, vha, 0x1071,
+                   "Failed to complete IOCB -- completion status (%x) "
+                   "ioparam=%x/%x.\n", le16_to_cpu(lg->comp_status),
                    le32_to_cpu(lg->io_parameter[0]),
-                   le32_to_cpu(lg->io_parameter[1])));
+                   le32_to_cpu(lg->io_parameter[1]));
        } else {
                /*EMPTY*/
-               DEBUG11(printk("%s(%ld): done.\n", __func__, vha->host_no));
+               ql_dbg(ql_dbg_mbx, vha, 0x1072, "Done %s.\n", __func__);
        }
 
        dma_pool_free(ha->s_dma_pool, lg, lg_dma);
@@ -1946,8 +1914,7 @@ qla2x00_fabric_logout(scsi_qla_host_t *vha, uint16_t loop_id, uint8_t domain,
        mbx_cmd_t mc;
        mbx_cmd_t *mcp = &mc;
 
-       DEBUG11(printk("qla2x00_fabric_logout(%ld): entered.\n",
-           vha->host_no));
+       ql_dbg(ql_dbg_mbx, vha, 0x1073, "Entered %s.\n", __func__);
 
        mcp->mb[0] = MBC_LOGOUT_FABRIC_PORT;
        mcp->out_mb = MBX_1|MBX_0;
@@ -1966,12 +1933,11 @@ qla2x00_fabric_logout(scsi_qla_host_t *vha, uint16_t loop_id, uint8_t domain,
 
        if (rval != QLA_SUCCESS) {
                /*EMPTY*/
-               DEBUG2_3_11(printk("qla2x00_fabric_logout(%ld): failed=%x "
-                   "mbx1=%x.\n", vha->host_no, rval, mcp->mb[1]));
+               ql_dbg(ql_dbg_mbx, vha, 0x1074,
+                   "Failed=%x mb[1]=%x.\n", rval, mcp->mb[1]);
        } else {
                /*EMPTY*/
-               DEBUG11(printk("qla2x00_fabric_logout(%ld): done.\n",
-                   vha->host_no));
+               ql_dbg(ql_dbg_mbx, vha, 0x1075, "Done %s.\n", __func__);
        }
 
        return rval;
@@ -1999,8 +1965,7 @@ qla2x00_full_login_lip(scsi_qla_host_t *vha)
        mbx_cmd_t mc;
        mbx_cmd_t *mcp = &mc;
 
-       DEBUG11(printk("qla2x00_full_login_lip(%ld): entered.\n",
-           vha->host_no));
+       ql_dbg(ql_dbg_mbx, vha, 0x1076, "Entered %s.\n", __func__);
 
        mcp->mb[0] = MBC_LIP_FULL_LOGIN;
        mcp->mb[1] = IS_FWI2_CAPABLE(vha->hw) ? BIT_3 : 0;
@@ -2014,12 +1979,10 @@ qla2x00_full_login_lip(scsi_qla_host_t *vha)
 
        if (rval != QLA_SUCCESS) {
                /*EMPTY*/
-               DEBUG2_3_11(printk("qla2x00_full_login_lip(%ld): failed=%x.\n",
-                   vha->host_no, rval));
+               ql_dbg(ql_dbg_mbx, vha, 0x1077, "Failed=%x.\n", rval);
        } else {
                /*EMPTY*/
-               DEBUG11(printk("qla2x00_full_login_lip(%ld): done.\n",
-                   vha->host_no));
+               ql_dbg(ql_dbg_mbx, vha, 0x1078, "Done %s.\n", __func__);
        }
 
        return rval;
@@ -2045,8 +2008,7 @@ qla2x00_get_id_list(scsi_qla_host_t *vha, void *id_list, dma_addr_t id_list_dma,
        mbx_cmd_t mc;
        mbx_cmd_t *mcp = &mc;
 
-       DEBUG11(printk("qla2x00_get_id_list(%ld): entered.\n",
-           vha->host_no));
+       ql_dbg(ql_dbg_mbx, vha, 0x1079, "Entered %s.\n", __func__);
 
        if (id_list == NULL)
                return QLA_FUNCTION_FAILED;
@@ -2075,12 +2037,10 @@ qla2x00_get_id_list(scsi_qla_host_t *vha, void *id_list, dma_addr_t id_list_dma,
 
        if (rval != QLA_SUCCESS) {
                /*EMPTY*/
-               DEBUG2_3_11(printk("qla2x00_get_id_list(%ld): failed=%x.\n",
-                   vha->host_no, rval));
+               ql_dbg(ql_dbg_mbx, vha, 0x107a, "Failed=%x.\n", rval);
        } else {
                *entries = mcp->mb[1];
-               DEBUG11(printk("qla2x00_get_id_list(%ld): done.\n",
-                   vha->host_no));
+               ql_dbg(ql_dbg_mbx, vha, 0x107b, "Done %s.\n", __func__);
        }
 
        return rval;
@@ -2108,7 +2068,7 @@ qla2x00_get_resource_cnts(scsi_qla_host_t *vha, uint16_t *cur_xchg_cnt,
        mbx_cmd_t mc;
        mbx_cmd_t *mcp = &mc;
 
-       DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no));
+       ql_dbg(ql_dbg_mbx, vha, 0x107c, "Entered %s.\n", __func__);
 
        mcp->mb[0] = MBC_GET_RESOURCE_COUNTS;
        mcp->out_mb = MBX_0;
@@ -2121,14 +2081,14 @@ qla2x00_get_resource_cnts(scsi_qla_host_t *vha, uint16_t *cur_xchg_cnt,
 
        if (rval != QLA_SUCCESS) {
                /*EMPTY*/
-               DEBUG2_3_11(printk("%s(%ld): failed = %x.\n", __func__,
-                   vha->host_no, mcp->mb[0]));
+               ql_dbg(ql_dbg_mbx, vha, 0x107d,
+                   "Failed mb[0]=%x.\n", mcp->mb[0]);
        } else {
-               DEBUG11(printk("%s(%ld): done. mb1=%x mb2=%x mb3=%x mb6=%x "
-                   "mb7=%x mb10=%x mb11=%x mb12=%x.\n", __func__,
-                   vha->host_no, mcp->mb[1], mcp->mb[2], mcp->mb[3],
-                   mcp->mb[6], mcp->mb[7], mcp->mb[10], mcp->mb[11],
-                   mcp->mb[12]));
+               ql_dbg(ql_dbg_mbx, vha, 0x107e,
+                   "Done %s mb1=%x mb2=%x mb3=%x mb6=%x mb7=%x mb10=%x "
+                   "mb11=%x mb12=%x.\n", __func__, mcp->mb[1], mcp->mb[2],
+                   mcp->mb[3], mcp->mb[6], mcp->mb[7], mcp->mb[10],
+                   mcp->mb[11], mcp->mb[12]);
 
                if (cur_xchg_cnt)
                        *cur_xchg_cnt = mcp->mb[3];
@@ -2147,7 +2107,6 @@ qla2x00_get_resource_cnts(scsi_qla_host_t *vha, uint16_t *cur_xchg_cnt,
        return (rval);
 }
 
-#if defined(QL_DEBUG_LEVEL_3)
 /*
  * qla2x00_get_fcal_position_map
  *     Get FCAL (LILP) position map using mailbox command
@@ -2172,10 +2131,12 @@ qla2x00_get_fcal_position_map(scsi_qla_host_t *vha, char *pos_map)
        dma_addr_t pmap_dma;
        struct qla_hw_data *ha = vha->hw;
 
+       ql_dbg(ql_dbg_mbx, vha, 0x107f, "Entered %s.\n", __func__);
+
        pmap = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &pmap_dma);
        if (pmap  == NULL) {
-               DEBUG2_3_11(printk("%s(%ld): **** Mem Alloc Failed ****",
-                   __func__, vha->host_no));
+               ql_log(ql_log_warn, vha, 0x1080,
+                   "Memory alloc failed.\n");
                return QLA_MEMORY_ALLOC_FAILED;
        }
        memset(pmap, 0, FCAL_MAP_SIZE);
@@ -2193,10 +2154,11 @@ qla2x00_get_fcal_position_map(scsi_qla_host_t *vha, char *pos_map)
        rval = qla2x00_mailbox_command(vha, mcp);
 
        if (rval == QLA_SUCCESS) {
-               DEBUG11(printk("%s(%ld): (mb0=%x/mb1=%x) FC/AL Position Map "
-                   "size (%x)\n", __func__, vha->host_no, mcp->mb[0],
-                   mcp->mb[1], (unsigned)pmap[0]));
-               DEBUG11(qla2x00_dump_buffer(pmap, pmap[0] + 1));
+               ql_dbg(ql_dbg_mbx, vha, 0x1081,
+                   "mb0/mb1=%x/%X FC/AL position map size (%x).\n",
+                   mcp->mb[0], mcp->mb[1], (unsigned)pmap[0]);
+               ql_dump_buffer(ql_dbg_mbx + ql_dbg_buffer, vha, 0x111d,
+                   pmap, pmap[0] + 1);
 
                if (pos_map)
                        memcpy(pos_map, pmap, FCAL_MAP_SIZE);
@@ -2204,15 +2166,13 @@ qla2x00_get_fcal_position_map(scsi_qla_host_t *vha, char *pos_map)
        dma_pool_free(ha->s_dma_pool, pmap, pmap_dma);
 
        if (rval != QLA_SUCCESS) {
-               DEBUG2_3_11(printk("%s(%ld): failed=%x.\n", __func__,
-                   vha->host_no, rval));
+               ql_dbg(ql_dbg_mbx, vha, 0x1082, "Failed=%x.\n", rval);
        } else {
-               DEBUG11(printk("%s(%ld): done.\n", __func__, vha->host_no));
+               ql_dbg(ql_dbg_mbx, vha, 0x1083, "Done %s.\n", __func__);
        }
 
        return rval;
 }
-#endif
 
 /*
  * qla2x00_get_link_status
@@ -2237,7 +2197,7 @@ qla2x00_get_link_status(scsi_qla_host_t *vha, uint16_t loop_id,
        uint32_t *siter, *diter, dwords;
        struct qla_hw_data *ha = vha->hw;
 
-       DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no));
+       ql_dbg(ql_dbg_mbx, vha, 0x1084, "Entered %s.\n", __func__);
 
        mcp->mb[0] = MBC_GET_LINK_STATUS;
        mcp->mb[2] = MSW(stats_dma);
@@ -2266,11 +2226,12 @@ qla2x00_get_link_status(scsi_qla_host_t *vha, uint16_t loop_id,
 
        if (rval == QLA_SUCCESS) {
                if (mcp->mb[0] != MBS_COMMAND_COMPLETE) {
-                       DEBUG2_3_11(printk("%s(%ld): cmd failed. mbx0=%x.\n",
-                           __func__, vha->host_no, mcp->mb[0]));
+                       ql_dbg(ql_dbg_mbx, vha, 0x1085,
+                           "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]);
                        rval = QLA_FUNCTION_FAILED;
                } else {
                        /* Copy over data -- firmware data is LE. */
+                       ql_dbg(ql_dbg_mbx, vha, 0x1086, "Done %s.\n", __func__);
                        dwords = offsetof(struct link_statistics, unused1) / 4;
                        siter = diter = &stats->link_fail_cnt;
                        while (dwords--)
@@ -2278,8 +2239,7 @@ qla2x00_get_link_status(scsi_qla_host_t *vha, uint16_t loop_id,
                }
        } else {
                /* Failed. */
-               DEBUG2_3_11(printk("%s(%ld): failed=%x.\n", __func__,
-                   vha->host_no, rval));
+               ql_dbg(ql_dbg_mbx, vha, 0x1087, "Failed=%x.\n", rval);
        }
 
        return rval;
@@ -2294,7 +2254,7 @@ qla24xx_get_isp_stats(scsi_qla_host_t *vha, struct link_statistics *stats,
        mbx_cmd_t *mcp = &mc;
        uint32_t *siter, *diter, dwords;
 
-       DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no));
+       ql_dbg(ql_dbg_mbx, vha, 0x1088, "Entered %s.\n", __func__);
 
        mcp->mb[0] = MBC_GET_LINK_PRIV_STATS;
        mcp->mb[2] = MSW(stats_dma);
@@ -2312,10 +2272,11 @@ qla24xx_get_isp_stats(scsi_qla_host_t *vha, struct link_statistics *stats,
 
        if (rval == QLA_SUCCESS) {
                if (mcp->mb[0] != MBS_COMMAND_COMPLETE) {
-                       DEBUG2_3_11(printk("%s(%ld): cmd failed. mbx0=%x.\n",
-                           __func__, vha->host_no, mcp->mb[0]));
+                       ql_dbg(ql_dbg_mbx, vha, 0x1089,
+                           "Failed mb[0]=%x.\n", mcp->mb[0]);
                        rval = QLA_FUNCTION_FAILED;
                } else {
+                       ql_dbg(ql_dbg_mbx, vha, 0x108a, "Done %s.\n", __func__);
                        /* Copy over data -- firmware data is LE. */
                        dwords = sizeof(struct link_statistics) / 4;
                        siter = diter = &stats->link_fail_cnt;
@@ -2324,8 +2285,7 @@ qla24xx_get_isp_stats(scsi_qla_host_t *vha, struct link_statistics *stats,
                }
        } else {
                /* Failed. */
-               DEBUG2_3_11(printk("%s(%ld): failed=%x.\n", __func__,
-                   vha->host_no, rval));
+               ql_dbg(ql_dbg_mbx, vha, 0x108b, "Failed=%x.\n", rval);
        }
 
        return rval;
@@ -2345,7 +2305,7 @@ qla24xx_abort_command(srb_t *sp)
        struct qla_hw_data *ha = vha->hw;
        struct req_que *req = vha->req;
 
-       DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no));
+       ql_dbg(ql_dbg_mbx, vha, 0x108c, "Entered %s.\n", __func__);
 
        spin_lock_irqsave(&ha->hardware_lock, flags);
        for (handle = 1; handle < MAX_OUTSTANDING_COMMANDS; handle++) {
@@ -2360,8 +2320,8 @@ qla24xx_abort_command(srb_t *sp)
 
        abt = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &abt_dma);
        if (abt == NULL) {
-               DEBUG2_3(printk("%s(%ld): failed to allocate Abort IOCB.\n",
-                   __func__, vha->host_no));
+               ql_log(ql_log_warn, vha, 0x108d,
+                   "Failed to allocate abort IOCB.\n");
                return QLA_MEMORY_ALLOC_FAILED;
        }
        memset(abt, 0, sizeof(struct abort_entry_24xx));
@@ -2380,20 +2340,20 @@ qla24xx_abort_command(srb_t *sp)
 
        rval = qla2x00_issue_iocb(vha, abt, abt_dma, 0);
        if (rval != QLA_SUCCESS) {
-               DEBUG2_3_11(printk("%s(%ld): failed to issue IOCB (%x).\n",
-                   __func__, vha->host_no, rval));
+               ql_dbg(ql_dbg_mbx, vha, 0x108e,
+                   "Failed to issue IOCB (%x).\n", rval);
        } else if (abt->entry_status != 0) {
-               DEBUG2_3_11(printk("%s(%ld): failed to complete IOCB "
-                   "-- error status (%x).\n", __func__, vha->host_no,
-                   abt->entry_status));
+               ql_dbg(ql_dbg_mbx, vha, 0x108f,
+                   "Failed to complete IOCB -- error status (%x).\n",
+                   abt->entry_status);
                rval = QLA_FUNCTION_FAILED;
        } else if (abt->nport_handle != __constant_cpu_to_le16(0)) {
-               DEBUG2_3_11(printk("%s(%ld): failed to complete IOCB "
-                   "-- completion status (%x).\n", __func__, vha->host_no,
-                   le16_to_cpu(abt->nport_handle)));
+               ql_dbg(ql_dbg_mbx, vha, 0x1090,
+                   "Failed to complete IOCB -- completion status (%x).\n",
+                   le16_to_cpu(abt->nport_handle));
                rval = QLA_FUNCTION_FAILED;
        } else {
-               DEBUG11(printk("%s(%ld): done.\n", __func__, vha->host_no));
+               ql_dbg(ql_dbg_mbx, vha, 0x1091, "Done %s.\n", __func__);
        }
 
        dma_pool_free(ha->s_dma_pool, abt, abt_dma);
@@ -2421,19 +2381,20 @@ __qla24xx_issue_tmf(char *name, uint32_t type, struct fc_port *fcport,
        struct req_que *req;
        struct rsp_que *rsp;
 
-       DEBUG11(printk("%s(%ld): entered.\n", __func__, fcport->vha->host_no));
-
        vha = fcport->vha;
        ha = vha->hw;
        req = vha->req;
+
+       ql_dbg(ql_dbg_mbx, vha, 0x1092, "Entered %s.\n", __func__);
+
        if (ha->flags.cpu_affinity_enabled)
                rsp = ha->rsp_q_map[tag + 1];
        else
                rsp = req->rsp;
        tsk = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &tsk_dma);
        if (tsk == NULL) {
-               DEBUG2_3(printk("%s(%ld): failed to allocate Task Management "
-                   "IOCB.\n", __func__, vha->host_no));
+               ql_log(ql_log_warn, vha, 0x1093,
+                   "Failed to allocate task management IOCB.\n");
                return QLA_MEMORY_ALLOC_FAILED;
        }
        memset(tsk, 0, sizeof(struct tsk_mgmt_cmd));
@@ -2457,30 +2418,30 @@ __qla24xx_issue_tmf(char *name, uint32_t type, struct fc_port *fcport,
        sts = &tsk->p.sts;
        rval = qla2x00_issue_iocb(vha, tsk, tsk_dma, 0);
        if (rval != QLA_SUCCESS) {
-               DEBUG2_3_11(printk("%s(%ld): failed to issue %s Reset IOCB "
-                   "(%x).\n", __func__, vha->host_no, name, rval));
+               ql_dbg(ql_dbg_mbx, vha, 0x1094,
+                   "Failed to issue %s reset IOCB (%x).\n", name, rval);
        } else if (sts->entry_status != 0) {
-               DEBUG2_3_11(printk("%s(%ld): failed to complete IOCB "
-                   "-- error status (%x).\n", __func__, vha->host_no,
-                   sts->entry_status));
+               ql_dbg(ql_dbg_mbx, vha, 0x1095,
+                   "Failed to complete IOCB -- error status (%x).\n",
+                   sts->entry_status);
                rval = QLA_FUNCTION_FAILED;
        } else if (sts->comp_status !=
            __constant_cpu_to_le16(CS_COMPLETE)) {
-               DEBUG2_3_11(printk("%s(%ld): failed to complete IOCB "
-                   "-- completion status (%x).\n", __func__,
-                   vha->host_no, le16_to_cpu(sts->comp_status)));
+               ql_dbg(ql_dbg_mbx, vha, 0x1096,
+                   "Failed to complete IOCB -- completion status (%x).\n",
+                   le16_to_cpu(sts->comp_status));
                rval = QLA_FUNCTION_FAILED;
        } else if (le16_to_cpu(sts->scsi_status) &
            SS_RESPONSE_INFO_LEN_VALID) {
                if (le32_to_cpu(sts->rsp_data_len) < 4) {
-                       DEBUG2_3_11(printk("%s(%ld): ignoring inconsistent "
-                           "data length -- not enough response info (%d).\n",
-                           __func__, vha->host_no,
-                           le32_to_cpu(sts->rsp_data_len)));
+                       ql_dbg(ql_dbg_mbx, vha, 0x1097,
+                           "Ignoring inconsistent data length -- not enough "
+                           "response info (%d).\n",
+                           le32_to_cpu(sts->rsp_data_len));
                } else if (sts->data[3]) {
-                       DEBUG2_3_11(printk("%s(%ld): failed to complete IOCB "
-                           "-- response (%x).\n", __func__,
-                           vha->host_no, sts->data[3]));
+                       ql_dbg(ql_dbg_mbx, vha, 0x1098,
+                           "Failed to complete IOCB -- response (%x).\n",
+                           sts->data[3]);
                        rval = QLA_FUNCTION_FAILED;
                }
        }
@@ -2489,10 +2450,10 @@ __qla24xx_issue_tmf(char *name, uint32_t type, struct fc_port *fcport,
        rval2 = qla2x00_marker(vha, req, rsp, fcport->loop_id, l,
            type == TCF_LUN_RESET ? MK_SYNC_ID_LUN: MK_SYNC_ID);
        if (rval2 != QLA_SUCCESS) {
-               DEBUG2_3_11(printk("%s(%ld): failed to issue Marker IOCB "
-                   "(%x).\n", __func__, vha->host_no, rval2));
+               ql_dbg(ql_dbg_mbx, vha, 0x1099,
+                   "Failed to issue marker IOCB (%x).\n", rval2);
        } else {
-               DEBUG11(printk("%s(%ld): done.\n", __func__, vha->host_no));
+               ql_dbg(ql_dbg_mbx, vha, 0x109a, "Done %s.\n", __func__);
        }
 
        dma_pool_free(ha->s_dma_pool, tsk, tsk_dma);
@@ -2533,7 +2494,7 @@ qla2x00_system_error(scsi_qla_host_t *vha)
        if (!IS_QLA23XX(ha) && !IS_FWI2_CAPABLE(ha))
                return QLA_FUNCTION_FAILED;
 
-       DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no));
+       ql_dbg(ql_dbg_mbx, vha, 0x109b, "Entered %s.\n", __func__);
 
        mcp->mb[0] = MBC_GEN_SYSTEM_ERROR;
        mcp->out_mb = MBX_0;
@@ -2543,10 +2504,9 @@ qla2x00_system_error(scsi_qla_host_t *vha)
        rval = qla2x00_mailbox_command(vha, mcp);
 
        if (rval != QLA_SUCCESS) {
-               DEBUG2_3_11(printk("%s(%ld): failed=%x.\n", __func__,
-                   vha->host_no, rval));
+               ql_dbg(ql_dbg_mbx, vha, 0x109c, "Failed=%x.\n", rval);
        } else {
-               DEBUG11(printk("%s(%ld): done.\n", __func__, vha->host_no));
+               ql_dbg(ql_dbg_mbx, vha, 0x109d, "Done %s.\n", __func__);
        }
 
        return rval;
@@ -2566,7 +2526,7 @@ qla2x00_set_serdes_params(scsi_qla_host_t *vha, uint16_t sw_em_1g,
        mbx_cmd_t mc;
        mbx_cmd_t *mcp = &mc;
 
-       DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no));
+       ql_dbg(ql_dbg_mbx, vha, 0x109e, "Entered %s.\n", __func__);
 
        mcp->mb[0] = MBC_SERDES_PARAMS;
        mcp->mb[1] = BIT_0;
@@ -2581,11 +2541,11 @@ qla2x00_set_serdes_params(scsi_qla_host_t *vha, uint16_t sw_em_1g,
 
        if (rval != QLA_SUCCESS) {
                /*EMPTY*/
-               DEBUG2_3_11(printk("%s(%ld): failed=%x (%x).\n", __func__,
-                   vha->host_no, rval, mcp->mb[0]));
+               ql_dbg(ql_dbg_mbx, vha, 0x109f,
+                   "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]);
        } else {
                /*EMPTY*/
-               DEBUG11(printk("%s(%ld): done.\n", __func__, vha->host_no));
+               ql_dbg(ql_dbg_mbx, vha, 0x10a0, "Done %s.\n", __func__);
        }
 
        return rval;
@@ -2601,7 +2561,7 @@ qla2x00_stop_firmware(scsi_qla_host_t *vha)
        if (!IS_FWI2_CAPABLE(vha->hw))
                return QLA_FUNCTION_FAILED;
 
-       DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no));
+       ql_dbg(ql_dbg_mbx, vha, 0x10a1, "Entered %s.\n", __func__);
 
        mcp->mb[0] = MBC_STOP_FIRMWARE;
        mcp->out_mb = MBX_0;
@@ -2611,12 +2571,11 @@ qla2x00_stop_firmware(scsi_qla_host_t *vha)
        rval = qla2x00_mailbox_command(vha, mcp);
 
        if (rval != QLA_SUCCESS) {
-               DEBUG2_3_11(printk("%s(%ld): failed=%x.\n", __func__,
-                   vha->host_no, rval));
+               ql_dbg(ql_dbg_mbx, vha, 0x10a2, "Failed=%x.\n", rval);
                if (mcp->mb[0] == MBS_INVALID_COMMAND)
                        rval = QLA_INVALID_COMMAND;
        } else {
-               DEBUG11(printk("%s(%ld): done.\n", __func__, vha->host_no));
+               ql_dbg(ql_dbg_mbx, vha, 0x10a3, "Done %s.\n", __func__);
        }
 
        return rval;
@@ -2630,14 +2589,14 @@ qla2x00_enable_eft_trace(scsi_qla_host_t *vha, dma_addr_t eft_dma,
        mbx_cmd_t mc;
        mbx_cmd_t *mcp = &mc;
 
+       ql_dbg(ql_dbg_mbx, vha, 0x10a4, "Entered %s.\n", __func__);
+
        if (!IS_FWI2_CAPABLE(vha->hw))
                return QLA_FUNCTION_FAILED;
 
        if (unlikely(pci_channel_offline(vha->hw->pdev)))
                return QLA_FUNCTION_FAILED;
 
-       DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no));
-
        mcp->mb[0] = MBC_TRACE_CONTROL;
        mcp->mb[1] = TC_EFT_ENABLE;
        mcp->mb[2] = LSW(eft_dma);
@@ -2652,10 +2611,11 @@ qla2x00_enable_eft_trace(scsi_qla_host_t *vha, dma_addr_t eft_dma,
        mcp->flags = 0;
        rval = qla2x00_mailbox_command(vha, mcp);
        if (rval != QLA_SUCCESS) {
-               DEBUG2_3_11(printk("%s(%ld): failed=%x mb[0]=%x mb[1]=%x.\n",
-                   __func__, vha->host_no, rval, mcp->mb[0], mcp->mb[1]));
+               ql_dbg(ql_dbg_mbx, vha, 0x10a5,
+                   "Failed=%x mb[0]=%x mb[1]=%x.\n",
+                   rval, mcp->mb[0], mcp->mb[1]);
        } else {
-               DEBUG11(printk("%s(%ld): done.\n", __func__, vha->host_no));
+               ql_dbg(ql_dbg_mbx, vha, 0x10a6, "Done %s.\n", __func__);
        }
 
        return rval;
@@ -2668,14 +2628,14 @@ qla2x00_disable_eft_trace(scsi_qla_host_t *vha)
        mbx_cmd_t mc;
        mbx_cmd_t *mcp = &mc;
 
+       ql_dbg(ql_dbg_mbx, vha, 0x10a7, "Entered %s.\n", __func__);
+
        if (!IS_FWI2_CAPABLE(vha->hw))
                return QLA_FUNCTION_FAILED;
 
        if (unlikely(pci_channel_offline(vha->hw->pdev)))
                return QLA_FUNCTION_FAILED;
 
-       DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no));
-
        mcp->mb[0] = MBC_TRACE_CONTROL;
        mcp->mb[1] = TC_EFT_DISABLE;
        mcp->out_mb = MBX_1|MBX_0;
@@ -2684,10 +2644,11 @@ qla2x00_disable_eft_trace(scsi_qla_host_t *vha)
        mcp->flags = 0;
        rval = qla2x00_mailbox_command(vha, mcp);
        if (rval != QLA_SUCCESS) {
-               DEBUG2_3_11(printk("%s(%ld): failed=%x mb[0]=%x mb[1]=%x.\n",
-                   __func__, vha->host_no, rval, mcp->mb[0], mcp->mb[1]));
+               ql_dbg(ql_dbg_mbx, vha, 0x10a8,
+                   "Failed=%x mb[0]=%x mb[1]=%x.\n",
+                   rval, mcp->mb[0], mcp->mb[1]);
        } else {
-               DEBUG11(printk("%s(%ld): done.\n", __func__, vha->host_no));
+               ql_dbg(ql_dbg_mbx, vha, 0x10a9, "Done %s.\n", __func__);
        }
 
        return rval;
@@ -2701,14 +2662,14 @@ qla2x00_enable_fce_trace(scsi_qla_host_t *vha, dma_addr_t fce_dma,
        mbx_cmd_t mc;
        mbx_cmd_t *mcp = &mc;
 
+       ql_dbg(ql_dbg_mbx, vha, 0x10aa, "Entered %s.\n", __func__);
+
        if (!IS_QLA25XX(vha->hw) && !IS_QLA81XX(vha->hw))
                return QLA_FUNCTION_FAILED;
 
        if (unlikely(pci_channel_offline(vha->hw->pdev)))
                return QLA_FUNCTION_FAILED;
 
-       DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no));
-
        mcp->mb[0] = MBC_TRACE_CONTROL;
        mcp->mb[1] = TC_FCE_ENABLE;
        mcp->mb[2] = LSW(fce_dma);
@@ -2727,10 +2688,11 @@ qla2x00_enable_fce_trace(scsi_qla_host_t *vha, dma_addr_t fce_dma,
        mcp->flags = 0;
        rval = qla2x00_mailbox_command(vha, mcp);
        if (rval != QLA_SUCCESS) {
-               DEBUG2_3_11(printk("%s(%ld): failed=%x mb[0]=%x mb[1]=%x.\n",
-                   __func__, vha->host_no, rval, mcp->mb[0], mcp->mb[1]));
+               ql_dbg(ql_dbg_mbx, vha, 0x10ab,
+                   "Failed=%x mb[0]=%x mb[1]=%x.\n",
+                   rval, mcp->mb[0], mcp->mb[1]);
        } else {
-               DEBUG11(printk("%s(%ld): done.\n", __func__, vha->host_no));
+               ql_dbg(ql_dbg_mbx, vha, 0x10ac, "Done %s.\n", __func__);
 
                if (mb)
                        memcpy(mb, mcp->mb, 8 * sizeof(*mb));
@@ -2748,14 +2710,14 @@ qla2x00_disable_fce_trace(scsi_qla_host_t *vha, uint64_t *wr, uint64_t *rd)
        mbx_cmd_t mc;
        mbx_cmd_t *mcp = &mc;
 
+       ql_dbg(ql_dbg_mbx, vha, 0x10ad, "Entered %s.\n", __func__);
+
        if (!IS_FWI2_CAPABLE(vha->hw))
                return QLA_FUNCTION_FAILED;
 
        if (unlikely(pci_channel_offline(vha->hw->pdev)))
                return QLA_FUNCTION_FAILED;
 
-       DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no));
-
        mcp->mb[0] = MBC_TRACE_CONTROL;
        mcp->mb[1] = TC_FCE_DISABLE;
        mcp->mb[2] = TC_FCE_DISABLE_TRACE;
@@ -2766,10 +2728,11 @@ qla2x00_disable_fce_trace(scsi_qla_host_t *vha, uint64_t *wr, uint64_t *rd)
        mcp->flags = 0;
        rval = qla2x00_mailbox_command(vha, mcp);
        if (rval != QLA_SUCCESS) {
-               DEBUG2_3_11(printk("%s(%ld): failed=%x mb[0]=%x mb[1]=%x.\n",
-                   __func__, vha->host_no, rval, mcp->mb[0], mcp->mb[1]));
+               ql_dbg(ql_dbg_mbx, vha, 0x10ae,
+                   "Failed=%x mb[0]=%x mb[1]=%x.\n",
+                   rval, mcp->mb[0], mcp->mb[1]);
        } else {
-               DEBUG11(printk("%s(%ld): done.\n", __func__, vha->host_no));
+               ql_dbg(ql_dbg_mbx, vha, 0x10af, "Done %s.\n", __func__);
 
                if (wr)
                        *wr = (uint64_t) mcp->mb[5] << 48 |
@@ -2794,11 +2757,11 @@ qla2x00_get_idma_speed(scsi_qla_host_t *vha, uint16_t loop_id,
        mbx_cmd_t mc;
        mbx_cmd_t *mcp = &mc;
 
+       ql_dbg(ql_dbg_mbx, vha, 0x10b0, "Entered %s.\n", __func__);
+
        if (!IS_IIDMA_CAPABLE(vha->hw))
                return QLA_FUNCTION_FAILED;
 
-       DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no));
-
        mcp->mb[0] = MBC_PORT_PARAMS;
        mcp->mb[1] = loop_id;
        mcp->mb[2] = mcp->mb[3] = 0;
@@ -2817,10 +2780,9 @@ qla2x00_get_idma_speed(scsi_qla_host_t *vha, uint16_t loop_id,
        }
 
        if (rval != QLA_SUCCESS) {
-               DEBUG2_3_11(printk("%s(%ld): failed=%x.\n", __func__,
-                   vha->host_no, rval));
+               ql_dbg(ql_dbg_mbx, vha, 0x10b1, "Failed=%x.\n", rval);
        } else {
-               DEBUG11(printk("%s(%ld): done.\n", __func__, vha->host_no));
+               ql_dbg(ql_dbg_mbx, vha, 0x10b2, "Done %s.\n", __func__);
                if (port_speed)
                        *port_speed = mcp->mb[3];
        }
@@ -2836,11 +2798,11 @@ qla2x00_set_idma_speed(scsi_qla_host_t *vha, uint16_t loop_id,
        mbx_cmd_t mc;
        mbx_cmd_t *mcp = &mc;
 
+       ql_dbg(ql_dbg_mbx, vha, 0x10b3, "Entered %s.\n", __func__);
+
        if (!IS_IIDMA_CAPABLE(vha->hw))
                return QLA_FUNCTION_FAILED;
 
-       DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no));
-
        mcp->mb[0] = MBC_PORT_PARAMS;
        mcp->mb[1] = loop_id;
        mcp->mb[2] = BIT_0;
@@ -2863,10 +2825,9 @@ qla2x00_set_idma_speed(scsi_qla_host_t *vha, uint16_t loop_id,
        }
 
        if (rval != QLA_SUCCESS) {
-               DEBUG2_3_11(printk("%s(%ld): failed=%x.\n", __func__,
-                   vha->host_no, rval));
+               ql_dbg(ql_dbg_mbx, vha, 0x10b4, "Failed=%x.\n", rval);
        } else {
-               DEBUG11(printk("%s(%ld): done.\n", __func__, vha->host_no));
+               ql_dbg(ql_dbg_mbx, vha, 0x10b5, "Done %s.\n", __func__);
        }
 
        return rval;
@@ -2882,33 +2843,36 @@ qla24xx_report_id_acquisition(scsi_qla_host_t *vha,
        scsi_qla_host_t *vp;
        unsigned long   flags;
 
+       ql_dbg(ql_dbg_mbx, vha, 0x10b6, "Entered %s.\n", __func__);
+
        if (rptid_entry->entry_status != 0)
                return;
 
        if (rptid_entry->format == 0) {
-               DEBUG15(printk("%s:format 0 : scsi(%ld) number of VPs setup %d,"
-                       " number of VPs acquired %d\n", __func__, vha->host_no,
-                       MSB(le16_to_cpu(rptid_entry->vp_count)),
-                       LSB(le16_to_cpu(rptid_entry->vp_count))));
-               DEBUG15(printk("%s primary port id %02x%02x%02x\n", __func__,
-                       rptid_entry->port_id[2], rptid_entry->port_id[1],
-                       rptid_entry->port_id[0]));
+               ql_dbg(ql_dbg_mbx, vha, 0x10b7,
+                   "Format 0 : Number of VPs setup %d, number of "
+                   "VPs acquired %d.\n",
+                   MSB(le16_to_cpu(rptid_entry->vp_count)),
+                   LSB(le16_to_cpu(rptid_entry->vp_count)));
+               ql_dbg(ql_dbg_mbx, vha, 0x10b8,
+                   "Primary port id %02x%02x%02x.\n",
+                   rptid_entry->port_id[2], rptid_entry->port_id[1],
+                   rptid_entry->port_id[0]);
        } else if (rptid_entry->format == 1) {
                vp_idx = LSB(stat);
-               DEBUG15(printk("%s:format 1: scsi(%ld): VP[%d] enabled "
-                   "- status %d - "
-                   "with port id %02x%02x%02x\n", __func__, vha->host_no,
-                   vp_idx, MSB(stat),
+               ql_dbg(ql_dbg_mbx, vha, 0x10b9,
+                   "Format 1: VP[%d] enabled - status %d - with "
+                   "port id %02x%02x%02x.\n", vp_idx, MSB(stat),
                    rptid_entry->port_id[2], rptid_entry->port_id[1],
-                   rptid_entry->port_id[0]));
+                   rptid_entry->port_id[0]);
 
                vp = vha;
                if (vp_idx == 0 && (MSB(stat) != 1))
                        goto reg_needed;
 
                if (MSB(stat) == 1) {
-                       DEBUG2(printk("scsi(%ld): Could not acquire ID for "
-                           "VP[%d].\n", vha->host_no, vp_idx));
+                       ql_dbg(ql_dbg_mbx, vha, 0x10ba,
+                           "Could not acquire ID for VP[%d].\n", vp_idx);
                        return;
                }
 
@@ -2963,10 +2927,12 @@ qla24xx_modify_vp_config(scsi_qla_host_t *vha)
 
        /* This can be called by the parent */
 
+       ql_dbg(ql_dbg_mbx, vha, 0x10bb, "Entered %s.\n", __func__);
+
        vpmod = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &vpmod_dma);
        if (!vpmod) {
-               DEBUG2_3(printk("%s(%ld): failed to allocate Modify VP "
-                   "IOCB.\n", __func__, vha->host_no));
+               ql_log(ql_log_warn, vha, 0x10bc,
+                   "Failed to allocate modify VP IOCB.\n");
                return QLA_MEMORY_ALLOC_FAILED;
        }
 
@@ -2983,22 +2949,21 @@ qla24xx_modify_vp_config(scsi_qla_host_t *vha)
 
        rval = qla2x00_issue_iocb(base_vha, vpmod, vpmod_dma, 0);
        if (rval != QLA_SUCCESS) {
-               DEBUG2_3_11(printk("%s(%ld): failed to issue VP config IOCB"
-                       "(%x).\n", __func__, base_vha->host_no, rval));
+               ql_dbg(ql_dbg_mbx, vha, 0x10bd,
+                   "Failed to issue VP config IOCB (%x).\n", rval);
        } else if (vpmod->comp_status != 0) {
-               DEBUG2_3_11(printk("%s(%ld): failed to complete IOCB "
-                       "-- error status (%x).\n", __func__, base_vha->host_no,
-                       vpmod->comp_status));
+               ql_dbg(ql_dbg_mbx, vha, 0x10be,
+                   "Failed to complete IOCB -- error status (%x).\n",
+                   vpmod->comp_status);
                rval = QLA_FUNCTION_FAILED;
        } else if (vpmod->comp_status != __constant_cpu_to_le16(CS_COMPLETE)) {
-               DEBUG2_3_11(printk("%s(%ld): failed to complete IOCB "
-                   "-- completion status (%x).\n", __func__, base_vha->host_no,
-                   le16_to_cpu(vpmod->comp_status)));
+               ql_dbg(ql_dbg_mbx, vha, 0x10bf,
+                   "Failed to complete IOCB -- completion status (%x).\n",
+                   le16_to_cpu(vpmod->comp_status));
                rval = QLA_FUNCTION_FAILED;
        } else {
                /* EMPTY */
-               DEBUG11(printk("%s(%ld): done.\n", __func__,
-                                                       base_vha->host_no));
+               ql_dbg(ql_dbg_mbx, vha, 0x10c0, "Done %s.\n", __func__);
                fc_vport_set_state(vha->fc_vport, FC_VPORT_INITIALIZING);
        }
        dma_pool_free(ha->s_dma_pool, vpmod, vpmod_dma);
@@ -3032,17 +2997,16 @@ qla24xx_control_vp(scsi_qla_host_t *vha, int cmd)
        int     vp_index = vha->vp_idx;
        struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev);
 
-       DEBUG11(printk("%s(%ld): entered. Enabling index %d\n", __func__,
-           vha->host_no, vp_index));
+       ql_dbg(ql_dbg_mbx, vha, 0x10c1,
+           "Entered %s enabling index %d.\n", __func__, vp_index);
 
        if (vp_index == 0 || vp_index >= ha->max_npiv_vports)
                return QLA_PARAMETER_ERROR;
 
        vce = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &vce_dma);
        if (!vce) {
-               DEBUG2_3(printk("%s(%ld): "
-                   "failed to allocate VP Control IOCB.\n", __func__,
-                   base_vha->host_no));
+               ql_log(ql_log_warn, vha, 0x10c2,
+                   "Failed to allocate VP control IOCB.\n");
                return QLA_MEMORY_ALLOC_FAILED;
        }
        memset(vce, 0, sizeof(struct vp_ctrl_entry_24xx));
@@ -3063,28 +3027,20 @@ qla24xx_control_vp(scsi_qla_host_t *vha, int cmd)
 
        rval = qla2x00_issue_iocb(base_vha, vce, vce_dma, 0);
        if (rval != QLA_SUCCESS) {
-               DEBUG2_3_11(printk("%s(%ld): failed to issue VP control IOCB"
-                   "(%x).\n", __func__, base_vha->host_no, rval));
-               printk("%s(%ld): failed to issue VP control IOCB"
-                   "(%x).\n", __func__, base_vha->host_no, rval);
+               ql_dbg(ql_dbg_mbx, vha, 0x10c3,
+                   "Failed to issue VP control IOCB (%x).\n", rval);
        } else if (vce->entry_status != 0) {
-               DEBUG2_3_11(printk("%s(%ld): failed to complete IOCB "
-                   "-- error status (%x).\n", __func__, base_vha->host_no,
-                   vce->entry_status));
-               printk("%s(%ld): failed to complete IOCB "
-                   "-- error status (%x).\n", __func__, base_vha->host_no,
+               ql_dbg(ql_dbg_mbx, vha, 0x10c4,
+                   "Failed to complete IOCB -- error status (%x).\n",
                    vce->entry_status);
                rval = QLA_FUNCTION_FAILED;
        } else if (vce->comp_status != __constant_cpu_to_le16(CS_COMPLETE)) {
-               DEBUG2_3_11(printk("%s(%ld): failed to complete IOCB "
-                   "-- completion status (%x).\n", __func__, base_vha->host_no,
-                   le16_to_cpu(vce->comp_status)));
-               printk("%s(%ld): failed to complete IOCB "
-                   "-- completion status (%x).\n", __func__, base_vha->host_no,
+               ql_dbg(ql_dbg_mbx, vha, 0x10c5,
+                   "Failed to complet IOCB -- completion status (%x).\n",
                    le16_to_cpu(vce->comp_status));
                rval = QLA_FUNCTION_FAILED;
        } else {
-               DEBUG2(printk("%s(%ld): done.\n", __func__, base_vha->host_no));
+               ql_dbg(ql_dbg_mbx, vha, 0x10c6, "Done %s.\n", __func__);
        }
 
        dma_pool_free(ha->s_dma_pool, vce, vce_dma);
@@ -3121,6 +3077,8 @@ qla2x00_send_change_request(scsi_qla_host_t *vha, uint16_t format,
        mbx_cmd_t mc;
        mbx_cmd_t *mcp = &mc;
 
+       ql_dbg(ql_dbg_mbx, vha, 0x10c7, "Entered %s.\n", __func__);
+
        /*
         * This command is implicitly executed by firmware during login for the
         * physical hosts
@@ -3155,7 +3113,7 @@ qla2x00_dump_ram(scsi_qla_host_t *vha, dma_addr_t req_dma, uint32_t addr,
        mbx_cmd_t mc;
        mbx_cmd_t *mcp = &mc;
 
-       DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no));
+       ql_dbg(ql_dbg_mbx, vha, 0x1009, "Entered %s.\n", __func__);
 
        if (MSW(addr) || IS_FWI2_CAPABLE(vha->hw)) {
                mcp->mb[0] = MBC_DUMP_RISC_RAM_EXTENDED;
@@ -3186,10 +3144,10 @@ qla2x00_dump_ram(scsi_qla_host_t *vha, dma_addr_t req_dma, uint32_t addr,
        rval = qla2x00_mailbox_command(vha, mcp);
 
        if (rval != QLA_SUCCESS) {
-               DEBUG2_3_11(printk("%s(%ld): failed=%x mb[0]=%x.\n", __func__,
-                   vha->host_no, rval, mcp->mb[0]));
+               ql_dbg(ql_dbg_mbx, vha, 0x1008,
+                   "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]);
        } else {
-               DEBUG11(printk("%s(%ld): done.\n", __func__, vha->host_no));
+               ql_dbg(ql_dbg_mbx, vha, 0x1007, "Done %s.\n", __func__);
        }
 
        return rval;
@@ -3214,12 +3172,10 @@ qla84xx_verify_chip(struct scsi_qla_host *vha, uint16_t *status)
        unsigned long flags;
        struct qla_hw_data *ha = vha->hw;
 
-       DEBUG16(printk("%s(%ld): entered.\n", __func__, vha->host_no));
+       ql_dbg(ql_dbg_mbx, vha, 0x10c8, "Entered %s.\n", __func__);
 
        mn = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &mn_dma);
        if (mn == NULL) {
-               DEBUG2_3(printk("%s(%ld): failed to allocate Verify ISP84XX "
-                   "IOCB.\n", __func__, vha->host_no));
                return QLA_MEMORY_ALLOC_FAILED;
        }
 
@@ -3237,43 +3193,43 @@ qla84xx_verify_chip(struct scsi_qla_host *vha, uint16_t *status)
                mn->p.req.entry_count = 1;
                mn->p.req.options = cpu_to_le16(options);
 
-               DEBUG16(printk("%s(%ld): Dump of Verify Request.\n", __func__,
-                   vha->host_no));
-               DEBUG16(qla2x00_dump_buffer((uint8_t *)mn,
-                   sizeof(*mn)));
+               ql_dbg(ql_dbg_mbx + ql_dbg_buffer, vha, 0x111c,
+                   "Dump of Verify Request.\n");
+               ql_dump_buffer(ql_dbg_mbx + ql_dbg_buffer, vha, 0x111e,
+                   (uint8_t *)mn, sizeof(*mn));
 
                rval = qla2x00_issue_iocb_timeout(vha, mn, mn_dma, 0, 120);
                if (rval != QLA_SUCCESS) {
-                       DEBUG2_16(printk("%s(%ld): failed to issue Verify "
-                           "IOCB (%x).\n", __func__, vha->host_no, rval));
+                       ql_dbg(ql_dbg_mbx, vha, 0x10cb,
+                           "Failed to issue verify IOCB (%x).\n", rval);
                        goto verify_done;
                }
 
-               DEBUG16(printk("%s(%ld): Dump of Verify Response.\n", __func__,
-                   vha->host_no));
-               DEBUG16(qla2x00_dump_buffer((uint8_t *)mn,
-                   sizeof(*mn)));
+               ql_dbg(ql_dbg_mbx + ql_dbg_buffer, vha, 0x1110,
+                   "Dump of Verify Response.\n");
+               ql_dump_buffer(ql_dbg_mbx + ql_dbg_buffer, vha, 0x1118,
+                   (uint8_t *)mn, sizeof(*mn));
 
                status[0] = le16_to_cpu(mn->p.rsp.comp_status);
                status[1] = status[0] == CS_VCS_CHIP_FAILURE ?
                    le16_to_cpu(mn->p.rsp.failure_code) : 0;
-               DEBUG2_16(printk("%s(%ld): cs=%x fc=%x\n", __func__,
-                   vha->host_no, status[0], status[1]));
+               ql_dbg(ql_dbg_mbx, vha, 0x10ce,
+                   "cs=%x fc=%x.\n", status[0], status[1]);
 
                if (status[0] != CS_COMPLETE) {
                        rval = QLA_FUNCTION_FAILED;
                        if (!(options & VCO_DONT_UPDATE_FW)) {
-                               DEBUG2_16(printk("%s(%ld): Firmware update "
-                                   "failed. Retrying without update "
-                                   "firmware.\n", __func__, vha->host_no));
+                               ql_dbg(ql_dbg_mbx, vha, 0x10cf,
+                                   "Firmware update failed. Retrying "
+                                   "without update firmware.\n");
                                options |= VCO_DONT_UPDATE_FW;
                                options &= ~VCO_FORCE_UPDATE;
                                retry = 1;
                        }
                } else {
-                       DEBUG2_16(printk("%s(%ld): firmware updated to %x.\n",
-                           __func__, vha->host_no,
-                           le32_to_cpu(mn->p.rsp.fw_ver)));
+                       ql_dbg(ql_dbg_mbx, vha, 0x10d0,
+                           "Firmware updated to %x.\n",
+                           le32_to_cpu(mn->p.rsp.fw_ver));
 
                        /* NOTE: we only update OP firmware. */
                        spin_lock_irqsave(&ha->cs84xx->access_lock, flags);
@@ -3288,10 +3244,9 @@ verify_done:
        dma_pool_free(ha->s_dma_pool, mn, mn_dma);
 
        if (rval != QLA_SUCCESS) {
-               DEBUG2_16(printk("%s(%ld): failed=%x.\n", __func__,
-                   vha->host_no, rval));
+               ql_dbg(ql_dbg_mbx, vha, 0x10d1, "Failed=%x.\n", rval);
        } else {
-               DEBUG16(printk("%s(%ld): done.\n", __func__, vha->host_no));
+               ql_dbg(ql_dbg_mbx, vha, 0x10d2, "Done %s.\n", __func__);
        }
 
        return rval;
@@ -3307,6 +3262,8 @@ qla25xx_init_req_que(struct scsi_qla_host *vha, struct req_que *req)
        struct device_reg_25xxmq __iomem *reg;
        struct qla_hw_data *ha = vha->hw;
 
+       ql_dbg(ql_dbg_mbx, vha, 0x10d3, "Entered %s.\n", __func__);
+
        mcp->mb[0] = MBC_INITIALIZE_MULTIQ;
        mcp->mb[1] = req->options;
        mcp->mb[2] = MSW(LSD(req->dma));
@@ -3344,9 +3301,13 @@ qla25xx_init_req_que(struct scsi_qla_host *vha, struct req_que *req)
        spin_unlock_irqrestore(&ha->hardware_lock, flags);
 
        rval = qla2x00_mailbox_command(vha, mcp);
-       if (rval != QLA_SUCCESS)
-               DEBUG2_3_11(printk(KERN_WARNING "%s(%ld): failed=%x mb0=%x.\n",
-                       __func__, vha->host_no, rval, mcp->mb[0]));
+       if (rval != QLA_SUCCESS) {
+               ql_dbg(ql_dbg_mbx, vha, 0x10d4,
+                   "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]);
+       } else {
+               ql_dbg(ql_dbg_mbx, vha, 0x10d5, "Done %s.\n", __func__);
+       }
+
        return rval;
 }
 
@@ -3360,6 +3321,8 @@ qla25xx_init_rsp_que(struct scsi_qla_host *vha, struct rsp_que *rsp)
        struct device_reg_25xxmq __iomem *reg;
        struct qla_hw_data *ha = vha->hw;
 
+       ql_dbg(ql_dbg_mbx, vha, 0x10d6, "Entered %s.\n", __func__);
+
        mcp->mb[0] = MBC_INITIALIZE_MULTIQ;
        mcp->mb[1] = rsp->options;
        mcp->mb[2] = MSW(LSD(rsp->dma));
@@ -3393,10 +3356,13 @@ qla25xx_init_rsp_que(struct scsi_qla_host *vha, struct rsp_que *rsp)
        spin_unlock_irqrestore(&ha->hardware_lock, flags);
 
        rval = qla2x00_mailbox_command(vha, mcp);
-       if (rval != QLA_SUCCESS)
-               DEBUG2_3_11(printk(KERN_WARNING "%s(%ld): failed=%x "
-                       "mb0=%x.\n", __func__,
-                       vha->host_no, rval, mcp->mb[0]));
+       if (rval != QLA_SUCCESS) {
+               ql_dbg(ql_dbg_mbx, vha, 0x10d7,
+                   "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]);
+       } else {
+               ql_dbg(ql_dbg_mbx, vha, 0x10d8, "Done %s.\n", __func__);
+       }
+
        return rval;
 }
 
@@ -3407,7 +3373,7 @@ qla81xx_idc_ack(scsi_qla_host_t *vha, uint16_t *mb)
        mbx_cmd_t mc;
        mbx_cmd_t *mcp = &mc;
 
-       DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no));
+       ql_dbg(ql_dbg_mbx, vha, 0x10d9, "Entered %s.\n", __func__);
 
        mcp->mb[0] = MBC_IDC_ACK;
        memcpy(&mcp->mb[1], mb, QLA_IDC_ACK_REGS * sizeof(uint16_t));
@@ -3418,10 +3384,10 @@ qla81xx_idc_ack(scsi_qla_host_t *vha, uint16_t *mb)
        rval = qla2x00_mailbox_command(vha, mcp);
 
        if (rval != QLA_SUCCESS) {
-               DEBUG2_3_11(printk("%s(%ld): failed=%x (%x).\n", __func__,
-                   vha->host_no, rval, mcp->mb[0]));
+               ql_dbg(ql_dbg_mbx, vha, 0x10da,
+                   "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]);
        } else {
-               DEBUG11(printk("%s(%ld): done.\n", __func__, vha->host_no));
+               ql_dbg(ql_dbg_mbx, vha, 0x10db, "Done %s.\n", __func__);
        }
 
        return rval;
@@ -3434,11 +3400,11 @@ qla81xx_fac_get_sector_size(scsi_qla_host_t *vha, uint32_t *sector_size)
        mbx_cmd_t mc;
        mbx_cmd_t *mcp = &mc;
 
+       ql_dbg(ql_dbg_mbx, vha, 0x10dc, "Entered %s.\n", __func__);
+
        if (!IS_QLA81XX(vha->hw))
                return QLA_FUNCTION_FAILED;
 
-       DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no));
-
        mcp->mb[0] = MBC_FLASH_ACCESS_CTRL;
        mcp->mb[1] = FAC_OPT_CMD_GET_SECTOR_SIZE;
        mcp->out_mb = MBX_1|MBX_0;
@@ -3448,10 +3414,11 @@ qla81xx_fac_get_sector_size(scsi_qla_host_t *vha, uint32_t *sector_size)
        rval = qla2x00_mailbox_command(vha, mcp);
 
        if (rval != QLA_SUCCESS) {
-               DEBUG2_3_11(printk("%s(%ld): failed=%x mb[0]=%x mb[1]=%x.\n",
-                   __func__, vha->host_no, rval, mcp->mb[0], mcp->mb[1]));
+               ql_dbg(ql_dbg_mbx, vha, 0x10dd,
+                   "Failed=%x mb[0]=%x mb[1]=%x.\n",
+                   rval, mcp->mb[0], mcp->mb[1]);
        } else {
-               DEBUG11(printk("%s(%ld): done.\n", __func__, vha->host_no));
+               ql_dbg(ql_dbg_mbx, vha, 0x10de, "Done %s.\n", __func__);
                *sector_size = mcp->mb[1];
        }
 
@@ -3468,7 +3435,7 @@ qla81xx_fac_do_write_enable(scsi_qla_host_t *vha, int enable)
        if (!IS_QLA81XX(vha->hw))
                return QLA_FUNCTION_FAILED;
 
-       DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no));
+       ql_dbg(ql_dbg_mbx, vha, 0x10df, "Entered %s.\n", __func__);
 
        mcp->mb[0] = MBC_FLASH_ACCESS_CTRL;
        mcp->mb[1] = enable ? FAC_OPT_CMD_WRITE_ENABLE :
@@ -3480,10 +3447,11 @@ qla81xx_fac_do_write_enable(scsi_qla_host_t *vha, int enable)
        rval = qla2x00_mailbox_command(vha, mcp);
 
        if (rval != QLA_SUCCESS) {
-               DEBUG2_3_11(printk("%s(%ld): failed=%x mb[0]=%x mb[1]=%x.\n",
-                   __func__, vha->host_no, rval, mcp->mb[0], mcp->mb[1]));
+               ql_dbg(ql_dbg_mbx, vha, 0x10e0,
+                   "Failed=%x mb[0]=%x mb[1]=%x.\n",
+                   rval, mcp->mb[0], mcp->mb[1]);
        } else {
-               DEBUG11(printk("%s(%ld): done.\n", __func__, vha->host_no));
+               ql_dbg(ql_dbg_mbx, vha, 0x10e1, "Done %s.\n", __func__);
        }
 
        return rval;
@@ -3499,7 +3467,7 @@ qla81xx_fac_erase_sector(scsi_qla_host_t *vha, uint32_t start, uint32_t finish)
        if (!IS_QLA81XX(vha->hw))
                return QLA_FUNCTION_FAILED;
 
-       DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no));
+       ql_dbg(ql_dbg_mbx, vha, 0x10e2, "Entered %s.\n", __func__);
 
        mcp->mb[0] = MBC_FLASH_ACCESS_CTRL;
        mcp->mb[1] = FAC_OPT_CMD_ERASE_SECTOR;
@@ -3514,11 +3482,11 @@ qla81xx_fac_erase_sector(scsi_qla_host_t *vha, uint32_t start, uint32_t finish)
        rval = qla2x00_mailbox_command(vha, mcp);
 
        if (rval != QLA_SUCCESS) {
-               DEBUG2_3_11(printk("%s(%ld): failed=%x mb[0]=%x mb[1]=%x "
-                   "mb[2]=%x.\n", __func__, vha->host_no, rval, mcp->mb[0],
-                   mcp->mb[1], mcp->mb[2]));
+               ql_dbg(ql_dbg_mbx, vha, 0x10e3,
+                   "Failed=%x mb[0]=%x mb[1]=%x mb[2]=%x.\n",
+                   rval, mcp->mb[0], mcp->mb[1], mcp->mb[2]);
        } else {
-               DEBUG11(printk("%s(%ld): done.\n", __func__, vha->host_no));
+               ql_dbg(ql_dbg_mbx, vha, 0x10e4, "Done %s.\n", __func__);
        }
 
        return rval;
@@ -3531,7 +3499,7 @@ qla81xx_restart_mpi_firmware(scsi_qla_host_t *vha)
        mbx_cmd_t mc;
        mbx_cmd_t *mcp = &mc;
 
-       DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no));
+       ql_dbg(ql_dbg_mbx, vha, 0x10e5, "Entered %s.\n", __func__);
 
        mcp->mb[0] = MBC_RESTART_MPI_FW;
        mcp->out_mb = MBX_0;
@@ -3541,10 +3509,11 @@ qla81xx_restart_mpi_firmware(scsi_qla_host_t *vha)
        rval = qla2x00_mailbox_command(vha, mcp);
 
        if (rval != QLA_SUCCESS) {
-               DEBUG2_3_11(printk("%s(%ld): failed=%x mb[0]=0x%x mb[1]=0x%x.\n",
-                   __func__, vha->host_no, rval, mcp->mb[0], mcp->mb[1]));
+               ql_dbg(ql_dbg_mbx, vha, 0x10e6,
+                   "Failed=%x mb[0]=%x mb[1]=%x.\n",
+                   rval, mcp->mb[0], mcp->mb[1]);
        } else {
-               DEBUG11(printk("%s(%ld): done.\n", __func__, vha->host_no));
+               ql_dbg(ql_dbg_mbx, vha, 0x10e7, "Done %s.\n", __func__);
        }
 
        return rval;
@@ -3559,11 +3528,11 @@ qla2x00_read_sfp(scsi_qla_host_t *vha, dma_addr_t sfp_dma, uint8_t *sfp,
        mbx_cmd_t *mcp = &mc;
        struct qla_hw_data *ha = vha->hw;
 
+       ql_dbg(ql_dbg_mbx, vha, 0x10e8, "Entered %s.\n", __func__);
+
        if (!IS_FWI2_CAPABLE(ha))
                return QLA_FUNCTION_FAILED;
 
-       DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no));
-
        if (len == 1)
                opt |= BIT_0;
 
@@ -3586,10 +3555,10 @@ qla2x00_read_sfp(scsi_qla_host_t *vha, dma_addr_t sfp_dma, uint8_t *sfp,
                *sfp = mcp->mb[1];
 
        if (rval != QLA_SUCCESS) {
-               DEBUG2_3_11(printk("%s(%ld): failed=%x (%x).\n", __func__,
-                   vha->host_no, rval, mcp->mb[0]));
+               ql_dbg(ql_dbg_mbx, vha, 0x10e9,
+                   "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]);
        } else {
-               DEBUG11(printk("%s(%ld): done.\n", __func__, vha->host_no));
+               ql_dbg(ql_dbg_mbx, vha, 0x10ea, "Done %s.\n", __func__);
        }
 
        return rval;
@@ -3604,11 +3573,11 @@ qla2x00_write_sfp(scsi_qla_host_t *vha, dma_addr_t sfp_dma, uint8_t *sfp,
        mbx_cmd_t *mcp = &mc;
        struct qla_hw_data *ha = vha->hw;
 
+       ql_dbg(ql_dbg_mbx, vha, 0x10eb, "Entered %s.\n", __func__);
+
        if (!IS_FWI2_CAPABLE(ha))
                return QLA_FUNCTION_FAILED;
 
-       DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no));
-
        if (len == 1)
                opt |= BIT_0;
 
@@ -3631,10 +3600,10 @@ qla2x00_write_sfp(scsi_qla_host_t *vha, dma_addr_t sfp_dma, uint8_t *sfp,
        rval = qla2x00_mailbox_command(vha, mcp);
 
        if (rval != QLA_SUCCESS) {
-               DEBUG2_3_11(printk("%s(%ld): failed=%x (%x).\n", __func__,
-                   vha->host_no, rval, mcp->mb[0]));
+               ql_dbg(ql_dbg_mbx, vha, 0x10ec,
+                   "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]);
        } else {
-               DEBUG11(printk("%s(%ld): done.\n", __func__, vha->host_no));
+               ql_dbg(ql_dbg_mbx, vha, 0x10ed, "Done %s.\n", __func__);
        }
 
        return rval;
@@ -3648,11 +3617,11 @@ qla2x00_get_xgmac_stats(scsi_qla_host_t *vha, dma_addr_t stats_dma,
        mbx_cmd_t mc;
        mbx_cmd_t *mcp = &mc;
 
+       ql_dbg(ql_dbg_mbx, vha, 0x10ee, "Entered %s.\n", __func__);
+
        if (!IS_QLA8XXX_TYPE(vha->hw))
                return QLA_FUNCTION_FAILED;
 
-       DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no));
-
        mcp->mb[0] = MBC_GET_XGMAC_STATS;
        mcp->mb[2] = MSW(stats_dma);
        mcp->mb[3] = LSW(stats_dma);
@@ -3666,11 +3635,12 @@ qla2x00_get_xgmac_stats(scsi_qla_host_t *vha, dma_addr_t stats_dma,
        rval = qla2x00_mailbox_command(vha, mcp);
 
        if (rval != QLA_SUCCESS) {
-               DEBUG2_3_11(printk("%s(%ld): failed=%x mb[0]=0x%x "
-                   "mb[1]=0x%x mb[2]=0x%x.\n", __func__, vha->host_no, rval,
-                   mcp->mb[0], mcp->mb[1], mcp->mb[2]));
+               ql_dbg(ql_dbg_mbx, vha, 0x10ef,
+                   "Failed=%x mb[0]=%x mb[1]=%x mb[2]=%x.\n",
+                   rval, mcp->mb[0], mcp->mb[1], mcp->mb[2]);
        } else {
-               DEBUG11(printk("%s(%ld): done.\n", __func__, vha->host_no));
+               ql_dbg(ql_dbg_mbx, vha, 0x10f0, "Done %s.\n", __func__);
+
 
                *actual_size = mcp->mb[2] << 2;
        }
@@ -3686,11 +3656,11 @@ qla2x00_get_dcbx_params(scsi_qla_host_t *vha, dma_addr_t tlv_dma,
        mbx_cmd_t mc;
        mbx_cmd_t *mcp = &mc;
 
+       ql_dbg(ql_dbg_mbx, vha, 0x10f1, "Entered %s.\n", __func__);
+
        if (!IS_QLA8XXX_TYPE(vha->hw))
                return QLA_FUNCTION_FAILED;
 
-       DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no));
-
        mcp->mb[0] = MBC_GET_DCBX_PARAMS;
        mcp->mb[1] = 0;
        mcp->mb[2] = MSW(tlv_dma);
@@ -3705,11 +3675,11 @@ qla2x00_get_dcbx_params(scsi_qla_host_t *vha, dma_addr_t tlv_dma,
        rval = qla2x00_mailbox_command(vha, mcp);
 
        if (rval != QLA_SUCCESS) {
-               DEBUG2_3_11(printk("%s(%ld): failed=%x mb[0]=0x%x "
-                   "mb[1]=0x%x mb[2]=0x%x.\n", __func__, vha->host_no, rval,
-                   mcp->mb[0], mcp->mb[1], mcp->mb[2]));
+               ql_dbg(ql_dbg_mbx, vha, 0x10f2,
+                   "Failed=%x mb[0]=%x mb[1]=%x mb[2]=%x.\n",
+                   rval, mcp->mb[0], mcp->mb[1], mcp->mb[2]);
        } else {
-               DEBUG11(printk("%s(%ld): done.\n", __func__, vha->host_no));
+               ql_dbg(ql_dbg_mbx, vha, 0x10f3, "Done %s.\n", __func__);
        }
 
        return rval;
@@ -3722,11 +3692,11 @@ qla2x00_read_ram_word(scsi_qla_host_t *vha, uint32_t risc_addr, uint32_t *data)
        mbx_cmd_t mc;
        mbx_cmd_t *mcp = &mc;
 
+       ql_dbg(ql_dbg_mbx, vha, 0x10f4, "Entered %s.\n", __func__);
+
        if (!IS_FWI2_CAPABLE(vha->hw))
                return QLA_FUNCTION_FAILED;
 
-       DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no));
-
        mcp->mb[0] = MBC_READ_RAM_EXTENDED;
        mcp->mb[1] = LSW(risc_addr);
        mcp->mb[8] = MSW(risc_addr);
@@ -3736,10 +3706,10 @@ qla2x00_read_ram_word(scsi_qla_host_t *vha, uint32_t risc_addr, uint32_t *data)
        mcp->flags = 0;
        rval = qla2x00_mailbox_command(vha, mcp);
        if (rval != QLA_SUCCESS) {
-               DEBUG2_3_11(printk("%s(%ld): failed=%x mb[0]=%x.\n", __func__,
-                   vha->host_no, rval, mcp->mb[0]));
+               ql_dbg(ql_dbg_mbx, vha, 0x10f5,
+                   "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]);
        } else {
-               DEBUG11(printk("%s(%ld): done.\n", __func__, vha->host_no));
+               ql_dbg(ql_dbg_mbx, vha, 0x10f6, "Done %s.\n", __func__);
                *data = mcp->mb[3] << 16 | mcp->mb[2];
        }
 
@@ -3755,7 +3725,7 @@ qla2x00_loopback_test(scsi_qla_host_t *vha, struct msg_echo_lb *mreq,
        mbx_cmd_t *mcp = &mc;
        uint32_t iter_cnt = 0x1;
 
-       DEBUG11(printk("scsi(%ld): entered.\n", vha->host_no));
+       ql_dbg(ql_dbg_mbx, vha, 0x10f7, "Entered %s.\n", __func__);
 
        memset(mcp->mb, 0 , sizeof(mcp->mb));
        mcp->mb[0] = MBC_DIAGNOSTIC_LOOP_BACK;
@@ -3794,15 +3764,12 @@ qla2x00_loopback_test(scsi_qla_host_t *vha, struct msg_echo_lb *mreq,
        rval = qla2x00_mailbox_command(vha, mcp);
 
        if (rval != QLA_SUCCESS) {
-               DEBUG2(printk(KERN_WARNING
-                       "(%ld): failed=%x mb[0]=0x%x "
-                       "mb[1]=0x%x mb[2]=0x%x mb[3]=0x%x mb[18]=0x%x "
-                       "mb[19]=0x%x.\n",
-                       vha->host_no, rval, mcp->mb[0], mcp->mb[1], mcp->mb[2],
-                       mcp->mb[3], mcp->mb[18], mcp->mb[19]));
+               ql_dbg(ql_dbg_mbx, vha, 0x10f8,
+                   "Failed=%x mb[0]=%x mb[1]=%x mb[2]=%x mb[3]=%x mb[18]=%x "
+                   "mb[19]=%x.\n", rval, mcp->mb[0], mcp->mb[1], mcp->mb[2],
+                   mcp->mb[3], mcp->mb[18], mcp->mb[19]);
        } else {
-               DEBUG2(printk(KERN_WARNING
-                   "scsi(%ld): done.\n", vha->host_no));
+               ql_dbg(ql_dbg_mbx, vha, 0x10f9, "Done %s.\n", __func__);
        }
 
        /* Copy mailbox information */
@@ -3819,7 +3786,7 @@ qla2x00_echo_test(scsi_qla_host_t *vha, struct msg_echo_lb *mreq,
        mbx_cmd_t *mcp = &mc;
        struct qla_hw_data *ha = vha->hw;
 
-       DEBUG11(printk("scsi(%ld): entered.\n", vha->host_no));
+       ql_dbg(ql_dbg_mbx, vha, 0x10fa, "Entered %s.\n", __func__);
 
        memset(mcp->mb, 0 , sizeof(mcp->mb));
        mcp->mb[0] = MBC_DIAGNOSTIC_ECHO;
@@ -3858,12 +3825,11 @@ qla2x00_echo_test(scsi_qla_host_t *vha, struct msg_echo_lb *mreq,
        rval = qla2x00_mailbox_command(vha, mcp);
 
        if (rval != QLA_SUCCESS) {
-               DEBUG2(printk(KERN_WARNING
-                   "(%ld): failed=%x mb[0]=0x%x mb[1]=0x%x.\n",
-                   vha->host_no, rval, mcp->mb[0], mcp->mb[1]));
+               ql_dbg(ql_dbg_mbx, vha, 0x10fb,
+                   "Failed=%x mb[0]=%x mb[1]=%x.\n",
+                   rval, mcp->mb[0], mcp->mb[1]);
        } else {
-               DEBUG2(printk(KERN_WARNING
-                   "scsi(%ld): done.\n", vha->host_no));
+               ql_dbg(ql_dbg_mbx, vha, 0x10fc, "Done %s.\n", __func__);
        }
 
        /* Copy mailbox information */
@@ -3872,14 +3838,14 @@ qla2x00_echo_test(scsi_qla_host_t *vha, struct msg_echo_lb *mreq,
 }
 
 int
-qla84xx_reset_chip(scsi_qla_host_t *ha, uint16_t enable_diagnostic)
+qla84xx_reset_chip(scsi_qla_host_t *vha, uint16_t enable_diagnostic)
 {
        int rval;
        mbx_cmd_t mc;
        mbx_cmd_t *mcp = &mc;
 
-       DEBUG16(printk("%s(%ld): enable_diag=%d entered.\n", __func__,
-               ha->host_no, enable_diagnostic));
+       ql_dbg(ql_dbg_mbx, vha, 0x10fd,
+           "Entered %s enable_diag=%d.\n", __func__, enable_diagnostic);
 
        mcp->mb[0] = MBC_ISP84XX_RESET;
        mcp->mb[1] = enable_diagnostic;
@@ -3887,13 +3853,12 @@ qla84xx_reset_chip(scsi_qla_host_t *ha, uint16_t enable_diagnostic)
        mcp->in_mb = MBX_1|MBX_0;
        mcp->tov = MBX_TOV_SECONDS;
        mcp->flags = MBX_DMA_OUT|MBX_DMA_IN|IOCTL_CMD;
-       rval = qla2x00_mailbox_command(ha, mcp);
+       rval = qla2x00_mailbox_command(vha, mcp);
 
        if (rval != QLA_SUCCESS)
-               DEBUG16(printk("%s(%ld): failed=%x.\n", __func__, ha->host_no,
-                       rval));
+               ql_dbg(ql_dbg_mbx, vha, 0x10fe, "Failed=%x.\n", rval);
        else
-               DEBUG16(printk("%s(%ld): done.\n", __func__, ha->host_no));
+               ql_dbg(ql_dbg_mbx, vha, 0x10ff, "Done %s.\n", __func__);
 
        return rval;
 }
@@ -3905,11 +3870,11 @@ qla2x00_write_ram_word(scsi_qla_host_t *vha, uint32_t risc_addr, uint32_t data)
        mbx_cmd_t mc;
        mbx_cmd_t *mcp = &mc;
 
+       ql_dbg(ql_dbg_mbx, vha, 0x1100, "Entered %s.\n", __func__);
+
        if (!IS_FWI2_CAPABLE(vha->hw))
                return QLA_FUNCTION_FAILED;
 
-       DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no));
-
        mcp->mb[0] = MBC_WRITE_RAM_WORD_EXTENDED;
        mcp->mb[1] = LSW(risc_addr);
        mcp->mb[2] = LSW(data);
@@ -3921,10 +3886,10 @@ qla2x00_write_ram_word(scsi_qla_host_t *vha, uint32_t risc_addr, uint32_t data)
        mcp->flags = 0;
        rval = qla2x00_mailbox_command(vha, mcp);
        if (rval != QLA_SUCCESS) {
-               DEBUG2_3_11(printk("%s(%ld): failed=%x mb[0]=%x.\n", __func__,
-                   vha->host_no, rval, mcp->mb[0]));
+               ql_dbg(ql_dbg_mbx, vha, 0x1101,
+                   "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]);
        } else {
-               DEBUG11(printk("%s(%ld): done.\n", __func__, vha->host_no));
+               ql_dbg(ql_dbg_mbx, vha, 0x1102, "Done %s.\n", __func__);
        }
 
        return rval;
@@ -3941,8 +3906,7 @@ qla81xx_write_mpi_register(scsi_qla_host_t *vha, uint16_t *mb)
 
        rval = QLA_SUCCESS;
 
-       DEBUG11(qla_printk(KERN_INFO, ha,
-           "%s(%ld): entered.\n", __func__, vha->host_no));
+       ql_dbg(ql_dbg_mbx, vha, 0x1103, "Entered %s.\n", __func__);
 
        clear_bit(MBX_INTERRUPT, &ha->mbx_cmd_flags);
 
@@ -3982,11 +3946,10 @@ qla81xx_write_mpi_register(scsi_qla_host_t *vha, uint16_t *mb)
                rval = QLA_FUNCTION_FAILED;
 
        if (rval != QLA_SUCCESS) {
-               DEBUG2_3_11(printk(KERN_INFO "%s(%ld): failed=%x mb[0]=%x.\n",
-                   __func__, vha->host_no, rval, mb[0]));
+               ql_dbg(ql_dbg_mbx, vha, 0x1104,
+                   "Failed=%x mb[0]=%x.\n", rval, mb[0]);
        } else {
-               DEBUG11(printk(KERN_INFO
-                   "%s(%ld): done.\n", __func__, vha->host_no));
+               ql_dbg(ql_dbg_mbx, vha, 0x1105, "Done %s.\n", __func__);
        }
 
        return rval;
@@ -3999,12 +3962,11 @@ qla2x00_get_data_rate(scsi_qla_host_t *vha)
        mbx_cmd_t *mcp = &mc;
        struct qla_hw_data *ha = vha->hw;
 
+       ql_dbg(ql_dbg_mbx, vha, 0x1106, "Entered %s.\n", __func__);
+
        if (!IS_FWI2_CAPABLE(ha))
                return QLA_FUNCTION_FAILED;
 
-       DEBUG11(qla_printk(KERN_INFO, ha,
-               "%s(%ld): entered.\n", __func__, vha->host_no));
-
        mcp->mb[0] = MBC_DATA_RATE;
        mcp->mb[1] = 0;
        mcp->out_mb = MBX_1|MBX_0;
@@ -4013,11 +3975,10 @@ qla2x00_get_data_rate(scsi_qla_host_t *vha)
        mcp->flags = 0;
        rval = qla2x00_mailbox_command(vha, mcp);
        if (rval != QLA_SUCCESS) {
-               DEBUG2_3_11(printk(KERN_INFO "%s(%ld): failed=%x mb[0]=%x.\n",
-                   __func__, vha->host_no, rval, mcp->mb[0]));
+               ql_dbg(ql_dbg_mbx, vha, 0x1107,
+                   "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]);
        } else {
-               DEBUG11(printk(KERN_INFO
-                   "%s(%ld): done.\n", __func__, vha->host_no));
+               ql_dbg(ql_dbg_mbx, vha, 0x1108, "Done %s.\n", __func__);
                if (mcp->mb[1] != 0x7)
                        ha->link_data_rate = mcp->mb[1];
        }
@@ -4033,8 +3994,7 @@ qla81xx_get_port_config(scsi_qla_host_t *vha, uint16_t *mb)
        mbx_cmd_t *mcp = &mc;
        struct qla_hw_data *ha = vha->hw;
 
-       DEBUG11(printk(KERN_INFO
-           "%s(%ld): entered.\n", __func__, vha->host_no));
+       ql_dbg(ql_dbg_mbx, vha, 0x1109, "Entered %s.\n", __func__);
 
        if (!IS_QLA81XX(ha))
                return QLA_FUNCTION_FAILED;
@@ -4047,15 +4007,13 @@ qla81xx_get_port_config(scsi_qla_host_t *vha, uint16_t *mb)
        rval = qla2x00_mailbox_command(vha, mcp);
 
        if (rval != QLA_SUCCESS) {
-               DEBUG2_3_11(printk(KERN_WARNING
-                   "%s(%ld): failed=%x (%x).\n", __func__,
-                   vha->host_no, rval, mcp->mb[0]));
+               ql_dbg(ql_dbg_mbx, vha, 0x110a,
+                   "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]);
        } else {
                /* Copy all bits to preserve original value */
                memcpy(mb, &mcp->mb[1], sizeof(uint16_t) * 4);
 
-               DEBUG11(printk(KERN_INFO
-                   "%s(%ld): done.\n", __func__, vha->host_no));
+               ql_dbg(ql_dbg_mbx, vha, 0x110b, "Done %s.\n", __func__);
        }
        return rval;
 }
@@ -4067,8 +4025,7 @@ qla81xx_set_port_config(scsi_qla_host_t *vha, uint16_t *mb)
        mbx_cmd_t mc;
        mbx_cmd_t *mcp = &mc;
 
-       DEBUG11(printk(KERN_INFO
-           "%s(%ld): entered.\n", __func__, vha->host_no));
+       ql_dbg(ql_dbg_mbx, vha, 0x110c, "Entered %s.\n", __func__);
 
        mcp->mb[0] = MBC_SET_PORT_CONFIG;
        /* Copy all bits to preserve original setting */
@@ -4080,12 +4037,10 @@ qla81xx_set_port_config(scsi_qla_host_t *vha, uint16_t *mb)
        rval = qla2x00_mailbox_command(vha, mcp);
 
        if (rval != QLA_SUCCESS) {
-               DEBUG2_3_11(printk(KERN_WARNING
-                   "%s(%ld): failed=%x (%x).\n", __func__,
-                   vha->host_no, rval, mcp->mb[0]));
+               ql_dbg(ql_dbg_mbx, vha, 0x110d,
+                   "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]);
        } else
-               DEBUG11(printk(KERN_INFO
-                   "%s(%ld): done.\n", __func__, vha->host_no));
+               ql_dbg(ql_dbg_mbx, vha, 0x110e, "Done %s.\n", __func__);
 
        return rval;
 }
@@ -4100,12 +4055,11 @@ qla24xx_set_fcp_prio(scsi_qla_host_t *vha, uint16_t loop_id, uint16_t priority,
        mbx_cmd_t *mcp = &mc;
        struct qla_hw_data *ha = vha->hw;
 
+       ql_dbg(ql_dbg_mbx, vha, 0x110f, "Entered %s.\n", __func__);
+
        if (!IS_QLA24XX_TYPE(ha) && !IS_QLA25XX(ha))
                return QLA_FUNCTION_FAILED;
 
-       DEBUG11(printk(KERN_INFO
-           "%s(%ld): entered.\n", __func__, vha->host_no));
-
        mcp->mb[0] = MBC_PORT_PARAMS;
        mcp->mb[1] = loop_id;
        if (ha->flags.fcp_prio_enabled)
@@ -4127,12 +4081,9 @@ qla24xx_set_fcp_prio(scsi_qla_host_t *vha, uint16_t loop_id, uint16_t priority,
        }
 
        if (rval != QLA_SUCCESS) {
-               DEBUG2_3_11(printk(KERN_WARNING
-                   "%s(%ld): failed=%x.\n", __func__,
-                   vha->host_no, rval));
+               ql_dbg(ql_dbg_mbx, vha, 0x10cd, "Failed=%x.\n", rval);
        } else {
-               DEBUG11(printk(KERN_INFO
-                   "%s(%ld): done.\n", __func__, vha->host_no));
+               ql_dbg(ql_dbg_mbx, vha, 0x10cc, "Done %s.\n", __func__);
        }
 
        return rval;
@@ -4145,13 +4096,12 @@ qla2x00_get_thermal_temp(scsi_qla_host_t *vha, uint16_t *temp, uint16_t *frac)
        uint8_t byte;
        struct qla_hw_data *ha = vha->hw;
 
-       DEBUG11(printk(KERN_INFO "%s(%ld): entered.\n", __func__, vha->host_no));
+       ql_dbg(ql_dbg_mbx, vha, 0x10ca, "Entered %s.\n", __func__);
 
        /* Integer part */
        rval = qla2x00_read_sfp(vha, 0, &byte, 0x98, 0x01, 1, BIT_13|BIT_0);
        if (rval != QLA_SUCCESS) {
-               DEBUG2_3_11(printk(KERN_WARNING
-                   "%s(%ld): failed=%x.\n", __func__, vha->host_no, rval));
+               ql_dbg(ql_dbg_mbx, vha, 0x10c9, "Failed=%x.\n", rval);
                ha->flags.thermal_supported = 0;
                goto fail;
        }
@@ -4160,14 +4110,13 @@ qla2x00_get_thermal_temp(scsi_qla_host_t *vha, uint16_t *temp, uint16_t *frac)
        /* Fraction part */
        rval = qla2x00_read_sfp(vha, 0, &byte, 0x98, 0x10, 1, BIT_13|BIT_0);
        if (rval != QLA_SUCCESS) {
-               DEBUG2_3_11(printk(KERN_WARNING
-                   "%s(%ld): failed=%x.\n", __func__, vha->host_no, rval));
+               ql_dbg(ql_dbg_mbx, vha, 0x1019, "Failed=%x.\n", rval);
                ha->flags.thermal_supported = 0;
                goto fail;
        }
        *frac = (byte >> 6) * 25;
 
-       DEBUG11(printk(KERN_INFO "%s(%ld): done.\n", __func__, vha->host_no));
+       ql_dbg(ql_dbg_mbx, vha, 0x1018, "Done %s.\n", __func__);
 fail:
        return rval;
 }
@@ -4180,12 +4129,11 @@ qla82xx_mbx_intr_enable(scsi_qla_host_t *vha)
        mbx_cmd_t mc;
        mbx_cmd_t *mcp = &mc;
 
+       ql_dbg(ql_dbg_mbx, vha, 0x1017, "Entered %s.\n", __func__);
+
        if (!IS_FWI2_CAPABLE(ha))
                return QLA_FUNCTION_FAILED;
 
-       DEBUG11(qla_printk(KERN_INFO, ha,
-               "%s(%ld): entered.\n", __func__, vha->host_no));
-
        memset(mcp, 0, sizeof(mbx_cmd_t));
        mcp->mb[0] = MBC_TOGGLE_INTERRUPT;
        mcp->mb[1] = 1;
@@ -4197,12 +4145,10 @@ qla82xx_mbx_intr_enable(scsi_qla_host_t *vha)
 
        rval = qla2x00_mailbox_command(vha, mcp);
        if (rval != QLA_SUCCESS) {
-               DEBUG2_3_11(qla_printk(KERN_WARNING, ha,
-                       "%s(%ld): failed=%x mb[0]=%x.\n", __func__,
-                       vha->host_no, rval, mcp->mb[0]));
+               ql_dbg(ql_dbg_mbx, vha, 0x1016,
+                   "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]);
        } else {
-               DEBUG11(qla_printk(KERN_INFO, ha,
-                       "%s(%ld): done.\n", __func__, vha->host_no));
+               ql_dbg(ql_dbg_mbx, vha, 0x100e, "Done %s.\n", __func__);
        }
 
        return rval;
@@ -4216,12 +4162,11 @@ qla82xx_mbx_intr_disable(scsi_qla_host_t *vha)
        mbx_cmd_t mc;
        mbx_cmd_t *mcp = &mc;
 
+       ql_dbg(ql_dbg_mbx, vha, 0x100d, "Entered %s.\n", __func__);
+
        if (!IS_QLA82XX(ha))
                return QLA_FUNCTION_FAILED;
 
-       DEBUG11(qla_printk(KERN_INFO, ha,
-               "%s(%ld): entered.\n", __func__, vha->host_no));
-
        memset(mcp, 0, sizeof(mbx_cmd_t));
        mcp->mb[0] = MBC_TOGGLE_INTERRUPT;
        mcp->mb[1] = 0;
@@ -4233,12 +4178,10 @@ qla82xx_mbx_intr_disable(scsi_qla_host_t *vha)
 
        rval = qla2x00_mailbox_command(vha, mcp);
        if (rval != QLA_SUCCESS) {
-               DEBUG2_3_11(qla_printk(KERN_WARNING, ha,
-                       "%s(%ld): failed=%x mb[0]=%x.\n", __func__,
-                       vha->host_no, rval, mcp->mb[0]));
+               ql_dbg(ql_dbg_mbx, vha, 0x100c,
+                   "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]);
        } else {
-               DEBUG11(qla_printk(KERN_INFO, ha,
-                       "%s(%ld): done.\n", __func__, vha->host_no));
+               ql_dbg(ql_dbg_mbx, vha, 0x100b, "Done %s.\n", __func__);
        }
 
        return rval;
index 5e343919acad791ccc8879b4b98cce37e92021d8..c706ed370000390f8450256aa2427817800e8430 100644 (file)
@@ -36,8 +36,9 @@ qla24xx_allocate_vp_id(scsi_qla_host_t *vha)
        mutex_lock(&ha->vport_lock);
        vp_id = find_first_zero_bit(ha->vp_idx_map, ha->max_npiv_vports + 1);
        if (vp_id > ha->max_npiv_vports) {
-               DEBUG15(printk ("vp_id %d is bigger than max-supported %d.\n",
-                   vp_id, ha->max_npiv_vports));
+               ql_dbg(ql_dbg_vport, vha, 0xa000,
+                   "vp_id %d is bigger than max-supported %d.\n",
+                   vp_id, ha->max_npiv_vports);
                mutex_unlock(&ha->vport_lock);
                return vp_id;
        }
@@ -131,9 +132,9 @@ qla2x00_mark_vp_devices_dead(scsi_qla_host_t *vha)
        fc_port_t *fcport;
 
        list_for_each_entry(fcport, &vha->vp_fcports, list) {
-               DEBUG15(printk("scsi(%ld): Marking port dead, "
-                   "loop_id=0x%04x :%x\n",
-                   vha->host_no, fcport->loop_id, fcport->vp_idx));
+               ql_dbg(ql_dbg_vport, vha, 0xa001,
+                   "Marking port dead, loop_id=0x%04x : %x.\n",
+                   fcport->loop_id, fcport->vp_idx);
 
                qla2x00_mark_device_lost(vha, fcport, 0, 0);
                qla2x00_set_fcport_state(fcport, FCS_UNCONFIGURED);
@@ -187,13 +188,13 @@ qla24xx_enable_vp(scsi_qla_host_t *vha)
                goto enable_failed;
        }
 
-       DEBUG15(qla_printk(KERN_INFO, ha,
-           "Virtual port with id: %d - Enabled\n", vha->vp_idx));
+       ql_dbg(ql_dbg_taskm, vha, 0x801a,
+           "Virtual port with id: %d - Enabled.\n", vha->vp_idx);
        return 0;
 
 enable_failed:
-       DEBUG15(qla_printk(KERN_INFO, ha,
-           "Virtual port with id: %d - Disabled\n", vha->vp_idx));
+       ql_dbg(ql_dbg_taskm, vha, 0x801b,
+           "Virtual port with id: %d - Disabled.\n", vha->vp_idx);
        return 1;
 }
 
@@ -205,12 +206,12 @@ qla24xx_configure_vp(scsi_qla_host_t *vha)
 
        fc_vport = vha->fc_vport;
 
-       DEBUG15(printk("scsi(%ld): %s: change request #3 for this host.\n",
-           vha->host_no, __func__));
+       ql_dbg(ql_dbg_vport, vha, 0xa002,
+           "%s: change request #3.\n", __func__);
        ret = qla2x00_send_change_request(vha, 0x3, vha->vp_idx);
        if (ret != QLA_SUCCESS) {
-               DEBUG15(qla_printk(KERN_ERR, vha->hw, "Failed to enable "
-                   "receiving of RSCN requests: 0x%x\n", ret));
+               ql_dbg(ql_dbg_vport, vha, 0xa003, "Failed to enable "
+                   "receiving of RSCN requests: 0x%x.\n", ret);
                return;
        } else {
                /* Corresponds to SCR enabled */
@@ -248,9 +249,9 @@ qla2x00_alert_all_vps(struct rsp_que *rsp, uint16_t *mb)
                        case MBA_CHG_IN_CONNECTION:
                        case MBA_PORT_UPDATE:
                        case MBA_RSCN_UPDATE:
-                               DEBUG15(printk("scsi(%ld)%s: Async_event for"
-                               " VP[%d], mb = 0x%x, vha=%p\n",
-                               vha->host_no, __func__, i, *mb, vha));
+                               ql_dbg(ql_dbg_async, vha, 0x5024,
+                                   "Async_event for VP[%d], mb=0x%x vha=%p.\n",
+                                   i, *mb, vha);
                                qla2x00_async_event(vha, rsp, mb);
                                break;
                        }
@@ -286,37 +287,49 @@ qla2x00_vp_abort_isp(scsi_qla_host_t *vha)
        if (!test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags))
                qla24xx_control_vp(vha, VCE_COMMAND_DISABLE_VPS_LOGO_ALL);
 
-       DEBUG15(printk("scsi(%ld): Scheduling enable of Vport %d...\n",
-           vha->host_no, vha->vp_idx));
+       ql_dbg(ql_dbg_taskm, vha, 0x801d,
+           "Scheduling enable of Vport %d.\n", vha->vp_idx);
        return qla24xx_enable_vp(vha);
 }
 
 static int
 qla2x00_do_dpc_vp(scsi_qla_host_t *vha)
 {
+       ql_dbg(ql_dbg_dpc, vha, 0x4012,
+           "Entering %s.\n", __func__);
+       ql_dbg(ql_dbg_dpc, vha, 0x4013,
+           "vp_flags: 0x%lx.\n", vha->vp_flags);
+
        qla2x00_do_work(vha);
 
        if (test_and_clear_bit(VP_IDX_ACQUIRED, &vha->vp_flags)) {
                /* VP acquired. complete port configuration */
+               ql_dbg(ql_dbg_dpc, vha, 0x4014,
+                   "Configure VP scheduled.\n");
                qla24xx_configure_vp(vha);
+               ql_dbg(ql_dbg_dpc, vha, 0x4015,
+                   "Configure VP end.\n");
                return 0;
        }
 
        if (test_bit(FCPORT_UPDATE_NEEDED, &vha->dpc_flags)) {
+               ql_dbg(ql_dbg_dpc, vha, 0x4016,
+                   "FCPort update scheduled.\n");
                qla2x00_update_fcports(vha);
                clear_bit(FCPORT_UPDATE_NEEDED, &vha->dpc_flags);
+               ql_dbg(ql_dbg_dpc, vha, 0x4017,
+                   "FCPort update end.\n");
        }
 
        if ((test_and_clear_bit(RELOGIN_NEEDED, &vha->dpc_flags)) &&
                !test_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags) &&
                atomic_read(&vha->loop_state) != LOOP_DOWN) {
 
-               DEBUG(printk("scsi(%ld): qla2x00_port_login()\n",
-                                               vha->host_no));
+               ql_dbg(ql_dbg_dpc, vha, 0x4018,
+                   "Relogin needed scheduled.\n");
                qla2x00_relogin(vha);
-
-               DEBUG(printk("scsi(%ld): qla2x00_port_login - end\n",
-                                                       vha->host_no));
+               ql_dbg(ql_dbg_dpc, vha, 0x4019,
+                   "Relogin needed end.\n");
        }
 
        if (test_and_clear_bit(RESET_MARKER_NEEDED, &vha->dpc_flags) &&
@@ -326,11 +339,17 @@ qla2x00_do_dpc_vp(scsi_qla_host_t *vha)
 
        if (test_and_clear_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags)) {
                if (!(test_and_set_bit(LOOP_RESYNC_ACTIVE, &vha->dpc_flags))) {
+                       ql_dbg(ql_dbg_dpc, vha, 0x401a,
+                           "Loop resync scheduled.\n");
                        qla2x00_loop_resync(vha);
                        clear_bit(LOOP_RESYNC_ACTIVE, &vha->dpc_flags);
+                       ql_dbg(ql_dbg_dpc, vha, 0x401b,
+                           "Loop resync end.\n");
                }
        }
 
+       ql_dbg(ql_dbg_dpc, vha, 0x401c,
+           "Exiting %s.\n", __func__);
        return 0;
 }
 
@@ -396,9 +415,10 @@ qla24xx_vport_create_req_sanity_check(struct fc_vport *fc_vport)
 
        /* Check up max-npiv-supports */
        if (ha->num_vhosts > ha->max_npiv_vports) {
-               DEBUG15(printk("scsi(%ld): num_vhosts %ud is bigger than "
-                   "max_npv_vports %ud.\n", base_vha->host_no,
-                   ha->num_vhosts, ha->max_npiv_vports));
+               ql_dbg(ql_dbg_vport, vha, 0xa004,
+                   "num_vhosts %ud is bigger "
+                   "than max_npiv_vports %ud.\n",
+                   ha->num_vhosts, ha->max_npiv_vports);
                return VPCERR_UNSUPPORTED;
        }
        return 0;
@@ -415,7 +435,8 @@ qla24xx_create_vhost(struct fc_vport *fc_vport)
 
        vha = qla2x00_create_host(sht, ha);
        if (!vha) {
-               DEBUG(printk("qla2xxx: scsi_host_alloc() failed for vport\n"));
+               ql_log(ql_log_warn, vha, 0xa005,
+                   "scsi_host_alloc() failed for vport.\n");
                return(NULL);
        }
 
@@ -429,8 +450,8 @@ qla24xx_create_vhost(struct fc_vport *fc_vport)
        vha->device_flags = 0;
        vha->vp_idx = qla24xx_allocate_vp_id(vha);
        if (vha->vp_idx > ha->max_npiv_vports) {
-               DEBUG15(printk("scsi(%ld): Couldn't allocate vp_id.\n",
-                       vha->host_no));
+               ql_dbg(ql_dbg_vport, vha, 0xa006,
+                   "Couldn't allocate vp_id.\n");
                goto create_vhost_failed;
        }
        vha->mgmt_svr_loop_id = 10 + vha->vp_idx;
@@ -461,8 +482,9 @@ qla24xx_create_vhost(struct fc_vport *fc_vport)
        host->max_id = MAX_TARGETS_2200;
        host->transportt = qla2xxx_transport_vport_template;
 
-       DEBUG15(printk("DEBUG: detect vport hba %ld at address = %p\n",
-           vha->host_no, vha));
+       ql_dbg(ql_dbg_vport, vha, 0xa007,
+           "Detect vport hba %ld at address = %p.\n",
+           vha->host_no, vha);
 
        vha->flags.init_done = 1;
 
@@ -567,9 +589,9 @@ qla25xx_delete_queues(struct scsi_qla_host *vha)
                if (req) {
                        ret = qla25xx_delete_req_que(vha, req);
                        if (ret != QLA_SUCCESS) {
-                               qla_printk(KERN_WARNING, ha,
-                               "Couldn't delete req que %d\n",
-                               req->id);
+                               ql_log(ql_log_warn, vha, 0x00ea,
+                                   "Couldn't delete req que %d.\n",
+                                   req->id);
                                return ret;
                        }
                }
@@ -581,9 +603,9 @@ qla25xx_delete_queues(struct scsi_qla_host *vha)
                if (rsp) {
                        ret = qla25xx_delete_rsp_que(vha, rsp);
                        if (ret != QLA_SUCCESS) {
-                               qla_printk(KERN_WARNING, ha,
-                               "Couldn't delete rsp que %d\n",
-                               rsp->id);
+                               ql_log(ql_log_warn, vha, 0x00eb,
+                                   "Couldn't delete rsp que %d.\n",
+                                   rsp->id);
                                return ret;
                        }
                }
@@ -604,8 +626,8 @@ qla25xx_create_req_que(struct qla_hw_data *ha, uint16_t options,
 
        req = kzalloc(sizeof(struct req_que), GFP_KERNEL);
        if (req == NULL) {
-               qla_printk(KERN_WARNING, ha, "could not allocate memory"
-                       "for request que\n");
+               ql_log(ql_log_fatal, base_vha, 0x00d9,
+                   "Failed to allocate memory for request queue.\n");
                goto failed;
        }
 
@@ -614,8 +636,8 @@ qla25xx_create_req_que(struct qla_hw_data *ha, uint16_t options,
                        (req->length + 1) * sizeof(request_t),
                        &req->dma, GFP_KERNEL);
        if (req->ring == NULL) {
-               qla_printk(KERN_WARNING, ha,
-               "Memory Allocation failed - request_ring\n");
+               ql_log(ql_log_fatal, base_vha, 0x00da,
+                   "Failed to allocte memory for request_ring.\n");
                goto que_failed;
        }
 
@@ -623,8 +645,8 @@ qla25xx_create_req_que(struct qla_hw_data *ha, uint16_t options,
        que_id = find_first_zero_bit(ha->req_qid_map, ha->max_req_queues);
        if (que_id >= ha->max_req_queues) {
                mutex_unlock(&ha->vport_lock);
-               qla_printk(KERN_INFO, ha, "No resources to create "
-                        "additional request queue\n");
+               ql_log(ql_log_warn, base_vha, 0x00db,
+                   "No resources to create additional request queue.\n");
                goto que_failed;
        }
        set_bit(que_id, ha->req_qid_map);
@@ -633,6 +655,12 @@ qla25xx_create_req_que(struct qla_hw_data *ha, uint16_t options,
        req->vp_idx = vp_idx;
        req->qos = qos;
 
+       ql_dbg(ql_dbg_multiq, base_vha, 0xc002,
+           "queue_id=%d rid=%d vp_idx=%d qos=%d.\n",
+           que_id, req->rid, req->vp_idx, req->qos);
+       ql_dbg(ql_dbg_init, base_vha, 0x00dc,
+           "queue_id=%d rid=%d vp_idx=%d qos=%d.\n",
+           que_id, req->rid, req->vp_idx, req->qos);
        if (rsp_que < 0)
                req->rsp = NULL;
        else
@@ -645,6 +673,10 @@ qla25xx_create_req_que(struct qla_hw_data *ha, uint16_t options,
                options |= BIT_5;
        req->options = options;
 
+       ql_dbg(ql_dbg_multiq, base_vha, 0xc003,
+           "options=0x%x.\n", req->options);
+       ql_dbg(ql_dbg_init, base_vha, 0x00dd,
+           "options=0x%x.\n", req->options);
        for (cnt = 1; cnt < MAX_OUTSTANDING_COMMANDS; cnt++)
                req->outstanding_cmds[cnt] = NULL;
        req->current_outstanding_cmd = 1;
@@ -656,10 +688,21 @@ qla25xx_create_req_que(struct qla_hw_data *ha, uint16_t options,
        reg = ISP_QUE_REG(ha, que_id);
        req->max_q_depth = ha->req_q_map[0]->max_q_depth;
        mutex_unlock(&ha->vport_lock);
+       ql_dbg(ql_dbg_multiq, base_vha, 0xc004,
+           "ring_ptr=%p ring_index=%d, "
+           "cnt=%d id=%d max_q_depth=%d.\n",
+           req->ring_ptr, req->ring_index,
+           req->cnt, req->id, req->max_q_depth);
+       ql_dbg(ql_dbg_init, base_vha, 0x00de,
+           "ring_ptr=%p ring_index=%d, "
+           "cnt=%d id=%d max_q_depth=%d.\n",
+           req->ring_ptr, req->ring_index, req->cnt,
+           req->id, req->max_q_depth);
 
        ret = qla25xx_init_req_que(base_vha, req);
        if (ret != QLA_SUCCESS) {
-               qla_printk(KERN_WARNING, ha, "%s failed\n", __func__);
+               ql_log(ql_log_fatal, base_vha, 0x00df,
+                   "%s failed.\n", __func__);
                mutex_lock(&ha->vport_lock);
                clear_bit(que_id, ha->req_qid_map);
                mutex_unlock(&ha->vport_lock);
@@ -700,8 +743,8 @@ qla25xx_create_rsp_que(struct qla_hw_data *ha, uint16_t options,
 
        rsp = kzalloc(sizeof(struct rsp_que), GFP_KERNEL);
        if (rsp == NULL) {
-               qla_printk(KERN_WARNING, ha, "could not allocate memory for"
-                               " response que\n");
+               ql_log(ql_log_warn, base_vha, 0x0066,
+                   "Failed to allocate memory for response queue.\n");
                goto failed;
        }
 
@@ -710,8 +753,8 @@ qla25xx_create_rsp_que(struct qla_hw_data *ha, uint16_t options,
                        (rsp->length + 1) * sizeof(response_t),
                        &rsp->dma, GFP_KERNEL);
        if (rsp->ring == NULL) {
-               qla_printk(KERN_WARNING, ha,
-               "Memory Allocation failed - response_ring\n");
+               ql_log(ql_log_warn, base_vha, 0x00e1,
+                   "Failed to allocate memory for response ring.\n");
                goto que_failed;
        }
 
@@ -719,8 +762,8 @@ qla25xx_create_rsp_que(struct qla_hw_data *ha, uint16_t options,
        que_id = find_first_zero_bit(ha->rsp_qid_map, ha->max_rsp_queues);
        if (que_id >= ha->max_rsp_queues) {
                mutex_unlock(&ha->vport_lock);
-               qla_printk(KERN_INFO, ha, "No resources to create "
-                        "additional response queue\n");
+               ql_log(ql_log_warn, base_vha, 0x00e2,
+                   "No resources to create additional request queue.\n");
                goto que_failed;
        }
        set_bit(que_id, ha->rsp_qid_map);
@@ -728,12 +771,16 @@ qla25xx_create_rsp_que(struct qla_hw_data *ha, uint16_t options,
        if (ha->flags.msix_enabled)
                rsp->msix = &ha->msix_entries[que_id + 1];
        else
-               qla_printk(KERN_WARNING, ha, "msix not enabled\n");
+               ql_log(ql_log_warn, base_vha, 0x00e3,
+                   "MSIX not enalbled.\n");
 
        ha->rsp_q_map[que_id] = rsp;
        rsp->rid = rid;
        rsp->vp_idx = vp_idx;
        rsp->hw = ha;
+       ql_dbg(ql_dbg_init, base_vha, 0x00e4,
+           "queue_id=%d rid=%d vp_idx=%d hw=%p.\n",
+           que_id, rsp->rid, rsp->vp_idx, rsp->hw);
        /* Use alternate PCI bus number */
        if (MSB(rsp->rid))
                options |= BIT_4;
@@ -750,6 +797,14 @@ qla25xx_create_rsp_que(struct qla_hw_data *ha, uint16_t options,
        rsp->rsp_q_in = &reg->isp25mq.rsp_q_in;
        rsp->rsp_q_out = &reg->isp25mq.rsp_q_out;
        mutex_unlock(&ha->vport_lock);
+       ql_dbg(ql_dbg_multiq, base_vha, 0xc00b,
+           "options=%x id=%d rsp_q_in=%p rsp_q_out=%p",
+           rsp->options, rsp->id, rsp->rsp_q_in,
+           rsp->rsp_q_out);
+       ql_dbg(ql_dbg_init, base_vha, 0x00e5,
+           "options=%x id=%d rsp_q_in=%p rsp_q_out=%p",
+           rsp->options, rsp->id, rsp->rsp_q_in,
+           rsp->rsp_q_out);
 
        ret = qla25xx_request_irq(rsp);
        if (ret)
@@ -757,7 +812,8 @@ qla25xx_create_rsp_que(struct qla_hw_data *ha, uint16_t options,
 
        ret = qla25xx_init_rsp_que(base_vha, rsp);
        if (ret != QLA_SUCCESS) {
-               qla_printk(KERN_WARNING, ha, "%s failed\n", __func__);
+               ql_log(ql_log_fatal, base_vha, 0x00e7,
+                   "%s failed.\n", __func__);
                mutex_lock(&ha->vport_lock);
                clear_bit(que_id, ha->rsp_qid_map);
                mutex_unlock(&ha->vport_lock);
index e1138bcc834c1e56b0bab79efbd94402d9116147..5cbf33a50b14415eed6b5101cba7f2d17080fccc 100644 (file)
@@ -348,6 +348,7 @@ static void
 qla82xx_pci_set_crbwindow_2M(struct qla_hw_data *ha, ulong *off)
 {
        u32 win_read;
+       scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev);
 
        ha->crb_win = CRB_HI(*off);
        writel(ha->crb_win,
@@ -358,9 +359,10 @@ qla82xx_pci_set_crbwindow_2M(struct qla_hw_data *ha, ulong *off)
         */
        win_read = RD_REG_DWORD((void *)(CRB_WINDOW_2M + ha->nx_pcibase));
        if (win_read != ha->crb_win) {
-               DEBUG2(qla_printk(KERN_INFO, ha,
-                   "%s: Written crbwin (0x%x) != Read crbwin (0x%x), "
-                   "off=0x%lx\n", __func__, ha->crb_win, win_read, *off));
+               ql_dbg(ql_dbg_p3p, vha, 0xb000,
+                   "%s: Written crbwin (0x%x) "
+                   "!= Read crbwin (0x%x), off=0x%lx.\n",
+                   ha->crb_win, win_read, *off);
        }
        *off = (*off & MASK(16)) + CRB_INDIRECT_2M + ha->nx_pcibase;
 }
@@ -368,6 +370,7 @@ qla82xx_pci_set_crbwindow_2M(struct qla_hw_data *ha, ulong *off)
 static inline unsigned long
 qla82xx_pci_set_crbwindow(struct qla_hw_data *ha, u64 off)
 {
+       scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev);
        /* See if we are currently pointing to the region we want to use next */
        if ((off >= QLA82XX_CRB_PCIX_HOST) && (off < QLA82XX_CRB_DDR_NET)) {
                /* No need to change window. PCIX and PCIEregs are in both
@@ -398,9 +401,10 @@ qla82xx_pci_set_crbwindow(struct qla_hw_data *ha, u64 off)
                        return off;
        }
        /* strange address given */
-       qla_printk(KERN_WARNING, ha,
-               "%s: Warning: unm_nic_pci_set_crbwindow called with"
-               " an unknown address(%llx)\n", QLA2XXX_DRIVER_NAME, off);
+       ql_dbg(ql_dbg_p3p, vha, 0xb001,
+           "%x: Warning: unm_nic_pci_set_crbwindow "
+           "called with an unknown address(%llx).\n",
+           QLA2XXX_DRIVER_NAME, off);
        return off;
 }
 
@@ -563,6 +567,7 @@ qla82xx_pci_set_window(struct qla_hw_data *ha, unsigned long long addr)
 {
        int window;
        u32 win_read;
+       scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev);
 
        if (QLA82XX_ADDR_IN_RANGE(addr, QLA82XX_ADDR_DDR_NET,
                QLA82XX_ADDR_DDR_NET_MAX)) {
@@ -574,8 +579,8 @@ qla82xx_pci_set_window(struct qla_hw_data *ha, unsigned long long addr)
                win_read = qla82xx_rd_32(ha,
                        ha->mn_win_crb | QLA82XX_PCI_CRBSPACE);
                if ((win_read << 17) != window) {
-                       qla_printk(KERN_WARNING, ha,
-                           "%s: Written MNwin (0x%x) != Read MNwin (0x%x)\n",
+                       ql_dbg(ql_dbg_p3p, vha, 0xb003,
+                           "%s: Written MNwin (0x%x) != Read MNwin (0x%x).\n",
                            __func__, window, win_read);
                }
                addr = GET_MEM_OFFS_2M(addr) + QLA82XX_PCI_DDR_NET;
@@ -583,7 +588,7 @@ qla82xx_pci_set_window(struct qla_hw_data *ha, unsigned long long addr)
                QLA82XX_ADDR_OCM0_MAX)) {
                unsigned int temp1;
                if ((addr & 0x00ff800) == 0xff800) {
-                       qla_printk(KERN_WARNING, ha,
+                       ql_log(ql_log_warn, vha, 0xb004,
                            "%s: QM access not handled.\n", __func__);
                        addr = -1UL;
                }
@@ -596,8 +601,8 @@ qla82xx_pci_set_window(struct qla_hw_data *ha, unsigned long long addr)
                temp1 = ((window & 0x1FF) << 7) |
                    ((window & 0x0FFFE0000) >> 17);
                if (win_read != temp1) {
-                       qla_printk(KERN_WARNING, ha,
-                           "%s: Written OCMwin (0x%x) != Read OCMwin (0x%x)\n",
+                       ql_log(ql_log_warn, vha, 0xb005,
+                           "%s: Written OCMwin (0x%x) != Read OCMwin (0x%x).\n",
                            __func__, temp1, win_read);
                }
                addr = GET_MEM_OFFS_2M(addr) + QLA82XX_PCI_OCM0_2M;
@@ -612,8 +617,8 @@ qla82xx_pci_set_window(struct qla_hw_data *ha, unsigned long long addr)
                win_read = qla82xx_rd_32(ha,
                        ha->ms_win_crb | QLA82XX_PCI_CRBSPACE);
                if (win_read != window) {
-                       qla_printk(KERN_WARNING, ha,
-                           "%s: Written MSwin (0x%x) != Read MSwin (0x%x)\n",
+                       ql_log(ql_log_warn, vha, 0xb006,
+                           "%s: Written MSwin (0x%x) != Read MSwin (0x%x).\n",
                            __func__, window, win_read);
                }
                addr = GET_MEM_OFFS_2M(addr) + QLA82XX_PCI_QDR_NET;
@@ -624,9 +629,9 @@ qla82xx_pci_set_window(struct qla_hw_data *ha, unsigned long long addr)
                 */
                if ((qla82xx_pci_set_window_warning_count++ < 8) ||
                    (qla82xx_pci_set_window_warning_count%64 == 0)) {
-                       qla_printk(KERN_WARNING, ha,
-                           "%s: Warning:%s Unknown address range!\n", __func__,
-                           QLA2XXX_DRIVER_NAME);
+                       ql_log(ql_log_warn, vha, 0xb007,
+                           "%s: Warning:%s Unknown address range!.\n",
+                           __func__, QLA2XXX_DRIVER_NAME);
                }
                addr = -1UL;
        }
@@ -671,6 +676,7 @@ static int qla82xx_pci_mem_read_direct(struct qla_hw_data *ha,
        uint8_t         *mem_ptr = NULL;
        unsigned long   mem_base;
        unsigned long   mem_page;
+       scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev);
 
        write_lock_irqsave(&ha->hw_lock, flags);
 
@@ -682,9 +688,10 @@ static int qla82xx_pci_mem_read_direct(struct qla_hw_data *ha,
        if ((start == -1UL) ||
                (qla82xx_pci_is_same_window(ha, off + size - 1) == 0)) {
                write_unlock_irqrestore(&ha->hw_lock, flags);
-               qla_printk(KERN_ERR, ha,
-                       "%s out of bound pci memory access. "
-                       "offset is 0x%llx\n", QLA2XXX_DRIVER_NAME, off);
+               ql_log(ql_log_fatal, vha, 0xb008,
+                   "%s out of bound pci memory "
+                   "access, offset is 0x%llx.\n",
+                   QLA2XXX_DRIVER_NAME, off);
                return -1;
        }
 
@@ -741,6 +748,7 @@ qla82xx_pci_mem_write_direct(struct qla_hw_data *ha,
        uint8_t         *mem_ptr = NULL;
        unsigned long   mem_base;
        unsigned long   mem_page;
+       scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev);
 
        write_lock_irqsave(&ha->hw_lock, flags);
 
@@ -752,9 +760,10 @@ qla82xx_pci_mem_write_direct(struct qla_hw_data *ha,
        if ((start == -1UL) ||
                (qla82xx_pci_is_same_window(ha, off + size - 1) == 0)) {
                write_unlock_irqrestore(&ha->hw_lock, flags);
-               qla_printk(KERN_ERR, ha,
-                       "%s out of bound pci memory access. "
-                       "offset is 0x%llx\n", QLA2XXX_DRIVER_NAME, off);
+               ql_log(ql_log_fatal, vha, 0xb009,
+                   "%s out of bount memory "
+                   "access, offset is 0x%llx.\n",
+                   QLA2XXX_DRIVER_NAME, off);
                return -1;
        }
 
@@ -855,15 +864,16 @@ qla82xx_wait_rom_busy(struct qla_hw_data *ha)
 {
        long timeout = 0;
        long done = 0 ;
+       scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev);
 
        while (done == 0) {
                done = qla82xx_rd_32(ha, QLA82XX_ROMUSB_GLB_STATUS);
                done &= 4;
                timeout++;
                if (timeout >= rom_max_timeout) {
-                       DEBUG(qla_printk(KERN_INFO, ha,
-                               "%s: Timeout reached waiting for rom busy",
-                               QLA2XXX_DRIVER_NAME));
+                       ql_dbg(ql_dbg_p3p, vha, 0xb00a,
+                           "%s: Timeout reached waiting for rom busy.\n",
+                           QLA2XXX_DRIVER_NAME);
                        return -1;
                }
        }
@@ -875,15 +885,16 @@ qla82xx_wait_rom_done(struct qla_hw_data *ha)
 {
        long timeout = 0;
        long done = 0 ;
+       scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev);
 
        while (done == 0) {
                done = qla82xx_rd_32(ha, QLA82XX_ROMUSB_GLB_STATUS);
                done &= 2;
                timeout++;
                if (timeout >= rom_max_timeout) {
-                       DEBUG(qla_printk(KERN_INFO, ha,
-                               "%s: Timeout reached  waiting for rom done",
-                               QLA2XXX_DRIVER_NAME));
+                       ql_dbg(ql_dbg_p3p, vha, 0xb00b,
+                           "%s: Timeout reached waiting for rom done.\n",
+                           QLA2XXX_DRIVER_NAME);
                        return -1;
                }
        }
@@ -893,15 +904,16 @@ qla82xx_wait_rom_done(struct qla_hw_data *ha)
 static int
 qla82xx_do_rom_fast_read(struct qla_hw_data *ha, int addr, int *valp)
 {
+       scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev);
+
        qla82xx_wr_32(ha, QLA82XX_ROMUSB_ROM_ADDRESS, addr);
        qla82xx_wr_32(ha, QLA82XX_ROMUSB_ROM_DUMMY_BYTE_CNT, 0);
        qla82xx_wr_32(ha, QLA82XX_ROMUSB_ROM_ABYTE_CNT, 3);
        qla82xx_wr_32(ha, QLA82XX_ROMUSB_ROM_INSTR_OPCODE, 0xb);
        qla82xx_wait_rom_busy(ha);
        if (qla82xx_wait_rom_done(ha)) {
-               qla_printk(KERN_WARNING, ha,
-                       "%s: Error waiting for rom done\n",
-                       QLA2XXX_DRIVER_NAME);
+               ql_log(ql_log_fatal, vha, 0x00ba,
+                   "Error waiting for rom done.\n");
                return -1;
        }
        /* Reset abyte_cnt and dummy_byte_cnt */
@@ -917,6 +929,7 @@ static int
 qla82xx_rom_fast_read(struct qla_hw_data *ha, int addr, int *valp)
 {
        int ret, loops = 0;
+       scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev);
 
        while ((qla82xx_rom_lock(ha) != 0) && (loops < 50000)) {
                udelay(100);
@@ -924,9 +937,8 @@ qla82xx_rom_fast_read(struct qla_hw_data *ha, int addr, int *valp)
                loops++;
        }
        if (loops >= 50000) {
-               qla_printk(KERN_INFO, ha,
-                       "%s: qla82xx_rom_lock failed\n",
-                       QLA2XXX_DRIVER_NAME);
+               ql_log(ql_log_fatal, vha, 0x00b9,
+                   "Failed to aquire SEM2 lock.\n");
                return -1;
        }
        ret = qla82xx_do_rom_fast_read(ha, addr, valp);
@@ -937,11 +949,12 @@ qla82xx_rom_fast_read(struct qla_hw_data *ha, int addr, int *valp)
 static int
 qla82xx_read_status_reg(struct qla_hw_data *ha, uint32_t *val)
 {
+       scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev);
        qla82xx_wr_32(ha, QLA82XX_ROMUSB_ROM_INSTR_OPCODE, M25P_INSTR_RDSR);
        qla82xx_wait_rom_busy(ha);
        if (qla82xx_wait_rom_done(ha)) {
-               qla_printk(KERN_WARNING, ha,
-                   "Error waiting for rom done\n");
+               ql_log(ql_log_warn, vha, 0xb00c,
+                   "Error waiting for rom done.\n");
                return -1;
        }
        *val = qla82xx_rd_32(ha, QLA82XX_ROMUSB_ROM_RDATA);
@@ -955,6 +968,7 @@ qla82xx_flash_wait_write_finish(struct qla_hw_data *ha)
        uint32_t done = 1 ;
        uint32_t val;
        int ret = 0;
+       scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev);
 
        qla82xx_wr_32(ha, QLA82XX_ROMUSB_ROM_ABYTE_CNT, 0);
        while ((done != 0) && (ret == 0)) {
@@ -964,8 +978,8 @@ qla82xx_flash_wait_write_finish(struct qla_hw_data *ha)
                udelay(10);
                cond_resched();
                if (timeout >= 50000) {
-                       qla_printk(KERN_WARNING, ha,
-                           "Timeout reached  waiting for write finish");
+                       ql_log(ql_log_warn, vha, 0xb00d,
+                           "Timeout reached waiting for write finish.\n");
                        return -1;
                }
        }
@@ -992,13 +1006,14 @@ qla82xx_flash_set_write_enable(struct qla_hw_data *ha)
 static int
 qla82xx_write_status_reg(struct qla_hw_data *ha, uint32_t val)
 {
+       scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev);
        if (qla82xx_flash_set_write_enable(ha))
                return -1;
        qla82xx_wr_32(ha, QLA82XX_ROMUSB_ROM_WDATA, val);
        qla82xx_wr_32(ha, QLA82XX_ROMUSB_ROM_INSTR_OPCODE, 0x1);
        if (qla82xx_wait_rom_done(ha)) {
-               qla_printk(KERN_WARNING, ha,
-                   "Error waiting for rom done\n");
+               ql_log(ql_log_warn, vha, 0xb00e,
+                   "Error waiting for rom done.\n");
                return -1;
        }
        return qla82xx_flash_wait_write_finish(ha);
@@ -1007,10 +1022,11 @@ qla82xx_write_status_reg(struct qla_hw_data *ha, uint32_t val)
 static int
 qla82xx_write_disable_flash(struct qla_hw_data *ha)
 {
+       scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev);
        qla82xx_wr_32(ha, QLA82XX_ROMUSB_ROM_INSTR_OPCODE, M25P_INSTR_WRDI);
        if (qla82xx_wait_rom_done(ha)) {
-               qla_printk(KERN_WARNING, ha,
-                   "Error waiting for rom done\n");
+               ql_log(ql_log_warn, vha, 0xb00f,
+                   "Error waiting for rom done.\n");
                return -1;
        }
        return 0;
@@ -1020,13 +1036,16 @@ static int
 ql82xx_rom_lock_d(struct qla_hw_data *ha)
 {
        int loops = 0;
+       scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev);
+
        while ((qla82xx_rom_lock(ha) != 0) && (loops < 50000)) {
                udelay(100);
                cond_resched();
                loops++;
        }
        if (loops >= 50000) {
-               qla_printk(KERN_WARNING, ha, "ROM lock failed\n");
+               ql_log(ql_log_warn, vha, 0xb010,
+                   "ROM lock failed.\n");
                return -1;
        }
        return 0;;
@@ -1037,10 +1056,12 @@ qla82xx_write_flash_dword(struct qla_hw_data *ha, uint32_t flashaddr,
        uint32_t data)
 {
        int ret = 0;
+       scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev);
 
        ret = ql82xx_rom_lock_d(ha);
        if (ret < 0) {
-               qla_printk(KERN_WARNING, ha, "ROM Lock failed\n");
+               ql_log(ql_log_warn, vha, 0xb011,
+                   "ROM lock failed.\n");
                return ret;
        }
 
@@ -1053,8 +1074,8 @@ qla82xx_write_flash_dword(struct qla_hw_data *ha, uint32_t flashaddr,
        qla82xx_wr_32(ha, QLA82XX_ROMUSB_ROM_INSTR_OPCODE, M25P_INSTR_PP);
        qla82xx_wait_rom_busy(ha);
        if (qla82xx_wait_rom_done(ha)) {
-               qla_printk(KERN_WARNING, ha,
-                       "Error waiting for rom done\n");
+               ql_log(ql_log_warn, vha, 0xb012,
+                   "Error waiting for rom done.\n");
                ret = -1;
                goto done_write;
        }
@@ -1159,8 +1180,8 @@ qla82xx_pinit_from_rom(scsi_qla_host_t *vha)
         */
        if (qla82xx_rom_fast_read(ha, 0, &n) != 0 || n != 0xcafecafeUL ||
            qla82xx_rom_fast_read(ha, 4, &n) != 0) {
-               qla_printk(KERN_WARNING, ha,
-                   "[ERROR] Reading crb_init area: n: %08x\n", n);
+               ql_log(ql_log_fatal, vha, 0x006e,
+                   "Error Reading crb_init area: n: %08x.\n", n);
                return -1;
        }
 
@@ -1172,20 +1193,18 @@ qla82xx_pinit_from_rom(scsi_qla_host_t *vha)
 
        /* number of addr/value pair should not exceed 1024 enteries */
        if (n  >= 1024) {
-               qla_printk(KERN_WARNING, ha,
-                   "%s: %s:n=0x%x [ERROR] Card flash not initialized.\n",
-                   QLA2XXX_DRIVER_NAME, __func__, n);
+               ql_log(ql_log_fatal, vha, 0x0071,
+                   "Card flash not initialized:n=0x%x.\n", n);
                return -1;
        }
 
-       qla_printk(KERN_INFO, ha,
-           "%s: %d CRB init values found in ROM.\n", QLA2XXX_DRIVER_NAME, n);
+       ql_log(ql_log_info, vha, 0x0072,
+           "%d CRB init values found in ROM.\n", n);
 
        buf = kmalloc(n * sizeof(struct crb_addr_pair), GFP_KERNEL);
        if (buf == NULL) {
-               qla_printk(KERN_WARNING, ha,
-                   "%s: [ERROR] Unable to malloc memory.\n",
-                   QLA2XXX_DRIVER_NAME);
+               ql_log(ql_log_fatal, vha, 0x010c,
+                   "Unable to allocate memory.\n");
                return -1;
        }
 
@@ -1236,9 +1255,8 @@ qla82xx_pinit_from_rom(scsi_qla_host_t *vha)
                        continue;
 
                if (off == ADDR_ERROR) {
-                       qla_printk(KERN_WARNING, ha,
-                           "%s: [ERROR] Unknown addr: 0x%08lx\n",
-                           QLA2XXX_DRIVER_NAME, buf[i].addr);
+                       ql_log(ql_log_fatal, vha, 0x0116,
+                           "Unknow addr: 0x%08lx.\n", buf[i].addr);
                        continue;
                }
 
@@ -1370,7 +1388,7 @@ qla82xx_pci_mem_write_2M(struct qla_hw_data *ha,
                if (j >= MAX_CTL_CHECK) {
                        if (printk_ratelimit())
                                dev_err(&ha->pdev->dev,
-                                   "failed to write through agent\n");
+                                   "failed to write through agent.\n");
                        ret = -1;
                        break;
                }
@@ -1460,7 +1478,7 @@ qla82xx_pci_mem_read_2M(struct qla_hw_data *ha,
                if (j >= MAX_CTL_CHECK) {
                        if (printk_ratelimit())
                                dev_err(&ha->pdev->dev,
-                                   "failed to read through agent\n");
+                                   "failed to read through agent.\n");
                        break;
                }
 
@@ -1633,17 +1651,15 @@ qla82xx_iospace_config(struct qla_hw_data *ha)
        uint32_t len = 0;
 
        if (pci_request_regions(ha->pdev, QLA2XXX_DRIVER_NAME)) {
-               qla_printk(KERN_WARNING, ha,
-                       "Failed to reserve selected regions (%s)\n",
-                       pci_name(ha->pdev));
+               ql_log_pci(ql_log_fatal, ha->pdev, 0x000c,
+                   "Failed to reserver selected regions.\n");
                goto iospace_error_exit;
        }
 
        /* Use MMIO operations for all accesses. */
        if (!(pci_resource_flags(ha->pdev, 0) & IORESOURCE_MEM)) {
-               qla_printk(KERN_ERR, ha,
-                       "region #0 not an MMIO resource (%s), aborting\n",
-                       pci_name(ha->pdev));
+               ql_log_pci(ql_log_fatal, ha->pdev, 0x000d,
+                   "Region #0 not an MMIO resource, aborting.\n");
                goto iospace_error_exit;
        }
 
@@ -1651,9 +1667,8 @@ qla82xx_iospace_config(struct qla_hw_data *ha)
        ha->nx_pcibase =
            (unsigned long)ioremap(pci_resource_start(ha->pdev, 0), len);
        if (!ha->nx_pcibase) {
-               qla_printk(KERN_ERR, ha,
-                   "cannot remap pcibase MMIO (%s), aborting\n",
-                   pci_name(ha->pdev));
+               ql_log_pci(ql_log_fatal, ha->pdev, 0x000e,
+                   "Cannot remap pcibase MMIO, aborting.\n");
                pci_release_regions(ha->pdev);
                goto iospace_error_exit;
        }
@@ -1667,9 +1682,8 @@ qla82xx_iospace_config(struct qla_hw_data *ha)
                    (unsigned long)ioremap((pci_resource_start(ha->pdev, 4) +
                    (ha->pdev->devfn << 12)), 4);
                if (!ha->nxdb_wr_ptr) {
-                       qla_printk(KERN_ERR, ha,
-                           "cannot remap MMIO (%s), aborting\n",
-                           pci_name(ha->pdev));
+                       ql_log_pci(ql_log_fatal, ha->pdev, 0x000f,
+                           "Cannot remap MMIO, aborting.\n");
                        pci_release_regions(ha->pdev);
                        goto iospace_error_exit;
                }
@@ -1687,6 +1701,16 @@ qla82xx_iospace_config(struct qla_hw_data *ha)
 
        ha->max_req_queues = ha->max_rsp_queues = 1;
        ha->msix_count = ha->max_rsp_queues + 1;
+       ql_dbg_pci(ql_dbg_multiq, ha->pdev, 0xc006,
+           "nx_pci_base=%p iobase=%p "
+           "max_req_queues=%d msix_count=%d.\n",
+           ha->nx_pcibase, ha->iobase,
+           ha->max_req_queues, ha->msix_count);
+       ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0010,
+           "nx_pci_base=%p iobase=%p "
+           "max_req_queues=%d msix_count=%d.\n",
+           ha->nx_pcibase, ha->iobase,
+           ha->max_req_queues, ha->msix_count);
        return 0;
 
 iospace_error_exit:
@@ -1712,6 +1736,9 @@ qla82xx_pci_config(scsi_qla_host_t *vha)
        pci_set_master(ha->pdev);
        ret = pci_set_mwi(ha->pdev);
        ha->chip_revision = ha->pdev->revision;
+       ql_dbg(ql_dbg_init, vha, 0x0043,
+           "Chip revision:%ld.\n",
+           ha->chip_revision);
        return 0;
 }
 
@@ -1877,6 +1904,7 @@ qla82xx_check_cmdpeg_state(struct qla_hw_data *ha)
 {
        u32 val = 0;
        int retries = 60;
+       scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev);
 
        do {
                read_lock(&ha->hw_lock);
@@ -1892,15 +1920,15 @@ qla82xx_check_cmdpeg_state(struct qla_hw_data *ha)
                default:
                        break;
                }
-               qla_printk(KERN_WARNING, ha,
-                       "CRB_CMDPEG_STATE: 0x%x and retries: 0x%x\n",
-                       val, retries);
+               ql_log(ql_log_info, vha, 0x00a8,
+                   "CRB_CMDPEG_STATE: 0x%x and retries:0x%x.\n",
+                   val, retries);
 
                msleep(500);
 
        } while (--retries);
 
-       qla_printk(KERN_INFO, ha,
+       ql_log(ql_log_fatal, vha, 0x00a9,
            "Cmd Peg initialization failed: 0x%x.\n", val);
 
        val = qla82xx_rd_32(ha, QLA82XX_ROMUSB_GLB_PEGTUNE_DONE);
@@ -1915,6 +1943,7 @@ qla82xx_check_rcvpeg_state(struct qla_hw_data *ha)
 {
        u32 val = 0;
        int retries = 60;
+       scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev);
 
        do {
                read_lock(&ha->hw_lock);
@@ -1930,17 +1959,16 @@ qla82xx_check_rcvpeg_state(struct qla_hw_data *ha)
                default:
                        break;
                }
-
-               qla_printk(KERN_WARNING, ha,
-                       "CRB_RCVPEG_STATE: 0x%x and retries: 0x%x\n",
-                       val, retries);
+               ql_log(ql_log_info, vha, 0x00ab,
+                   "CRB_RCVPEG_STATE: 0x%x and retries: 0x%x.\n",
+                   val, retries);
 
                msleep(500);
 
        } while (--retries);
 
-       qla_printk(KERN_INFO, ha,
-               "Rcv Peg initialization failed: 0x%x.\n", val);
+       ql_log(ql_log_fatal, vha, 0x00ac,
+           "Rcv Peg initializatin failed: 0x%x.\n", val);
        read_lock(&ha->hw_lock);
        qla82xx_wr_32(ha, CRB_RCVPEG_STATE, PHAN_INITIALIZE_FAILED);
        read_unlock(&ha->hw_lock);
@@ -1989,13 +2017,11 @@ qla82xx_mbx_completion(scsi_qla_host_t *vha, uint16_t mb0)
        }
 
        if (ha->mcp) {
-               DEBUG3_11(printk(KERN_INFO "%s(%ld): "
-                       "Got mailbox completion. cmd=%x.\n",
-                       __func__, vha->host_no, ha->mcp->mb[0]));
+               ql_dbg(ql_dbg_async, vha, 0x5052,
+                   "Got mailbox completion. cmd=%x.\n", ha->mcp->mb[0]);
        } else {
-               qla_printk(KERN_INFO, ha,
-                       "%s(%ld): MBX pointer ERROR!\n",
-                       __func__, vha->host_no);
+               ql_dbg(ql_dbg_async, vha, 0x5053,
+                   "MBX pointer ERROR.\n");
        }
 }
 
@@ -2019,13 +2045,13 @@ qla82xx_intr_handler(int irq, void *dev_id)
        int status = 0, status1 = 0;
        unsigned long   flags;
        unsigned long   iter;
-       uint32_t        stat;
+       uint32_t        stat = 0;
        uint16_t        mb[4];
 
        rsp = (struct rsp_que *) dev_id;
        if (!rsp) {
                printk(KERN_INFO
-                       "%s(): NULL response queue pointer\n", __func__);
+                       "%s(): NULL response queue pointer.\n", __func__);
                return IRQ_NONE;
        }
        ha = rsp->hw;
@@ -2075,9 +2101,9 @@ qla82xx_intr_handler(int irq, void *dev_id)
                                qla24xx_process_response_queue(vha, rsp);
                                break;
                        default:
-                               DEBUG2(printk("scsi(%ld): "
-                                       " Unrecognized interrupt type (%d).\n",
-                                       vha->host_no, stat & 0xff));
+                               ql_dbg(ql_dbg_async, vha, 0x5054,
+                                   "Unrecognized interrupt type (%d).\n",
+                                   stat & 0xff);
                                break;
                        }
                }
@@ -2089,8 +2115,8 @@ qla82xx_intr_handler(int irq, void *dev_id)
 
 #ifdef QL_DEBUG_LEVEL_17
        if (!irq && ha->flags.eeh_busy)
-               qla_printk(KERN_WARNING, ha,
-                   "isr: status %x, cmd_flags %lx, mbox_int %x, stat %x\n",
+               ql_log(ql_log_warn, vha, 0x503d,
+                   "isr:status %x, cmd_flags %lx, mbox_int %x, stat %x.\n",
                    status, ha->mbx_cmd_flags, ha->flags.mbox_int, stat);
 #endif
 
@@ -2111,13 +2137,13 @@ qla82xx_msix_default(int irq, void *dev_id)
        struct device_reg_82xx __iomem *reg;
        int status = 0;
        unsigned long flags;
-       uint32_t stat;
+       uint32_t stat = 0;
        uint16_t mb[4];
 
        rsp = (struct rsp_que *) dev_id;
        if (!rsp) {
                printk(KERN_INFO
-                       "%s(): NULL response queue pointer\n", __func__);
+                       "%s(): NULL response queue pointer.\n", __func__);
                return IRQ_NONE;
        }
        ha = rsp->hw;
@@ -2149,9 +2175,9 @@ qla82xx_msix_default(int irq, void *dev_id)
                                qla24xx_process_response_queue(vha, rsp);
                                break;
                        default:
-                               DEBUG2(printk("scsi(%ld): "
-                                       " Unrecognized interrupt type (%d).\n",
-                                       vha->host_no, stat & 0xff));
+                               ql_dbg(ql_dbg_async, vha, 0x5041,
+                                   "Unrecognized interrupt type (%d).\n",
+                                   stat & 0xff);
                                break;
                        }
                }
@@ -2162,9 +2188,9 @@ qla82xx_msix_default(int irq, void *dev_id)
 
 #ifdef QL_DEBUG_LEVEL_17
        if (!irq && ha->flags.eeh_busy)
-               qla_printk(KERN_WARNING, ha,
-                       "isr: status %x, cmd_flags %lx, mbox_int %x, stat %x\n",
-                       status, ha->mbx_cmd_flags, ha->flags.mbox_int, stat);
+               ql_log(ql_log_warn, vha, 0x5044,
+                   "isr:status %x, cmd_flags %lx, mbox_int %x, stat %x.\n",
+                   status, ha->mbx_cmd_flags, ha->flags.mbox_int, stat);
 #endif
 
        if (test_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags) &&
@@ -2186,7 +2212,7 @@ qla82xx_msix_rsp_q(int irq, void *dev_id)
        rsp = (struct rsp_que *) dev_id;
        if (!rsp) {
                printk(KERN_INFO
-                       "%s(): NULL response queue pointer\n", __func__);
+                       "%s(): NULL response queue pointer.\n", __func__);
                return IRQ_NONE;
        }
 
@@ -2215,7 +2241,7 @@ qla82xx_poll(int irq, void *dev_id)
        rsp = (struct rsp_que *) dev_id;
        if (!rsp) {
                printk(KERN_INFO
-                       "%s(): NULL response queue pointer\n", __func__);
+                       "%s(): NULL response queue pointer.\n", __func__);
                return;
        }
        ha = rsp->hw;
@@ -2245,9 +2271,9 @@ qla82xx_poll(int irq, void *dev_id)
                        qla24xx_process_response_queue(vha, rsp);
                        break;
                default:
-                       DEBUG2(printk("scsi(%ld): Unrecognized interrupt type "
-                               "(%d).\n",
-                               vha->host_no, stat & 0xff));
+                       ql_dbg(ql_dbg_p3p, vha, 0xb013,
+                           "Unrecognized interrupt type (%d).\n",
+                           stat * 0xff);
                        break;
                }
        }
@@ -2347,9 +2373,8 @@ qla82xx_set_rst_ready(struct qla_hw_data *ha)
                drv_state = qla82xx_rd_32(ha, QLA82XX_CRB_DRV_STATE);
        }
        drv_state |= (QLA82XX_DRVST_RST_RDY << (ha->portnum * 4));
-       qla_printk(KERN_INFO, ha,
-               "%s(%ld):drv_state = 0x%x\n",
-               __func__, vha->host_no, drv_state);
+       ql_log(ql_log_info, vha, 0x00bb,
+           "drv_state = 0x%x.\n", drv_state);
        qla82xx_wr_32(ha, QLA82XX_CRB_DRV_STATE, drv_state);
 }
 
@@ -2392,8 +2417,8 @@ qla82xx_load_fw(scsi_qla_host_t *vha)
        struct qla_hw_data *ha = vha->hw;
 
        if (qla82xx_pinit_from_rom(vha) != QLA_SUCCESS) {
-               qla_printk(KERN_ERR, ha,
-                       "%s: Error during CRB Initialization\n", __func__);
+               ql_log(ql_log_fatal, vha, 0x009f,
+                   "Error during CRB initialization.\n");
                return QLA_FUNCTION_FAILED;
        }
        udelay(500);
@@ -2411,27 +2436,27 @@ qla82xx_load_fw(scsi_qla_host_t *vha)
        if (ql2xfwloadbin == 2)
                goto try_blob_fw;
 
-       qla_printk(KERN_INFO, ha,
-               "Attempting to load firmware from flash\n");
+       ql_log(ql_log_info, vha, 0x00a0,
+           "Attempting to load firmware from flash.\n");
 
        if (qla82xx_fw_load_from_flash(ha) == QLA_SUCCESS) {
-               qla_printk(KERN_ERR, ha,
-                   "Firmware loaded successfully from flash\n");
+               ql_log(ql_log_info, vha, 0x00a1,
+                   "Firmware loaded successully from flash.\n");
                return QLA_SUCCESS;
        } else {
-               qla_printk(KERN_ERR, ha,
-                   "Firmware load from flash failed\n");
+               ql_log(ql_log_warn, vha, 0x0108,
+                   "Firmware load from flash failed.\n");
        }
 
 try_blob_fw:
-       qla_printk(KERN_INFO, ha,
-           "Attempting to load firmware from blob\n");
+       ql_log(ql_log_info, vha, 0x00a2,
+           "Attempting to load firmware from blob.\n");
 
        /* Load firmware blob. */
        blob = ha->hablob = qla2x00_request_firmware(vha);
        if (!blob) {
-               qla_printk(KERN_ERR, ha,
-                       "Firmware image not present.\n");
+               ql_log(ql_log_fatal, vha, 0x00a3,
+                   "Firmware image not preset.\n");
                goto fw_load_failed;
        }
 
@@ -2441,20 +2466,19 @@ try_blob_fw:
                /* Fallback to URI format */
                if (qla82xx_validate_firmware_blob(vha,
                        QLA82XX_UNIFIED_ROMIMAGE)) {
-                       qla_printk(KERN_ERR, ha,
-                               "No valid firmware image found!!!");
+                       ql_log(ql_log_fatal, vha, 0x00a4,
+                           "No valid firmware image found.\n");
                        return QLA_FUNCTION_FAILED;
                }
        }
 
        if (qla82xx_fw_load_from_blob(ha) == QLA_SUCCESS) {
-               qla_printk(KERN_ERR, ha,
-                       "%s: Firmware loaded successfully "
-                       " from binary blob\n", __func__);
+               ql_log(ql_log_info, vha, 0x00a5,
+                   "Firmware loaded successfully from binary blob.\n");
                return QLA_SUCCESS;
        } else {
-               qla_printk(KERN_ERR, ha,
-                   "Firmware load failed from binary blob\n");
+               ql_log(ql_log_fatal, vha, 0x00a6,
+                   "Firmware load failed for binary blob.\n");
                blob->fw = NULL;
                blob = NULL;
                goto fw_load_failed;
@@ -2486,15 +2510,15 @@ qla82xx_start_firmware(scsi_qla_host_t *vha)
        qla82xx_wr_32(ha, QLA82XX_PEG_HALT_STATUS2, 0);
 
        if (qla82xx_load_fw(vha) != QLA_SUCCESS) {
-               qla_printk(KERN_INFO, ha,
-                       "%s: Error trying to start fw!\n", __func__);
+               ql_log(ql_log_fatal, vha, 0x00a7,
+                   "Error trying to start fw.\n");
                return QLA_FUNCTION_FAILED;
        }
 
        /* Handshake with the card before we register the devices. */
        if (qla82xx_check_cmdpeg_state(ha) != QLA_SUCCESS) {
-               qla_printk(KERN_INFO, ha,
-                       "%s: Error during card handshake!\n", __func__);
+               ql_log(ql_log_fatal, vha, 0x00aa,
+                   "Error during card handshake.\n");
                return QLA_FUNCTION_FAILED;
        }
 
@@ -2663,8 +2687,11 @@ qla82xx_start_scsi(srb_t *sp)
        /* Send marker if required */
        if (vha->marker_needed != 0) {
                if (qla2x00_marker(vha, req,
-                       rsp, 0, 0, MK_SYNC_ALL) != QLA_SUCCESS)
+                       rsp, 0, 0, MK_SYNC_ALL) != QLA_SUCCESS) {
+                       ql_log(ql_log_warn, vha, 0x300c,
+                           "qla2x00_marker failed for cmd=%p.\n", cmd);
                        return QLA_FUNCTION_FAILED;
+               }
                vha->marker_needed = 0;
        }
 
@@ -2701,8 +2728,13 @@ qla82xx_start_scsi(srb_t *sp)
                uint16_t i;
 
                more_dsd_lists = qla82xx_calc_dsd_lists(tot_dsds);
-               if ((more_dsd_lists + ha->gbl_dsd_inuse) >= NUM_DSD_CHAIN)
+               if ((more_dsd_lists + ha->gbl_dsd_inuse) >= NUM_DSD_CHAIN) {
+                       ql_dbg(ql_dbg_io, vha, 0x300d,
+                           "Num of DSD list %d is than %d for cmd=%p.\n",
+                           more_dsd_lists + ha->gbl_dsd_inuse, NUM_DSD_CHAIN,
+                           cmd);
                        goto queuing_error;
+               }
 
                if (more_dsd_lists <= ha->gbl_dsd_avail)
                        goto sufficient_dsds;
@@ -2711,13 +2743,20 @@ qla82xx_start_scsi(srb_t *sp)
 
                for (i = 0; i < more_dsd_lists; i++) {
                        dsd_ptr = kzalloc(sizeof(struct dsd_dma), GFP_ATOMIC);
-                       if (!dsd_ptr)
+                       if (!dsd_ptr) {
+                               ql_log(ql_log_fatal, vha, 0x300e,
+                                   "Failed to allocate memory for dsd_dma "
+                                   "for cmd=%p.\n", cmd);
                                goto queuing_error;
+                       }
 
                        dsd_ptr->dsd_addr = dma_pool_alloc(ha->dl_dma_pool,
                                GFP_ATOMIC, &dsd_ptr->dsd_list_dma);
                        if (!dsd_ptr->dsd_addr) {
                                kfree(dsd_ptr);
+                               ql_log(ql_log_fatal, vha, 0x300f,
+                                   "Failed to allocate memory for dsd_addr "
+                                   "for cmd=%p.\n", cmd);
                                goto queuing_error;
                        }
                        list_add_tail(&dsd_ptr->list, &ha->gbl_dsd_list);
@@ -2742,17 +2781,16 @@ sufficient_dsds:
 
                ctx = sp->ctx = mempool_alloc(ha->ctx_mempool, GFP_ATOMIC);
                if (!sp->ctx) {
-                       DEBUG(printk(KERN_INFO
-                               "%s(%ld): failed to allocate"
-                               " ctx.\n", __func__, vha->host_no));
+                       ql_log(ql_log_fatal, vha, 0x3010,
+                           "Failed to allocate ctx for cmd=%p.\n", cmd);
                        goto queuing_error;
                }
                memset(ctx, 0, sizeof(struct ct6_dsd));
                ctx->fcp_cmnd = dma_pool_alloc(ha->fcp_cmnd_dma_pool,
                        GFP_ATOMIC, &ctx->fcp_cmnd_dma);
                if (!ctx->fcp_cmnd) {
-                       DEBUG2_3(printk("%s(%ld): failed to allocate"
-                               " fcp_cmnd.\n", __func__, vha->host_no));
+                       ql_log(ql_log_fatal, vha, 0x3011,
+                           "Failed to allocate fcp_cmnd for cmd=%p.\n", cmd);
                        goto queuing_error_fcp_cmnd;
                }
 
@@ -2766,6 +2804,9 @@ sufficient_dsds:
                                /* SCSI command bigger than 16 bytes must be
                                 * multiple of 4
                                 */
+                               ql_log(ql_log_warn, vha, 0x3012,
+                                   "scsi cmd len %d not multiple of 4 "
+                                   "for cmd=%p.\n", cmd->cmd_len, cmd);
                                goto queuing_error_fcp_cmnd;
                        }
                        ctx->fcp_cmnd_len = 12 + cmd->cmd_len + 4;
@@ -2845,7 +2886,7 @@ sufficient_dsds:
                cmd_pkt->entry_status = (uint8_t) rsp->id;
        } else {
                struct cmd_type_7 *cmd_pkt;
-               req_cnt = qla24xx_calc_iocbs(tot_dsds);
+               req_cnt = qla24xx_calc_iocbs(vha, tot_dsds);
                if (req->cnt < (req_cnt + 2)) {
                        cnt = (uint16_t)RD_REG_DWORD_RELAXED(
                            &reg->req_q_out[0]);
@@ -2979,8 +3020,8 @@ qla82xx_read_flash_data(scsi_qla_host_t *vha, uint32_t *dwptr, uint32_t faddr,
        /* Dword reads to flash. */
        for (i = 0; i < length/4; i++, faddr += 4) {
                if (qla82xx_rom_fast_read(ha, faddr, &val)) {
-                       qla_printk(KERN_WARNING, ha,
-                           "Do ROM fast read failed\n");
+                       ql_log(ql_log_warn, vha, 0x0106,
+                           "Do ROM fast read failed.\n");
                        goto done_read;
                }
                dwptr[i] = __constant_cpu_to_le32(val);
@@ -2994,10 +3035,12 @@ qla82xx_unprotect_flash(struct qla_hw_data *ha)
 {
        int ret;
        uint32_t val;
+       scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev);
 
        ret = ql82xx_rom_lock_d(ha);
        if (ret < 0) {
-               qla_printk(KERN_WARNING, ha, "ROM Lock failed\n");
+               ql_log(ql_log_warn, vha, 0xb014,
+                   "ROM Lock failed.\n");
                return ret;
        }
 
@@ -3013,7 +3056,8 @@ qla82xx_unprotect_flash(struct qla_hw_data *ha)
        }
 
        if (qla82xx_write_disable_flash(ha) != 0)
-               qla_printk(KERN_WARNING, ha, "Write disable failed\n");
+               ql_log(ql_log_warn, vha, 0xb015,
+                   "Write disable failed.\n");
 
 done_unprotect:
        qla82xx_rom_unlock(ha);
@@ -3025,10 +3069,12 @@ qla82xx_protect_flash(struct qla_hw_data *ha)
 {
        int ret;
        uint32_t val;
+       scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev);
 
        ret = ql82xx_rom_lock_d(ha);
        if (ret < 0) {
-               qla_printk(KERN_WARNING, ha, "ROM Lock failed\n");
+               ql_log(ql_log_warn, vha, 0xb016,
+                   "ROM Lock failed.\n");
                return ret;
        }
 
@@ -3040,10 +3086,12 @@ qla82xx_protect_flash(struct qla_hw_data *ha)
        /* LOCK all sectors */
        ret = qla82xx_write_status_reg(ha, val);
        if (ret < 0)
-               qla_printk(KERN_WARNING, ha, "Write status register failed\n");
+               ql_log(ql_log_warn, vha, 0xb017,
+                   "Write status register failed.\n");
 
        if (qla82xx_write_disable_flash(ha) != 0)
-               qla_printk(KERN_WARNING, ha, "Write disable failed\n");
+               ql_log(ql_log_warn, vha, 0xb018,
+                   "Write disable failed.\n");
 done_protect:
        qla82xx_rom_unlock(ha);
        return ret;
@@ -3053,10 +3101,12 @@ static int
 qla82xx_erase_sector(struct qla_hw_data *ha, int addr)
 {
        int ret = 0;
+       scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev);
 
        ret = ql82xx_rom_lock_d(ha);
        if (ret < 0) {
-               qla_printk(KERN_WARNING, ha, "ROM Lock failed\n");
+               ql_log(ql_log_warn, vha, 0xb019,
+                   "ROM Lock failed.\n");
                return ret;
        }
 
@@ -3066,8 +3116,8 @@ qla82xx_erase_sector(struct qla_hw_data *ha, int addr)
        qla82xx_wr_32(ha, QLA82XX_ROMUSB_ROM_INSTR_OPCODE, M25P_INSTR_SE);
 
        if (qla82xx_wait_rom_done(ha)) {
-               qla_printk(KERN_WARNING, ha,
-                   "Error waiting for rom done\n");
+               ql_log(ql_log_warn, vha, 0xb01a,
+                   "Error waiting for rom done.\n");
                ret = -1;
                goto done;
        }
@@ -3110,10 +3160,10 @@ qla82xx_write_flash_data(struct scsi_qla_host *vha, uint32_t *dwptr,
                optrom = dma_alloc_coherent(&ha->pdev->dev, OPTROM_BURST_SIZE,
                    &optrom_dma, GFP_KERNEL);
                if (!optrom) {
-                       qla_printk(KERN_DEBUG, ha,
-                               "Unable to allocate memory for optrom "
-                               "burst write (%x KB).\n",
-                               OPTROM_BURST_SIZE / 1024);
+                       ql_log(ql_log_warn, vha, 0xb01b,
+                           "Unable to allocate memory "
+                           "for optron burst write (%x KB).\n",
+                           OPTROM_BURST_SIZE / 1024);
                }
        }
 
@@ -3122,8 +3172,8 @@ qla82xx_write_flash_data(struct scsi_qla_host *vha, uint32_t *dwptr,
 
        ret = qla82xx_unprotect_flash(ha);
        if (ret) {
-               qla_printk(KERN_WARNING, ha,
-                       "Unable to unprotect flash for update.\n");
+               ql_log(ql_log_warn, vha, 0xb01c,
+                   "Unable to unprotect flash for update.\n");
                goto write_done;
        }
 
@@ -3133,9 +3183,9 @@ qla82xx_write_flash_data(struct scsi_qla_host *vha, uint32_t *dwptr,
 
                        ret = qla82xx_erase_sector(ha, faddr);
                        if (ret) {
-                               DEBUG9(qla_printk(KERN_ERR, ha,
-                                   "Unable to erase sector: "
-                                   "address=%x.\n", faddr));
+                               ql_log(ql_log_warn, vha, 0xb01d,
+                                   "Unable to erase sector: address=%x.\n",
+                                   faddr);
                                break;
                        }
                }
@@ -3149,12 +3199,12 @@ qla82xx_write_flash_data(struct scsi_qla_host *vha, uint32_t *dwptr,
                            (ha->flash_data_off | faddr),
                            OPTROM_BURST_DWORDS);
                        if (ret != QLA_SUCCESS) {
-                               qla_printk(KERN_WARNING, ha,
+                               ql_log(ql_log_warn, vha, 0xb01e,
                                    "Unable to burst-write optrom segment "
                                    "(%x/%x/%llx).\n", ret,
                                    (ha->flash_data_off | faddr),
                                    (unsigned long long)optrom_dma);
-                               qla_printk(KERN_WARNING, ha,
+                               ql_log(ql_log_warn, vha, 0xb01f,
                                    "Reverting to slow-write.\n");
 
                                dma_free_coherent(&ha->pdev->dev,
@@ -3171,16 +3221,16 @@ qla82xx_write_flash_data(struct scsi_qla_host *vha, uint32_t *dwptr,
                ret = qla82xx_write_flash_dword(ha, faddr,
                    cpu_to_le32(*dwptr));
                if (ret) {
-                       DEBUG9(printk(KERN_DEBUG "%s(%ld) Unable to program"
-                           "flash address=%x data=%x.\n", __func__,
-                           ha->host_no, faddr, *dwptr));
+                       ql_dbg(ql_dbg_p3p, vha, 0xb020,
+                           "Unable to program flash address=%x data=%x.\n",
+                           faddr, *dwptr);
                        break;
                }
        }
 
        ret = qla82xx_protect_flash(ha);
        if (ret)
-               qla_printk(KERN_WARNING, ha,
+               ql_log(ql_log_warn, vha, 0xb021,
                    "Unable to protect flash after update.\n");
 write_done:
        if (optrom)
@@ -3244,9 +3294,12 @@ qla82xx_start_iocbs(srb_t *sp)
 
 void qla82xx_rom_lock_recovery(struct qla_hw_data *ha)
 {
+       scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev);
+
        if (qla82xx_rom_lock(ha))
                /* Someone else is holding the lock. */
-               qla_printk(KERN_INFO, ha, "Resetting rom_lock\n");
+               ql_log(ql_log_info, vha, 0xb022,
+                   "Resetting rom_lock.\n");
 
        /*
         * Either we got the lock, or someone
@@ -3313,7 +3366,8 @@ qla82xx_device_bootstrap(scsi_qla_host_t *vha)
 
 dev_initialize:
        /* set to DEV_INITIALIZING */
-       qla_printk(KERN_INFO, ha, "HW State: INITIALIZING\n");
+       ql_log(ql_log_info, vha, 0x009e,
+           "HW State: INITIALIZING.\n");
        qla82xx_wr_32(ha, QLA82XX_CRB_DEV_STATE, QLA82XX_DEV_INITIALIZING);
 
        /* Driver that sets device state to initializating sets IDC version */
@@ -3324,14 +3378,16 @@ dev_initialize:
        qla82xx_idc_lock(ha);
 
        if (rval != QLA_SUCCESS) {
-               qla_printk(KERN_INFO, ha, "HW State: FAILED\n");
+               ql_log(ql_log_fatal, vha, 0x00ad,
+                   "HW State: FAILED.\n");
                qla82xx_clear_drv_active(ha);
                qla82xx_wr_32(ha, QLA82XX_CRB_DEV_STATE, QLA82XX_DEV_FAILED);
                return rval;
        }
 
 dev_ready:
-       qla_printk(KERN_INFO, ha, "HW State: READY\n");
+       ql_log(ql_log_info, vha, 0x00ae,
+           "HW State: READY.\n");
        qla82xx_wr_32(ha, QLA82XX_CRB_DEV_STATE, QLA82XX_DEV_READY);
 
        return QLA_SUCCESS;
@@ -3376,15 +3432,15 @@ qla82xx_need_qsnt_handler(scsi_qla_host_t *vha)
                        /* quiescence timeout, other functions didn't ack
                         * changing the state to DEV_READY
                         */
-                       qla_printk(KERN_INFO, ha,
-                           "%s: QUIESCENT TIMEOUT\n", QLA2XXX_DRIVER_NAME);
-                       qla_printk(KERN_INFO, ha,
-                           "DRV_ACTIVE:%d DRV_STATE:%d\n", drv_active,
-                           drv_state);
+                       ql_log(ql_log_info, vha, 0xb023,
+                           "%s : QUIESCENT TIMEOUT.\n", QLA2XXX_DRIVER_NAME);
+                       ql_log(ql_log_info, vha, 0xb024,
+                           "DRV_ACTIVE:%d DRV_STATE:%d.\n",
+                           drv_active, drv_state);
                        qla82xx_wr_32(ha, QLA82XX_CRB_DEV_STATE,
-                                               QLA82XX_DEV_READY);
-                       qla_printk(KERN_INFO, ha,
-                           "HW State: DEV_READY\n");
+                           QLA82XX_DEV_READY);
+                       ql_log(ql_log_info, vha, 0xb025,
+                           "HW State: DEV_READY.\n");
                        qla82xx_idc_unlock(ha);
                        qla2x00_perform_loop_resync(vha);
                        qla82xx_idc_lock(ha);
@@ -3404,7 +3460,8 @@ qla82xx_need_qsnt_handler(scsi_qla_host_t *vha)
        dev_state = qla82xx_rd_32(ha, QLA82XX_CRB_DEV_STATE);
        /* everyone acked so set the state to DEV_QUIESCENCE */
        if (dev_state == QLA82XX_DEV_NEED_QUIESCENT) {
-               qla_printk(KERN_INFO, ha, "HW State: DEV_QUIESCENT\n");
+               ql_log(ql_log_info, vha, 0xb026,
+                   "HW State: DEV_QUIESCENT.\n");
                qla82xx_wr_32(ha, QLA82XX_CRB_DEV_STATE, QLA82XX_DEV_QUIESCENT);
        }
 }
@@ -3441,7 +3498,8 @@ qla82xx_dev_failed_handler(scsi_qla_host_t *vha)
        struct qla_hw_data *ha = vha->hw;
 
        /* Disable the board */
-       qla_printk(KERN_INFO, ha, "Disabling the board\n");
+       ql_log(ql_log_fatal, vha, 0x00b8,
+           "Disabling the board.\n");
 
        qla82xx_idc_lock(ha);
        qla82xx_clear_drv_active(ha);
@@ -3492,8 +3550,8 @@ qla82xx_need_reset_handler(scsi_qla_host_t *vha)
 
        while (drv_state != drv_active) {
                if (time_after_eq(jiffies, reset_timeout)) {
-                       qla_printk(KERN_INFO, ha,
-                               "%s: RESET TIMEOUT!\n", QLA2XXX_DRIVER_NAME);
+                       ql_log(ql_log_warn, vha, 0x00b5,
+                           "Reset timeout.\n");
                        break;
                }
                qla82xx_idc_unlock(ha);
@@ -3504,12 +3562,15 @@ qla82xx_need_reset_handler(scsi_qla_host_t *vha)
        }
 
        dev_state = qla82xx_rd_32(ha, QLA82XX_CRB_DEV_STATE);
-       qla_printk(KERN_INFO, ha, "3:Device state is 0x%x = %s\n", dev_state,
-               dev_state < MAX_STATES ? qdev_state[dev_state] : "Unknown");
+       ql_log(ql_log_info, vha, 0x00b6,
+           "Device state is 0x%x = %s.\n",
+           dev_state,
+           dev_state < MAX_STATES ? qdev_state[dev_state] : "Unknown");
 
        /* Force to DEV_COLD unless someone else is starting a reset */
        if (dev_state != QLA82XX_DEV_INITIALIZING) {
-               qla_printk(KERN_INFO, ha, "HW State: COLD/RE-INIT\n");
+               ql_log(ql_log_info, vha, 0x00b7,
+                   "HW State: COLD/RE-INIT.\n");
                qla82xx_wr_32(ha, QLA82XX_CRB_DEV_STATE, QLA82XX_DEV_COLD);
        }
 }
@@ -3523,8 +3584,12 @@ qla82xx_check_fw_alive(scsi_qla_host_t *vha)
        fw_heartbeat_counter = qla82xx_rd_32(vha->hw,
                QLA82XX_PEG_ALIVE_COUNTER);
        /* all 0xff, assume AER/EEH in progress, ignore */
-       if (fw_heartbeat_counter == 0xffffffff)
+       if (fw_heartbeat_counter == 0xffffffff) {
+               ql_dbg(ql_dbg_timer, vha, 0x6003,
+                   "FW heartbeat counter is 0xffffffff, "
+                   "returning status=%d.\n", status);
                return status;
+       }
        if (vha->fw_heartbeat_counter == fw_heartbeat_counter) {
                vha->seconds_since_last_heartbeat++;
                /* FW not alive after 2 seconds */
@@ -3535,6 +3600,9 @@ qla82xx_check_fw_alive(scsi_qla_host_t *vha)
        } else
                vha->seconds_since_last_heartbeat = 0;
        vha->fw_heartbeat_counter = fw_heartbeat_counter;
+       if (status)
+               ql_dbg(ql_dbg_timer, vha, 0x6004,
+                   "Returning status=%d.\n", status);
        return status;
 }
 
@@ -3565,8 +3633,10 @@ qla82xx_device_state_handler(scsi_qla_host_t *vha)
 
        dev_state = qla82xx_rd_32(ha, QLA82XX_CRB_DEV_STATE);
        old_dev_state = dev_state;
-       qla_printk(KERN_INFO, ha, "1:Device state is 0x%x = %s\n", dev_state,
-               dev_state < MAX_STATES ? qdev_state[dev_state] : "Unknown");
+       ql_log(ql_log_info, vha, 0x009b,
+           "Device state is 0x%x = %s.\n",
+           dev_state,
+           dev_state < MAX_STATES ? qdev_state[dev_state] : "Unknown");
 
        /* wait for 30 seconds for device to go ready */
        dev_init_timeout = jiffies + (ha->nx_dev_init_timeout * HZ);
@@ -3574,9 +3644,8 @@ qla82xx_device_state_handler(scsi_qla_host_t *vha)
        while (1) {
 
                if (time_after_eq(jiffies, dev_init_timeout)) {
-                       DEBUG(qla_printk(KERN_INFO, ha,
-                               "%s: device init failed!\n",
-                               QLA2XXX_DRIVER_NAME));
+                       ql_log(ql_log_fatal, vha, 0x009c,
+                           "Device init failed.\n");
                        rval = QLA_FUNCTION_FAILED;
                        break;
                }
@@ -3586,10 +3655,11 @@ qla82xx_device_state_handler(scsi_qla_host_t *vha)
                        old_dev_state = dev_state;
                }
                if (loopcount < 5) {
-                       qla_printk(KERN_INFO, ha,
-                           "2:Device state is 0x%x = %s\n", dev_state,
-                           dev_state < MAX_STATES ?
-                           qdev_state[dev_state] : "Unknown");
+                       ql_log(ql_log_info, vha, 0x009d,
+                           "Device state is 0x%x = %s.\n",
+                           dev_state,
+                           dev_state < MAX_STATES ? qdev_state[dev_state] :
+                           "Unknown");
                }
 
                switch (dev_state) {
@@ -3656,29 +3726,26 @@ void qla82xx_watchdog(scsi_qla_host_t *vha)
                dev_state = qla82xx_rd_32(ha, QLA82XX_CRB_DEV_STATE);
                if (dev_state == QLA82XX_DEV_NEED_RESET &&
                    !test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags)) {
-                       qla_printk(KERN_WARNING, ha,
-                           "scsi(%ld) %s: Adapter reset needed!\n",
-                               vha->host_no, __func__);
+                       ql_log(ql_log_warn, vha, 0x6001,
+                           "Adapter reset needed.\n");
                        set_bit(ISP_ABORT_NEEDED, &vha->dpc_flags);
                        qla2xxx_wake_dpc(vha);
                } else if (dev_state == QLA82XX_DEV_NEED_QUIESCENT &&
                        !test_bit(ISP_QUIESCE_NEEDED, &vha->dpc_flags)) {
-                       DEBUG(qla_printk(KERN_INFO, ha,
-                               "scsi(%ld) %s - detected quiescence needed\n",
-                               vha->host_no, __func__));
+                       ql_log(ql_log_warn, vha, 0x6002,
+                           "Quiescent needed.\n");
                        set_bit(ISP_QUIESCE_NEEDED, &vha->dpc_flags);
                        qla2xxx_wake_dpc(vha);
                } else {
                        if (qla82xx_check_fw_alive(vha)) {
                                halt_status = qla82xx_rd_32(ha,
                                    QLA82XX_PEG_HALT_STATUS1);
-                               qla_printk(KERN_INFO, ha,
-                                   "scsi(%ld): %s, Dumping hw/fw registers:\n "
-                                   " PEG_HALT_STATUS1: 0x%x, PEG_HALT_STATUS2: 0x%x,\n "
-                                   " PEG_NET_0_PC: 0x%x, PEG_NET_1_PC: 0x%x,\n "
-                                   " PEG_NET_2_PC: 0x%x, PEG_NET_3_PC: 0x%x,\n "
-                                   " PEG_NET_4_PC: 0x%x\n",
-                                   vha->host_no, __func__, halt_status,
+                               ql_dbg(ql_dbg_timer, vha, 0x6005,
+                                   "dumping hw/fw registers:.\n "
+                                   " PEG_HALT_STATUS1: 0x%x, PEG_HALT_STATUS2: 0x%x,.\n "
+                                   " PEG_NET_0_PC: 0x%x, PEG_NET_1_PC: 0x%x,.\n "
+                                   " PEG_NET_2_PC: 0x%x, PEG_NET_3_PC: 0x%x,.\n "
+                                   " PEG_NET_4_PC: 0x%x.\n", halt_status,
                                    qla82xx_rd_32(ha, QLA82XX_PEG_HALT_STATUS2),
                                    qla82xx_rd_32(ha,
                                            QLA82XX_CRB_PEG_NET_0 + 0x3c),
@@ -3694,9 +3761,8 @@ void qla82xx_watchdog(scsi_qla_host_t *vha)
                                        set_bit(ISP_UNRECOVERABLE,
                                            &vha->dpc_flags);
                                } else {
-                                       qla_printk(KERN_INFO, ha,
-                                           "scsi(%ld): %s - detect abort needed\n",
-                                           vha->host_no, __func__);
+                                       ql_log(ql_log_info, vha, 0x6006,
+                                           "Detect abort  needed.\n");
                                        set_bit(ISP_ABORT_NEEDED,
                                            &vha->dpc_flags);
                                }
@@ -3704,10 +3770,10 @@ void qla82xx_watchdog(scsi_qla_host_t *vha)
                                ha->flags.isp82xx_fw_hung = 1;
                                if (ha->flags.mbox_busy) {
                                        ha->flags.mbox_int = 1;
-                                       DEBUG2(qla_printk(KERN_ERR, ha,
-                                           "scsi(%ld) Due to fw hung, doing "
+                                       ql_log(ql_log_warn, vha, 0x6007,
+                                           "Due to FW hung, doing "
                                            "premature completion of mbx "
-                                           "command\n", vha->host_no));
+                                           "command.\n");
                                        if (test_bit(MBX_INTR_WAIT,
                                            &ha->mbx_cmd_flags))
                                                complete(&ha->mbx_intr_comp);
@@ -3742,9 +3808,8 @@ qla82xx_abort_isp(scsi_qla_host_t *vha)
        uint32_t dev_state;
 
        if (vha->device_flags & DFLG_DEV_FAILED) {
-               qla_printk(KERN_WARNING, ha,
-                       "%s(%ld): Device in failed state, "
-                       "Exiting.\n", __func__, vha->host_no);
+               ql_log(ql_log_warn, vha, 0x8024,
+                   "Device in failed state, exiting.\n");
                return QLA_SUCCESS;
        }
        ha->flags.isp82xx_reset_hdlr_active = 1;
@@ -3752,13 +3817,14 @@ qla82xx_abort_isp(scsi_qla_host_t *vha)
        qla82xx_idc_lock(ha);
        dev_state = qla82xx_rd_32(ha, QLA82XX_CRB_DEV_STATE);
        if (dev_state == QLA82XX_DEV_READY) {
-               qla_printk(KERN_INFO, ha, "HW State: NEED RESET\n");
+               ql_log(ql_log_info, vha, 0x8025,
+                   "HW State: NEED RESET.\n");
                qla82xx_wr_32(ha, QLA82XX_CRB_DEV_STATE,
                        QLA82XX_DEV_NEED_RESET);
        } else
-               qla_printk(KERN_INFO, ha, "HW State: %s\n",
-                       dev_state < MAX_STATES ?
-                       qdev_state[dev_state] : "Unknown");
+               ql_log(ql_log_info, vha, 0x8026,
+                   "Hw State: %s.\n", dev_state < MAX_STATES ?
+                   qdev_state[dev_state] : "Unknown");
        qla82xx_idc_unlock(ha);
 
        rval = qla82xx_device_state_handler(vha);
@@ -3777,9 +3843,9 @@ qla82xx_abort_isp(scsi_qla_host_t *vha)
                vha->flags.online = 1;
                if (test_bit(ISP_ABORT_RETRY, &vha->dpc_flags)) {
                        if (ha->isp_abort_cnt == 0) {
-                               qla_printk(KERN_WARNING, ha,
-                                   "ISP error recovery failed - "
-                                   "board disabled\n");
+                               ql_log(ql_log_warn, vha, 0x8027,
+                                   "ISP error recover failed - board "
+                                   "disabled.\n");
                                /*
                                 * The next call disables the board
                                 * completely.
@@ -3791,16 +3857,16 @@ qla82xx_abort_isp(scsi_qla_host_t *vha)
                                rval = QLA_SUCCESS;
                        } else { /* schedule another ISP abort */
                                ha->isp_abort_cnt--;
-                               DEBUG(qla_printk(KERN_INFO, ha,
-                                   "qla%ld: ISP abort - retry remaining %d\n",
-                                   vha->host_no, ha->isp_abort_cnt));
+                               ql_log(ql_log_warn, vha, 0x8036,
+                                   "ISP abort - retry remaining %d.\n",
+                                   ha->isp_abort_cnt);
                                rval = QLA_FUNCTION_FAILED;
                        }
                } else {
                        ha->isp_abort_cnt = MAX_RETRIES_OF_ISP_ABORT;
-                       DEBUG(qla_printk(KERN_INFO, ha,
-                           "(%ld): ISP error recovery - retrying (%d) "
-                           "more times\n", vha->host_no, ha->isp_abort_cnt));
+                       ql_dbg(ql_dbg_taskm, vha, 0x8029,
+                           "ISP error recovery - retrying (%d) more times.\n",
+                           ha->isp_abort_cnt);
                        set_bit(ISP_ABORT_RETRY, &vha->dpc_flags);
                        rval = QLA_FUNCTION_FAILED;
                }
@@ -3872,8 +3938,8 @@ int qla2x00_wait_for_fcoe_ctx_reset(scsi_qla_host_t *vha)
                        break;
                }
        }
-       DEBUG2(printk(KERN_INFO
-           "%s status=%d\n", __func__, status));
+       ql_dbg(ql_dbg_p3p, vha, 0xb027,
+           "%s status=%d.\n", status);
 
        return status;
 }
@@ -3902,6 +3968,9 @@ qla82xx_chip_reset_cleanup(scsi_qla_host_t *vha)
                        }
                }
        }
+       ql_dbg(ql_dbg_init, vha, 0x00b0,
+           "Entered %s fw_hung=%d.\n",
+           __func__, ha->flags.isp82xx_fw_hung);
 
        /* Abort all commands gracefully if fw NOT hung */
        if (!ha->flags.isp82xx_fw_hung) {
@@ -3922,13 +3991,13 @@ qla82xx_chip_reset_cleanup(scsi_qla_host_t *vha)
                                                spin_unlock_irqrestore(
                                                    &ha->hardware_lock, flags);
                                                if (ha->isp_ops->abort_command(sp)) {
-                                                       qla_printk(KERN_INFO, ha,
-                                                           "scsi(%ld): mbx abort command failed in %s\n",
-                                                           vha->host_no, __func__);
+                                                       ql_log(ql_log_info, vha,
+                                                           0x00b1,
+                                                           "mbx abort failed.\n");
                                                } else {
-                                                       qla_printk(KERN_INFO, ha,
-                                                           "scsi(%ld): mbx abort command success in %s\n",
-                                                           vha->host_no, __func__);
+                                                       ql_log(ql_log_info, vha,
+                                                           0x00b2,
+                                                           "mbx abort success.\n");
                                                }
                                                spin_lock_irqsave(&ha->hardware_lock, flags);
                                        }
@@ -3940,8 +4009,9 @@ qla82xx_chip_reset_cleanup(scsi_qla_host_t *vha)
                /* Wait for pending cmds (physical and virtual) to complete */
                if (!qla2x00_eh_wait_for_pending_commands(vha, 0, 0,
                    WAIT_HOST) == QLA_SUCCESS) {
-                       DEBUG2(qla_printk(KERN_INFO, ha,
-                           "Done wait for pending commands\n"));
+                       ql_dbg(ql_dbg_init, vha, 0x00b3,
+                           "Done wait for "
+                           "pending commands.\n");
                }
        }
 }
index 8aa05c87b653f03032d21faef1cf60b9397cca64..e02df276804ed25e119ca06d3ce7bf6f159d0876 100644 (file)
@@ -141,8 +141,8 @@ MODULE_PARM_DESC(ql2xmultique_tag,
 int ql2xfwloadbin;
 module_param(ql2xfwloadbin, int, S_IRUGO);
 MODULE_PARM_DESC(ql2xfwloadbin,
-               "Option to specify location from which to load ISP firmware:\n"
-               " 2 -- load firmware via the request_firmware() (hotplug)\n"
+               "Option to specify location from which to load ISP firmware:.\n"
+               " 2 -- load firmware via the request_firmware() (hotplug).\n"
                "      interface.\n"
                " 1 -- load firmware from flash.\n"
                " 0 -- use default semantics.\n");
@@ -156,7 +156,7 @@ MODULE_PARM_DESC(ql2xetsenable,
 int ql2xdbwr = 1;
 module_param(ql2xdbwr, int, S_IRUGO);
 MODULE_PARM_DESC(ql2xdbwr,
-       "Option to specify scheme for request queue posting\n"
+       "Option to specify scheme for request queue posting.\n"
        " 0 -- Regular doorbell.\n"
        " 1 -- CAMRAM doorbell (faster).\n");
 
@@ -181,7 +181,7 @@ MODULE_PARM_DESC(ql2xasynctmfenable,
 int ql2xdontresethba;
 module_param(ql2xdontresethba, int, S_IRUGO);
 MODULE_PARM_DESC(ql2xdontresethba,
-       "Option to specify reset behaviour\n"
+       "Option to specify reset behaviour.\n"
        " 0 (Default) -- Reset on failure.\n"
        " 1 -- Do not reset on failure.\n");
 
@@ -260,8 +260,11 @@ static inline void
 qla2x00_restart_timer(scsi_qla_host_t *vha, unsigned long interval)
 {
        /* Currently used for 82XX only. */
-       if (vha->device_flags & DFLG_DEV_FAILED)
+       if (vha->device_flags & DFLG_DEV_FAILED) {
+               ql_dbg(ql_dbg_timer, vha, 0x600d,
+                   "Device in a failed state, returning.\n");
                return;
+       }
 
        mod_timer(&vha->timer, jiffies + interval * HZ);
 }
@@ -286,19 +289,20 @@ static void qla2x00_sp_free_dma(srb_t *);
 /* -------------------------------------------------------------------------- */
 static int qla2x00_alloc_queues(struct qla_hw_data *ha)
 {
+       scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev);
        ha->req_q_map = kzalloc(sizeof(struct req_que *) * ha->max_req_queues,
                                GFP_KERNEL);
        if (!ha->req_q_map) {
-               qla_printk(KERN_WARNING, ha,
-                       "Unable to allocate memory for request queue ptrs\n");
+               ql_log(ql_log_fatal, vha, 0x003b,
+                   "Unable to allocate memory for request queue ptrs.\n");
                goto fail_req_map;
        }
 
        ha->rsp_q_map = kzalloc(sizeof(struct rsp_que *) * ha->max_rsp_queues,
                                GFP_KERNEL);
        if (!ha->rsp_q_map) {
-               qla_printk(KERN_WARNING, ha,
-                       "Unable to allocate memory for response queue ptrs\n");
+               ql_log(ql_log_fatal, vha, 0x003c,
+                   "Unable to allocate memory for response queue ptrs.\n");
                goto fail_rsp_map;
        }
        set_bit(0, ha->rsp_qid_map);
@@ -362,8 +366,8 @@ static int qla25xx_setup_mode(struct scsi_qla_host *vha)
        struct qla_hw_data *ha = vha->hw;
 
        if (!(ha->fw_attributes & BIT_6)) {
-               qla_printk(KERN_INFO, ha,
-                       "Firmware is not multi-queue capable\n");
+               ql_log(ql_log_warn, vha, 0x00d8,
+                   "Firmware is not multi-queue capable.\n");
                goto fail;
        }
        if (ql2xmultique_tag) {
@@ -372,8 +376,8 @@ static int qla25xx_setup_mode(struct scsi_qla_host *vha)
                req = qla25xx_create_req_que(ha, options, 0, 0, -1,
                        QLA_DEFAULT_QUE_QOS);
                if (!req) {
-                       qla_printk(KERN_WARNING, ha,
-                               "Can't create request queue\n");
+                       ql_log(ql_log_warn, vha, 0x00e0,
+                           "Failed to create request queue.\n");
                        goto fail;
                }
                ha->wq = alloc_workqueue("qla2xxx_wq", WQ_MEM_RECLAIM, 1);
@@ -382,17 +386,20 @@ static int qla25xx_setup_mode(struct scsi_qla_host *vha)
                for (ques = 1; ques < ha->max_rsp_queues; ques++) {
                        ret = qla25xx_create_rsp_que(ha, options, 0, 0, req);
                        if (!ret) {
-                               qla_printk(KERN_WARNING, ha,
-                                       "Response Queue create failed\n");
+                               ql_log(ql_log_warn, vha, 0x00e8,
+                                   "Failed to create response queue.\n");
                                goto fail2;
                        }
                }
                ha->flags.cpu_affinity_enabled = 1;
-
-               DEBUG2(qla_printk(KERN_INFO, ha,
-                       "CPU affinity mode enabled, no. of response"
-                       " queues:%d, no. of request queues:%d\n",
-                       ha->max_rsp_queues, ha->max_req_queues));
+               ql_dbg(ql_dbg_multiq, vha, 0xc007,
+                   "CPU affinity mode enalbed, "
+                   "no. of response queues:%d no. of request queues:%d.\n",
+                   ha->max_rsp_queues, ha->max_req_queues);
+               ql_dbg(ql_dbg_init, vha, 0x00e9,
+                   "CPU affinity mode enalbed, "
+                   "no. of response queues:%d no. of request queues:%d.\n",
+                   ha->max_rsp_queues, ha->max_req_queues);
        }
        return 0;
 fail2:
@@ -539,8 +546,11 @@ qla2x00_get_new_sp(scsi_qla_host_t *vha, fc_port_t *fcport,
        struct qla_hw_data *ha = vha->hw;
 
        sp = mempool_alloc(ha->srb_mempool, GFP_ATOMIC);
-       if (!sp)
+       if (!sp) {
+               ql_log(ql_log_warn, vha, 0x3006,
+                   "Memory allocation failed for sp.\n");
                return sp;
+       }
 
        atomic_set(&sp->ref_count, 1);
        sp->fcport = fcport;
@@ -564,30 +574,43 @@ qla2xxx_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd)
        int rval;
 
        if (ha->flags.eeh_busy) {
-               if (ha->flags.pci_channel_io_perm_failure)
+               if (ha->flags.pci_channel_io_perm_failure) {
+                       ql_dbg(ql_dbg_io, vha, 0x3001,
+                           "PCI Channel IO permanent failure, exiting "
+                           "cmd=%p.\n", cmd);
                        cmd->result = DID_NO_CONNECT << 16;
-               else
+               } else {
+                       ql_dbg(ql_dbg_io, vha, 0x3002,
+                           "EEH_Busy, Requeuing the cmd=%p.\n", cmd);
                        cmd->result = DID_REQUEUE << 16;
+               }
                goto qc24_fail_command;
        }
 
        rval = fc_remote_port_chkready(rport);
        if (rval) {
                cmd->result = rval;
+               ql_dbg(ql_dbg_io, vha, 0x3003,
+                   "fc_remote_port_chkready failed for cmd=%p, rval=0x%x.\n",
+                   cmd, rval);
                goto qc24_fail_command;
        }
 
        if (!vha->flags.difdix_supported &&
                scsi_get_prot_op(cmd) != SCSI_PROT_NORMAL) {
-                       DEBUG2(qla_printk(KERN_ERR, ha,
-                           "DIF Cap Not Reg, fail DIF capable cmd's:%x\n",
-                           cmd->cmnd[0]));
+                       ql_dbg(ql_dbg_io, vha, 0x3004,
+                           "DIF Cap not reg, fail DIF capable cmd's:%p.\n",
+                           cmd);
                        cmd->result = DID_NO_CONNECT << 16;
                        goto qc24_fail_command;
        }
        if (atomic_read(&fcport->state) != FCS_ONLINE) {
                if (atomic_read(&fcport->state) == FCS_DEVICE_DEAD ||
                        atomic_read(&base_vha->loop_state) == LOOP_DEAD) {
+                       ql_dbg(ql_dbg_io, vha, 0x3005,
+                           "Returning DNC, fcport_state=%d loop_state=%d.\n",
+                           atomic_read(&fcport->state),
+                           atomic_read(&base_vha->loop_state));
                        cmd->result = DID_NO_CONNECT << 16;
                        goto qc24_fail_command;
                }
@@ -599,8 +622,11 @@ qla2xxx_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd)
                goto qc24_host_busy;
 
        rval = ha->isp_ops->start_scsi(sp);
-       if (rval != QLA_SUCCESS)
+       if (rval != QLA_SUCCESS) {
+               ql_dbg(ql_dbg_io, vha, 0x3013,
+                   "Start scsi failed rval=%d for cmd=%p.\n", rval, cmd);
                goto qc24_host_busy_free_sp;
+       }
 
        return 0;
 
@@ -643,7 +669,8 @@ qla2x00_eh_wait_on_command(struct scsi_cmnd *cmd)
        int ret = QLA_SUCCESS;
 
        if (unlikely(pci_channel_offline(ha->pdev)) || ha->flags.eeh_busy) {
-               DEBUG17(qla_printk(KERN_WARNING, ha, "return:eh_wait\n"));
+               ql_dbg(ql_dbg_taskm, vha, 0x8005,
+                   "Return:eh_wait.\n");
                return ret;
        }
 
@@ -736,7 +763,8 @@ qla2x00_wait_for_reset_ready(scsi_qla_host_t *vha)
        else
                return_status = QLA_FUNCTION_FAILED;
 
-       DEBUG2(printk("%s return_status=%d\n", __func__, return_status));
+       ql_dbg(ql_dbg_taskm, vha, 0x8019,
+           "%s return status=%d.\n", __func__, return_status);
 
        return return_status;
 }
@@ -844,10 +872,14 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd)
        int wait = 0;
        struct qla_hw_data *ha = vha->hw;
 
+       ql_dbg(ql_dbg_taskm, vha, 0x8000,
+           "Entered %s for cmd=%p.\n", __func__, cmd);
        if (!CMD_SP(cmd))
                return SUCCESS;
 
        ret = fc_block_scsi_eh(cmd);
+       ql_dbg(ql_dbg_taskm, vha, 0x8001,
+           "Return value of fc_block_scsi_eh=%d.\n", ret);
        if (ret != 0)
                return ret;
        ret = SUCCESS;
@@ -862,20 +894,19 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd)
                return SUCCESS;
        }
 
-       DEBUG2(printk("%s(%ld): aborting sp %p from RISC.",
-           __func__, vha->host_no, sp));
+       ql_dbg(ql_dbg_taskm, vha, 0x8002,
+           "Aborting sp=%p cmd=%p from RISC ", sp, cmd);
 
        /* Get a reference to the sp and drop the lock.*/
        sp_get(sp);
 
        spin_unlock_irqrestore(&ha->hardware_lock, flags);
        if (ha->isp_ops->abort_command(sp)) {
-               DEBUG2(printk("%s(%ld): abort_command "
-               "mbx failed.\n", __func__, vha->host_no));
-               ret = FAILED;
+               ql_dbg(ql_dbg_taskm, vha, 0x8003,
+                   "Abort command mbx failed for cmd=%p.\n", cmd);
        } else {
-               DEBUG3(printk("%s(%ld): abort_command "
-               "mbx success.\n", __func__, vha->host_no));
+               ql_dbg(ql_dbg_taskm, vha, 0x8004,
+                   "Abort command mbx success.\n");
                wait = 1;
        }
        qla2x00_sp_compl(ha, sp);
@@ -883,16 +914,14 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd)
        /* Wait for the command to be returned. */
        if (wait) {
                if (qla2x00_eh_wait_on_command(cmd) != QLA_SUCCESS) {
-                       qla_printk(KERN_ERR, ha,
-                           "scsi(%ld:%d:%d): Abort handler timed out -- %x.\n",
-                           vha->host_no, id, lun, ret);
+                       ql_log(ql_log_warn, vha, 0x8006,
+                           "Abort handler timed out for cmd=%p.\n", cmd);
                        ret = FAILED;
                }
        }
 
-       qla_printk(KERN_INFO, ha,
-           "scsi(%ld:%d:%d): Abort command issued -- %d %x.\n",
-           vha->host_no, id, lun, wait, ret);
+       ql_log(ql_log_info, vha, 0x801c,
+           "Abort command issued --  %d %x.\n", wait, ret);
 
        return ret;
 }
@@ -960,40 +989,59 @@ __qla2xxx_eh_generic_reset(char *name, enum nexus_wait_type type,
        fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata;
        int err;
 
-       if (!fcport)
+       if (!fcport) {
+               ql_log(ql_log_warn, vha, 0x8007,
+                   "fcport is NULL.\n");
                return FAILED;
+       }
 
        err = fc_block_scsi_eh(cmd);
+       ql_dbg(ql_dbg_taskm, vha, 0x8008,
+           "fc_block_scsi_eh ret=%d.\n", err);
        if (err != 0)
                return err;
 
-       qla_printk(KERN_INFO, vha->hw, "scsi(%ld:%d:%d): %s RESET ISSUED.\n",
-           vha->host_no, cmd->device->id, cmd->device->lun, name);
+       ql_log(ql_log_info, vha, 0x8009,
+           "%s RESET ISSUED for id %d lun %d cmd=%p.\n", name,
+           cmd->device->id, cmd->device->lun, cmd);
 
        err = 0;
-       if (qla2x00_wait_for_hba_online(vha) != QLA_SUCCESS)
+       if (qla2x00_wait_for_hba_online(vha) != QLA_SUCCESS) {
+               ql_log(ql_log_warn, vha, 0x800a,
+                   "Wait for hba online failed for cmd=%p.\n", cmd);
                goto eh_reset_failed;
+       }
        err = 1;
-       if (qla2x00_wait_for_loop_ready(vha) != QLA_SUCCESS)
+       if (qla2x00_wait_for_loop_ready(vha) != QLA_SUCCESS) {
+               ql_log(ql_log_warn, vha, 0x800b,
+                   "Wait for loop ready failed for cmd=%p.\n", cmd);
                goto eh_reset_failed;
+       }
        err = 2;
        if (do_reset(fcport, cmd->device->lun, cmd->request->cpu + 1)
-               != QLA_SUCCESS)
+               != QLA_SUCCESS) {
+               ql_log(ql_log_warn, vha, 0x800c,
+                   "do_reset failed for cmd=%p.\n", cmd);
                goto eh_reset_failed;
+       }
        err = 3;
        if (qla2x00_eh_wait_for_pending_commands(vha, cmd->device->id,
-           cmd->device->lun, type) != QLA_SUCCESS)
+           cmd->device->lun, type) != QLA_SUCCESS) {
+               ql_log(ql_log_warn, vha, 0x800d,
+                   "wait for peding cmds failed for cmd=%p.\n", cmd);
                goto eh_reset_failed;
+       }
 
-       qla_printk(KERN_INFO, vha->hw, "scsi(%ld:%d:%d): %s RESET SUCCEEDED.\n",
-           vha->host_no, cmd->device->id, cmd->device->lun, name);
+       ql_log(ql_log_info, vha, 0x800e,
+           "%s RESET SUCCEEDED for id %d lun %d cmd=%p.\n", name,
+           cmd->device->id, cmd->device->lun, cmd);
 
        return SUCCESS;
 
 eh_reset_failed:
-       qla_printk(KERN_INFO, vha->hw, "scsi(%ld:%d:%d): %s RESET FAILED: %s.\n"
-           , vha->host_no, cmd->device->id, cmd->device->lun, name,
-           reset_errors[err]);
+       ql_log(ql_log_info, vha, 0x800f,
+           "%s RESET FAILED: %s for id %d lun %d cmd=%p.\n", name,
+           reset_errors[err], cmd->device->id, cmd->device->lun);
        return FAILED;
 }
 
@@ -1043,19 +1091,25 @@ qla2xxx_eh_bus_reset(struct scsi_cmnd *cmd)
        id = cmd->device->id;
        lun = cmd->device->lun;
 
-       if (!fcport)
+       if (!fcport) {
+               ql_log(ql_log_warn, vha, 0x8010,
+                   "fcport is NULL.\n");
                return ret;
+       }
 
        ret = fc_block_scsi_eh(cmd);
+       ql_dbg(ql_dbg_taskm, vha, 0x8011,
+           "fc_block_scsi_eh ret=%d.\n", ret);
        if (ret != 0)
                return ret;
        ret = FAILED;
 
-       qla_printk(KERN_INFO, vha->hw,
-           "scsi(%ld:%d:%d): BUS RESET ISSUED.\n", vha->host_no, id, lun);
+       ql_log(ql_log_info, vha, 0x8012,
+           "BUS RESET ISSUED for id %d lun %d.\n", id, lun);
 
        if (qla2x00_wait_for_hba_online(vha) != QLA_SUCCESS) {
-               DEBUG2(printk("%s failed:board disabled\n",__func__));
+               ql_log(ql_log_fatal, vha, 0x8013,
+                   "Wait for hba online failed board disabled.\n");
                goto eh_bus_reset_done;
        }
 
@@ -1068,12 +1122,15 @@ qla2xxx_eh_bus_reset(struct scsi_cmnd *cmd)
 
        /* Flush outstanding commands. */
        if (qla2x00_eh_wait_for_pending_commands(vha, 0, 0, WAIT_HOST) !=
-           QLA_SUCCESS)
+           QLA_SUCCESS) {
+               ql_log(ql_log_warn, vha, 0x8014,
+                   "Wait for pending commands failed.\n");
                ret = FAILED;
+       }
 
 eh_bus_reset_done:
-       qla_printk(KERN_INFO, vha->hw, "%s: reset %s\n", __func__,
-           (ret == FAILED) ? "failed" : "succeeded");
+       ql_log(ql_log_warn, vha, 0x802b,
+           "BUS RESET %s.\n", (ret == FAILED) ? "FAILED" : "SUCCEDED");
 
        return ret;
 }
@@ -1106,16 +1163,21 @@ qla2xxx_eh_host_reset(struct scsi_cmnd *cmd)
        id = cmd->device->id;
        lun = cmd->device->lun;
 
-       if (!fcport)
+       if (!fcport) {
+               ql_log(ql_log_warn, vha, 0x8016,
+                   "fcport is NULL.\n");
                return ret;
+       }
 
        ret = fc_block_scsi_eh(cmd);
+       ql_dbg(ql_dbg_taskm, vha, 0x8017,
+           "fc_block_scsi_eh ret=%d.\n", ret);
        if (ret != 0)
                return ret;
        ret = FAILED;
 
-       qla_printk(KERN_INFO, ha,
-           "scsi(%ld:%d:%d): ADAPTER RESET ISSUED.\n", vha->host_no, id, lun);
+       ql_log(ql_log_info, vha, 0x8018,
+           "ADAPTER RESET ISSUED for id %d lun %d.\n", id, lun);
 
        if (qla2x00_wait_for_reset_ready(vha) != QLA_SUCCESS)
                goto eh_host_reset_lock;
@@ -1150,8 +1212,11 @@ qla2xxx_eh_host_reset(struct scsi_cmnd *cmd)
                        /* failed. schedule dpc to try */
                        set_bit(ISP_ABORT_NEEDED, &base_vha->dpc_flags);
 
-                       if (qla2x00_wait_for_hba_online(vha) != QLA_SUCCESS)
+                       if (qla2x00_wait_for_hba_online(vha) != QLA_SUCCESS) {
+                               ql_log(ql_log_warn, vha, 0x802a,
+                                   "wait for hba online failed.\n");
                                goto eh_host_reset_lock;
+                       }
                }
                clear_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags);
        }
@@ -1162,7 +1227,7 @@ qla2xxx_eh_host_reset(struct scsi_cmnd *cmd)
                ret = SUCCESS;
 
 eh_host_reset_lock:
-       qla_printk(KERN_INFO, ha, "%s: reset %s\n", __func__,
+       qla_printk(KERN_INFO, ha, "%s: reset %s.\n", __func__,
            (ret == FAILED) ? "failed" : "succeeded");
 
        return ret;
@@ -1192,9 +1257,9 @@ qla2x00_loop_reset(scsi_qla_host_t *vha)
 
                        ret = ha->isp_ops->target_reset(fcport, 0, 0);
                        if (ret != QLA_SUCCESS) {
-                               DEBUG2_3(printk("%s(%ld): bus_reset failed: "
-                                   "target_reset=%d d_id=%x.\n", __func__,
-                                   vha->host_no, ret, fcport->d_id.b24));
+                               ql_dbg(ql_dbg_taskm, vha, 0x802c,
+                                   "Bus Reset failed: Target Reset=%d "
+                                   "d_id=%x.\n", ret, fcport->d_id.b24);
                        }
                }
        }
@@ -1202,9 +1267,8 @@ qla2x00_loop_reset(scsi_qla_host_t *vha)
        if (ha->flags.enable_lip_full_login && !IS_QLA8XXX_TYPE(ha)) {
                ret = qla2x00_full_login_lip(vha);
                if (ret != QLA_SUCCESS) {
-                       DEBUG2_3(printk("%s(%ld): failed: "
-                           "full_login_lip=%d.\n", __func__, vha->host_no,
-                           ret));
+                       ql_dbg(ql_dbg_taskm, vha, 0x802d,
+                           "full_login_lip=%d.\n", ret);
                }
                atomic_set(&vha->loop_state, LOOP_DOWN);
                atomic_set(&vha->loop_down_timer, LOOP_DOWN_TIME);
@@ -1215,8 +1279,8 @@ qla2x00_loop_reset(scsi_qla_host_t *vha)
        if (ha->flags.enable_lip_reset) {
                ret = qla2x00_lip_reset(vha);
                if (ret != QLA_SUCCESS) {
-                       DEBUG2_3(printk("%s(%ld): failed: "
-                           "lip_reset=%d.\n", __func__, vha->host_no, ret));
+                       ql_dbg(ql_dbg_taskm, vha, 0x802e,
+                           "lip_reset failed (%d).\n", ret);
                } else
                        qla2x00_wait_for_loop_ready(vha);
        }
@@ -1315,17 +1379,17 @@ static void qla2x00_handle_queue_full(struct scsi_device *sdev, int qdepth)
        if (!scsi_track_queue_full(sdev, qdepth))
                return;
 
-       DEBUG2(qla_printk(KERN_INFO, fcport->vha->hw,
-               "scsi(%ld:%d:%d:%d): Queue depth adjusted-down to %d.\n",
-               fcport->vha->host_no, sdev->channel, sdev->id, sdev->lun,
-               sdev->queue_depth));
+       ql_dbg(ql_dbg_io, fcport->vha, 0x3029,
+           "Queue depth adjusted-down "
+           "to %d for scsi(%ld:%d:%d:%d).\n",
+           sdev->queue_depth, fcport->vha->host_no,
+           sdev->channel, sdev->id, sdev->lun);
 }
 
 static void qla2x00_adjust_sdev_qdepth_up(struct scsi_device *sdev, int qdepth)
 {
        fc_port_t *fcport = sdev->hostdata;
        struct scsi_qla_host *vha = fcport->vha;
-       struct qla_hw_data *ha = vha->hw;
        struct req_que *req = NULL;
 
        req = vha->req;
@@ -1340,10 +1404,11 @@ static void qla2x00_adjust_sdev_qdepth_up(struct scsi_device *sdev, int qdepth)
        else
                scsi_adjust_queue_depth(sdev, MSG_SIMPLE_TAG, qdepth);
 
-       DEBUG2(qla_printk(KERN_INFO, ha,
-              "scsi(%ld:%d:%d:%d): Queue depth adjusted-up to %d.\n",
-              fcport->vha->host_no, sdev->channel, sdev->id, sdev->lun,
-              sdev->queue_depth));
+       ql_dbg(ql_dbg_io, vha, 0x302a,
+           "Queue depth adjusted-up to %d for "
+           "scsi(%ld:%d:%d:%d).\n",
+           sdev->queue_depth, fcport->vha->host_no,
+           sdev->channel, sdev->id, sdev->lun);
 }
 
 static int
@@ -1789,6 +1854,9 @@ qla2x00_set_isp_flags(struct qla_hw_data *ha)
                ha->flags.port0 = 1;
        else
                ha->flags.port0 = 0;
+       ql_dbg_pci(ql_dbg_init, ha->pdev, 0x000b,
+           "device_type=0x%x port=%d fw_srisc_address=%p.\n",
+           ha->device_type, ha->flags.port0, ha->fw_srisc_address);
 }
 
 static int
@@ -1803,10 +1871,9 @@ qla2x00_iospace_config(struct qla_hw_data *ha)
 
        if (pci_request_selected_regions(ha->pdev, ha->bars,
            QLA2XXX_DRIVER_NAME)) {
-               qla_printk(KERN_WARNING, ha,
-                   "Failed to reserve PIO/MMIO regions (%s)\n",
+               ql_log_pci(ql_log_fatal, ha->pdev, 0x0011,
+                   "Failed to reserve PIO/MMIO regions (%s), aborting.\n",
                    pci_name(ha->pdev));
-
                goto iospace_error_exit;
        }
        if (!(ha->bars & 1))
@@ -1816,39 +1883,42 @@ qla2x00_iospace_config(struct qla_hw_data *ha)
        pio = pci_resource_start(ha->pdev, 0);
        if (pci_resource_flags(ha->pdev, 0) & IORESOURCE_IO) {
                if (pci_resource_len(ha->pdev, 0) < MIN_IOBASE_LEN) {
-                       qla_printk(KERN_WARNING, ha,
-                           "Invalid PCI I/O region size (%s)...\n",
-                               pci_name(ha->pdev));
+                       ql_log_pci(ql_log_warn, ha->pdev, 0x0012,
+                           "Invalid pci I/O region size (%s).\n",
+                           pci_name(ha->pdev));
                        pio = 0;
                }
        } else {
-               qla_printk(KERN_WARNING, ha,
-                   "region #0 not a PIO resource (%s)...\n",
+               ql_log_pci(ql_log_warn, ha->pdev, 0x0013,
+                   "Region #0 no a PIO resource (%s).\n",
                    pci_name(ha->pdev));
                pio = 0;
        }
        ha->pio_address = pio;
+       ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0014,
+           "PIO address=%p.\n",
+           ha->pio_address);
 
 skip_pio:
        /* Use MMIO operations for all accesses. */
        if (!(pci_resource_flags(ha->pdev, 1) & IORESOURCE_MEM)) {
-               qla_printk(KERN_ERR, ha,
-                   "region #1 not an MMIO resource (%s), aborting\n",
+               ql_log_pci(ql_log_fatal, ha->pdev, 0x0015,
+                   "Region #1 not an MMIO resource (%s), aborting.\n",
                    pci_name(ha->pdev));
                goto iospace_error_exit;
        }
        if (pci_resource_len(ha->pdev, 1) < MIN_IOBASE_LEN) {
-               qla_printk(KERN_ERR, ha,
-                   "Invalid PCI mem region size (%s), aborting\n",
-                       pci_name(ha->pdev));
+               ql_log_pci(ql_log_fatal, ha->pdev, 0x0016,
+                   "Invalid PCI mem region size (%s), aborting.\n",
+                   pci_name(ha->pdev));
                goto iospace_error_exit;
        }
 
        ha->iobase = ioremap(pci_resource_start(ha->pdev, 1), MIN_IOBASE_LEN);
        if (!ha->iobase) {
-               qla_printk(KERN_ERR, ha,
-                   "cannot remap MMIO (%s), aborting\n", pci_name(ha->pdev));
-
+               ql_log_pci(ql_log_fatal, ha->pdev, 0x0017,
+                   "Cannot remap MMIO (%s), aborting.\n",
+                   pci_name(ha->pdev));
                goto iospace_error_exit;
        }
 
@@ -1862,6 +1932,8 @@ skip_pio:
        ha->mqiobase = ioremap(pci_resource_start(ha->pdev, 3),
                        pci_resource_len(ha->pdev, 3));
        if (ha->mqiobase) {
+               ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0018,
+                   "MQIO Base=%p.\n", ha->mqiobase);
                /* Read MSIX vector size of the board */
                pci_read_config_word(ha->pdev, QLA_PCI_MSIX_CONTROL, &msix);
                ha->msix_count = msix;
@@ -1874,17 +1946,24 @@ skip_pio:
                        ha->max_req_queues = 2;
                } else if (ql2xmaxqueues > 1) {
                        ha->max_req_queues = ql2xmaxqueues > QLA_MQ_SIZE ?
-                                               QLA_MQ_SIZE : ql2xmaxqueues;
-                       DEBUG2(qla_printk(KERN_INFO, ha, "QoS mode set, max no"
-                       " of request queues:%d\n", ha->max_req_queues));
+                           QLA_MQ_SIZE : ql2xmaxqueues;
+                       ql_dbg_pci(ql_dbg_multiq, ha->pdev, 0xc008,
+                           "QoS mode set, max no of request queues:%d.\n",
+                           ha->max_req_queues);
+                       ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0019,
+                           "QoS mode set, max no of request queues:%d.\n",
+                           ha->max_req_queues);
                }
-               qla_printk(KERN_INFO, ha,
-                       "MSI-X vector count: %d\n", msix);
+               ql_log_pci(ql_log_info, ha->pdev, 0x001a,
+                   "MSI-X vector count: %d.\n", msix);
        } else
-               qla_printk(KERN_INFO, ha, "BAR 3 not enabled\n");
+               ql_log_pci(ql_log_info, ha->pdev, 0x001b,
+                   "BAR 3 not enabled.\n");
 
 mqiobase_exit:
        ha->msix_count = ha->max_rsp_queues + 1;
+       ql_dbg_pci(ql_dbg_init, ha->pdev, 0x001c,
+           "MSIX Count:%d.\n", ha->msix_count);
        return (0);
 
 iospace_error_exit:
@@ -1948,7 +2027,11 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
            pdev->device == PCI_DEVICE_ID_QLOGIC_ISP8021) {
                bars = pci_select_bars(pdev, IORESOURCE_MEM);
                mem_only = 1;
+               ql_dbg_pci(ql_dbg_init, pdev, 0x0007,
+                   "Mem only adapter.\n");
        }
+       ql_dbg_pci(ql_dbg_init, pdev, 0x0008,
+           "Bars=%d.\n", bars);
 
        if (mem_only) {
                if (pci_enable_device_mem(pdev))
@@ -1963,9 +2046,12 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
 
        ha = kzalloc(sizeof(struct qla_hw_data), GFP_KERNEL);
        if (!ha) {
-               DEBUG(printk("Unable to allocate memory for ha\n"));
+               ql_log_pci(ql_log_fatal, pdev, 0x0009,
+                   "Unable to allocate memory for ha.\n");
                goto probe_out;
        }
+       ql_dbg_pci(ql_dbg_init, pdev, 0x000a,
+           "Memory allocated for ha=%p.\n", ha);
        ha->pdev = pdev;
 
        /* Clear our data area */
@@ -1987,10 +2073,9 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
        if (ret)
                goto probe_hw_failed;
 
-       qla_printk(KERN_INFO, ha,
-           "Found an ISP%04X, irq %d, iobase 0x%p\n", pdev->device, pdev->irq,
-           ha->iobase);
-
+       ql_log_pci(ql_log_info, pdev, 0x001d,
+           "Found an ISP%04X irq %d iobase 0x%p.\n",
+           pdev->device, pdev->irq, ha->iobase);
        ha->prev_topology = 0;
        ha->init_cb_size = sizeof(init_cb_t);
        ha->link_data_rate = PORT_SPEED_UNKNOWN;
@@ -2091,7 +2176,18 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
                ha->nvram_conf_off = FARX_ACCESS_NVRAM_CONF;
                ha->nvram_data_off = FARX_ACCESS_NVRAM_DATA;
        }
-
+       ql_dbg_pci(ql_dbg_init, pdev, 0x001e,
+           "mbx_count=%d, req_length=%d, "
+           "rsp_length=%d, max_loop_id=%d, init_cb_size=%d, "
+           "gid_list_info_size=%d, optrom_size=%d, nvram_npiv_size=%d, .\n",
+           ha->mbx_count, req_length, rsp_length, ha->max_loop_id,
+           ha->init_cb_size, ha->gid_list_info_size, ha->optrom_size,
+           ha->nvram_npiv_size);
+       ql_dbg_pci(ql_dbg_init, pdev, 0x001f,
+           "isp_ops=%p, flash_conf_off=%d, "
+           "flash_data_off=%d, nvram_conf_off=%d, nvram_data_off=%d.\n",
+           ha->isp_ops, ha->flash_conf_off, ha->flash_data_off,
+           ha->nvram_conf_off, ha->nvram_data_off);
        mutex_init(&ha->vport_lock);
        init_completion(&ha->mbx_cmd_comp);
        complete(&ha->mbx_cmd_comp);
@@ -2101,10 +2197,14 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
        set_bit(0, (unsigned long *) ha->vp_idx_map);
 
        qla2x00_config_dma_addressing(ha);
+       ql_dbg_pci(ql_dbg_init, pdev, 0x0020,
+           "64 Bit addressing is %s.\n",
+           ha->flags.enable_64bit_addressing ? "enable" :
+           "disable");
        ret = qla2x00_mem_alloc(ha, req_length, rsp_length, &req, &rsp);
        if (!ret) {
-               qla_printk(KERN_WARNING, ha,
-                   "[ERROR] Failed to allocate memory for adapter\n");
+               ql_log_pci(ql_log_fatal, pdev, 0x0031,
+                   "Failed to allocate memory for adapter, aborting.\n");
 
                goto probe_hw_failed;
        }
@@ -2116,9 +2216,6 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
 
        base_vha = qla2x00_create_host(sht, ha);
        if (!base_vha) {
-               qla_printk(KERN_WARNING, ha,
-                   "[ERROR] Failed to allocate memory for scsi_host\n");
-
                ret = -ENOMEM;
                qla2x00_mem_free(ha);
                qla2x00_free_req_que(ha, req);
@@ -2145,7 +2242,11 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
                if (!IS_QLA82XX(ha))
                        host->sg_tablesize = QLA_SG_ALL;
        }
-
+       ql_dbg(ql_dbg_init, base_vha, 0x0032,
+           "can_queue=%d, req=%p, "
+           "mgmt_svr_loop_id=%d, sg_tablesize=%d.\n",
+           host->can_queue, base_vha->req,
+           base_vha->mgmt_svr_loop_id, host->sg_tablesize);
        host->max_id = max_id;
        host->this_id = 255;
        host->cmd_per_lun = 3;
@@ -2159,6 +2260,14 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
        host->transportt = qla2xxx_transport_template;
        sht->vendor_id = (SCSI_NL_VID_TYPE_PCI | PCI_VENDOR_ID_QLOGIC);
 
+       ql_dbg(ql_dbg_init, base_vha, 0x0033,
+           "max_id=%d this_id=%d "
+           "cmd_per_len=%d unique_id=%d max_cmd_len=%d max_channel=%d "
+           "max_lun=%d transportt=%p, vendor_id=%d.\n", host->max_id,
+           host->this_id, host->cmd_per_lun, host->unique_id,
+           host->max_cmd_len, host->max_channel, host->max_lun,
+           host->transportt, sht->vendor_id);
+
        /* Set up the irqs */
        ret = qla2x00_request_irqs(ha, rsp);
        if (ret)
@@ -2169,9 +2278,8 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
        /* Alloc arrays of request and response ring ptrs */
 que_init:
        if (!qla2x00_alloc_queues(ha)) {
-               qla_printk(KERN_WARNING, ha,
-               "[ERROR] Failed to allocate memory for queue"
-               " pointers\n");
+               ql_log(ql_log_fatal, base_vha, 0x003d,
+                   "Failed to allocate memory for queue pointers.. aborting.\n");
                goto probe_init_failed;
        }
 
@@ -2199,20 +2307,33 @@ que_init:
                rsp->rsp_q_out = &ha->iobase->isp82.rsp_q_out[0];
        }
 
-       if (qla2x00_initialize_adapter(base_vha)) {
-               qla_printk(KERN_WARNING, ha,
-                   "Failed to initialize adapter\n");
+       ql_dbg(ql_dbg_multiq, base_vha, 0xc009,
+           "rsp_q_map=%p req_q_map=%p rsp->req=%p req->rsp=%p.\n",
+           ha->rsp_q_map, ha->req_q_map, rsp->req, req->rsp);
+       ql_dbg(ql_dbg_multiq, base_vha, 0xc00a,
+           "req->req_q_in=%p req->req_q_out=%p "
+           "rsp->rsp_q_in=%p rsp->rsp_q_out=%p.\n",
+           req->req_q_in, req->req_q_out,
+           rsp->rsp_q_in, rsp->rsp_q_out);
+       ql_dbg(ql_dbg_init, base_vha, 0x003e,
+           "rsp_q_map=%p req_q_map=%p rsp->req=%p req->rsp=%p.\n",
+           ha->rsp_q_map, ha->req_q_map, rsp->req, req->rsp);
+       ql_dbg(ql_dbg_init, base_vha, 0x003f,
+           "req->req_q_in=%p req->req_q_out=%p rsp->rsp_q_in=%p rsp->rsp_q_out=%p.\n",
+           req->req_q_in, req->req_q_out, rsp->rsp_q_in, rsp->rsp_q_out);
 
-               DEBUG2(printk("scsi(%ld): Failed to initialize adapter - "
-                   "Adapter flags %x.\n",
-                   base_vha->host_no, base_vha->device_flags));
+       if (qla2x00_initialize_adapter(base_vha)) {
+               ql_log(ql_log_fatal, base_vha, 0x00d6,
+                   "Failed to initialize adapter - Adapter flags %x.\n",
+                   base_vha->device_flags);
 
                if (IS_QLA82XX(ha)) {
                        qla82xx_idc_lock(ha);
                        qla82xx_wr_32(ha, QLA82XX_CRB_DEV_STATE,
                                QLA82XX_DEV_FAILED);
                        qla82xx_idc_unlock(ha);
-                       qla_printk(KERN_INFO, ha, "HW State: FAILED\n");
+                       ql_log(ql_log_fatal, base_vha, 0x00d7,
+                           "HW State: FAILED.\n");
                }
 
                ret = -ENODEV;
@@ -2221,9 +2342,8 @@ que_init:
 
        if (ha->mqenable) {
                if (qla25xx_setup_mode(base_vha)) {
-                       qla_printk(KERN_WARNING, ha,
-                               "Can't create queues, falling back to single"
-                               " queue mode\n");
+                       ql_log(ql_log_warn, base_vha, 0x00ec,
+                           "Failed to create queues, falling back to single queue mode.\n");
                        goto que_init;
                }
        }
@@ -2235,13 +2355,15 @@ que_init:
         * Startup the kernel thread for this host adapter
         */
        ha->dpc_thread = kthread_create(qla2x00_do_dpc, ha,
-                       "%s_dpc", base_vha->host_str);
+           "%s_dpc", base_vha->host_str);
        if (IS_ERR(ha->dpc_thread)) {
-               qla_printk(KERN_WARNING, ha,
-                   "Unable to start DPC thread!\n");
+               ql_log(ql_log_fatal, base_vha, 0x00ed,
+                   "Failed to start DPC thread.\n");
                ret = PTR_ERR(ha->dpc_thread);
                goto probe_failed;
        }
+       ql_dbg(ql_dbg_init, base_vha, 0x00ee,
+           "DPC thread started successfully.\n");
 
 skip_dpc:
        list_add_tail(&base_vha->list, &ha->vp_list);
@@ -2249,16 +2371,18 @@ skip_dpc:
 
        /* Initialized the timer */
        qla2x00_start_timer(base_vha, qla2x00_timer, WATCH_INTERVAL);
-
-       DEBUG2(printk("DEBUG: detect hba %ld at address = %p\n",
-           base_vha->host_no, ha));
+       ql_dbg(ql_dbg_init, base_vha, 0x00ef,
+           "Started qla2x00_timer with "
+           "interval=%d.\n", WATCH_INTERVAL);
+       ql_dbg(ql_dbg_init, base_vha, 0x00f0,
+           "Detected hba at address=%p.\n",
+           ha);
 
        if ((IS_QLA25XX(ha) || IS_QLA81XX(ha)) && ql2xenabledif) {
                if (ha->fw_attributes & BIT_4) {
                        base_vha->flags.difdix_supported = 1;
-                       DEBUG18(qla_printk(KERN_INFO, ha,
-                           "Registering for DIF/DIX type 1 and 3"
-                           " protection.\n"));
+                       ql_dbg(ql_dbg_init, base_vha, 0x00f1,
+                           "Registering for DIF/DIX type 1 and 3 protection.\n");
                        scsi_host_set_prot(host,
                            SHOST_DIF_TYPE1_PROTECTION
                            | SHOST_DIF_TYPE2_PROTECTION
@@ -2280,6 +2404,9 @@ skip_dpc:
        base_vha->flags.init_done = 1;
        base_vha->flags.online = 1;
 
+       ql_dbg(ql_dbg_init, base_vha, 0x00f2,
+           "Init done and hba is online.\n");
+
        scsi_scan_host(host);
 
        qla2x00_alloc_sysfs_attr(base_vha);
@@ -2288,14 +2415,17 @@ skip_dpc:
 
        qla2x00_dfs_setup(base_vha);
 
-       qla_printk(KERN_INFO, ha, "\n"
-           " QLogic Fibre Channel HBA Driver: %s\n"
-           "  QLogic %s - %s\n"
-           "  ISP%04X: %s @ %s hdma%c, host#=%ld, fw=%s\n",
-           qla2x00_version_str, ha->model_number,
-           ha->model_desc ? ha->model_desc : "", pdev->device,
-           ha->isp_ops->pci_info_str(base_vha, pci_info), pci_name(pdev),
-           ha->flags.enable_64bit_addressing ? '+' : '-', base_vha->host_no,
+       ql_log(ql_log_info, base_vha, 0x00fa,
+           "QLogic Fibre Channed HBA Driver: %s.\n",
+           qla2x00_version_str);
+       ql_log(ql_log_info, base_vha, 0x00fb,
+           "QLogic %s - %s.\n",
+           ha->model_number, ha->model_desc ? ha->model_desc : "");
+       ql_log(ql_log_info, base_vha, 0x00fc,
+           "ISP%04X: %s @ %s hdma%c host#=%ld fw=%s.\n",
+           pdev->device, ha->isp_ops->pci_info_str(base_vha, pci_info),
+           pci_name(pdev), ha->flags.enable_64bit_addressing ? '+' : '-',
+           base_vha->host_no,
            ha->isp_ops->fw_version_str(base_vha, fw_str));
 
        return 0;
@@ -2593,20 +2723,15 @@ void qla2x00_mark_device_lost(scsi_qla_host_t *vha, fc_port_t *fcport,
                fcport->login_retry = vha->hw->login_retry_count;
                set_bit(RELOGIN_NEEDED, &vha->dpc_flags);
 
-               DEBUG(printk("scsi(%ld): Port login retry: "
+               ql_dbg(ql_dbg_disc, vha, 0x2067,
+                   "Port login retry "
                    "%02x%02x%02x%02x%02x%02x%02x%02x, "
-                   "id = 0x%04x retry cnt=%d\n",
-                   vha->host_no,
-                   fcport->port_name[0],
-                   fcport->port_name[1],
-                   fcport->port_name[2],
-                   fcport->port_name[3],
-                   fcport->port_name[4],
-                   fcport->port_name[5],
-                   fcport->port_name[6],
-                   fcport->port_name[7],
-                   fcport->loop_id,
-                   fcport->login_retry));
+                   "id = 0x%04x retry cnt=%d.\n",
+                   fcport->port_name[0], fcport->port_name[1],
+                   fcport->port_name[2], fcport->port_name[3],
+                   fcport->port_name[4], fcport->port_name[5],
+                   fcport->port_name[6], fcport->port_name[7],
+                   fcport->loop_id, fcport->login_retry);
        }
 }
 
@@ -2689,6 +2814,9 @@ qla2x00_mem_alloc(struct qla_hw_data *ha, uint16_t req_len, uint16_t rsp_len,
                        ctx_cachep);
                if (!ha->ctx_mempool)
                        goto fail_free_srb_mempool;
+               ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0021,
+                   "ctx_cachep=%p ctx_mempool=%p.\n",
+                   ctx_cachep, ha->ctx_mempool);
        }
 
        /* Get memory for cached NVRAM */
@@ -2703,22 +2831,29 @@ qla2x00_mem_alloc(struct qla_hw_data *ha, uint16_t req_len, uint16_t rsp_len,
        if (!ha->s_dma_pool)
                goto fail_free_nvram;
 
+       ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0022,
+           "init_cb=%p gid_list=%p, srb_mempool=%p s_dma_pool=%p.\n",
+           ha->init_cb, ha->gid_list, ha->srb_mempool, ha->s_dma_pool);
+
        if (IS_QLA82XX(ha) || ql2xenabledif) {
                ha->dl_dma_pool = dma_pool_create(name, &ha->pdev->dev,
                        DSD_LIST_DMA_POOL_SIZE, 8, 0);
                if (!ha->dl_dma_pool) {
-                       qla_printk(KERN_WARNING, ha,
-                           "Memory Allocation failed - dl_dma_pool\n");
+                       ql_log_pci(ql_log_fatal, ha->pdev, 0x0023,
+                           "Failed to allocate memory for dl_dma_pool.\n");
                        goto fail_s_dma_pool;
                }
 
                ha->fcp_cmnd_dma_pool = dma_pool_create(name, &ha->pdev->dev,
                        FCP_CMND_DMA_POOL_SIZE, 8, 0);
                if (!ha->fcp_cmnd_dma_pool) {
-                       qla_printk(KERN_WARNING, ha,
-                           "Memory Allocation failed - fcp_cmnd_dma_pool\n");
+                       ql_log_pci(ql_log_fatal, ha->pdev, 0x0024,
+                           "Failed to allocate memory for fcp_cmnd_dma_pool.\n");
                        goto fail_dl_dma_pool;
                }
+               ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0025,
+                   "dl_dma_pool=%p fcp_cmnd_dma_pool=%p.\n",
+                   ha->dl_dma_pool, ha->fcp_cmnd_dma_pool);
        }
 
        /* Allocate memory for SNS commands */
@@ -2728,6 +2863,8 @@ qla2x00_mem_alloc(struct qla_hw_data *ha, uint16_t req_len, uint16_t rsp_len,
                sizeof(struct sns_cmd_pkt), &ha->sns_cmd_dma, GFP_KERNEL);
                if (!ha->sns_cmd)
                        goto fail_dma_pool;
+               ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0026,
+                   "sns_cmd.\n", ha->sns_cmd);
        } else {
        /* Get consistent memory allocated for MS IOCB */
                ha->ms_iocb = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL,
@@ -2739,12 +2876,16 @@ qla2x00_mem_alloc(struct qla_hw_data *ha, uint16_t req_len, uint16_t rsp_len,
                        sizeof(struct ct_sns_pkt), &ha->ct_sns_dma, GFP_KERNEL);
                if (!ha->ct_sns)
                        goto fail_free_ms_iocb;
+               ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0027,
+                   "ms_iocb=%p ct_sns=%p.\n",
+                   ha->ms_iocb, ha->ct_sns);
        }
 
        /* Allocate memory for request ring */
        *req = kzalloc(sizeof(struct req_que), GFP_KERNEL);
        if (!*req) {
-               DEBUG(printk("Unable to allocate memory for req\n"));
+               ql_log_pci(ql_log_fatal, ha->pdev, 0x0028,
+                   "Failed to allocate memory for req.\n");
                goto fail_req;
        }
        (*req)->length = req_len;
@@ -2752,14 +2893,15 @@ qla2x00_mem_alloc(struct qla_hw_data *ha, uint16_t req_len, uint16_t rsp_len,
                ((*req)->length + 1) * sizeof(request_t),
                &(*req)->dma, GFP_KERNEL);
        if (!(*req)->ring) {
-               DEBUG(printk("Unable to allocate memory for req_ring\n"));
+               ql_log_pci(ql_log_fatal, ha->pdev, 0x0029,
+                   "Failed to allocate memory for req_ring.\n");
                goto fail_req_ring;
        }
        /* Allocate memory for response ring */
        *rsp = kzalloc(sizeof(struct rsp_que), GFP_KERNEL);
        if (!*rsp) {
-               qla_printk(KERN_WARNING, ha,
-                       "Unable to allocate memory for rsp\n");
+               ql_log_pci(ql_log_fatal, ha->pdev, 0x002a,
+                   "Failed to allocate memory for rsp.\n");
                goto fail_rsp;
        }
        (*rsp)->hw = ha;
@@ -2768,19 +2910,24 @@ qla2x00_mem_alloc(struct qla_hw_data *ha, uint16_t req_len, uint16_t rsp_len,
                ((*rsp)->length + 1) * sizeof(response_t),
                &(*rsp)->dma, GFP_KERNEL);
        if (!(*rsp)->ring) {
-               qla_printk(KERN_WARNING, ha,
-                       "Unable to allocate memory for rsp_ring\n");
+               ql_log_pci(ql_log_fatal, ha->pdev, 0x002b,
+                   "Failed to allocate memory for rsp_ring.\n");
                goto fail_rsp_ring;
        }
        (*req)->rsp = *rsp;
        (*rsp)->req = *req;
+       ql_dbg_pci(ql_dbg_init, ha->pdev, 0x002c,
+           "req=%p req->length=%d req->ring=%p rsp=%p "
+           "rsp->length=%d rsp->ring=%p.\n",
+           *req, (*req)->length, (*req)->ring, *rsp, (*rsp)->length,
+           (*rsp)->ring);
        /* Allocate memory for NVRAM data for vports */
        if (ha->nvram_npiv_size) {
                ha->npiv_info = kzalloc(sizeof(struct qla_npiv_entry) *
-                                       ha->nvram_npiv_size, GFP_KERNEL);
+                   ha->nvram_npiv_size, GFP_KERNEL);
                if (!ha->npiv_info) {
-                       qla_printk(KERN_WARNING, ha,
-                               "Unable to allocate memory for npiv info\n");
+                       ql_log_pci(ql_log_fatal, ha->pdev, 0x002d,
+                           "Failed to allocate memory for npiv_info.\n");
                        goto fail_npiv_info;
                }
        } else
@@ -2792,6 +2939,8 @@ qla2x00_mem_alloc(struct qla_hw_data *ha, uint16_t req_len, uint16_t rsp_len,
                    &ha->ex_init_cb_dma);
                if (!ha->ex_init_cb)
                        goto fail_ex_init_cb;
+               ql_dbg_pci(ql_dbg_init, ha->pdev, 0x002e,
+                   "ex_init_cb=%p.\n", ha->ex_init_cb);
        }
 
        INIT_LIST_HEAD(&ha->gbl_dsd_list);
@@ -2802,6 +2951,8 @@ qla2x00_mem_alloc(struct qla_hw_data *ha, uint16_t req_len, uint16_t rsp_len,
                        &ha->async_pd_dma);
                if (!ha->async_pd)
                        goto fail_async_pd;
+               ql_dbg_pci(ql_dbg_init, ha->pdev, 0x002f,
+                   "async_pd=%p.\n", ha->async_pd);
        }
 
        INIT_LIST_HEAD(&ha->vp_list);
@@ -2867,7 +3018,8 @@ fail_free_init_cb:
        ha->init_cb = NULL;
        ha->init_cb_dma = 0;
 fail:
-       DEBUG(printk("%s: Memory allocation failure\n", __func__));
+       ql_log(ql_log_fatal, NULL, 0x0030,
+           "Memory allocation failure.\n");
        return -ENOMEM;
 }
 
@@ -3016,8 +3168,8 @@ struct scsi_qla_host *qla2x00_create_host(struct scsi_host_template *sht,
 
        host = scsi_host_alloc(sht, sizeof(scsi_qla_host_t));
        if (host == NULL) {
-               printk(KERN_WARNING
-               "qla2xxx: Couldn't allocate host from scsi layer!\n");
+               ql_log_pci(ql_log_fatal, ha->pdev, 0x0107,
+                   "Failed to allocate host from the scsi layer, aborting.\n");
                goto fail;
        }
 
@@ -3036,6 +3188,11 @@ struct scsi_qla_host *qla2x00_create_host(struct scsi_host_template *sht,
        spin_lock_init(&vha->work_lock);
 
        sprintf(vha->host_str, "%s_%ld", QLA2XXX_DRIVER_NAME, vha->host_no);
+       ql_dbg(ql_dbg_init, vha, 0x0041,
+           "Allocated the host=%p hw=%p vha=%p dev_name=%s",
+           vha->host, vha->hw, vha,
+           dev_name(&(ha->pdev->dev)));
+
        return vha;
 
 fail:
@@ -3277,18 +3434,18 @@ void qla2x00_relogin(struct scsi_qla_host *vha)
                        if (status == QLA_SUCCESS) {
                                fcport->old_loop_id = fcport->loop_id;
 
-                               DEBUG(printk("scsi(%ld): port login OK: logged "
-                               "in ID 0x%x\n", vha->host_no, fcport->loop_id));
+                               ql_dbg(ql_dbg_disc, vha, 0x2003,
+                                   "Port login OK: logged in ID 0x%x.\n",
+                                   fcport->loop_id);
 
                                qla2x00_update_fcport(vha, fcport);
 
                        } else if (status == 1) {
                                set_bit(RELOGIN_NEEDED, &vha->dpc_flags);
                                /* retry the login again */
-                               DEBUG(printk("scsi(%ld): Retrying"
-                               " %d login again loop_id 0x%x\n",
-                               vha->host_no, fcport->login_retry,
-                                               fcport->loop_id));
+                               ql_dbg(ql_dbg_disc, vha, 0x2007,
+                                   "Retrying %d login again loop_id 0x%x.\n",
+                                   fcport->login_retry, fcport->loop_id);
                        } else {
                                fcport->login_retry = 0;
                        }
@@ -3328,26 +3485,27 @@ qla2x00_do_dpc(void *data)
 
        set_current_state(TASK_INTERRUPTIBLE);
        while (!kthread_should_stop()) {
-               DEBUG3(printk("qla2x00: DPC handler sleeping\n"));
+               ql_dbg(ql_dbg_dpc, base_vha, 0x4000,
+                   "DPC handler sleeping.\n");
 
                schedule();
                __set_current_state(TASK_RUNNING);
 
-               DEBUG3(printk("qla2x00: DPC handler waking up\n"));
+               ql_dbg(ql_dbg_dpc, base_vha, 0x4001,
+                   "DPC handler waking up.\n");
+               ql_dbg(ql_dbg_dpc, base_vha, 0x4002,
+                   "dpc_flags=0x%lx.\n", base_vha->dpc_flags);
 
                /* Initialization not yet finished. Don't do anything yet. */
                if (!base_vha->flags.init_done)
                        continue;
 
                if (ha->flags.eeh_busy) {
-                       DEBUG17(qla_printk(KERN_WARNING, ha,
-                           "qla2x00_do_dpc: dpc_flags: %lx\n",
-                           base_vha->dpc_flags));
+                       ql_dbg(ql_dbg_dpc, base_vha, 0x4003,
+                           "eeh_busy=%d.\n", ha->flags.eeh_busy);
                        continue;
                }
 
-               DEBUG3(printk("scsi(%ld): DPC handler\n", base_vha->host_no));
-
                ha->dpc_active = 1;
 
                if (ha->flags.mbox_busy) {
@@ -3364,8 +3522,8 @@ qla2x00_do_dpc(void *data)
                                qla82xx_wr_32(ha, QLA82XX_CRB_DEV_STATE,
                                        QLA82XX_DEV_FAILED);
                                qla82xx_idc_unlock(ha);
-                               qla_printk(KERN_INFO, ha,
-                                       "HW State: FAILED\n");
+                               ql_log(ql_log_info, base_vha, 0x4004,
+                                   "HW State: FAILED.\n");
                                qla82xx_device_state_handler(base_vha);
                                continue;
                        }
@@ -3373,10 +3531,8 @@ qla2x00_do_dpc(void *data)
                        if (test_and_clear_bit(FCOE_CTX_RESET_NEEDED,
                                &base_vha->dpc_flags)) {
 
-                               DEBUG(printk(KERN_INFO
-                                       "scsi(%ld): dpc: sched "
-                                       "qla82xx_fcoe_ctx_reset ha = %p\n",
-                                       base_vha->host_no, ha));
+                               ql_dbg(ql_dbg_dpc, base_vha, 0x4005,
+                                   "FCoE context reset scheduled.\n");
                                if (!(test_and_set_bit(ABORT_ISP_ACTIVE,
                                        &base_vha->dpc_flags))) {
                                        if (qla82xx_fcoe_ctx_reset(base_vha)) {
@@ -3390,18 +3546,16 @@ qla2x00_do_dpc(void *data)
                                                &base_vha->dpc_flags);
                                }
 
-                               DEBUG(printk("scsi(%ld): dpc:"
-                                       " qla82xx_fcoe_ctx_reset end\n",
-                                       base_vha->host_no));
+                               ql_dbg(ql_dbg_dpc, base_vha, 0x4006,
+                                   "FCoE context reset end.\n");
                        }
                }
 
                if (test_and_clear_bit(ISP_ABORT_NEEDED,
                                                &base_vha->dpc_flags)) {
 
-                       DEBUG(printk("scsi(%ld): dpc: sched "
-                           "qla2x00_abort_isp ha = %p\n",
-                           base_vha->host_no, ha));
+                       ql_dbg(ql_dbg_dpc, base_vha, 0x4007,
+                           "ISP abort scheduled.\n");
                        if (!(test_and_set_bit(ABORT_ISP_ACTIVE,
                            &base_vha->dpc_flags))) {
 
@@ -3414,8 +3568,8 @@ qla2x00_do_dpc(void *data)
                                                &base_vha->dpc_flags);
                        }
 
-                       DEBUG(printk("scsi(%ld): dpc: qla2x00_abort_isp end\n",
-                           base_vha->host_no));
+                       ql_dbg(ql_dbg_dpc, base_vha, 0x4008,
+                           "ISP abort end.\n");
                }
 
                if (test_bit(FCPORT_UPDATE_NEEDED, &base_vha->dpc_flags)) {
@@ -3424,9 +3578,8 @@ qla2x00_do_dpc(void *data)
                }
 
                if (test_bit(ISP_QUIESCE_NEEDED, &base_vha->dpc_flags)) {
-                       DEBUG(printk(KERN_INFO "scsi(%ld): dpc: sched "
-                           "qla2x00_quiesce_needed ha = %p\n",
-                           base_vha->host_no, ha));
+                       ql_dbg(ql_dbg_dpc, base_vha, 0x4009,
+                           "Quiescence mode scheduled.\n");
                        qla82xx_device_state_handler(base_vha);
                        clear_bit(ISP_QUIESCE_NEEDED, &base_vha->dpc_flags);
                        if (!ha->flags.quiesce_owner) {
@@ -3436,17 +3589,20 @@ qla2x00_do_dpc(void *data)
                                qla82xx_clear_qsnt_ready(base_vha);
                                qla82xx_idc_unlock(ha);
                        }
+                       ql_dbg(ql_dbg_dpc, base_vha, 0x400a,
+                           "Quiescence mode end.\n");
                }
 
                if (test_and_clear_bit(RESET_MARKER_NEEDED,
                                                        &base_vha->dpc_flags) &&
                    (!(test_and_set_bit(RESET_ACTIVE, &base_vha->dpc_flags)))) {
 
-                       DEBUG(printk("scsi(%ld): qla2x00_reset_marker()\n",
-                           base_vha->host_no));
-
+                       ql_dbg(ql_dbg_dpc, base_vha, 0x400b,
+                           "Reset marker scheduled.\n");
                        qla2x00_rst_aen(base_vha);
                        clear_bit(RESET_ACTIVE, &base_vha->dpc_flags);
+                       ql_dbg(ql_dbg_dpc, base_vha, 0x400c,
+                           "Reset marker end.\n");
                }
 
                /* Retry each device up to login retry count */
@@ -3455,19 +3611,18 @@ qla2x00_do_dpc(void *data)
                    !test_bit(LOOP_RESYNC_NEEDED, &base_vha->dpc_flags) &&
                    atomic_read(&base_vha->loop_state) != LOOP_DOWN) {
 
-                       DEBUG(printk("scsi(%ld): qla2x00_port_login()\n",
-                                       base_vha->host_no));
+                       ql_dbg(ql_dbg_dpc, base_vha, 0x400d,
+                           "Relogin scheduled.\n");
                        qla2x00_relogin(base_vha);
-
-                       DEBUG(printk("scsi(%ld): qla2x00_port_login - end\n",
-                           base_vha->host_no));
+                       ql_dbg(ql_dbg_dpc, base_vha, 0x400e,
+                           "Relogin end.\n");
                }
 
                if (test_and_clear_bit(LOOP_RESYNC_NEEDED,
                                                        &base_vha->dpc_flags)) {
 
-                       DEBUG(printk("scsi(%ld): qla2x00_loop_resync()\n",
-                               base_vha->host_no));
+                       ql_dbg(ql_dbg_dpc, base_vha, 0x400f,
+                           "Loop resync scheduled.\n");
 
                        if (!(test_and_set_bit(LOOP_RESYNC_ACTIVE,
                            &base_vha->dpc_flags))) {
@@ -3478,8 +3633,8 @@ qla2x00_do_dpc(void *data)
                                                &base_vha->dpc_flags);
                        }
 
-                       DEBUG(printk("scsi(%ld): qla2x00_loop_resync - end\n",
-                           base_vha->host_no));
+                       ql_dbg(ql_dbg_dpc, base_vha, 0x4010,
+                           "Loop resync end.\n");
                }
 
                if (test_bit(NPIV_CONFIG_NEEDED, &base_vha->dpc_flags) &&
@@ -3502,7 +3657,8 @@ qla2x00_do_dpc(void *data)
        } /* End of while(1) */
        __set_current_state(TASK_RUNNING);
 
-       DEBUG(printk("scsi(%ld): DPC handler exiting\n", base_vha->host_no));
+       ql_dbg(ql_dbg_dpc, base_vha, 0x4011,
+           "DPC handler exiting.\n");
 
        /*
         * Make sure that nobody tries to wake us up again.
@@ -3609,9 +3765,11 @@ void
 qla2x00_sp_compl(struct qla_hw_data *ha, srb_t *sp)
 {
        if (atomic_read(&sp->ref_count) == 0) {
-               DEBUG2(qla_printk(KERN_WARNING, ha,
-                   "SP reference-count to ZERO -- sp=%p\n", sp));
-               DEBUG2(BUG());
+               ql_dbg(ql_dbg_io, sp->fcport->vha, 0x3015,
+                   "SP reference-count to ZERO -- sp=%p cmd=%p.\n",
+                   sp, sp->cmd);
+               if (ql2xextended_error_logging & ql_dbg_io)
+                       BUG();
                return;
        }
        if (!atomic_dec_and_test(&sp->ref_count))
@@ -3639,6 +3797,9 @@ qla2x00_timer(scsi_qla_host_t *vha)
        struct req_que *req;
 
        if (ha->flags.eeh_busy) {
+               ql_dbg(ql_dbg_timer, vha, 0x6000,
+                   "EEH = %d, restarting timer.\n",
+                   ha->flags.eeh_busy);
                qla2x00_restart_timer(vha, WATCH_INTERVAL);
                return;
        }
@@ -3663,9 +3824,8 @@ qla2x00_timer(scsi_qla_host_t *vha)
                if (atomic_read(&vha->loop_down_timer) ==
                    vha->loop_down_abort_time) {
 
-                       DEBUG(printk("scsi(%ld): Loop Down - aborting the "
-                           "queues before time expire\n",
-                           vha->host_no));
+                       ql_log(ql_log_info, vha, 0x6008,
+                           "Loop down - aborting the queues before time expires.\n");
 
                        if (!IS_QLA2100(ha) && vha->link_down_timeout)
                                atomic_set(&vha->loop_state, LOOP_DEAD);
@@ -3710,10 +3870,7 @@ qla2x00_timer(scsi_qla_host_t *vha)
                /* if the loop has been down for 4 minutes, reinit adapter */
                if (atomic_dec_and_test(&vha->loop_down_timer) != 0) {
                        if (!(vha->device_flags & DFLG_NO_CABLE)) {
-                               DEBUG(printk("scsi(%ld): Loop down - "
-                                   "aborting ISP.\n",
-                                   vha->host_no));
-                               qla_printk(KERN_WARNING, ha,
+                               ql_log(ql_log_warn, vha, 0x6009,
                                    "Loop down - aborting ISP.\n");
 
                                if (IS_QLA82XX(ha))
@@ -3724,9 +3881,9 @@ qla2x00_timer(scsi_qla_host_t *vha)
                                                &vha->dpc_flags);
                        }
                }
-               DEBUG3(printk("scsi(%ld): Loop Down - seconds remaining %d\n",
-                   vha->host_no,
-                   atomic_read(&vha->loop_down_timer)));
+               ql_dbg(ql_dbg_timer, vha, 0x600a,
+                   "Loop down - seconds remaining %d.\n",
+                   atomic_read(&vha->loop_down_timer));
        }
 
        /* Check if beacon LED needs to be blinked for physical host only */
@@ -3749,8 +3906,27 @@ qla2x00_timer(scsi_qla_host_t *vha)
            test_bit(ISP_UNRECOVERABLE, &vha->dpc_flags) ||
            test_bit(FCOE_CTX_RESET_NEEDED, &vha->dpc_flags) ||
            test_bit(VP_DPC_NEEDED, &vha->dpc_flags) ||
-           test_bit(RELOGIN_NEEDED, &vha->dpc_flags)))
+           test_bit(RELOGIN_NEEDED, &vha->dpc_flags))) {
+               ql_dbg(ql_dbg_timer, vha, 0x600b,
+                   "isp_abort_needed=%d loop_resync_needed=%d "
+                   "fcport_update_needed=%d start_dpc=%d "
+                   "reset_marker_needed=%d",
+                   test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags),
+                   test_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags),
+                   test_bit(FCPORT_UPDATE_NEEDED, &vha->dpc_flags),
+                   start_dpc,
+                   test_bit(RESET_MARKER_NEEDED, &vha->dpc_flags));
+               ql_dbg(ql_dbg_timer, vha, 0x600c,
+                   "beacon_blink_needed=%d isp_unrecoverable=%d "
+                   "fcoe_ctx_reset_needed=%d vp_dpc_needed=%d "
+                   "relogin_needed=%d.\n",
+                   test_bit(BEACON_BLINK_NEEDED, &vha->dpc_flags),
+                   test_bit(ISP_UNRECOVERABLE, &vha->dpc_flags),
+                   test_bit(FCOE_CTX_RESET_NEEDED, &vha->dpc_flags),
+                   test_bit(VP_DPC_NEEDED, &vha->dpc_flags),
+                   test_bit(RELOGIN_NEEDED, &vha->dpc_flags));
                qla2xxx_wake_dpc(vha);
+       }
 
        qla2x00_restart_timer(vha, WATCH_INTERVAL);
 }
@@ -3819,8 +3995,8 @@ qla2x00_request_firmware(scsi_qla_host_t *vha)
                goto out;
 
        if (request_firmware(&blob->fw, blob->name, &ha->pdev->dev)) {
-               DEBUG2(printk("scsi(%ld): Failed to load firmware image "
-                   "(%s).\n", vha->host_no, blob->name));
+               ql_log(ql_log_warn, vha, 0x0063,
+                   "Failed to load firmware image (%s).\n", blob->name);
                blob->fw = NULL;
                blob = NULL;
                goto out;
@@ -3849,8 +4025,8 @@ qla2xxx_pci_error_detected(struct pci_dev *pdev, pci_channel_state_t state)
        scsi_qla_host_t *vha = pci_get_drvdata(pdev);
        struct qla_hw_data *ha = vha->hw;
 
-       DEBUG2(qla_printk(KERN_WARNING, ha, "error_detected:state %x\n",
-           state));
+       ql_dbg(ql_dbg_aer, vha, 0x9000,
+           "PCI error detected, state %x.\n", state);
 
        switch (state) {
        case pci_channel_io_normal:
@@ -3863,9 +4039,9 @@ qla2xxx_pci_error_detected(struct pci_dev *pdev, pci_channel_state_t state)
                        ha->flags.isp82xx_fw_hung = 1;
                        if (ha->flags.mbox_busy) {
                                ha->flags.mbox_int = 1;
-                               DEBUG2(qla_printk(KERN_ERR, ha,
-                                       "Due to pci channel io frozen, doing premature "
-                                       "completion of mbx command\n"));
+                               ql_dbg(ql_dbg_aer, vha, 0x9001,
+                                   "Due to pci channel io frozen, doing premature "
+                                   "completion of mbx command.\n");
                                complete(&ha->mbx_intr_comp);
                        }
                }
@@ -3913,8 +4089,8 @@ qla2xxx_pci_mmio_enabled(struct pci_dev *pdev)
        spin_unlock_irqrestore(&ha->hardware_lock, flags);
 
        if (risc_paused) {
-               qla_printk(KERN_INFO, ha, "RISC paused -- mmio_enabled, "
-                   "Dumping firmware!\n");
+               ql_log(ql_log_info, base_vha, 0x9003,
+                   "RISC paused -- mmio_enabled, Dumping firmware.\n");
                ha->isp_ops->fw_dump(base_vha, 0);
 
                return PCI_ERS_RESULT_NEED_RESET;
@@ -3930,8 +4106,8 @@ uint32_t qla82xx_error_recovery(scsi_qla_host_t *base_vha)
        int fn;
        struct pci_dev *other_pdev = NULL;
 
-       DEBUG17(qla_printk(KERN_INFO, ha,
-           "scsi(%ld): In qla82xx_error_recovery\n", base_vha->host_no));
+       ql_dbg(ql_dbg_aer, base_vha, 0x9006,
+           "Entered %s.\n", __func__);
 
        set_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags);
 
@@ -3945,8 +4121,8 @@ uint32_t qla82xx_error_recovery(scsi_qla_host_t *base_vha)
        fn = PCI_FUNC(ha->pdev->devfn);
        while (fn > 0) {
                fn--;
-               DEBUG17(qla_printk(KERN_INFO, ha,
-                   "Finding pci device at function = 0x%x\n", fn));
+               ql_dbg(ql_dbg_aer, base_vha, 0x9007,
+                   "Finding pci device at function = 0x%x.\n", fn);
                other_pdev =
                    pci_get_domain_bus_and_slot(pci_domain_nr(ha->pdev->bus),
                    ha->pdev->bus->number, PCI_DEVFN(PCI_SLOT(ha->pdev->devfn),
@@ -3955,9 +4131,9 @@ uint32_t qla82xx_error_recovery(scsi_qla_host_t *base_vha)
                if (!other_pdev)
                        continue;
                if (atomic_read(&other_pdev->enable_cnt)) {
-                       DEBUG17(qla_printk(KERN_INFO, ha,
-                           "Found PCI func available and enabled at 0x%x\n",
-                           fn));
+                       ql_dbg(ql_dbg_aer, base_vha, 0x9008,
+                           "Found PCI func available and enable at 0x%x.\n",
+                           fn);
                        pci_dev_put(other_pdev);
                        break;
                }
@@ -3966,8 +4142,9 @@ uint32_t qla82xx_error_recovery(scsi_qla_host_t *base_vha)
 
        if (!fn) {
                /* Reset owner */
-               DEBUG17(qla_printk(KERN_INFO, ha,
-                   "This devfn is reset owner = 0x%x\n", ha->pdev->devfn));
+               ql_dbg(ql_dbg_aer, base_vha, 0x9009,
+                   "This devfn is reset owner = 0x%x.\n",
+                   ha->pdev->devfn);
                qla82xx_idc_lock(ha);
 
                qla82xx_wr_32(ha, QLA82XX_CRB_DEV_STATE,
@@ -3977,8 +4154,8 @@ uint32_t qla82xx_error_recovery(scsi_qla_host_t *base_vha)
                    QLA82XX_IDC_VERSION);
 
                drv_active = qla82xx_rd_32(ha, QLA82XX_CRB_DRV_ACTIVE);
-               DEBUG17(qla_printk(KERN_INFO, ha,
-                   "drv_active = 0x%x\n", drv_active));
+               ql_dbg(ql_dbg_aer, base_vha, 0x900a,
+                   "drv_active = 0x%x.\n", drv_active);
 
                qla82xx_idc_unlock(ha);
                /* Reset if device is not already reset
@@ -3991,12 +4168,14 @@ uint32_t qla82xx_error_recovery(scsi_qla_host_t *base_vha)
                qla82xx_idc_lock(ha);
 
                if (rval != QLA_SUCCESS) {
-                       qla_printk(KERN_INFO, ha, "HW State: FAILED\n");
+                       ql_log(ql_log_info, base_vha, 0x900b,
+                           "HW State: FAILED.\n");
                        qla82xx_clear_drv_active(ha);
                        qla82xx_wr_32(ha, QLA82XX_CRB_DEV_STATE,
                            QLA82XX_DEV_FAILED);
                } else {
-                       qla_printk(KERN_INFO, ha, "HW State: READY\n");
+                       ql_log(ql_log_info, base_vha, 0x900c,
+                           "HW State: READY.\n");
                        qla82xx_wr_32(ha, QLA82XX_CRB_DEV_STATE,
                            QLA82XX_DEV_READY);
                        qla82xx_idc_unlock(ha);
@@ -4009,8 +4188,9 @@ uint32_t qla82xx_error_recovery(scsi_qla_host_t *base_vha)
                }
                qla82xx_idc_unlock(ha);
        } else {
-               DEBUG17(qla_printk(KERN_INFO, ha,
-                   "This devfn is not reset owner = 0x%x\n", ha->pdev->devfn));
+               ql_dbg(ql_dbg_aer, base_vha, 0x900d,
+                   "This devfn is not reset owner = 0x%x.\n",
+                   ha->pdev->devfn);
                if ((qla82xx_rd_32(ha, QLA82XX_CRB_DEV_STATE) ==
                    QLA82XX_DEV_READY)) {
                        ha->flags.isp82xx_fw_hung = 0;
@@ -4034,7 +4214,8 @@ qla2xxx_pci_slot_reset(struct pci_dev *pdev)
        struct rsp_que *rsp;
        int rc, retries = 10;
 
-       DEBUG17(qla_printk(KERN_WARNING, ha, "slot_reset\n"));
+       ql_dbg(ql_dbg_aer, base_vha, 0x9004,
+           "Slot Reset.\n");
 
        /* Workaround: qla2xxx driver which access hardware earlier
         * needs error state to be pci_channel_io_online.
@@ -4055,7 +4236,7 @@ qla2xxx_pci_slot_reset(struct pci_dev *pdev)
                rc = pci_enable_device(pdev);
 
        if (rc) {
-               qla_printk(KERN_WARNING, ha,
+               ql_log(ql_log_warn, base_vha, 0x9005,
                    "Can't re-enable PCI device after reset.\n");
                goto exit_slot_reset;
        }
@@ -4085,8 +4266,8 @@ qla2xxx_pci_slot_reset(struct pci_dev *pdev)
 
 
 exit_slot_reset:
-       DEBUG17(qla_printk(KERN_WARNING, ha,
-           "slot_reset-return:ret=%x\n", ret));
+       ql_dbg(ql_dbg_aer, base_vha, 0x900e,
+           "slot_reset return %x.\n", ret);
 
        return ret;
 }
@@ -4098,13 +4279,13 @@ qla2xxx_pci_resume(struct pci_dev *pdev)
        struct qla_hw_data *ha = base_vha->hw;
        int ret;
 
-       DEBUG17(qla_printk(KERN_WARNING, ha, "pci_resume\n"));
+       ql_dbg(ql_dbg_aer, base_vha, 0x900f,
+           "pci_resume.\n");
 
        ret = qla2x00_wait_for_hba_online(base_vha);
        if (ret != QLA_SUCCESS) {
-               qla_printk(KERN_ERR, ha,
-                   "the device failed to resume I/O "
-                   "from slot/link_reset");
+               ql_log(ql_log_fatal, base_vha, 0x9002,
+                   "The device failed to resume I/O from slot/link_reset.\n");
        }
 
        pci_cleanup_aer_uncorrect_error_status(pdev);
@@ -4168,8 +4349,8 @@ qla2x00_module_init(void)
        srb_cachep = kmem_cache_create("qla2xxx_srbs", sizeof(srb_t), 0,
            SLAB_HWCACHE_ALIGN, NULL);
        if (srb_cachep == NULL) {
-               printk(KERN_ERR
-                   "qla2xxx: Unable to allocate SRB cache...Failing load!\n");
+               ql_log(ql_log_fatal, NULL, 0x0001,
+                   "Unable to allocate SRB cache...Failing load!.\n");
                return -ENOMEM;
        }
 
@@ -4182,13 +4363,15 @@ qla2x00_module_init(void)
            fc_attach_transport(&qla2xxx_transport_functions);
        if (!qla2xxx_transport_template) {
                kmem_cache_destroy(srb_cachep);
+               ql_log(ql_log_fatal, NULL, 0x0002,
+                   "fc_attach_transport failed...Failing load!.\n");
                return -ENODEV;
        }
 
        apidev_major = register_chrdev(0, QLA2XXX_APIDEV, &apidev_fops);
        if (apidev_major < 0) {
-               printk(KERN_WARNING "qla2xxx: Unable to register char device "
-                   "%s\n", QLA2XXX_APIDEV);
+               ql_log(ql_log_fatal, NULL, 0x0003,
+                   "Unable to register char device %s.\n", QLA2XXX_APIDEV);
        }
 
        qla2xxx_transport_vport_template =
@@ -4196,16 +4379,21 @@ qla2x00_module_init(void)
        if (!qla2xxx_transport_vport_template) {
                kmem_cache_destroy(srb_cachep);
                fc_release_transport(qla2xxx_transport_template);
+               ql_log(ql_log_fatal, NULL, 0x0004,
+                   "fc_attach_transport vport failed...Failing load!.\n");
                return -ENODEV;
        }
-
-       printk(KERN_INFO "QLogic Fibre Channel HBA Driver: %s\n",
+       ql_log(ql_log_info, NULL, 0x0005,
+           "QLogic Fibre Channel HBA Driver: %s.\n",
            qla2x00_version_str);
        ret = pci_register_driver(&qla2xxx_pci_driver);
        if (ret) {
                kmem_cache_destroy(srb_cachep);
                fc_release_transport(qla2xxx_transport_template);
                fc_release_transport(qla2xxx_transport_vport_template);
+               ql_log(ql_log_fatal, NULL, 0x0006,
+                   "pci_register_driver failed...ret=%d Failing load!.\n",
+                   ret);
        }
        return ret;
 }
index 693647661ed1e535faa2dffca9abf6adfed0c472..eff13563c82dba6061b51b5d6b7786b718ac181d 100644 (file)
@@ -189,6 +189,7 @@ qla2x00_write_nvram_word(struct qla_hw_data *ha, uint32_t addr, uint16_t data)
        uint16_t word;
        uint32_t nv_cmd, wait_cnt;
        struct device_reg_2xxx __iomem *reg = &ha->iobase->isp;
+       scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev);
 
        qla2x00_nv_write(ha, NVR_DATA_OUT);
        qla2x00_nv_write(ha, 0);
@@ -220,8 +221,8 @@ qla2x00_write_nvram_word(struct qla_hw_data *ha, uint32_t addr, uint16_t data)
        wait_cnt = NVR_WAIT_CNT;
        do {
                if (!--wait_cnt) {
-                       DEBUG9_10(qla_printk(KERN_WARNING, ha,
-                           "NVRAM didn't go ready...\n"));
+                       ql_dbg(ql_dbg_user, vha, 0x708d,
+                           "NVRAM didn't go ready...\n");
                        break;
                }
                NVRAM_DELAY();
@@ -308,6 +309,7 @@ qla2x00_clear_nvram_protection(struct qla_hw_data *ha)
        struct device_reg_2xxx __iomem *reg = &ha->iobase->isp;
        uint32_t word, wait_cnt;
        uint16_t wprot, wprot_old;
+       scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev);
 
        /* Clear NVRAM write protection. */
        ret = QLA_FUNCTION_FAILED;
@@ -350,8 +352,8 @@ qla2x00_clear_nvram_protection(struct qla_hw_data *ha)
                wait_cnt = NVR_WAIT_CNT;
                do {
                        if (!--wait_cnt) {
-                               DEBUG9_10(qla_printk(KERN_WARNING, ha,
-                                   "NVRAM didn't go ready...\n"));
+                               ql_dbg(ql_dbg_user, vha, 0x708e,
+                                   "NVRAM didn't go ready...\n");
                                break;
                        }
                        NVRAM_DELAY();
@@ -371,6 +373,7 @@ qla2x00_set_nvram_protection(struct qla_hw_data *ha, int stat)
 {
        struct device_reg_2xxx __iomem *reg = &ha->iobase->isp;
        uint32_t word, wait_cnt;
+       scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev);
 
        if (stat != QLA_SUCCESS)
                return;
@@ -409,8 +412,8 @@ qla2x00_set_nvram_protection(struct qla_hw_data *ha, int stat)
        wait_cnt = NVR_WAIT_CNT;
        do {
                if (!--wait_cnt) {
-                       DEBUG9_10(qla_printk(KERN_WARNING, ha,
-                           "NVRAM didn't go ready...\n"));
+                       ql_dbg(ql_dbg_user, vha, 0x708f,
+                           "NVRAM didn't go ready...\n");
                        break;
                }
                NVRAM_DELAY();
@@ -607,9 +610,10 @@ qla2xxx_find_flt_start(scsi_qla_host_t *vha, uint32_t *start)
        for (chksum = 0; cnt; cnt--)
                chksum += le16_to_cpu(*wptr++);
        if (chksum) {
-               qla_printk(KERN_ERR, ha,
+               ql_log(ql_log_fatal, vha, 0x0045,
                    "Inconsistent FLTL detected: checksum=0x%x.\n", chksum);
-               qla2x00_dump_buffer(buf, sizeof(struct qla_flt_location));
+               ql_dump_buffer(ql_dbg_init + ql_dbg_buffer, vha, 0x010e,
+                   buf, sizeof(struct qla_flt_location));
                return QLA_FUNCTION_FAILED;
        }
 
@@ -618,7 +622,9 @@ qla2xxx_find_flt_start(scsi_qla_host_t *vha, uint32_t *start)
        *start = (le16_to_cpu(fltl->start_hi) << 16 |
            le16_to_cpu(fltl->start_lo)) >> 2;
 end:
-       DEBUG2(qla_printk(KERN_DEBUG, ha, "FLTL[%s] = 0x%x.\n", loc, *start));
+       ql_dbg(ql_dbg_init, vha, 0x0046,
+           "FLTL[%s] = 0x%x.\n",
+           loc, *start);
        return QLA_SUCCESS;
 }
 
@@ -685,10 +691,10 @@ qla2xxx_get_flt_info(scsi_qla_host_t *vha, uint32_t flt_addr)
        if (*wptr == __constant_cpu_to_le16(0xffff))
                goto no_flash_data;
        if (flt->version != __constant_cpu_to_le16(1)) {
-               DEBUG2(qla_printk(KERN_INFO, ha, "Unsupported FLT detected: "
-                   "version=0x%x length=0x%x checksum=0x%x.\n",
+               ql_log(ql_log_warn, vha, 0x0047,
+                   "Unsupported FLT detected: version=0x%x length=0x%x checksum=0x%x.\n",
                    le16_to_cpu(flt->version), le16_to_cpu(flt->length),
-                   le16_to_cpu(flt->checksum)));
+                   le16_to_cpu(flt->checksum));
                goto no_flash_data;
        }
 
@@ -696,10 +702,10 @@ qla2xxx_get_flt_info(scsi_qla_host_t *vha, uint32_t flt_addr)
        for (chksum = 0; cnt; cnt--)
                chksum += le16_to_cpu(*wptr++);
        if (chksum) {
-               DEBUG2(qla_printk(KERN_INFO, ha, "Inconsistent FLT detected: "
-                   "version=0x%x length=0x%x checksum=0x%x.\n",
+               ql_log(ql_log_fatal, vha, 0x0048,
+                   "Inconsistent FLT detected: version=0x%x length=0x%x checksum=0x%x.\n",
                    le16_to_cpu(flt->version), le16_to_cpu(flt->length),
-                   chksum));
+                   le16_to_cpu(flt->checksum));
                goto no_flash_data;
        }
 
@@ -708,10 +714,11 @@ qla2xxx_get_flt_info(scsi_qla_host_t *vha, uint32_t flt_addr)
        for ( ; cnt; cnt--, region++) {
                /* Store addresses as DWORD offsets. */
                start = le32_to_cpu(region->start) >> 2;
-
-               DEBUG3(qla_printk(KERN_DEBUG, ha, "FLT[%02x]: start=0x%x "
-                   "end=0x%x size=0x%x.\n", le32_to_cpu(region->code), start,
-                   le32_to_cpu(region->end) >> 2, le32_to_cpu(region->size)));
+               ql_dbg(ql_dbg_init, vha, 0x0049,
+                   "FLT[%02x]: start=0x%x "
+                   "end=0x%x size=0x%x.\n", le32_to_cpu(region->code),
+                   start, le32_to_cpu(region->end) >> 2,
+                   le32_to_cpu(region->size));
 
                switch (le32_to_cpu(region->code) & 0xff) {
                case FLT_REG_FW:
@@ -796,12 +803,16 @@ no_flash_data:
        ha->flt_region_npiv_conf = ha->flags.port0 ?
            def_npiv_conf0[def] : def_npiv_conf1[def];
 done:
-       DEBUG2(qla_printk(KERN_DEBUG, ha, "FLT[%s]: boot=0x%x fw=0x%x "
-           "vpd_nvram=0x%x vpd=0x%x nvram=0x%x fdt=0x%x flt=0x%x "
-           "npiv=0x%x. fcp_prio_cfg=0x%x\n", loc, ha->flt_region_boot,
-           ha->flt_region_fw, ha->flt_region_vpd_nvram, ha->flt_region_vpd,
-           ha->flt_region_nvram, ha->flt_region_fdt, ha->flt_region_flt,
-           ha->flt_region_npiv_conf, ha->flt_region_fcp_prio));
+       ql_dbg(ql_dbg_init, vha, 0x004a,
+           "FLT[%s]: boot=0x%x fw=0x%x vpd_nvram=0x%x vpd=0x%x.\n",
+           loc, ha->flt_region_boot,
+           ha->flt_region_fw, ha->flt_region_vpd_nvram,
+           ha->flt_region_vpd);
+       ql_dbg(ql_dbg_init, vha, 0x004b,
+           "nvram=0x%x fdt=0x%x flt=0x%x npiv=0x%x fcp_prif_cfg=0x%x.\n",
+           ha->flt_region_nvram,
+           ha->flt_region_fdt, ha->flt_region_flt,
+           ha->flt_region_npiv_conf, ha->flt_region_fcp_prio);
 }
 
 static void
@@ -833,10 +844,12 @@ qla2xxx_get_fdt_info(scsi_qla_host_t *vha)
            cnt++)
                chksum += le16_to_cpu(*wptr++);
        if (chksum) {
-               DEBUG2(qla_printk(KERN_INFO, ha, "Inconsistent FDT detected: "
-                   "checksum=0x%x id=%c version=0x%x.\n", chksum, fdt->sig[0],
-                   le16_to_cpu(fdt->version)));
-               DEBUG9(qla2x00_dump_buffer((uint8_t *)fdt, sizeof(*fdt)));
+               ql_dbg(ql_dbg_init, vha, 0x004c,
+                   "Inconsistent FDT detected:"
+                   " checksum=0x%x id=%c version0x%x.\n", chksum,
+                   fdt->sig[0], le16_to_cpu(fdt->version));
+               ql_dump_buffer(ql_dbg_init + ql_dbg_buffer, vha, 0x0113,
+                   (uint8_t *)fdt, sizeof(*fdt));
                goto no_flash_data;
        }
 
@@ -890,11 +903,12 @@ no_flash_data:
                break;
        }
 done:
-       DEBUG2(qla_printk(KERN_DEBUG, ha, "FDT[%s]: (0x%x/0x%x) erase=0x%x "
-           "pro=%x upro=%x wrtd=0x%x blk=0x%x.\n", loc, mid, fid,
+       ql_dbg(ql_dbg_init, vha, 0x004d,
+           "FDT[%x]: (0x%x/0x%x) erase=0x%x "
+           "pr=%x upro=%x wrtd=0x%x blk=0x%x.\n", loc, mid, fid,
            ha->fdt_erase_cmd, ha->fdt_protect_sec_cmd,
-           ha->fdt_unprotect_sec_cmd, ha->fdt_wrt_disable,
-           ha->fdt_block_size));
+           ha->fdt_wrt_disable, ha->fdt_block_size);
+
 }
 
 static void
@@ -919,6 +933,10 @@ qla2xxx_get_idc_param(scsi_qla_host_t *vha)
                ha->nx_dev_init_timeout = le32_to_cpu(*wptr++);
                ha->nx_reset_timeout = le32_to_cpu(*wptr);
        }
+       ql_dbg(ql_dbg_init, vha, 0x004e,
+           "nx_dev_init_timeout=%d "
+           "nx_reset_timeout=%d.\n", ha->nx_dev_init_timeout,
+           ha->nx_reset_timeout);
        return;
 }
 
@@ -963,17 +981,18 @@ qla2xxx_flash_npiv_conf(scsi_qla_host_t *vha)
        if (hdr.version == __constant_cpu_to_le16(0xffff))
                return;
        if (hdr.version != __constant_cpu_to_le16(1)) {
-               DEBUG2(qla_printk(KERN_INFO, ha, "Unsupported NPIV-Config "
+               ql_dbg(ql_dbg_user, vha, 0x7090,
+                   "Unsupported NPIV-Config "
                    "detected: version=0x%x entries=0x%x checksum=0x%x.\n",
                    le16_to_cpu(hdr.version), le16_to_cpu(hdr.entries),
-                   le16_to_cpu(hdr.checksum)));
+                   le16_to_cpu(hdr.checksum));
                return;
        }
 
        data = kmalloc(NPIV_CONFIG_SIZE, GFP_KERNEL);
        if (!data) {
-               DEBUG2(qla_printk(KERN_INFO, ha, "NPIV-Config: Unable to "
-                   "allocate memory.\n"));
+               ql_log(ql_log_warn, vha, 0x7091,
+                   "Unable to allocate memory for data.\n");
                return;
        }
 
@@ -985,10 +1004,11 @@ qla2xxx_flash_npiv_conf(scsi_qla_host_t *vha)
        for (wptr = data, chksum = 0; cnt; cnt--)
                chksum += le16_to_cpu(*wptr++);
        if (chksum) {
-               DEBUG2(qla_printk(KERN_INFO, ha, "Inconsistent NPIV-Config "
+               ql_dbg(ql_dbg_user, vha, 0x7092,
+                   "Inconsistent NPIV-Config "
                    "detected: version=0x%x entries=0x%x checksum=0x%x.\n",
                    le16_to_cpu(hdr.version), le16_to_cpu(hdr.entries),
-                   chksum));
+                   le16_to_cpu(hdr.checksum));
                goto done;
        }
 
@@ -1014,21 +1034,22 @@ qla2xxx_flash_npiv_conf(scsi_qla_host_t *vha)
                vid.port_name = wwn_to_u64(entry->port_name);
                vid.node_name = wwn_to_u64(entry->node_name);
 
-               DEBUG2(qla_printk(KERN_INFO, ha, "NPIV[%02x]: wwpn=%llx "
-                       "wwnn=%llx vf_id=0x%x Q_qos=0x%x F_qos=0x%x.\n", cnt,
-                       (unsigned long long)vid.port_name,
-                       (unsigned long long)vid.node_name,
-                       le16_to_cpu(entry->vf_id),
-                       entry->q_qos, entry->f_qos));
+               ql_dbg(ql_dbg_user, vha, 0x7093,
+                   "NPIV[%02x]: wwpn=%llx "
+                   "wwnn=%llx vf_id=0x%x Q_qos=0x%x F_qos=0x%x.\n", cnt,
+                   (unsigned long long)vid.port_name,
+                   (unsigned long long)vid.node_name,
+                   le16_to_cpu(entry->vf_id),
+                   entry->q_qos, entry->f_qos);
 
                if (i < QLA_PRECONFIG_VPORTS) {
                        vport = fc_vport_create(vha->host, 0, &vid);
                        if (!vport)
-                               qla_printk(KERN_INFO, ha,
-                               "NPIV-Config: Failed to create vport [%02x]: "
-                               "wwpn=%llx wwnn=%llx.\n", cnt,
-                               (unsigned long long)vid.port_name,
-                               (unsigned long long)vid.node_name);
+                               ql_log(ql_log_warn, vha, 0x7094,
+                                   "NPIV-Config Failed to create vport [%02x]: "
+                                   "wwpn=%llx wwnn=%llx.\n", cnt,
+                                   (unsigned long long)vid.port_name,
+                                   (unsigned long long)vid.node_name);
                }
        }
 done:
@@ -1127,9 +1148,10 @@ qla24xx_write_flash_data(scsi_qla_host_t *vha, uint32_t *dwptr, uint32_t faddr,
                optrom = dma_alloc_coherent(&ha->pdev->dev, OPTROM_BURST_SIZE,
                    &optrom_dma, GFP_KERNEL);
                if (!optrom) {
-                       qla_printk(KERN_DEBUG, ha,
-                           "Unable to allocate memory for optrom burst write "
-                           "(%x KB).\n", OPTROM_BURST_SIZE / 1024);
+                       ql_log(ql_log_warn, vha, 0x7095,
+                           "Unable to allocate "
+                           "memory for optrom burst write (%x KB).\n",
+                           OPTROM_BURST_SIZE / 1024);
                }
        }
 
@@ -1138,7 +1160,7 @@ qla24xx_write_flash_data(scsi_qla_host_t *vha, uint32_t *dwptr, uint32_t faddr,
 
        ret = qla24xx_unprotect_flash(vha);
        if (ret != QLA_SUCCESS) {
-               qla_printk(KERN_WARNING, ha,
+               ql_log(ql_log_warn, vha, 0x7096,
                    "Unable to unprotect flash for update.\n");
                goto done;
        }
@@ -1156,9 +1178,9 @@ qla24xx_write_flash_data(scsi_qla_host_t *vha, uint32_t *dwptr, uint32_t faddr,
                                    0xff0000) | ((fdata >> 16) & 0xff));
                        ret = qla24xx_erase_sector(vha, fdata);
                        if (ret != QLA_SUCCESS) {
-                               DEBUG9(qla_printk(KERN_WARNING, ha,
-                                   "Unable to erase sector: address=%x.\n",
-                                   faddr));
+                               ql_dbg(ql_dbg_user, vha, 0x7007,
+                                   "Unable to erase erase sector: address=%x.\n",
+                                   faddr);
                                break;
                        }
                }
@@ -1172,12 +1194,12 @@ qla24xx_write_flash_data(scsi_qla_host_t *vha, uint32_t *dwptr, uint32_t faddr,
                            flash_data_addr(ha, faddr),
                            OPTROM_BURST_DWORDS);
                        if (ret != QLA_SUCCESS) {
-                               qla_printk(KERN_WARNING, ha,
+                               ql_log(ql_log_warn, vha, 0x7097,
                                    "Unable to burst-write optrom segment "
                                    "(%x/%x/%llx).\n", ret,
                                    flash_data_addr(ha, faddr),
                                    (unsigned long long)optrom_dma);
-                               qla_printk(KERN_WARNING, ha,
+                               ql_log(ql_log_warn, vha, 0x7098,
                                    "Reverting to slow-write.\n");
 
                                dma_free_coherent(&ha->pdev->dev,
@@ -1194,9 +1216,9 @@ qla24xx_write_flash_data(scsi_qla_host_t *vha, uint32_t *dwptr, uint32_t faddr,
                ret = qla24xx_write_flash_dword(ha,
                    flash_data_addr(ha, faddr), cpu_to_le32(*dwptr));
                if (ret != QLA_SUCCESS) {
-                       DEBUG9(printk("%s(%ld) Unable to program flash "
-                           "address=%x data=%x.\n", __func__,
-                           vha->host_no, faddr, *dwptr));
+                       ql_dbg(ql_dbg_user, vha, 0x7006,
+                           "Unable to program flash address=%x data=%x.\n",
+                           faddr, *dwptr);
                        break;
                }
 
@@ -1211,7 +1233,7 @@ qla24xx_write_flash_data(scsi_qla_host_t *vha, uint32_t *dwptr, uint32_t faddr,
 
        ret = qla24xx_protect_flash(vha);
        if (ret != QLA_SUCCESS)
-               qla_printk(KERN_WARNING, ha,
+               ql_log(ql_log_warn, vha, 0x7099,
                    "Unable to protect flash after update.\n");
 done:
        if (optrom)
@@ -1324,9 +1346,9 @@ qla24xx_write_nvram_data(scsi_qla_host_t *vha, uint8_t *buf, uint32_t naddr,
                ret = qla24xx_write_flash_dword(ha,
                    nvram_data_addr(ha, naddr), cpu_to_le32(*dwptr));
                if (ret != QLA_SUCCESS) {
-                       DEBUG9(qla_printk(KERN_WARNING, ha,
+                       ql_dbg(ql_dbg_user, vha, 0x709a,
                            "Unable to program nvram address=%x data=%x.\n",
-                           naddr, *dwptr));
+                           naddr, *dwptr);
                        break;
                }
        }
@@ -1476,7 +1498,7 @@ qla2x00_beacon_on(struct scsi_qla_host *vha)
        ha->fw_options[1] |= FO1_DISABLE_GPIO6_7;
 
        if (qla2x00_set_fw_options(vha, ha->fw_options) != QLA_SUCCESS) {
-               qla_printk(KERN_WARNING, ha,
+               ql_log(ql_log_warn, vha, 0x709b,
                    "Unable to update fw options (beacon on).\n");
                return QLA_FUNCTION_FAILED;
        }
@@ -1541,7 +1563,7 @@ qla2x00_beacon_off(struct scsi_qla_host *vha)
 
        rval = qla2x00_set_fw_options(vha, ha->fw_options);
        if (rval != QLA_SUCCESS)
-               qla_printk(KERN_WARNING, ha,
+               ql_log(ql_log_warn, vha, 0x709c,
                    "Unable to update fw options (beacon off).\n");
        return rval;
 }
@@ -1616,7 +1638,7 @@ qla24xx_beacon_on(struct scsi_qla_host *vha)
 
                if (qla2x00_get_fw_options(vha, ha->fw_options) !=
                    QLA_SUCCESS) {
-                       qla_printk(KERN_WARNING, ha,
+                       ql_log(ql_log_warn, vha, 0x7009,
                            "Unable to update fw options (beacon on).\n");
                        return QLA_FUNCTION_FAILED;
                }
@@ -1670,14 +1692,14 @@ qla24xx_beacon_off(struct scsi_qla_host *vha)
        ha->fw_options[1] &= ~ADD_FO1_DISABLE_GPIO_LED_CTRL;
 
        if (qla2x00_set_fw_options(vha, ha->fw_options) != QLA_SUCCESS) {
-               qla_printk(KERN_WARNING, ha,
-                   "Unable to update fw options (beacon off).\n");
+               ql_log(ql_log_warn, vha, 0x704d,
+                   "Unable to update fw options (beacon on).\n");
                return QLA_FUNCTION_FAILED;
        }
 
        if (qla2x00_get_fw_options(vha, ha->fw_options) != QLA_SUCCESS) {
-               qla_printk(KERN_WARNING, ha,
-                   "Unable to get fw options (beacon off).\n");
+               ql_log(ql_log_warn, vha, 0x704e,
+                   "Unable to update fw options (beacon on).\n");
                return QLA_FUNCTION_FAILED;
        }
 
@@ -2389,10 +2411,9 @@ try_fast:
        optrom = dma_alloc_coherent(&ha->pdev->dev, OPTROM_BURST_SIZE,
            &optrom_dma, GFP_KERNEL);
        if (!optrom) {
-               qla_printk(KERN_DEBUG, ha,
-                   "Unable to allocate memory for optrom burst read "
-                   "(%x KB).\n", OPTROM_BURST_SIZE / 1024);
-
+               ql_log(ql_log_warn, vha, 0x00cc,
+                   "Unable to allocate memory for optrom burst read (%x KB).\n",
+                   OPTROM_BURST_SIZE / 1024);
                goto slow_read;
        }
 
@@ -2407,12 +2428,11 @@ try_fast:
                rval = qla2x00_dump_ram(vha, optrom_dma,
                    flash_data_addr(ha, faddr), burst);
                if (rval) {
-                       qla_printk(KERN_WARNING, ha,
-                           "Unable to burst-read optrom segment "
-                           "(%x/%x/%llx).\n", rval,
-                           flash_data_addr(ha, faddr),
+                       ql_log(ql_log_warn, vha, 0x00f5,
+                           "Unable to burst-read optrom segment (%x/%x/%llx).\n",
+                           rval, flash_data_addr(ha, faddr),
                            (unsigned long long)optrom_dma);
-                       qla_printk(KERN_WARNING, ha,
+                       ql_log(ql_log_warn, vha, 0x00f6,
                            "Reverting to slow-read.\n");
 
                        dma_free_coherent(&ha->pdev->dev, OPTROM_BURST_SIZE,
@@ -2556,8 +2576,8 @@ qla2x00_get_flash_version(scsi_qla_host_t *vha, void *mbuf)
                if (qla2x00_read_flash_byte(ha, pcihdr) != 0x55 ||
                    qla2x00_read_flash_byte(ha, pcihdr + 0x01) != 0xaa) {
                        /* No signature */
-                       DEBUG2(qla_printk(KERN_DEBUG, ha, "No matching ROM "
-                           "signature.\n"));
+                       ql_log(ql_log_fatal, vha, 0x0050,
+                           "No matching ROM signature.\n");
                        ret = QLA_FUNCTION_FAILED;
                        break;
                }
@@ -2573,8 +2593,8 @@ qla2x00_get_flash_version(scsi_qla_host_t *vha, void *mbuf)
                    qla2x00_read_flash_byte(ha, pcids + 0x2) != 'I' ||
                    qla2x00_read_flash_byte(ha, pcids + 0x3) != 'R') {
                        /* Incorrect header. */
-                       DEBUG2(qla_printk(KERN_INFO, ha, "PCI data struct not "
-                           "found pcir_adr=%x.\n", pcids));
+                       ql_log(ql_log_fatal, vha, 0x0051,
+                           "PCI data struct not found pcir_adr=%x.\n", pcids);
                        ret = QLA_FUNCTION_FAILED;
                        break;
                }
@@ -2588,8 +2608,9 @@ qla2x00_get_flash_version(scsi_qla_host_t *vha, void *mbuf)
                            qla2x00_read_flash_byte(ha, pcids + 0x12);
                        ha->bios_revision[1] =
                            qla2x00_read_flash_byte(ha, pcids + 0x13);
-                       DEBUG3(qla_printk(KERN_DEBUG, ha, "read BIOS %d.%d.\n",
-                           ha->bios_revision[1], ha->bios_revision[0]));
+                       ql_dbg(ql_dbg_init, vha, 0x0052,
+                           "Read BIOS %d.%d.\n",
+                           ha->bios_revision[1], ha->bios_revision[0]);
                        break;
                case ROM_CODE_TYPE_FCODE:
                        /* Open Firmware standard for PCI (FCode). */
@@ -2602,12 +2623,14 @@ qla2x00_get_flash_version(scsi_qla_host_t *vha, void *mbuf)
                            qla2x00_read_flash_byte(ha, pcids + 0x12);
                        ha->efi_revision[1] =
                            qla2x00_read_flash_byte(ha, pcids + 0x13);
-                       DEBUG3(qla_printk(KERN_DEBUG, ha, "read EFI %d.%d.\n",
-                           ha->efi_revision[1], ha->efi_revision[0]));
+                       ql_dbg(ql_dbg_init, vha, 0x0053,
+                           "Read EFI %d.%d.\n",
+                           ha->efi_revision[1], ha->efi_revision[0]);
                        break;
                default:
-                       DEBUG2(qla_printk(KERN_INFO, ha, "Unrecognized code "
-                           "type %x at pcids %x.\n", code_type, pcids));
+                       ql_log(ql_log_warn, vha, 0x0054,
+                           "Unrecognized code type %x at pcids %x.\n",
+                           code_type, pcids);
                        break;
                }
 
@@ -2627,21 +2650,28 @@ qla2x00_get_flash_version(scsi_qla_host_t *vha, void *mbuf)
 
                qla2x00_read_flash_data(ha, dbyte, ha->flt_region_fw * 4 + 10,
                    8);
-               DEBUG3(qla_printk(KERN_DEBUG, ha, "dumping fw ver from "
-                   "flash:\n"));
-               DEBUG3(qla2x00_dump_buffer((uint8_t *)dbyte, 8));
+               ql_dbg(ql_dbg_init + ql_dbg_buffer, vha, 0x010a,
+                   "Dumping fw "
+                   "ver from flash:.\n");
+               ql_dump_buffer(ql_dbg_init + ql_dbg_buffer, vha, 0x010b,
+                   (uint8_t *)dbyte, 8);
 
                if ((dcode[0] == 0xffff && dcode[1] == 0xffff &&
                    dcode[2] == 0xffff && dcode[3] == 0xffff) ||
                    (dcode[0] == 0 && dcode[1] == 0 && dcode[2] == 0 &&
                    dcode[3] == 0)) {
-                       DEBUG2(qla_printk(KERN_INFO, ha, "Unrecognized fw "
-                           "revision at %x.\n", ha->flt_region_fw * 4));
+                       ql_log(ql_log_warn, vha, 0x0057,
+                           "Unrecognized fw revision at %x.\n",
+                           ha->flt_region_fw * 4);
                } else {
                        /* values are in big endian */
                        ha->fw_revision[0] = dbyte[0] << 16 | dbyte[1];
                        ha->fw_revision[1] = dbyte[2] << 16 | dbyte[3];
                        ha->fw_revision[2] = dbyte[4] << 16 | dbyte[5];
+                       ql_dbg(ql_dbg_init, vha, 0x0058,
+                           "FW Version: "
+                           "%d.%d.%d.\n", ha->fw_revision[0],
+                           ha->fw_revision[1], ha->fw_revision[2]);
                }
        }
 
@@ -2683,8 +2713,8 @@ qla24xx_get_flash_version(scsi_qla_host_t *vha, void *mbuf)
                bcode = mbuf + (pcihdr % 4);
                if (bcode[0x0] != 0x55 || bcode[0x1] != 0xaa) {
                        /* No signature */
-                       DEBUG2(qla_printk(KERN_DEBUG, ha, "No matching ROM "
-                           "signature.\n"));
+                       ql_log(ql_log_fatal, vha, 0x0059,
+                           "No matching ROM signature.\n");
                        ret = QLA_FUNCTION_FAILED;
                        break;
                }
@@ -2699,8 +2729,8 @@ qla24xx_get_flash_version(scsi_qla_host_t *vha, void *mbuf)
                if (bcode[0x0] != 'P' || bcode[0x1] != 'C' ||
                    bcode[0x2] != 'I' || bcode[0x3] != 'R') {
                        /* Incorrect header. */
-                       DEBUG2(qla_printk(KERN_INFO, ha, "PCI data struct not "
-                           "found pcir_adr=%x.\n", pcids));
+                       ql_log(ql_log_fatal, vha, 0x005a,
+                           "PCI data struct not found pcir_adr=%x.\n", pcids);
                        ret = QLA_FUNCTION_FAILED;
                        break;
                }
@@ -2712,26 +2742,30 @@ qla24xx_get_flash_version(scsi_qla_host_t *vha, void *mbuf)
                        /* Intel x86, PC-AT compatible. */
                        ha->bios_revision[0] = bcode[0x12];
                        ha->bios_revision[1] = bcode[0x13];
-                       DEBUG3(qla_printk(KERN_DEBUG, ha, "read BIOS %d.%d.\n",
-                           ha->bios_revision[1], ha->bios_revision[0]));
+                       ql_dbg(ql_dbg_init, vha, 0x005b,
+                           "Read BIOS %d.%d.\n",
+                           ha->bios_revision[1], ha->bios_revision[0]);
                        break;
                case ROM_CODE_TYPE_FCODE:
                        /* Open Firmware standard for PCI (FCode). */
                        ha->fcode_revision[0] = bcode[0x12];
                        ha->fcode_revision[1] = bcode[0x13];
-                       DEBUG3(qla_printk(KERN_DEBUG, ha, "read FCODE %d.%d.\n",
-                           ha->fcode_revision[1], ha->fcode_revision[0]));
+                       ql_dbg(ql_dbg_init, vha, 0x005c,
+                           "Read FCODE %d.%d.\n",
+                           ha->fcode_revision[1], ha->fcode_revision[0]);
                        break;
                case ROM_CODE_TYPE_EFI:
                        /* Extensible Firmware Interface (EFI). */
                        ha->efi_revision[0] = bcode[0x12];
                        ha->efi_revision[1] = bcode[0x13];
-                       DEBUG3(qla_printk(KERN_DEBUG, ha, "read EFI %d.%d.\n",
-                           ha->efi_revision[1], ha->efi_revision[0]));
+                       ql_dbg(ql_dbg_init, vha, 0x005d,
+                           "Read EFI %d.%d.\n",
+                           ha->efi_revision[1], ha->efi_revision[0]);
                        break;
                default:
-                       DEBUG2(qla_printk(KERN_INFO, ha, "Unrecognized code "
-                           "type %x at pcids %x.\n", code_type, pcids));
+                       ql_log(ql_log_warn, vha, 0x005e,
+                           "Unrecognized code type %x at pcids %x.\n",
+                           code_type, pcids);
                        break;
                }
 
@@ -2753,13 +2787,18 @@ qla24xx_get_flash_version(scsi_qla_host_t *vha, void *mbuf)
            dcode[2] == 0xffffffff && dcode[3] == 0xffffffff) ||
            (dcode[0] == 0 && dcode[1] == 0 && dcode[2] == 0 &&
            dcode[3] == 0)) {
-               DEBUG2(qla_printk(KERN_INFO, ha, "Unrecognized fw "
-                   "revision at %x.\n", ha->flt_region_fw * 4));
+               ql_log(ql_log_warn, vha, 0x005f,
+                   "Unrecognized fw revision at %x.\n",
+                   ha->flt_region_fw * 4);
        } else {
                ha->fw_revision[0] = dcode[0];
                ha->fw_revision[1] = dcode[1];
                ha->fw_revision[2] = dcode[2];
                ha->fw_revision[3] = dcode[3];
+               ql_dbg(ql_dbg_init, vha, 0x0060,
+                   "Firmware revision %d.%d.%d.%d.\n",
+                   ha->fw_revision[0], ha->fw_revision[1],
+                   ha->fw_revision[2], ha->fw_revision[3]);
        }
 
        /* Check for golden firmware and get version if available */
@@ -2775,9 +2814,9 @@ qla24xx_get_flash_version(scsi_qla_host_t *vha, void *mbuf)
 
        if (dcode[4] == 0xFFFFFFFF && dcode[5] == 0xFFFFFFFF &&
            dcode[6] == 0xFFFFFFFF && dcode[7] == 0xFFFFFFFF) {
-               DEBUG2(qla_printk(KERN_INFO, ha,
-                   "%s(%ld): Unrecognized golden fw at 0x%x.\n",
-                   __func__, vha->host_no, ha->flt_region_gold_fw * 4));
+               ql_log(ql_log_warn, vha, 0x0056,
+                   "Unrecognized golden fw at 0x%x.\n",
+                   ha->flt_region_gold_fw * 4);
                return ret;
        }
 
@@ -2843,9 +2882,9 @@ qla24xx_read_fcp_prio_cfg(scsi_qla_host_t *vha)
        if (!ha->fcp_prio_cfg) {
                ha->fcp_prio_cfg = vmalloc(FCP_PRIO_CFG_SIZE);
                if (!ha->fcp_prio_cfg) {
-                       qla_printk(KERN_WARNING, ha,
-                       "Unable to allocate memory for fcp priority data "
-                                       "(%x).\n", FCP_PRIO_CFG_SIZE);
+                       ql_log(ql_log_warn, vha, 0x00d5,
+                           "Unable to allocate memory for fcp priorty data (%x).\n",
+                           FCP_PRIO_CFG_SIZE);
                        return QLA_FUNCTION_FAILED;
                }
        }
@@ -2857,7 +2896,7 @@ qla24xx_read_fcp_prio_cfg(scsi_qla_host_t *vha)
        ha->isp_ops->read_optrom(vha, (uint8_t *)ha->fcp_prio_cfg,
                        fcp_prio_addr << 2, FCP_PRIO_CFG_HDR_SIZE);
 
-       if (!qla24xx_fcp_prio_cfg_valid(ha->fcp_prio_cfg, 0))
+       if (!qla24xx_fcp_prio_cfg_valid(vha, ha->fcp_prio_cfg, 0))
                goto fail;
 
        /* read remaining FCP CMD config data from flash */
@@ -2869,7 +2908,7 @@ qla24xx_read_fcp_prio_cfg(scsi_qla_host_t *vha)
                        fcp_prio_addr << 2, (len < max_len ? len : max_len));
 
        /* revalidate the entire FCP priority config data, including entries */
-       if (!qla24xx_fcp_prio_cfg_valid(ha->fcp_prio_cfg, 1))
+       if (!qla24xx_fcp_prio_cfg_valid(vha, ha->fcp_prio_cfg, 1))
                goto fail;
 
        ha->flags.fcp_prio_enabled = 1;