aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/qla2xxx/qla_mbx.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/qla2xxx/qla_mbx.c')
-rw-r--r--drivers/scsi/qla2xxx/qla_mbx.c97
1 files changed, 44 insertions, 53 deletions
diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c
index 409ea0ac4032..13e1c9047079 100644
--- a/drivers/scsi/qla2xxx/qla_mbx.c
+++ b/drivers/scsi/qla2xxx/qla_mbx.c
@@ -19,6 +19,7 @@
19#include "qla_def.h" 19#include "qla_def.h"
20 20
21#include <linux/delay.h> 21#include <linux/delay.h>
22#include <scsi/scsi_transport_fc.h>
22 23
23static void 24static void
24qla2x00_mbx_sem_timeout(unsigned long data) 25qla2x00_mbx_sem_timeout(unsigned long data)
@@ -251,7 +252,7 @@ qla2x00_mailbox_command(scsi_qla_host_t *ha, mbx_cmd_t *mcp)
251 mb0 = RD_REG_WORD(&reg->isp24.mailbox0); 252 mb0 = RD_REG_WORD(&reg->isp24.mailbox0);
252 ictrl = RD_REG_DWORD(&reg->isp24.ictrl); 253 ictrl = RD_REG_DWORD(&reg->isp24.ictrl);
253 } else { 254 } else {
254 mb0 = RD_MAILBOX_REG(ha, reg->isp, 0); 255 mb0 = RD_MAILBOX_REG(ha, &reg->isp, 0);
255 ictrl = RD_REG_WORD(&reg->isp.ictrl); 256 ictrl = RD_REG_WORD(&reg->isp.ictrl);
256 } 257 }
257 printk("%s(%ld): **** MB Command Timeout for cmd %x ****\n", 258 printk("%s(%ld): **** MB Command Timeout for cmd %x ****\n",
@@ -983,58 +984,6 @@ qla2x00_abort_target(fc_port_t *fcport)
983#endif 984#endif
984 985
985/* 986/*
986 * qla2x00_target_reset
987 * Issue target reset mailbox command.
988 *
989 * Input:
990 * ha = adapter block pointer.
991 * TARGET_QUEUE_LOCK must be released.
992 * ADAPTER_STATE_LOCK must be released.
993 *
994 * Returns:
995 * qla2x00 local function return status code.
996 *
997 * Context:
998 * Kernel context.
999 */
1000int
1001qla2x00_target_reset(scsi_qla_host_t *ha, struct fc_port *fcport)
1002{
1003 int rval;
1004 mbx_cmd_t mc;
1005 mbx_cmd_t *mcp = &mc;
1006
1007 DEBUG11(printk("qla2x00_target_reset(%ld): entered.\n", ha->host_no);)
1008
1009 if (atomic_read(&fcport->state) != FCS_ONLINE)
1010 return 0;
1011
1012 mcp->mb[0] = MBC_TARGET_RESET;
1013 if (HAS_EXTENDED_IDS(ha))
1014 mcp->mb[1] = fcport->loop_id;
1015 else
1016 mcp->mb[1] = fcport->loop_id << 8;
1017 mcp->mb[2] = ha->loop_reset_delay;
1018 mcp->out_mb = MBX_2|MBX_1|MBX_0;
1019 mcp->in_mb = MBX_0;
1020 mcp->tov = 30;
1021 mcp->flags = 0;
1022 rval = qla2x00_mailbox_command(ha, mcp);
1023
1024 if (rval != QLA_SUCCESS) {
1025 /*EMPTY*/
1026 DEBUG2_3_11(printk("qla2x00_target_reset(%ld): failed=%x.\n",
1027 ha->host_no, rval);)
1028 } else {
1029 /*EMPTY*/
1030 DEBUG11(printk("qla2x00_target_reset(%ld): done.\n",
1031 ha->host_no);)
1032 }
1033
1034 return rval;
1035}
1036
1037/*
1038 * qla2x00_get_adapter_id 987 * qla2x00_get_adapter_id
1039 * Get adapter ID and topology. 988 * Get adapter ID and topology.
1040 * 989 *
@@ -1326,6 +1275,10 @@ qla2x00_get_port_database(scsi_qla_host_t *ha, fc_port_t *fcport, uint8_t opt)
1326 fcport->port_type = FCT_INITIATOR; 1275 fcport->port_type = FCT_INITIATOR;
1327 else 1276 else
1328 fcport->port_type = FCT_TARGET; 1277 fcport->port_type = FCT_TARGET;
1278
1279 /* Passback COS information. */
1280 fcport->supported_classes = (pd->options & BIT_4) ?
1281 FC_COS_CLASS2: FC_COS_CLASS3;
1329 } 1282 }
1330 1283
1331gpd_error_out: 1284gpd_error_out:
@@ -1661,6 +1614,13 @@ qla24xx_login_fabric(scsi_qla_host_t *ha, uint16_t loop_id, uint8_t domain,
1661 mb[1] |= BIT_1; 1614 mb[1] |= BIT_1;
1662 } else 1615 } else
1663 mb[1] = BIT_0; 1616 mb[1] = BIT_0;
1617
1618 /* Passback COS information. */
1619 mb[10] = 0;
1620 if (lg->io_parameter[7] || lg->io_parameter[8])
1621 mb[10] |= BIT_0; /* Class 2. */
1622 if (lg->io_parameter[9] || lg->io_parameter[10])
1623 mb[10] |= BIT_1; /* Class 3. */
1664 } 1624 }
1665 1625
1666 dma_pool_free(ha->s_dma_pool, lg, lg_dma); 1626 dma_pool_free(ha->s_dma_pool, lg, lg_dma);
@@ -1723,6 +1683,8 @@ qla2x00_login_fabric(scsi_qla_host_t *ha, uint16_t loop_id, uint8_t domain,
1723 mb[2] = mcp->mb[2]; 1683 mb[2] = mcp->mb[2];
1724 mb[6] = mcp->mb[6]; 1684 mb[6] = mcp->mb[6];
1725 mb[7] = mcp->mb[7]; 1685 mb[7] = mcp->mb[7];
1686 /* COS retrieved from Get-Port-Database mailbox command. */
1687 mb[10] = 0;
1726 } 1688 }
1727 1689
1728 if (rval != QLA_SUCCESS) { 1690 if (rval != QLA_SUCCESS) {
@@ -2465,3 +2427,32 @@ qla2x00_set_serdes_params(scsi_qla_host_t *ha, uint16_t sw_em_1g,
2465 2427
2466 return rval; 2428 return rval;
2467} 2429}
2430
2431int
2432qla2x00_stop_firmware(scsi_qla_host_t *ha)
2433{
2434 int rval;
2435 mbx_cmd_t mc;
2436 mbx_cmd_t *mcp = &mc;
2437
2438 if (!IS_QLA24XX(ha) && !IS_QLA25XX(ha))
2439 return QLA_FUNCTION_FAILED;
2440
2441 DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no));
2442
2443 mcp->mb[0] = MBC_STOP_FIRMWARE;
2444 mcp->out_mb = MBX_0;
2445 mcp->in_mb = MBX_0;
2446 mcp->tov = 5;
2447 mcp->flags = 0;
2448 rval = qla2x00_mailbox_command(ha, mcp);
2449
2450 if (rval != QLA_SUCCESS) {
2451 DEBUG2_3_11(printk("%s(%ld): failed=%x.\n", __func__,
2452 ha->host_no, rval));
2453 } else {
2454 DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no));
2455 }
2456
2457 return rval;
2458}