linux 2.6.16.38 w/ vs2.0.3-rc1
[linux-2.6.git] / drivers / scsi / qla2xxx / qla_mbx.c
index d6cb3bd..363dfdd 100644 (file)
@@ -91,7 +91,7 @@ qla2x00_mailbox_command(scsi_qla_host_t *ha, mbx_cmd_t *mcp)
        spin_lock_irqsave(&ha->hardware_lock, flags);
 
        /* Load mailbox registers. */
-       if (IS_QLA24XX(ha) || IS_QLA54XX(ha))
+       if (IS_QLA24XX(ha) || IS_QLA25XX(ha))
                optr = (uint16_t __iomem *)&reg->isp24.mailbox0;
        else
                optr = (uint16_t __iomem *)MAILBOX_REG(ha, &reg->isp, 0);
@@ -155,7 +155,7 @@ qla2x00_mailbox_command(scsi_qla_host_t *ha, mbx_cmd_t *mcp)
 
                set_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags);
 
-               if (IS_QLA24XX(ha) || IS_QLA54XX(ha))
+               if (IS_QLA24XX(ha) || IS_QLA25XX(ha))
                        WRT_REG_DWORD(&reg->isp24.hccr, HCCRX_SET_HOST_INT);
                else
                        WRT_REG_WORD(&reg->isp.hccr, HCCR_SET_HOST_INT);
@@ -179,7 +179,7 @@ qla2x00_mailbox_command(scsi_qla_host_t *ha, mbx_cmd_t *mcp)
                DEBUG3_11(printk("%s(%ld): cmd=%x POLLING MODE.\n", __func__,
                    ha->host_no, command);)
 
-               if (IS_QLA24XX(ha) || IS_QLA54XX(ha))
+               if (IS_QLA24XX(ha) || IS_QLA25XX(ha))
                        WRT_REG_DWORD(&reg->isp24.hccr, HCCRX_SET_HOST_INT);
                else
                        WRT_REG_WORD(&reg->isp.hccr, HCCR_SET_HOST_INT);
@@ -237,7 +237,7 @@ qla2x00_mailbox_command(scsi_qla_host_t *ha, mbx_cmd_t *mcp)
                uint16_t mb0;
                uint32_t ictrl;
 
-               if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) {
+               if (IS_QLA24XX(ha) || IS_QLA25XX(ha)) {
                        mb0 = RD_REG_WORD(&reg->isp24.mailbox0);
                        ictrl = RD_REG_DWORD(&reg->isp24.ictrl);
                } else {
@@ -284,7 +284,9 @@ qla2x00_mailbox_command(scsi_qla_host_t *ha, mbx_cmd_t *mcp)
                            "Mailbox command timeout occured. Scheduling ISP "
                            "abort.\n");
                        set_bit(ISP_ABORT_NEEDED, &ha->dpc_flags);
-                       qla2xxx_wake_dpc(ha);
+                       if (ha->dpc_wait && !ha->dpc_active)
+                               up(ha->dpc_wait);
+
                } else if (!abort_active) {
                        /* call abort directly since we are in the DPC thread */
                        DEBUG(printk("%s(%ld): timeout calling abort_isp\n",
@@ -334,7 +336,7 @@ qla2x00_load_ram(scsi_qla_host_t *ha, dma_addr_t req_dma, uint32_t risc_addr,
 
        DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no));
 
-       if (MSW(risc_addr) || IS_QLA24XX(ha) || IS_QLA54XX(ha)) {
+       if (MSW(risc_addr) || IS_QLA24XX(ha) || IS_QLA25XX(ha)) {
                mcp->mb[0] = MBC_LOAD_RISC_RAM_EXTENDED;
                mcp->mb[8] = MSW(risc_addr);
                mcp->out_mb = MBX_8|MBX_0;
@@ -348,7 +350,7 @@ qla2x00_load_ram(scsi_qla_host_t *ha, dma_addr_t req_dma, uint32_t risc_addr,
        mcp->mb[6] = MSW(MSD(req_dma));
        mcp->mb[7] = LSW(MSD(req_dma));
        mcp->out_mb |= MBX_7|MBX_6|MBX_3|MBX_2|MBX_1;
-       if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) {
+       if (IS_QLA24XX(ha) || IS_QLA25XX(ha)) {
                mcp->mb[4] = MSW(risc_code_size);
                mcp->mb[5] = LSW(risc_code_size);
                mcp->out_mb |= MBX_5|MBX_4;
@@ -399,7 +401,7 @@ qla2x00_execute_fw(scsi_qla_host_t *ha, uint32_t risc_addr)
        mcp->mb[0] = MBC_EXECUTE_FIRMWARE;
        mcp->out_mb = MBX_0;
        mcp->in_mb = MBX_0;
-       if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) {
+       if (IS_QLA24XX(ha) || IS_QLA25XX(ha)) {
                mcp->mb[1] = MSW(risc_addr);
                mcp->mb[2] = LSW(risc_addr);
                mcp->mb[3] = 0;
@@ -422,7 +424,7 @@ qla2x00_execute_fw(scsi_qla_host_t *ha, uint32_t risc_addr)
                DEBUG2_3_11(printk("%s(%ld): failed=%x mb[0]=%x.\n", __func__,
                    ha->host_no, rval, mcp->mb[0]));
        } else {
-               if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) {
+               if (IS_QLA24XX(ha) || IS_QLA25XX(ha)) {
                        DEBUG11(printk("%s(%ld): done exchanges=%x.\n",
                            __func__, ha->host_no, mcp->mb[1]);)
                } else {
@@ -563,7 +565,7 @@ qla2x00_set_fw_options(scsi_qla_host_t *ha, uint16_t *fwopts)
        mcp->mb[3] = fwopts[3];
        mcp->out_mb = MBX_3|MBX_2|MBX_1|MBX_0;
        mcp->in_mb = MBX_0;
-       if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) {
+       if (IS_QLA24XX(ha) || IS_QLA25XX(ha)) {
                mcp->in_mb |= MBX_1;
        } else {
                mcp->mb[10] = fwopts[10];
@@ -676,7 +678,7 @@ qla2x00_verify_checksum(scsi_qla_host_t *ha, uint32_t risc_addr)
        mcp->mb[0] = MBC_VERIFY_CHECKSUM;
        mcp->out_mb = MBX_0;
        mcp->in_mb = MBX_0;
-       if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) {
+       if (IS_QLA24XX(ha) || IS_QLA25XX(ha)) {
                mcp->mb[1] = MSW(risc_addr);
                mcp->mb[2] = LSW(risc_addr);
                mcp->out_mb |= MBX_2|MBX_1;
@@ -693,7 +695,7 @@ qla2x00_verify_checksum(scsi_qla_host_t *ha, uint32_t risc_addr)
 
        if (rval != QLA_SUCCESS) {
                DEBUG2_3_11(printk("%s(%ld): failed=%x chk sum=%x.\n", __func__,
-                   ha->host_no, rval, (IS_QLA24XX(ha) || IS_QLA54XX(ha) ?
+                   ha->host_no, rval, (IS_QLA24XX(ha) || IS_QLA25XX(ha) ?
                    (mcp->mb[2] << 16) | mcp->mb[1]: mcp->mb[1]));)
        } else {
                DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no);)
@@ -751,7 +753,7 @@ qla2x00_issue_iocb(scsi_qla_host_t *ha, void*  buffer, dma_addr_t phys_addr,
 
                /* Mask reserved bits. */
                sts_entry->entry_status &=
-                   IS_QLA24XX(ha) || IS_QLA54XX(ha) ? RF_MASK_24XX :RF_MASK;
+                   IS_QLA24XX(ha) || IS_QLA25XX(ha) ? RF_MASK_24XX :RF_MASK;
        }
 
        return rval;
@@ -1091,7 +1093,7 @@ qla2x00_get_port_database(scsi_qla_host_t *ha, fc_port_t *fcport, uint8_t opt)
        memset(pd, 0, max(PORT_DATABASE_SIZE, PORT_DATABASE_24XX_SIZE));
 
        mcp->mb[0] = MBC_GET_PORT_DATABASE;
-       if (opt != 0 && !IS_QLA24XX(ha) && !IS_QLA54XX(ha))
+       if (opt != 0 && !IS_QLA24XX(ha) && !IS_QLA25XX(ha))
                mcp->mb[0] = MBC_ENHANCED_GET_PORT_DATABASE;
        mcp->mb[2] = MSW(pd_dma);
        mcp->mb[3] = LSW(pd_dma);
@@ -1099,7 +1101,7 @@ qla2x00_get_port_database(scsi_qla_host_t *ha, fc_port_t *fcport, uint8_t opt)
        mcp->mb[7] = LSW(MSD(pd_dma));
        mcp->out_mb = MBX_7|MBX_6|MBX_3|MBX_2|MBX_0;
        mcp->in_mb = MBX_0;
-       if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) {
+       if (IS_QLA24XX(ha) || IS_QLA25XX(ha)) {
                mcp->mb[1] = fcport->loop_id;
                mcp->mb[10] = opt;
                mcp->out_mb |= MBX_10|MBX_1;
@@ -1112,7 +1114,7 @@ qla2x00_get_port_database(scsi_qla_host_t *ha, fc_port_t *fcport, uint8_t opt)
                mcp->mb[1] = fcport->loop_id << 8 | opt;
                mcp->out_mb |= MBX_1;
        }
-       mcp->buf_size = (IS_QLA24XX(ha) || IS_QLA54XX(ha) ?
+       mcp->buf_size = (IS_QLA24XX(ha) || IS_QLA25XX(ha) ?
            PORT_DATABASE_24XX_SIZE : PORT_DATABASE_SIZE);
        mcp->flags = MBX_DMA_IN;
        mcp->tov = (ha->login_timeout * 2) + (ha->login_timeout / 2);
@@ -1120,7 +1122,7 @@ qla2x00_get_port_database(scsi_qla_host_t *ha, fc_port_t *fcport, uint8_t opt)
        if (rval != QLA_SUCCESS)
                goto gpd_error_out;
 
-       if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) {
+       if (IS_QLA24XX(ha) || IS_QLA25XX(ha)) {
                pd24 = (struct port_database_24xx *) pd;
 
                /* Check for logged in state. */
@@ -1337,7 +1339,7 @@ qla2x00_lip_reset(scsi_qla_host_t *ha)
 
        DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no);)
 
-       if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) {
+       if (IS_QLA24XX(ha) || IS_QLA25XX(ha)) {
                mcp->mb[0] = MBC_LIP_FULL_LOGIN;
                mcp->mb[1] = BIT_0;
                mcp->mb[2] = 0xff;
@@ -1631,25 +1633,20 @@ qla2x00_login_fabric(scsi_qla_host_t *ha, uint16_t loop_id, uint8_t domain,
  *
  */
 int
-qla2x00_login_local_device(scsi_qla_host_t *ha, fc_port_t *fcport,
+qla2x00_login_local_device(scsi_qla_host_t *ha, uint16_t loop_id,
     uint16_t *mb_ret, uint8_t opt)
 {
        int rval;
        mbx_cmd_t mc;
        mbx_cmd_t *mcp = &mc;
 
-       if (IS_QLA24XX(ha) || IS_QLA54XX(ha))
-               return qla24xx_login_fabric(ha, 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__, ha->host_no);)
 
        mcp->mb[0] = MBC_LOGIN_LOOP_PORT;
        if (HAS_EXTENDED_IDS(ha))
-               mcp->mb[1] = fcport->loop_id;
+               mcp->mb[1] = loop_id;
        else
-               mcp->mb[1] = fcport->loop_id << 8;
+               mcp->mb[1] = loop_id << 8;
        mcp->mb[2] = opt;
        mcp->out_mb = MBX_2|MBX_1|MBX_0;
        mcp->in_mb = MBX_7|MBX_6|MBX_1|MBX_0;
@@ -1871,7 +1868,7 @@ qla2x00_get_id_list(scsi_qla_host_t *ha, void *id_list, dma_addr_t id_list_dma,
 
        mcp->mb[0] = MBC_GET_ID_LIST;
        mcp->out_mb = MBX_0;
-       if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) {
+       if (IS_QLA24XX(ha) || IS_QLA25XX(ha)) {
                mcp->mb[2] = MSW(id_list_dma);
                mcp->mb[3] = LSW(id_list_dma);
                mcp->mb[6] = MSW(MSD(id_list_dma));
@@ -2062,7 +2059,7 @@ qla2x00_get_link_status(scsi_qla_host_t *ha, uint16_t loop_id,
        mcp->mb[7] = LSW(MSD(stat_buf_dma));
        mcp->out_mb = MBX_7|MBX_6|MBX_3|MBX_2|MBX_0;
        mcp->in_mb = MBX_0;
-       if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) {
+       if (IS_QLA24XX(ha) || IS_QLA25XX(ha)) {
                mcp->mb[1] = loop_id;
                mcp->mb[4] = 0;
                mcp->mb[10] = 0;
@@ -2329,7 +2326,7 @@ qla2x00_system_error(scsi_qla_host_t *ha)
        mbx_cmd_t mc;
        mbx_cmd_t *mcp = &mc;
 
-       if (!IS_QLA24XX(ha) && !IS_QLA54XX(ha))
+       if (!IS_QLA24XX(ha) && !IS_QLA25XX(ha))
                return QLA_FUNCTION_FAILED;
 
        DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no));
@@ -2411,9 +2408,9 @@ qla2x00_set_serdes_params(scsi_qla_host_t *ha, uint16_t sw_em_1g,
 
        mcp->mb[0] = MBC_SERDES_PARAMS;
        mcp->mb[1] = BIT_0;
-       mcp->mb[2] = sw_em_1g | BIT_15;
-       mcp->mb[3] = sw_em_2g | BIT_15;
-       mcp->mb[4] = sw_em_4g | BIT_15;
+       mcp->mb[2] = sw_em_1g;
+       mcp->mb[3] = sw_em_2g;
+       mcp->mb[4] = sw_em_4g;
        mcp->out_mb = MBX_4|MBX_3|MBX_2|MBX_1|MBX_0;
        mcp->in_mb = MBX_0;
        mcp->tov = 30;
@@ -2439,7 +2436,7 @@ qla2x00_stop_firmware(scsi_qla_host_t *ha)
        mbx_cmd_t mc;
        mbx_cmd_t *mcp = &mc;
 
-       if (!IS_QLA24XX(ha) && !IS_QLA54XX(ha))
+       if (!IS_QLA24XX(ha) && !IS_QLA25XX(ha))
                return QLA_FUNCTION_FAILED;
 
        DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no));