From: Chaitra P B <chaitra.basappa@broadcom.com>
To: linux-scsi@vger.kernel.org, stable@vger.kernel.org
Cc: suganath-prabu.subramani@broadcom.com,
Sathya.Prakash@broadcom.com, sreekanth.reddy@broadcom.com,
Chaitra P B <chaitra.basappa@broadcom.com>
Subject: [PATCH 11/15] mpt3sas: Report Firmware Package Version from HBA Driver.
Date: Fri, 30 Mar 2018 15:07:20 +0530 [thread overview]
Message-ID: <1522402644-3016-12-git-send-email-chaitra.basappa@broadcom.com> (raw)
In-Reply-To: <1522402644-3016-1-git-send-email-chaitra.basappa@broadcom.com>
Added function _base_display_fwpkg_version, which sends FWUpload
request to pull FW package version from FW Image Header.
Now driver prints FW package version in addition to FW
version if the PackageVersion is valid.
Signed-off-by: Chaitra P B <chaitra.basappa@broadcom.com>
Signed-off-by: Suganath Prabu S <suganath-prabu.subramani@broadcom.com>
---
drivers/scsi/mpt3sas/mpt3sas_base.c | 115 +++++++++++++++++++++++++++++++++++-
drivers/scsi/mpt3sas/mpt3sas_base.h | 1 +
2 files changed, 114 insertions(+), 2 deletions(-)
diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c
index dca0782..94c69aa 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
@@ -3825,6 +3825,111 @@ _base_display_OEMs_branding(struct MPT3SAS_ADAPTER *ioc)
}
/**
+ * _base_display_fwpkg_version - sends FWUpload request to pull FWPkg
+ * version from FW Image Header.
+ * @ioc: per adapter object
+ *
+ * Returns 0 for success, non-zero for failure.
+ */
+ static int
+_base_display_fwpkg_version(struct MPT3SAS_ADAPTER *ioc)
+{
+ Mpi2FWImageHeader_t *FWImgHdr;
+ Mpi25FWUploadRequest_t *mpi_request;
+ Mpi2FWUploadReply_t mpi_reply;
+ int r = 0;
+ void *fwpkg_data = NULL;
+ dma_addr_t fwpkg_data_dma;
+ u16 smid, ioc_status;
+ size_t data_length;
+
+ dinitprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name,
+ __func__));
+
+ if (ioc->base_cmds.status & MPT3_CMD_PENDING) {
+ pr_err(MPT3SAS_FMT "%s: internal command already in use\n",
+ ioc->name, __func__);
+ return -EAGAIN;
+ }
+
+ data_length = sizeof(Mpi2FWImageHeader_t);
+ fwpkg_data = pci_alloc_consistent(ioc->pdev, data_length,
+ &fwpkg_data_dma);
+ if (!fwpkg_data) {
+ pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
+ ioc->name, __FILE__, __LINE__, __func__);
+ return -ENOMEM;
+ }
+
+ smid = mpt3sas_base_get_smid(ioc, ioc->base_cb_idx);
+ if (!smid) {
+ pr_err(MPT3SAS_FMT "%s: failed obtaining a smid\n",
+ ioc->name, __func__);
+ r = -EAGAIN;
+ goto out;
+ }
+
+ ioc->base_cmds.status = MPT3_CMD_PENDING;
+ mpi_request = mpt3sas_base_get_msg_frame(ioc, smid);
+ ioc->base_cmds.smid = smid;
+ memset(mpi_request, 0, sizeof(Mpi25FWUploadRequest_t));
+ mpi_request->Function = MPI2_FUNCTION_FW_UPLOAD;
+ mpi_request->ImageType = MPI2_FW_UPLOAD_ITYPE_FW_FLASH;
+ mpi_request->ImageSize = data_length;
+ ioc->build_sg(ioc, &mpi_request->SGL, 0, 0, fwpkg_data_dma,
+ data_length);
+ init_completion(&ioc->base_cmds.done);
+ mpt3sas_base_put_smid_default(ioc, smid);
+ /* Wait for 15 seconds */
+ wait_for_completion_timeout(&ioc->base_cmds.done,
+ FW_IMG_HDR_READ_TIMEOUT*HZ);
+ pr_info(MPT3SAS_FMT "%s: complete\n",
+ ioc->name, __func__);
+ if (!(ioc->base_cmds.status & MPT3_CMD_COMPLETE)) {
+ pr_err(MPT3SAS_FMT "%s: timeout\n",
+ ioc->name, __func__);
+ _debug_dump_mf(mpi_request,
+ sizeof(Mpi25FWUploadRequest_t)/4);
+ r = -ETIME;
+ } else {
+ memset(&mpi_reply, 0, sizeof(Mpi2FWUploadReply_t));
+ if (ioc->base_cmds.status & MPT3_CMD_REPLY_VALID) {
+ memcpy(&mpi_reply, ioc->base_cmds.reply,
+ sizeof(Mpi2FWUploadReply_t));
+ ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
+ MPI2_IOCSTATUS_MASK;
+ if (ioc_status == MPI2_IOCSTATUS_SUCCESS) {
+ FWImgHdr = (Mpi2FWImageHeader_t *)fwpkg_data;
+ FWImgHdr->PackageVersion.Word =
+ le32_to_cpu(FWImgHdr->PackageVersion.Word);
+ if (FWImgHdr->PackageVersion.Word) {
+ pr_info(MPT3SAS_FMT "FW Package Version"
+ "(%02d.%02d.%02d.%02d)\n",
+ ioc->name,
+ ((FWImgHdr->PackageVersion.Word)
+ & 0xFF000000) >> 24,
+ ((FWImgHdr->PackageVersion.Word)
+ & 0x00FF0000) >> 16,
+ ((FWImgHdr->PackageVersion.Word)
+ & 0x0000FF00) >> 8,
+ (FWImgHdr->PackageVersion.Word)
+ & 0x000000FF);
+ }
+ } else {
+ _debug_dump_mf(&mpi_reply,
+ sizeof(Mpi2FWUploadReply_t)/4);
+ }
+ }
+ }
+ ioc->base_cmds.status = MPT3_CMD_NOT_USED;
+out:
+ if (fwpkg_data)
+ pci_free_consistent(ioc->pdev, data_length, fwpkg_data,
+ fwpkg_data_dma);
+ return r;
+}
+
+/**
* _base_display_ioc_capabilities - Disply IOC's capabilities.
* @ioc: per adapter object
*
@@ -6359,12 +6464,18 @@ _base_make_ioc_operational(struct MPT3SAS_ADAPTER *ioc)
skip_init_reply_post_host_index:
_base_unmask_interrupts(ioc);
+
+ if (ioc->hba_mpi_version_belonged != MPI2_VERSION) {
+ r = _base_display_fwpkg_version(ioc);
+ if (r)
+ return r;
+ }
+
+ _base_static_config_pages(ioc);
r = _base_event_notification(ioc);
if (r)
return r;
- _base_static_config_pages(ioc);
-
if (ioc->is_driver_loading) {
if (ioc->is_warpdrive && ioc->manu_pg10.OEMIdentifier
diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.h b/drivers/scsi/mpt3sas/mpt3sas_base.h
index 6f3329e..20fe90d 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.h
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.h
@@ -138,6 +138,7 @@
#define MAX_CHAIN_ELEMT_SZ 16
#define DEFAULT_NUM_FWCHAIN_ELEMTS 8
+#define FW_IMG_HDR_READ_TIMEOUT 15
/*
* NVMe defines
*/
--
1.8.3.1
next prev parent reply other threads:[~2018-03-30 9:39 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-30 9:37 [PATCH 00/15] mpt3sas: Enhancements and Defect fixes Chaitra P B
2018-03-30 9:37 ` [PATCH 01/15] mpt3sas: Fixed warnings Chaitra P B
2018-03-30 9:37 ` [PATCH 02/15] mpt3sas: Pre-allocate RDPQ Array at driver boot time Chaitra P B
2018-03-30 9:37 ` [PATCH 03/15] mpt3sas: Add sanity checks for scsi tracker before accessing it Chaitra P B
2018-03-30 11:59 ` Christoph Hellwig
2018-04-02 6:23 ` Sreekanth Reddy
2018-04-02 15:25 ` Bart Van Assche
2018-04-03 4:41 ` Sreekanth Reddy
2018-04-03 15:56 ` Bart Van Assche
2018-04-04 12:28 ` Sreekanth Reddy
2018-03-30 15:54 ` Bart Van Assche
2018-03-30 9:37 ` [PATCH 04/15] mpt3sas: Lockless access for chain buffers Chaitra P B
2018-03-30 9:37 ` [PATCH 05/15] mpt3sas: Optimize I/O memory consumption in driver Chaitra P B
2018-03-30 9:37 ` [PATCH 06/15] mpt3sas: Enhanced handling of Sense Buffer Chaitra P B
2018-03-30 9:37 ` [PATCH 07/15] mpt3sas: Added support for SAS Device Discovery Error Event Chaitra P B
2018-03-30 9:37 ` [PATCH 08/15] mpt3sas: Increase event log buffer to support 24 port HBA's Chaitra P B
2018-03-30 9:37 ` [PATCH 09/15] mpt3sas: Allow processing of events during driver unload Chaitra P B
2018-03-30 9:37 ` [PATCH 10/15] mpt3sas: Cache enclosure pages during enclosure add Chaitra P B
2018-03-30 9:37 ` Chaitra P B [this message]
2018-03-31 8:44 ` [PATCH 11/15] mpt3sas: Report Firmware Package Version from HBA Driver kbuild test robot
2018-03-30 9:37 ` [PATCH 12/15] mpt3sas: Update MPI Headers Chaitra P B
2018-03-30 9:37 ` [PATCH 13/15] mpt3sas: For NVME device, issue a protocol level reset instead of hot reset and use TM timeout value exposed in PCIe Device Page 2 Chaitra P B
2018-03-30 9:37 ` [PATCH 14/15] mpt3sas: fix possible memory leak Chaitra P B
2018-03-30 9:37 ` [PATCH 15/15] mpt3sas: Update driver version "25.100.00.00" Chaitra P B
2018-03-30 9:58 ` [PATCH 00/15] mpt3sas: Enhancements and Defect fixes Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1522402644-3016-12-git-send-email-chaitra.basappa@broadcom.com \
--to=chaitra.basappa@broadcom.com \
--cc=Sathya.Prakash@broadcom.com \
--cc=linux-scsi@vger.kernel.org \
--cc=sreekanth.reddy@broadcom.com \
--cc=stable@vger.kernel.org \
--cc=suganath-prabu.subramani@broadcom.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox