diff mbox series

[6/8] mpt3sas: Add MPI triggers persistent Trigger Page4

Message ID 20201124035019.27975-7-suganath-prabu.subramani@broadcom.com (mailing list archive)
State Superseded
Headers show
Series mpt3sas: Features to enhance driver debugging. | expand

Commit Message

Suganath Prabu S Nov. 24, 2020, 3:50 a.m. UTC
Description:
This trigger page is used store information about
MPI (IOC Status & LogInfo) triggers.

Driver Persistent Trigger Page-4 format:
-------------------------------------------------------
| 31       24 23           16 15         8 7          0|  Byte
-------------------------------------------------------
| PageType   | PageNumber    | Reserved	 | PageVersion |  0x00
--------------------------------------------------------
| Reserved   | ExtPageType   |      ExtPageLength      |  0x04
--------------------------------------------------------
|          Reserved	     | NumMpiTriggerEntries    |  0x08
--------------------------------------------------------
|	      MPITriggerEntry[0]		       |  0x0C
--------------------------------------------------------
|		…                                      |
--------------------------------------------------------
|	     MPITriggerEntry[19]	   	       |  0xA4
--------------------------------------------------------

NumMpiTriggerEntries:
This field indicates number of MPI (IOC Status & LogInfo)
trigger entries stored in this page. Currently driver is supporting
a maximum of 20-MPI trigger entries.

MPITriggerEntry:
-----------------------------------------------------
| 31                    16 15                     0 |
-----------------------------------------------------
|        Reserved         |      IOCStatus	    |
-----------------------------------------------------
|                   IOCLogInfo	                    |
-----------------------------------------------------

IOCStatus  => Status value from the IOC
IOCLogInfo => Specific value that supplements the IOCStatus.

During driver load:
 If MPI trigger type bit is enabled in the Persistent
 Trigger Page0 then read the Persistent Trigger Page4 and update the
 ioc instances diag_trigger_mpi.MPITriggerEntry with Persistent
 Trigger Page4's MPITriggerEntries. This will restores the
 MPI trigger type's triggers which are enabled before.

When user modifies the MPI trigger type triggers:
 When user sets/clears the MPI trigger type triggers then driver
 fisrt checks whether IOC firmware supports trigger pages support
 or not. if firmware supports these pages then driver enables the
 MPI trigger type bit in Persistent Trigger Page0 (if it was not
 enabled before) and updates the user provided trigger values in
 Persistent Trigger Page4.

Signed-off-by: Suganath Prabu S <suganath-prabu.subramani@broadcom.com>
---
 drivers/scsi/mpt3sas/mpt3sas_base.c   |  61 +++++++++-
 drivers/scsi/mpt3sas/mpt3sas_base.h   |   3 +
 drivers/scsi/mpt3sas/mpt3sas_config.c | 158 ++++++++++++++++++++++++++
 3 files changed, 221 insertions(+), 1 deletion(-)

Comments

kernel test robot Nov. 24, 2020, 11:03 a.m. UTC | #1
Hi Suganath,

I love your patch! Perhaps something to improve:

[auto build test WARNING on scsi/for-next]
[also build test WARNING on mkp-scsi/for-next v5.10-rc5 next-20201123]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Suganath-Prabu-S/mpt3sas-Features-to-enhance-driver-debugging/20201124-115842
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next
config: x86_64-rhel (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce (this is a W=1 build):
        # https://github.com/0day-ci/linux/commit/d13faa942966ed911558ffa9c1fb021847f72632
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Suganath-Prabu-S/mpt3sas-Features-to-enhance-driver-debugging/20201124-115842
        git checkout d13faa942966ed911558ffa9c1fb021847f72632
        # save the attached .config to linux build tree
        make W=1 ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   drivers/scsi/mpt3sas/mpt3sas_config.c:1793:1: warning: no previous prototype for '_config_set_driver_trigger_pg0' [-Wmissing-prototypes]
    1793 | _config_set_driver_trigger_pg0(struct MPT3SAS_ADAPTER *ioc,
         | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/scsi/mpt3sas/mpt3sas_config.c:1835:1: warning: no previous prototype for 'mpt3sas_config_update_driver_trigger_pg0' [-Wmissing-prototypes]
    1835 | mpt3sas_config_update_driver_trigger_pg0(struct MPT3SAS_ADAPTER *ioc,
         | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/scsi/mpt3sas/mpt3sas_config.c:1927:1: warning: no previous prototype for '_config_set_driver_trigger_pg1' [-Wmissing-prototypes]
    1927 | _config_set_driver_trigger_pg1(struct MPT3SAS_ADAPTER *ioc,
         | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/scsi/mpt3sas/mpt3sas_config.c:1969:1: warning: no previous prototype for 'mpt3sas_config_update_driver_trigger_pg1' [-Wmissing-prototypes]
    1969 | mpt3sas_config_update_driver_trigger_pg1(struct MPT3SAS_ADAPTER *ioc,
         | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/scsi/mpt3sas/mpt3sas_config.c:2078:1: warning: no previous prototype for '_config_set_driver_trigger_pg2' [-Wmissing-prototypes]
    2078 | _config_set_driver_trigger_pg2(struct MPT3SAS_ADAPTER *ioc,
         | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/scsi/mpt3sas/mpt3sas_config.c:2120:1: warning: no previous prototype for 'mpt3sas_config_update_driver_trigger_pg2' [-Wmissing-prototypes]
    2120 | mpt3sas_config_update_driver_trigger_pg2(struct MPT3SAS_ADAPTER *ioc,
         | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/scsi/mpt3sas/mpt3sas_config.c:2238:1: warning: no previous prototype for '_config_set_driver_trigger_pg3' [-Wmissing-prototypes]
    2238 | _config_set_driver_trigger_pg3(struct MPT3SAS_ADAPTER *ioc,
         | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/scsi/mpt3sas/mpt3sas_config.c:2280:1: warning: no previous prototype for 'mpt3sas_config_update_driver_trigger_pg3' [-Wmissing-prototypes]
    2280 | mpt3sas_config_update_driver_trigger_pg3(struct MPT3SAS_ADAPTER *ioc,
         | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/scsi/mpt3sas/mpt3sas_config.c:2395:1: warning: no previous prototype for '_config_set_driver_trigger_pg4' [-Wmissing-prototypes]
    2395 | _config_set_driver_trigger_pg4(struct MPT3SAS_ADAPTER *ioc,
         | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/scsi/mpt3sas/mpt3sas_config.c:2437:1: warning: no previous prototype for 'mpt3sas_config_update_driver_trigger_pg4' [-Wmissing-prototypes]
    2437 | mpt3sas_config_update_driver_trigger_pg4(struct MPT3SAS_ADAPTER *ioc,
         | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

vim +/_config_set_driver_trigger_pg4 +2395 drivers/scsi/mpt3sas/mpt3sas_config.c

  2384	
  2385	/**
  2386	 * mpt3sas_config_set_driver_trigger_pg4 - write driver trigger page 4
  2387	 * @ioc: per adapter object
  2388	 * @mpi_reply: reply mf payload returned from firmware
  2389	 * @config_page: contents of the config page
  2390	 * Context: sleep.
  2391	 *
  2392	 * Returns 0 for success, non-zero for failure.
  2393	 */
  2394	int
> 2395	_config_set_driver_trigger_pg4(struct MPT3SAS_ADAPTER *ioc,
  2396		Mpi2ConfigReply_t *mpi_reply, Mpi26DriverTriggerPage4_t *config_page)
  2397	{
  2398		Mpi2ConfigRequest_t mpi_request;
  2399		int r;
  2400	
  2401		memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t));
  2402		mpi_request.Function = MPI2_FUNCTION_CONFIG;
  2403		mpi_request.Action = MPI2_CONFIG_ACTION_PAGE_HEADER;
  2404		mpi_request.Header.PageType = MPI2_CONFIG_PAGETYPE_EXTENDED;
  2405		mpi_request.ExtPageType =
  2406		    MPI2_CONFIG_EXTPAGETYPE_DRIVER_PERSISTENT_TRIGGER;
  2407		mpi_request.Header.PageNumber = 4;
  2408		mpi_request.Header.PageVersion = MPI26_DRIVER_TRIGGER_PAGE4_PAGEVERSION;
  2409		ioc->build_zero_len_sge_mpi(ioc, &mpi_request.PageBufferSGE);
  2410		r = _config_request(ioc, &mpi_request, mpi_reply,
  2411		    MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT, NULL, 0);
  2412		if (r)
  2413			goto out;
  2414	
  2415		mpi_request.Action = MPI2_CONFIG_ACTION_PAGE_WRITE_CURRENT;
  2416		_config_request(ioc, &mpi_request, mpi_reply,
  2417		    MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT, config_page,
  2418		    sizeof(*config_page));
  2419		mpi_request.Action = MPI2_CONFIG_ACTION_PAGE_WRITE_NVRAM;
  2420		r = _config_request(ioc, &mpi_request, mpi_reply,
  2421		    MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT, config_page,
  2422		    sizeof(*config_page));
  2423	 out:
  2424		return r;
  2425	}
  2426	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
kernel test robot Nov. 24, 2020, 12:05 p.m. UTC | #2
Hi Suganath,

I love your patch! Perhaps something to improve:

[auto build test WARNING on scsi/for-next]
[also build test WARNING on mkp-scsi/for-next v5.10-rc5 next-20201123]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Suganath-Prabu-S/mpt3sas-Features-to-enhance-driver-debugging/20201124-115842
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next
config: i386-randconfig-s001-20201124 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.3-151-g540c2c4b-dirty
        # https://github.com/0day-ci/linux/commit/d13faa942966ed911558ffa9c1fb021847f72632
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Suganath-Prabu-S/mpt3sas-Features-to-enhance-driver-debugging/20201124-115842
        git checkout d13faa942966ed911558ffa9c1fb021847f72632
        # save the attached .config to linux build tree
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=i386 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


"sparse warnings: (new ones prefixed by >>)"
   drivers/scsi/mpt3sas/mpt3sas_config.c:1793:1: sparse: sparse: symbol '_config_set_driver_trigger_pg0' was not declared. Should it be static?
   drivers/scsi/mpt3sas/mpt3sas_config.c:1835:1: sparse: sparse: symbol 'mpt3sas_config_update_driver_trigger_pg0' was not declared. Should it be static?
   drivers/scsi/mpt3sas/mpt3sas_config.c:1927:1: sparse: sparse: symbol '_config_set_driver_trigger_pg1' was not declared. Should it be static?
   drivers/scsi/mpt3sas/mpt3sas_config.c:1969:1: sparse: sparse: symbol 'mpt3sas_config_update_driver_trigger_pg1' was not declared. Should it be static?
   drivers/scsi/mpt3sas/mpt3sas_config.c:2078:1: sparse: sparse: symbol '_config_set_driver_trigger_pg2' was not declared. Should it be static?
   drivers/scsi/mpt3sas/mpt3sas_config.c:2120:1: sparse: sparse: symbol 'mpt3sas_config_update_driver_trigger_pg2' was not declared. Should it be static?
   drivers/scsi/mpt3sas/mpt3sas_config.c:2238:1: sparse: sparse: symbol '_config_set_driver_trigger_pg3' was not declared. Should it be static?
   drivers/scsi/mpt3sas/mpt3sas_config.c:2280:1: sparse: sparse: symbol 'mpt3sas_config_update_driver_trigger_pg3' was not declared. Should it be static?
>> drivers/scsi/mpt3sas/mpt3sas_config.c:2395:1: sparse: sparse: symbol '_config_set_driver_trigger_pg4' was not declared. Should it be static?
   drivers/scsi/mpt3sas/mpt3sas_config.c:2437:1: sparse: sparse: symbol 'mpt3sas_config_update_driver_trigger_pg4' was not declared. Should it be static?

Please review and possibly fold the followup patch.

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
diff mbox series

Patch

diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c
index 75c0c64..ee86124 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
@@ -4899,6 +4899,59 @@  _base_get_scsi_diag_triggers(struct MPT3SAS_ADAPTER *ioc)
 	}
 }
 
+/**
+ * _base_get_mpi_diag_triggers - get mpi diag trigger values from
+ *				persistent pages
+ * @ioc : per adapter object
+ *
+ * Return nothing.
+ */
+static void
+_base_get_mpi_diag_triggers(struct MPT3SAS_ADAPTER *ioc)
+{
+	Mpi26DriverTriggerPage4_t trigger_pg4;
+	struct SL_WH_MPI_TRIGGER_T *status_tg;
+	MPI26_DRIVER_IOCSTATUS_LOGINFO_TIGGER_ENTRY *mpi_status_tg;
+	Mpi2ConfigReply_t mpi_reply;
+	int r = 0, i = 0;
+	u16 count = 0;
+	u16 ioc_status;
+
+	r = mpt3sas_config_get_driver_trigger_pg4(ioc, &mpi_reply,
+	    &trigger_pg4);
+	if (r)
+		return;
+
+	ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
+	    MPI2_IOCSTATUS_MASK;
+	if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
+		dinitprintk(ioc,
+		    ioc_err(ioc,
+		    "%s: Failed to get trigger pg4, ioc_status(0x%04x)\n",
+		    __func__, ioc_status));
+		return;
+	}
+
+	if (le16_to_cpu(trigger_pg4.NumIOCStatusLogInfoTrigger)) {
+		count = le16_to_cpu(trigger_pg4.NumIOCStatusLogInfoTrigger);
+		count = min_t(u16, NUM_VALID_ENTRIES, count);
+		ioc->diag_trigger_mpi.ValidEntries = count;
+
+		status_tg = &ioc->diag_trigger_mpi.MPITriggerEntry[0];
+		mpi_status_tg = &trigger_pg4.IOCStatusLoginfoTriggers[0];
+
+		for (i = 0; i < count; i++) {
+			status_tg->IOCStatus = le16_to_cpu(
+			    mpi_status_tg->IOCStatus);
+			status_tg->IocLogInfo = le32_to_cpu(
+			    mpi_status_tg->LogInfo);
+
+			status_tg++;
+			mpi_status_tg++;
+		}
+	}
+}
+
 /**
  * _base_get_master_diag_triggers - get master diag trigger values from
  *				persistent pages
@@ -5011,7 +5064,13 @@  _base_get_diag_triggers(struct MPT3SAS_ADAPTER *ioc)
 	if ((u16)trigger_flags &
 	    MPI26_DRIVER_TRIGGER0_FLAG_SCSI_SENSE_TRIGGER_VALID)
 		_base_get_scsi_diag_triggers(ioc);
-
+	/*
+	 * Retrieve mpi error diag trigger values from driver trigger pg4
+	 * if loginfo trigger bit enabled in TriggerFlags.
+	 */
+	if ((u16)trigger_flags &
+	    MPI26_DRIVER_TRIGGER0_FLAG_LOGINFO_TRIGGER_VALID)
+		_base_get_mpi_diag_triggers(ioc);
 }
 
 /**
diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.h b/drivers/scsi/mpt3sas/mpt3sas_base.h
index 6c3bc50..6745d79 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.h
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.h
@@ -1831,6 +1831,9 @@  mpt3sas_config_get_driver_trigger_pg2(struct MPT3SAS_ADAPTER *ioc,
 int
 mpt3sas_config_get_driver_trigger_pg3(struct MPT3SAS_ADAPTER *ioc,
 	Mpi2ConfigReply_t *mpi_reply, Mpi26DriverTriggerPage3_t *config_page);
+int
+mpt3sas_config_get_driver_trigger_pg4(struct MPT3SAS_ADAPTER *ioc,
+	Mpi2ConfigReply_t *mpi_reply, Mpi26DriverTriggerPage4_t *config_page);
 
 /* ctl shared API */
 extern struct device_attribute *mpt3sas_host_attrs[];
diff --git a/drivers/scsi/mpt3sas/mpt3sas_config.c b/drivers/scsi/mpt3sas/mpt3sas_config.c
index 98b6a59..c3aaaab 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_config.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_config.c
@@ -2344,6 +2344,164 @@  out:
 	return rc;
 }
 
+/**
+ * mpt3sas_config_get_driver_trigger_pg4 - obtain driver trigger page 4
+ * @ioc: per adapter object
+ * @mpi_reply: reply mf payload returned from firmware
+ * @config_page: contents of the config page
+ * Context: sleep.
+ *
+ * Returns 0 for success, non-zero for failure.
+ */
+int
+mpt3sas_config_get_driver_trigger_pg4(struct MPT3SAS_ADAPTER *ioc,
+	Mpi2ConfigReply_t *mpi_reply, Mpi26DriverTriggerPage4_t *config_page)
+{
+	Mpi2ConfigRequest_t mpi_request;
+	int r;
+
+	memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t));
+	mpi_request.Function = MPI2_FUNCTION_CONFIG;
+	mpi_request.Action = MPI2_CONFIG_ACTION_PAGE_HEADER;
+	mpi_request.Header.PageType = MPI2_CONFIG_PAGETYPE_EXTENDED;
+	mpi_request.ExtPageType =
+	    MPI2_CONFIG_EXTPAGETYPE_DRIVER_PERSISTENT_TRIGGER;
+	mpi_request.Header.PageNumber = 4;
+	mpi_request.Header.PageVersion = MPI26_DRIVER_TRIGGER_PAGE4_PAGEVERSION;
+	ioc->build_zero_len_sge_mpi(ioc, &mpi_request.PageBufferSGE);
+	r = _config_request(ioc, &mpi_request, mpi_reply,
+	    MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT, NULL, 0);
+	if (r)
+		goto out;
+
+	mpi_request.Action = MPI2_CONFIG_ACTION_PAGE_READ_CURRENT;
+	r = _config_request(ioc, &mpi_request, mpi_reply,
+	    MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT, config_page,
+	    sizeof(*config_page));
+ out:
+	return r;
+}
+
+/**
+ * mpt3sas_config_set_driver_trigger_pg4 - write driver trigger page 4
+ * @ioc: per adapter object
+ * @mpi_reply: reply mf payload returned from firmware
+ * @config_page: contents of the config page
+ * Context: sleep.
+ *
+ * Returns 0 for success, non-zero for failure.
+ */
+int
+_config_set_driver_trigger_pg4(struct MPT3SAS_ADAPTER *ioc,
+	Mpi2ConfigReply_t *mpi_reply, Mpi26DriverTriggerPage4_t *config_page)
+{
+	Mpi2ConfigRequest_t mpi_request;
+	int r;
+
+	memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t));
+	mpi_request.Function = MPI2_FUNCTION_CONFIG;
+	mpi_request.Action = MPI2_CONFIG_ACTION_PAGE_HEADER;
+	mpi_request.Header.PageType = MPI2_CONFIG_PAGETYPE_EXTENDED;
+	mpi_request.ExtPageType =
+	    MPI2_CONFIG_EXTPAGETYPE_DRIVER_PERSISTENT_TRIGGER;
+	mpi_request.Header.PageNumber = 4;
+	mpi_request.Header.PageVersion = MPI26_DRIVER_TRIGGER_PAGE4_PAGEVERSION;
+	ioc->build_zero_len_sge_mpi(ioc, &mpi_request.PageBufferSGE);
+	r = _config_request(ioc, &mpi_request, mpi_reply,
+	    MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT, NULL, 0);
+	if (r)
+		goto out;
+
+	mpi_request.Action = MPI2_CONFIG_ACTION_PAGE_WRITE_CURRENT;
+	_config_request(ioc, &mpi_request, mpi_reply,
+	    MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT, config_page,
+	    sizeof(*config_page));
+	mpi_request.Action = MPI2_CONFIG_ACTION_PAGE_WRITE_NVRAM;
+	r = _config_request(ioc, &mpi_request, mpi_reply,
+	    MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT, config_page,
+	    sizeof(*config_page));
+ out:
+	return r;
+}
+
+/**
+ * mpt3sas_config_update_driver_trigger_pg4 - update driver trigger page 4
+ * @ioc: per adapter object
+ * @trigger_flags: trigger type bit map
+ * @set: set ot clear trigger values
+ * Context: sleep.
+ *
+ * Returns 0 for success, non-zero for failure.
+ */
+int
+mpt3sas_config_update_driver_trigger_pg4(struct MPT3SAS_ADAPTER *ioc,
+	struct SL_WH_MPI_TRIGGERS_T *mpi_tg, bool set)
+{
+	Mpi26DriverTriggerPage4_t tg_pg4;
+	Mpi2ConfigReply_t mpi_reply;
+	int rc, i, count;
+	u16 ioc_status;
+
+	rc = mpt3sas_config_update_driver_trigger_pg0(ioc,
+	    MPI26_DRIVER_TRIGGER0_FLAG_LOGINFO_TRIGGER_VALID, set);
+	if (rc)
+		return rc;
+
+	rc = mpt3sas_config_get_driver_trigger_pg4(ioc, &mpi_reply, &tg_pg4);
+	if (rc)
+		goto out;
+
+	ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
+	    MPI2_IOCSTATUS_MASK;
+	if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
+		dcprintk(ioc,
+		    ioc_err(ioc,
+		    "%s: Failed to get trigger pg4, ioc_status(0x%04x)\n",
+		    __func__, ioc_status));
+		rc = -EFAULT;
+		goto out;
+	}
+
+	if (set) {
+		count = mpi_tg->ValidEntries;
+		tg_pg4.NumIOCStatusLogInfoTrigger = cpu_to_le16(count);
+		for (i = 0; i < count; i++) {
+			tg_pg4.IOCStatusLoginfoTriggers[i].IOCStatus =
+			    cpu_to_le16(mpi_tg->MPITriggerEntry[i].IOCStatus);
+			tg_pg4.IOCStatusLoginfoTriggers[i].LogInfo =
+			    cpu_to_le32(mpi_tg->MPITriggerEntry[i].IocLogInfo);
+		}
+	} else {
+		tg_pg4.NumIOCStatusLogInfoTrigger = 0;
+		memset(&tg_pg4.IOCStatusLoginfoTriggers[0], 0,
+		    NUM_VALID_ENTRIES * sizeof(
+		    MPI26_DRIVER_IOCSTATUS_LOGINFO_TIGGER_ENTRY));
+	}
+
+	rc = _config_set_driver_trigger_pg4(ioc, &mpi_reply, &tg_pg4);
+	if (rc)
+		goto out;
+
+	ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
+	    MPI2_IOCSTATUS_MASK;
+	if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
+		dcprintk(ioc,
+		    ioc_err(ioc,
+		    "%s: Failed to get trigger pg4, ioc_status(0x%04x)\n",
+		    __func__, ioc_status));
+		rc = -EFAULT;
+		goto out;
+	}
+
+	return 0;
+
+out:
+	mpt3sas_config_update_driver_trigger_pg0(ioc,
+	    MPI26_DRIVER_TRIGGER0_FLAG_LOGINFO_TRIGGER_VALID, !set);
+
+	return rc;
+}
+
 /**
  * mpt3sas_config_get_volume_handle - returns volume handle for give hidden
  * raid components