Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 81178772 authored by Saurav Kashyap's avatar Saurav Kashyap Committed by James Bottomley
Browse files

[SCSI] qla2xxx: Implemetation of mctp.



[jejb: fix up checkpatch errors]
Signed-off-by: default avatarSaurav Kashyap <saurav.kashyap@qlogic.com>
Signed-off-by: default avatarChad Dupuis <chad.dupuis@qlogic.com>
Signed-off-by: default avatarJames Bottomley <JBottomley@Parallels.com>
parent 7d613ac6
Loading
Loading
Loading
Loading
+23 −2
Original line number Diff line number Diff line
@@ -26,7 +26,7 @@ qla2x00_sysfs_read_fw_dump(struct file *filp, struct kobject *kobj,
	struct qla_hw_data *ha = vha->hw;
	int rval = 0;

	if (ha->fw_dump_reading == 0)
	if (!(ha->fw_dump_reading || ha->mctp_dump_reading))
		return 0;

	if (IS_QLA82XX(ha)) {
@@ -39,9 +39,14 @@ qla2x00_sysfs_read_fw_dump(struct file *filp, struct kobject *kobj,
		rval = memory_read_from_buffer(buf, count,
		    &off, ha->md_dump, ha->md_dump_size);
		return rval;
	} else
	} else if (ha->mctp_dumped && ha->mctp_dump_reading)
		return memory_read_from_buffer(buf, count, &off, ha->mctp_dump,
		    MCTP_DUMP_SIZE);
	else if (ha->fw_dump_reading)
		return memory_read_from_buffer(buf, count, &off, ha->fw_dump,
					ha->fw_dump_len);
	else
		return 0;
}

static ssize_t
@@ -107,6 +112,22 @@ qla2x00_sysfs_write_fw_dump(struct file *filp, struct kobject *kobj,
		if (IS_QLA82XX(ha))
			set_bit(ISP_ABORT_NEEDED, &vha->dpc_flags);
		break;
	case 6:
		if (!ha->mctp_dump_reading)
			break;
		ql_log(ql_log_info, vha, 0x70c1,
		    "MCTP dump cleared on (%ld).\n", vha->host_no);
		ha->mctp_dump_reading = 0;
		ha->mctp_dumped = 0;
		break;
	case 7:
		if (ha->mctp_dumped && !ha->mctp_dump_reading) {
			ha->mctp_dump_reading = 1;
			ql_log(ql_log_info, vha, 0x70c2,
			    "Raw mctp dump ready for read on (%ld).\n",
			    vha->host_no);
		}
		break;
	}
	return count;
}
+6 −4
Original line number Diff line number Diff line
@@ -12,28 +12,30 @@
 * |             Level            |   Last Value Used  |     Holes	|
 * ----------------------------------------------------------------------
 * | Module Init and Probe        |       0x0124       | 0x4b,0xba,0xfa |
 * | Mailbox commands             |       0x114c       | 0x111a-0x111b  |
 * | Mailbox commands             |       0x114f       | 0x111a-0x111b  |
 * |                              |                    | 0x112c-0x112e  |
 * |                              |                    | 0x113a         |
 * | Device Discovery             |       0x2087       | 0x2020-0x2022  |
 * | Queue Command and IO tracing |       0x3030       | 0x3006,0x3008  |
 * |                              |                    | 0x302d-0x302e  |
 * | DPC Thread                   |       0x401c       | 0x4002,0x4013  |
 * | Async Events                 |       0x506c       | 0x502b-0x502f  |
 * | Async Events                 |       0x5071       | 0x502b-0x502f  |
 * |                              |                    | 0x5047,0x5052  |
 * | Timer Routines               |       0x6011       |                |
 * | User Space Interactions      |       0x70bd       | 0x7018,0x702e, |
 * | User Space Interactions      |       0x70c2       | 0x7018,0x702e, |
 * |                              |                    | 0x7039,0x7045, |
 * |                              |                    | 0x7073-0x7075, |
 * |                              |                    | 0x708c,        |
 * |                              |                    | 0x70a5,0x70a6, |
 * |                              |                    | 0x70a8,0x70ab, |
 * |                              |                    | 0x70ad-0x70ae  |
 * |                              |                    | 0x70be-70c0    |
 * | Task Management              |       0x803c       | 0x8025-0x8026  |
 * |                              |                    | 0x800b,0x8039  |
 * | AER/EEH                      |       0x9011       |		|
 * | Virtual Port                 |       0xa007       |		|
 * | ISP82XX Specific             |       0xb080       | 0xb024         |
 * | ISP82XX Specific             |       0xb084       | 0xb002         |
 * |                              |                    | 0xb082,0xb083  |
 * | MultiQ                       |       0xc00c       |		|
 * | Misc                         |       0xd010       |		|
 * | Target Mode		  |	  0xe06f       |		|
+9 −1
Original line number Diff line number Diff line
@@ -2765,6 +2765,9 @@ struct qla_hw_data {
#define IS_CT6_SUPPORTED(ha)	((ha)->device_type & DT_CT6_SUPPORTED)
#define IS_MQUE_CAPABLE(ha)	((ha)->mqenable || IS_QLA83XX(ha))
#define IS_BIDI_CAPABLE(ha)	((IS_QLA25XX(ha) || IS_QLA2031(ha)))
/* Bit 21 of fw_attributes decides the MCTP capabilities */
#define IS_MCTP_CAPABLE(ha)	(IS_QLA2031(ha) && \
				((ha)->fw_attributes_ext[0] & BIT_0))

	/* HBA serial number */
	uint8_t		serial0;
@@ -2880,7 +2883,12 @@ struct qla_hw_data {
	int		fw_dump_reading;
	dma_addr_t	eft_dma;
	void		*eft;

/* Current size of mctp dump is 0x086064 bytes */
#define MCTP_DUMP_SIZE  0x086064
	dma_addr_t	mctp_dump_dma;
	void		*mctp_dump;
	int		mctp_dumped;
	int		mctp_dump_reading;
	uint32_t	chain_offset;
	struct dentry *dfs_dir;
	struct dentry *dfs_fce;
+4 −0
Original line number Diff line number Diff line
@@ -82,6 +82,7 @@ extern int __qla83xx_get_idc_control(scsi_qla_host_t *, uint32_t *);
extern void qla83xx_idc_audit(scsi_qla_host_t *, int);
extern int qla83xx_nic_core_reset(scsi_qla_host_t *);
extern void qla83xx_reset_ownership(scsi_qla_host_t *);
extern int qla2xxx_mctp_dump(scsi_qla_host_t *);

/*
 * Global Data in qla_os.c source file.
@@ -399,6 +400,9 @@ qla81xx_set_port_config(scsi_qla_host_t *, uint16_t *);
extern int
qla2x00_port_logout(scsi_qla_host_t *, struct fc_port *);

extern int
qla2x00_dump_mctp_data(scsi_qla_host_t *, dma_addr_t, uint32_t, uint32_t);

/*
 * Global Function Prototypes in qla_isr.c source file.
 */
+54 −0
Original line number Diff line number Diff line
@@ -4110,6 +4110,60 @@ qla83xx_nic_core_reset(scsi_qla_host_t *vha)
	return rval;
}

int
qla2xxx_mctp_dump(scsi_qla_host_t *vha)
{
	struct qla_hw_data *ha = vha->hw;
	int rval = QLA_FUNCTION_FAILED;

	if (!IS_MCTP_CAPABLE(ha)) {
		/* This message can be removed from the final version */
		ql_log(ql_log_info, vha, 0x506d,
		    "This board is not MCTP capable\n");
		return rval;
	}

	if (!ha->mctp_dump) {
		ha->mctp_dump = dma_alloc_coherent(&ha->pdev->dev,
		    MCTP_DUMP_SIZE, &ha->mctp_dump_dma, GFP_KERNEL);

		if (!ha->mctp_dump) {
			ql_log(ql_log_warn, vha, 0x506e,
			    "Failed to allocate memory for mctp dump\n");
			return rval;
		}
	}

#define MCTP_DUMP_STR_ADDR	0x00000000
	rval = qla2x00_dump_mctp_data(vha, ha->mctp_dump_dma,
	    MCTP_DUMP_STR_ADDR, MCTP_DUMP_SIZE/4);
	if (rval != QLA_SUCCESS) {
		ql_log(ql_log_warn, vha, 0x506f,
		    "Failed to capture mctp dump\n");
	} else {
		ql_log(ql_log_info, vha, 0x5070,
		    "Mctp dump capture for host (%ld/%p).\n",
		    vha->host_no, ha->mctp_dump);
		ha->mctp_dumped = 1;
	}

	if (!ha->flags.nic_core_reset_hdlr_active) {
		ha->flags.nic_core_reset_hdlr_active = 1;
		rval = qla83xx_restart_nic_firmware(vha);
		if (rval)
			/* NIC Core reset failed. */
			ql_log(ql_log_warn, vha, 0x5071,
			    "Failed to restart nic firmware\n");
		else
			ql_dbg(ql_dbg_p3p, vha, 0xb084,
			    "Restarted NIC firmware successfully.\n");
		ha->flags.nic_core_reset_hdlr_active = 0;
	}

	return rval;

}

/*
* qla82xx_quiescent_state_cleanup
* Description: This function will block the new I/Os
Loading