[SCSI] qla2xxx: Implemeted beacon on/off for ISP82XX.
Saurav Kashyap [Tue, 16 Aug 2011 18:31:45 +0000 (11:31 -0700)]
[jejb: fix up checkpatch.pl errors]
Signed-off-by: Saurav Kashyap <saurav.kashyap@qlogic.com>
Signed-off-by: Chad Dupuis <chad.dupuis@qlogic.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>

drivers/scsi/qla2xxx/qla_dbg.c
drivers/scsi/qla2xxx/qla_gbl.h
drivers/scsi/qla2xxx/qla_mbx.c
drivers/scsi/qla2xxx/qla_nx.c
drivers/scsi/qla2xxx/qla_nx.h
drivers/scsi/qla2xxx/qla_os.c

index 238bc91..9df4787 100644 (file)
@@ -12,7 +12,7 @@
  * |             Level            |   Last Value Used  |     Holes     |
  * ----------------------------------------------------------------------
  * | Module Init and Probe        |       0x0116       |               |
- * | Mailbox commands             |       0x1126       |               |
+ * | Mailbox commands             |       0x1129       |               |
  * | Device Discovery             |       0x2083       |               |
  * | Queue Command and IO tracing |       0x302e       |     0x3008     |
  * | DPC Thread                   |       0x401c       |               |
@@ -22,7 +22,7 @@
  * | Task Management              |       0x8041       |               |
  * | AER/EEH                      |       0x900f       |               |
  * | Virtual Port                 |       0xa007       |               |
- * | ISP82XX Specific             |       0xb04f       |               |
+ * | ISP82XX Specific             |       0xb051       |               |
  * | MultiQ                       |       0xc00b       |               |
  * | Misc                         |       0xd00b       |               |
  * ----------------------------------------------------------------------
index df58e24..e1aebae 100644 (file)
@@ -409,6 +409,8 @@ extern void qla2x00_beacon_blink(struct scsi_qla_host *);
 extern int qla24xx_beacon_on(struct scsi_qla_host *);
 extern int qla24xx_beacon_off(struct scsi_qla_host *);
 extern void qla24xx_beacon_blink(struct scsi_qla_host *);
+extern int qla82xx_beacon_on(struct scsi_qla_host *);
+extern int qla82xx_beacon_off(struct scsi_qla_host *);
 
 extern uint8_t *qla2x00_read_optrom_data(struct scsi_qla_host *, uint8_t *,
     uint32_t, uint32_t);
@@ -573,6 +575,7 @@ extern int qla82xx_mbx_intr_disable(scsi_qla_host_t *);
 extern void qla82xx_start_iocbs(srb_t *);
 extern int qla82xx_fcoe_ctx_reset(scsi_qla_host_t *);
 extern void qla82xx_chip_reset_cleanup(scsi_qla_host_t *);
+extern int qla82xx_mbx_beacon_ctl(scsi_qla_host_t *, int);
 extern char *qdev_state(uint32_t);
 
 /* BSG related functions */
index a411374..3b3cec9 100644 (file)
@@ -4275,3 +4275,41 @@ qla82xx_md_get_template(scsi_qla_host_t *vha)
                ql_dbg(ql_dbg_mbx, vha, 0x1126, "Done %s.\n", __func__);
        return rval;
 }
+
+int
+qla82xx_mbx_beacon_ctl(scsi_qla_host_t *vha, int enable)
+{
+       int rval;
+       struct qla_hw_data *ha = vha->hw;
+       mbx_cmd_t mc;
+       mbx_cmd_t *mcp = &mc;
+
+       if (!IS_QLA82XX(ha))
+               return QLA_FUNCTION_FAILED;
+
+       ql_dbg(ql_dbg_mbx, vha, 0x1127,
+               "Entered %s.\n", __func__);
+
+       memset(mcp, 0, sizeof(mbx_cmd_t));
+       mcp->mb[0] = MBC_SET_LED_CONFIG;
+       if (enable)
+               mcp->mb[7] = 0xE;
+       else
+               mcp->mb[7] = 0xD;
+
+       mcp->out_mb = MBX_7|MBX_0;
+       mcp->in_mb = MBX_0;
+       mcp->tov = 30;
+       mcp->flags = 0;
+
+       rval = qla2x00_mailbox_command(vha, mcp);
+       if (rval != QLA_SUCCESS) {
+               ql_dbg(ql_dbg_mbx, vha, 0x1128,
+                   "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]);
+       } else {
+               ql_dbg(ql_dbg_mbx, vha, 0x1129,
+                   "Done %s.\n", __func__);
+       }
+
+       return rval;
+}
index 43a0a9a..b03c86b 100644 (file)
@@ -4874,3 +4874,43 @@ qla82xx_md_prep(scsi_qla_host_t *vha)
                }
        }
 }
+
+int
+qla82xx_beacon_on(struct scsi_qla_host *vha)
+{
+
+       int rval;
+       struct qla_hw_data *ha = vha->hw;
+       qla82xx_idc_lock(ha);
+       rval = qla82xx_mbx_beacon_ctl(vha, 1);
+
+       if (rval) {
+               ql_log(ql_log_warn, vha, 0xb050,
+                   "mbx set led config failed in %s\n", __func__);
+               goto exit;
+       }
+       ha->beacon_blink_led = 1;
+exit:
+       qla82xx_idc_unlock(ha);
+       return rval;
+}
+
+int
+qla82xx_beacon_off(struct scsi_qla_host *vha)
+{
+
+       int rval;
+       struct qla_hw_data *ha = vha->hw;
+       qla82xx_idc_lock(ha);
+       rval = qla82xx_mbx_beacon_ctl(vha, 0);
+
+       if (rval) {
+               ql_log(ql_log_warn, vha, 0xb051,
+                   "mbx set led config failed in %s\n", __func__);
+               goto exit;
+       }
+       ha->beacon_blink_led = 0;
+exit:
+       qla82xx_idc_unlock(ha);
+       return rval;
+}
index 97ee250..57820c1 100644 (file)
@@ -888,6 +888,7 @@ struct ct6_dsd {
 };
 
 #define MBC_TOGGLE_INTERRUPT   0x10
+#define MBC_SET_LED_CONFIG     0x125
 
 /* Flash  offset */
 #define FLT_REG_BOOTLOAD_82XX  0x72
index e37556c..ca9c76e 100644 (file)
@@ -1762,9 +1762,9 @@ static struct isp_operations qla82xx_isp_ops = {
        .read_nvram             = qla24xx_read_nvram_data,
        .write_nvram            = qla24xx_write_nvram_data,
        .fw_dump                = qla24xx_fw_dump,
-       .beacon_on              = qla24xx_beacon_on,
-       .beacon_off             = qla24xx_beacon_off,
-       .beacon_blink           = qla24xx_beacon_blink,
+       .beacon_on              = qla82xx_beacon_on,
+       .beacon_off             = qla82xx_beacon_off,
+       .beacon_blink           = NULL,
        .read_optrom            = qla82xx_read_optrom_data,
        .write_optrom           = qla82xx_write_optrom_data,
        .get_flash_version      = qla24xx_get_flash_version,
@@ -3917,8 +3917,11 @@ qla2x00_timer(scsi_qla_host_t *vha)
 
        /* Check if beacon LED needs to be blinked for physical host only */
        if (!vha->vp_idx && (ha->beacon_blink_led == 1)) {
-               set_bit(BEACON_BLINK_NEEDED, &vha->dpc_flags);
-               start_dpc++;
+               /* There is no beacon_blink function for ISP82xx */
+               if (!IS_QLA82XX(ha)) {
+                       set_bit(BEACON_BLINK_NEEDED, &vha->dpc_flags);
+                       start_dpc++;
+               }
        }
 
        /* Process any deferred work. */