~ubuntu-branches/ubuntu/quantal/linux-linaro-mx51/quantal

« back to all changes in this revision

Viewing changes to drivers/scsi/qla4xxx/ql4_mbx.c

  • Committer: Package Import Robot
  • Author(s): John Rigby, John Rigby
  • Date: 2011-09-26 10:44:23 UTC
  • Revision ID: package-import@ubuntu.com-20110926104423-3o58a3c1bj7x00rs
Tags: 3.0.0-1007.9
[ John Rigby ]

Enable crypto modules and remove crypto-modules from
exclude-module files
LP: #826021

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 * @mbx_cmd: data pointer for mailbox in registers.
20
20
 * @mbx_sts: data pointer for mailbox out registers.
21
21
 *
22
 
 * This routine isssue mailbox commands and waits for completion.
 
22
 * This routine issue mailbox commands and waits for completion.
23
23
 * If outCount is 0, this routine completes successfully WITHOUT waiting
24
24
 * for the mailbox command to complete.
25
25
 **/
86
86
                msleep(10);
87
87
        }
88
88
 
89
 
        /* To prevent overwriting mailbox registers for a command that has
90
 
         * not yet been serviced, check to see if an active command
91
 
         * (AEN, IOCB, etc.) is interrupting, then service it.
92
 
         * -----------------------------------------------------------------
93
 
         */
94
89
        spin_lock_irqsave(&ha->hardware_lock, flags);
95
90
 
96
 
        if (!is_qla8022(ha)) {
97
 
                intr_status = readl(&ha->reg->ctrl_status);
98
 
                if (intr_status & CSR_SCSI_PROCESSOR_INTR) {
99
 
                        /* Service existing interrupt */
100
 
                        ha->isp_ops->interrupt_service_routine(ha, intr_status);
101
 
                        clear_bit(AF_MBOX_COMMAND_DONE, &ha->flags);
102
 
                }
103
 
        }
104
 
 
105
91
        ha->mbox_status_count = outCount;
106
92
        for (i = 0; i < outCount; i++)
107
93
                ha->mbox_status[i] = 0;
1057
1043
}
1058
1044
 
1059
1045
/**
1060
 
 * qla4xxx_get_fw_version - gets firmware version
 
1046
 * qla4xxx_about_firmware - gets FW, iscsi draft and boot loader version
1061
1047
 * @ha: Pointer to host adapter structure.
1062
1048
 *
1063
 
 * Retrieves the firmware version on HBA. In QLA4010, mailboxes 2 & 3 may
1064
 
 * hold an address for data.  Make sure that we write 0 to those mailboxes,
1065
 
 * if unused.
 
1049
 * Retrieves the FW version, iSCSI draft version & bootloader version of HBA.
 
1050
 * Mailboxes 2 & 3 may hold an address for data. Make sure that we write 0 to
 
1051
 * those mailboxes, if unused.
1066
1052
 **/
1067
 
int qla4xxx_get_fw_version(struct scsi_qla_host * ha)
 
1053
int qla4xxx_about_firmware(struct scsi_qla_host *ha)
1068
1054
{
 
1055
        struct about_fw_info *about_fw = NULL;
 
1056
        dma_addr_t about_fw_dma;
1069
1057
        uint32_t mbox_cmd[MBOX_REG_COUNT];
1070
1058
        uint32_t mbox_sts[MBOX_REG_COUNT];
1071
 
 
1072
 
        /* Get firmware version. */
 
1059
        int status = QLA_ERROR;
 
1060
 
 
1061
        about_fw = dma_alloc_coherent(&ha->pdev->dev,
 
1062
                                      sizeof(struct about_fw_info),
 
1063
                                      &about_fw_dma, GFP_KERNEL);
 
1064
        if (!about_fw) {
 
1065
                DEBUG2(ql4_printk(KERN_ERR, ha, "%s: Unable to alloc memory "
 
1066
                                  "for about_fw\n", __func__));
 
1067
                return status;
 
1068
        }
 
1069
 
 
1070
        memset(about_fw, 0, sizeof(struct about_fw_info));
1073
1071
        memset(&mbox_cmd, 0, sizeof(mbox_cmd));
1074
1072
        memset(&mbox_sts, 0, sizeof(mbox_sts));
1075
1073
 
1076
1074
        mbox_cmd[0] = MBOX_CMD_ABOUT_FW;
 
1075
        mbox_cmd[2] = LSDW(about_fw_dma);
 
1076
        mbox_cmd[3] = MSDW(about_fw_dma);
 
1077
        mbox_cmd[4] = sizeof(struct about_fw_info);
1077
1078
 
1078
 
        if (qla4xxx_mailbox_command(ha, MBOX_REG_COUNT, 5, &mbox_cmd[0], &mbox_sts[0]) !=
1079
 
            QLA_SUCCESS) {
1080
 
                DEBUG2(printk("scsi%ld: %s: MBOX_CMD_ABOUT_FW failed w/ "
1081
 
                    "status %04X\n", ha->host_no, __func__, mbox_sts[0]));
1082
 
                return QLA_ERROR;
 
1079
        status = qla4xxx_mailbox_command(ha, MBOX_REG_COUNT, MBOX_REG_COUNT,
 
1080
                                         &mbox_cmd[0], &mbox_sts[0]);
 
1081
        if (status != QLA_SUCCESS) {
 
1082
                DEBUG2(ql4_printk(KERN_WARNING, ha, "%s: MBOX_CMD_ABOUT_FW "
 
1083
                                  "failed w/ status %04X\n", __func__,
 
1084
                                  mbox_sts[0]));
 
1085
                goto exit_about_fw;
1083
1086
        }
1084
1087
 
1085
 
        /* Save firmware version information. */
1086
 
        ha->firmware_version[0] = mbox_sts[1];
1087
 
        ha->firmware_version[1] = mbox_sts[2];
1088
 
        ha->patch_number = mbox_sts[3];
1089
 
        ha->build_number = mbox_sts[4];
 
1088
        /* Save version information. */
 
1089
        ha->firmware_version[0] = le16_to_cpu(about_fw->fw_major);
 
1090
        ha->firmware_version[1] = le16_to_cpu(about_fw->fw_minor);
 
1091
        ha->patch_number = le16_to_cpu(about_fw->fw_patch);
 
1092
        ha->build_number = le16_to_cpu(about_fw->fw_build);
 
1093
        ha->iscsi_major = le16_to_cpu(about_fw->iscsi_major);
 
1094
        ha->iscsi_minor = le16_to_cpu(about_fw->iscsi_minor);
 
1095
        ha->bootload_major = le16_to_cpu(about_fw->bootload_major);
 
1096
        ha->bootload_minor = le16_to_cpu(about_fw->bootload_minor);
 
1097
        ha->bootload_patch = le16_to_cpu(about_fw->bootload_patch);
 
1098
        ha->bootload_build = le16_to_cpu(about_fw->bootload_build);
 
1099
        status = QLA_SUCCESS;
1090
1100
 
1091
 
        return QLA_SUCCESS;
 
1101
exit_about_fw:
 
1102
        dma_free_coherent(&ha->pdev->dev, sizeof(struct about_fw_info),
 
1103
                          about_fw, about_fw_dma);
 
1104
        return status;
1092
1105
}
1093
1106
 
1094
1107
static int qla4xxx_get_default_ddb(struct scsi_qla_host *ha,