[SCSI] qla2xxx: Stop firmware execution at unintialization time.
authorAndrew Vasquez <andrew.vasquez@qlogic.com>
Sat, 27 Aug 2005 02:10:20 +0000 (19:10 -0700)
committerJames Bottomley <jejb@mulgrave.(none)>
Mon, 5 Sep 2005 00:53:57 +0000 (19:53 -0500)
On ISP24xx parts, stop execution of firmware during ISP
tear-down.

Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
drivers/scsi/qla2xxx/qla_def.h
drivers/scsi/qla2xxx/qla_gbl.h
drivers/scsi/qla2xxx/qla_mbx.c
drivers/scsi/qla2xxx/qla_os.c

index b7f82b757cbcf567e130412fb99cf8eb1bec054e..b455c31405e49bb622191bab04357ccab7277478 100644 (file)
@@ -631,6 +631,7 @@ typedef struct {
 #define MBC_WRITE_RAM_WORD_EXTENDED    0xd     /* Write RAM word extended */
 #define MBC_READ_RAM_EXTENDED          0xf     /* Read RAM extended. */
 #define MBC_IOCB_COMMAND               0x12    /* Execute IOCB command. */
+#define MBC_STOP_FIRMWARE              0x14    /* Stop firmware. */
 #define MBC_ABORT_COMMAND              0x15    /* Abort IOCB command. */
 #define MBC_ABORT_DEVICE               0x16    /* Abort device (ID/LUN). */
 #define MBC_ABORT_TARGET               0x17    /* Abort target (ID). */
index 95fb0c4941aa712ef04383ca734dec92f4909f53..1ed32e7b5472091ef7324e154dfdcf32464f0ae8 100644 (file)
@@ -213,6 +213,9 @@ qla2x00_get_serdes_params(scsi_qla_host_t *, uint16_t *, uint16_t *,
 extern int
 qla2x00_set_serdes_params(scsi_qla_host_t *, uint16_t, uint16_t, uint16_t);
 
+extern int
+qla2x00_stop_firmware(scsi_qla_host_t *);
+
 /*
  * Global Function Prototypes in qla_isr.c source file.
  */
index 953156faafdbf1b187833e9f371e17df63c6b800..13e1c9047079e8fcfd2ef808f1ba93d1fbef13e9 100644 (file)
@@ -2427,3 +2427,32 @@ qla2x00_set_serdes_params(scsi_qla_host_t *ha, uint16_t sw_em_1g,
 
        return rval;
 }
+
+int
+qla2x00_stop_firmware(scsi_qla_host_t *ha)
+{
+       int rval;
+       mbx_cmd_t mc;
+       mbx_cmd_t *mcp = &mc;
+
+       if (!IS_QLA24XX(ha) && !IS_QLA25XX(ha))
+               return QLA_FUNCTION_FAILED;
+
+       DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no));
+
+       mcp->mb[0] = MBC_STOP_FIRMWARE;
+       mcp->out_mb = MBX_0;
+       mcp->in_mb = MBX_0;
+       mcp->tov = 5;
+       mcp->flags = 0;
+       rval = qla2x00_mailbox_command(ha, mcp);
+
+       if (rval != QLA_SUCCESS) {
+               DEBUG2_3_11(printk("%s(%ld): failed=%x.\n", __func__,
+                   ha->host_no, rval));
+       } else {
+               DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no));
+       }
+
+       return rval;
+}
index af9b4e77cbff28195c31c3069290bcf81f3b015a..8982978c42fdfa4f780bf454bac3e8f8d4de0507 100644 (file)
@@ -79,7 +79,7 @@ module_param(ql2xloginretrycount, int, S_IRUGO|S_IRUSR);
 MODULE_PARM_DESC(ql2xloginretrycount,
                "Specify an alternate value for the NVRAM login retry count.");
 
-int ql2xfwloadbin;
+int ql2xfwloadbin=1;
 module_param(ql2xfwloadbin, int, S_IRUGO|S_IRUSR);
 MODULE_PARM_DESC(ql2xfwloadbin,
                "Load ISP2xxx firmware image via hotplug.");
@@ -1626,10 +1626,6 @@ qla2x00_free_device(scsi_qla_host_t *ha)
        if (!IS_QLA2100(ha) && !IS_QLA2200(ha))
                qla2x00_cancel_io_descriptors(ha);
 
-       /* turn-off interrupts on the card */
-       if (ha->interrupts_on)
-               ha->isp_ops.disable_intrs(ha);
-
        /* Disable timer */
        if (ha->timer_active)
                qla2x00_stop_timer(ha);
@@ -1649,8 +1645,14 @@ qla2x00_free_device(scsi_qla_host_t *ha)
                }
        }
 
-       qla2x00_mem_free(ha);
+       /* Stop currently executing firmware. */
+       qla2x00_stop_firmware(ha);
 
+       /* turn-off interrupts on the card */
+       if (ha->interrupts_on)
+               ha->isp_ops.disable_intrs(ha);
+
+       qla2x00_mem_free(ha);
 
        ha->flags.online = 0;