Merge branch 'topic/core-cleanup' into for-linus
[safe/jmp/linux-2.6] / drivers / scsi / qla4xxx / ql4_mbx.c
index 35cd73c..caeb7d1 100644 (file)
@@ -385,16 +385,6 @@ int qla4xxx_get_firmware_status(struct scsi_qla_host * ha)
                              mbox_sts[0]));
                return QLA_ERROR;
        }
-
-       /* High-water mark of IOCBs */
-       ha->iocb_hiwat = mbox_sts[2];
-       if (ha->iocb_hiwat > IOCB_HIWAT_CUSHION)
-               ha->iocb_hiwat -= IOCB_HIWAT_CUSHION;
-       else
-               dev_info(&ha->pdev->dev, "WARNING!!!  You have less than %d "
-                          "firmare IOCBs available (%d).\n",
-                          IOCB_HIWAT_CUSHION, ha->iocb_hiwat);
-
        return QLA_SUCCESS;
 }
 
@@ -477,7 +467,7 @@ int qla4xxx_get_fwddb_entry(struct scsi_qla_host *ha,
        if (conn_err_detail)
                *conn_err_detail = mbox_sts[5];
        if (tcp_source_port_num)
-               *tcp_source_port_num = (uint16_t) mbox_sts[6] >> 16;
+               *tcp_source_port_num = (uint16_t) (mbox_sts[6] >> 16);
        if (connection_id)
                *connection_id = (uint16_t) mbox_sts[6] & 0x00FF;
        status = QLA_SUCCESS;
@@ -713,6 +703,45 @@ int qla4xxx_reset_lun(struct scsi_qla_host * ha, struct ddb_entry * ddb_entry,
        return status;
 }
 
+/**
+ * qla4xxx_reset_target - issues target Reset
+ * @ha: Pointer to host adapter structure.
+ * @db_entry: Pointer to device database entry
+ * @un_entry: Pointer to lun entry structure
+ *
+ * This routine performs a TARGET RESET on the specified target.
+ * The caller must ensure that the ddb_entry pointers
+ * are valid before calling this routine.
+ **/
+int qla4xxx_reset_target(struct scsi_qla_host *ha,
+                        struct ddb_entry *ddb_entry)
+{
+       uint32_t mbox_cmd[MBOX_REG_COUNT];
+       uint32_t mbox_sts[MBOX_REG_COUNT];
+       int status = QLA_SUCCESS;
+
+       DEBUG2(printk("scsi%ld:%d: target reset issued\n", ha->host_no,
+                     ddb_entry->os_target_id));
+
+       /*
+        * Send target reset command to ISP, so that the ISP will return all
+        * outstanding requests with RESET status
+        */
+       memset(&mbox_cmd, 0, sizeof(mbox_cmd));
+       memset(&mbox_sts, 0, sizeof(mbox_sts));
+
+       mbox_cmd[0] = MBOX_CMD_TARGET_WARM_RESET;
+       mbox_cmd[1] = ddb_entry->fw_ddb_index;
+       mbox_cmd[5] = 0x01;     /* Immediate Command Enable */
+
+       qla4xxx_mailbox_command(ha, MBOX_REG_COUNT, 1, &mbox_cmd[0],
+                               &mbox_sts[0]);
+       if (mbox_sts[0] != MBOX_STS_COMMAND_COMPLETE &&
+           mbox_sts[0] != MBOX_STS_COMMAND_ERROR)
+               status = QLA_ERROR;
+
+       return status;
+}
 
 int qla4xxx_get_flash(struct scsi_qla_host * ha, dma_addr_t dma_addr,
                      uint32_t offset, uint32_t len)