forked from torvalds/linux
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mpt3sas: Add persistent trigger pages support
Problem statement: User sets the tigger value inorder to collect the IOC's Host tace buffer automicatically upon detecting the trigger condition. But the tigger values that the user has set are not persistent across the system reboot or reload of driver. User has to set them eveytime upon rebooting, realoding the driver or when HBA is moved to another system. Solution: Inorder to make the user trigger settings persistant, these trigger values needs to be saved in IOC's pages and IOC provides below pages to save them, * Driver Persistent Trigger Page 0 : This page is used to know list of trigger types that are enabled * Driver Persistent Trigger Page 1 : This page stores the list of Mater triggers that are enabled * Driver Persistent Trigger Page 2 : This page stores the list of MPI Event Triggers that are enabled * Driver Persistent Trigger Page 3 : This page stores the list of SCSI Sense Triggers that are enabled * Driver Persistent Trigger Page 4 : This page stores the list of IOCStatus-LogInfo Triggers that are enabled. * Whenever user configure the trigger values then driver writes the configured trigger values in the corresponding trigger pages. * During next driver load time, driver reads the trigger values from these pages and configures the trigger values accordingly. * During firmware upload operation, * if the newer firmware supports these driver trigger pages then driver write backs the configured diag trigger values on driver trigger pages of IOC. * if the newer firmware doesn't supports these driver trigger pages then driver clear the supporting trigger flag so that whenever user modifies the trigger values then driver won't do any config write operations to driver trigger pages. Current patch change set: * During driver load, driver will first read Persistent Trigger Page0. - If this page's read operation fails then it means that IOC firmware doesn't support these Persistent Trigger Pages, i.e. current feature of saving/restoring the tigger values is not enabled in the IOC. So, driver can't read/store user trigger values from/to Persistent triggers pages. - If this Page's read opearation is successful then it means that IOC firmware supports storing the trigger values on persistent trigger pages. So, driver sets the supports_trigger_pages ioc variable to one. On reading this page, driver will get to know which are all the trigger types that are enabled before the driver load. * And added below helper functions to read & modify Persistent Trigger Page0. - mpt3sas_config_get_driver_trigger_pg0 : reads the page, - mpt3sas_config_set_driver_trigger_pg0 : writes the page, - mpt3sas_config_update_driver_trigger_pg0 : When user adds any new trigger values then driver enable the corresponding trigger type bit in 'TriggerFlags' field of Persistent Trigger Page0 (if it was not enabled before) before adding these trigger values to corresponding Persistent Trigger type pages. Signed-off-by: Suganath Prabu S <suganath-prabu.subramani@broadcom.com>
- Loading branch information
1 parent
25de902
commit 6ef897d
Showing
4 changed files
with
304 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
/* SPDX-License-Identifier: GPL-2.0-or-later */ | ||
|
||
/* | ||
* This is the Fusion MPT base driver providing common API layer interface | ||
* to store diag trigger values into persistent driver triggers pages | ||
* for MPT (Message Passing Technology) based controllers. | ||
* | ||
* Copyright (C) 2020 Broadcom Inc. | ||
* | ||
* Authors: Broadcom Inc. | ||
* Sreekanth Reddy <sreekanth.reddy@broadcom.com> | ||
* | ||
* Send feedback to : MPT-FusionLinux.pdl@broadcom.com) | ||
*/ | ||
|
||
#include "mpi/mpi2_cnfg.h" | ||
|
||
#ifndef MPI2_TRIGGER_PAGES_H | ||
#define MPI2_TRIGGER_PAGES_H | ||
|
||
#define MPI2_CONFIG_EXTPAGETYPE_DRIVER_PERSISTENT_TRIGGER (0xE0) | ||
#define MPI26_DRIVER_TRIGGER_PAGE0_PAGEVERSION (0x01) | ||
typedef struct _MPI26_CONFIG_PAGE_DRIVER_TIGGER_0 { | ||
MPI2_CONFIG_EXTENDED_PAGE_HEADER Header; /* 0x00 */ | ||
U16 TriggerFlags; /* 0x08 */ | ||
U16 Reserved0xA; /* 0x0A */ | ||
U32 Reserved0xC[61]; /* 0x0C */ | ||
} _MPI26_CONFIG_PAGE_DRIVER_TIGGER_0, Mpi26DriverTriggerPage0_t; | ||
|
||
/* Trigger Flags */ | ||
#define MPI26_DRIVER_TRIGGER0_FLAG_MASTER_TRIGGER_VALID (0x0001) | ||
#define MPI26_DRIVER_TRIGGER0_FLAG_MPI_EVENT_TRIGGER_VALID (0x0002) | ||
#define MPI26_DRIVER_TRIGGER0_FLAG_SCSI_SENSE_TRIGGER_VALID (0x0004) | ||
#define MPI26_DRIVER_TRIGGER0_FLAG_LOGINFO_TRIGGER_VALID (0x0008) | ||
|
||
#define MPI26_DRIVER_TRIGGER_PAGE1_PAGEVERSION (0x01) | ||
typedef struct _MPI26_DRIVER_MASTER_TIGGER_ENTRY { | ||
U32 MasterTriggerFlags; | ||
} MPI26_DRIVER_MASTER_TIGGER_ENTRY; | ||
|
||
#define MPI26_MAX_MASTER_TRIGGERS (1) | ||
typedef struct _MPI26_CONFIG_PAGE_DRIVER_TIGGER_1 { | ||
MPI2_CONFIG_EXTENDED_PAGE_HEADER Header; /* 0x00 */ | ||
U16 NumMasterTrigger; /* 0x08 */ | ||
U16 Reserved0xA; /* 0x0A */ | ||
MPI26_DRIVER_MASTER_TIGGER_ENTRY MasterTriggers[MPI26_MAX_MASTER_TRIGGERS]; /* 0x0C */ | ||
} MPI26_CONFIG_PAGE_DRIVER_TIGGER_1, Mpi26DriverTriggerPage1_t; | ||
|
||
#define MPI26_DRIVER_TRIGGER_PAGE2_PAGEVERSION (0x01) | ||
typedef struct _MPI26_DRIVER_MPI_EVENT_TIGGER_ENTRY { | ||
U16 MPIEventCode; /* 0x00 */ | ||
U16 MPIEventCodeSpecific; /* 0x02 */ | ||
} MPI26_DRIVER_MPI_EVENT_TIGGER_ENTRY; | ||
|
||
#define MPI26_MAX_MPI_EVENT_TRIGGERS (20) | ||
typedef struct _MPI26_CONFIG_PAGE_DRIVER_TIGGER_2 { | ||
MPI2_CONFIG_EXTENDED_PAGE_HEADER Header; /* 0x00 */ | ||
U16 NumMPIEventTrigger; /* 0x08 */ | ||
U16 Reserved0xA; /* 0x0A */ | ||
MPI26_DRIVER_MPI_EVENT_TIGGER_ENTRY MPIEventTriggers[MPI26_MAX_MPI_EVENT_TRIGGERS]; /* 0x0C */ | ||
} MPI26_CONFIG_PAGE_DRIVER_TIGGER_2, Mpi26DriverTriggerPage2_t; | ||
|
||
#define MPI26_DRIVER_TRIGGER_PAGE3_PAGEVERSION (0x01) | ||
typedef struct _MPI26_DRIVER_SCSI_SENSE_TIGGER_ENTRY { | ||
U8 ASCQ; /* 0x00 */ | ||
U8 ASC; /* 0x01 */ | ||
U8 SenseKey; /* 0x02 */ | ||
U8 Reserved; /* 0x03 */ | ||
} MPI26_DRIVER_SCSI_SENSE_TIGGER_ENTRY; | ||
|
||
#define MPI26_MAX_SCSI_SENSE_TRIGGERS (20) | ||
typedef struct _MPI26_CONFIG_PAGE_DRIVER_TIGGER_3 { | ||
MPI2_CONFIG_EXTENDED_PAGE_HEADER Header; /* 0x00 */ | ||
U16 NumSCSISenseTrigger; /* 0x08 */ | ||
U16 Reserved0xA; /* 0x0A */ | ||
MPI26_DRIVER_SCSI_SENSE_TIGGER_ENTRY SCSISenseTriggers[MPI26_MAX_SCSI_SENSE_TRIGGERS]; /* 0x0C */ | ||
} MPI26_CONFIG_PAGE_DRIVER_TIGGER_3, Mpi26DriverTriggerPage3_t; | ||
|
||
#define MPI26_DRIVER_TRIGGER_PAGE4_PAGEVERSION (0x01) | ||
typedef struct _MPI26_DRIVER_IOCSTATUS_LOGINFO_TIGGER_ENTRY { | ||
U16 IOCStatus; /* 0x00 */ | ||
U16 Reserved; /* 0x02 */ | ||
U32 LogInfo; /* 0x04 */ | ||
} MPI26_DRIVER_IOCSTATUS_LOGINFO_TIGGER_ENTRY; | ||
|
||
#define MPI26_MAX_LOGINFO_TRIGGERS (20) | ||
typedef struct _MPI26_CONFIG_PAGE_DRIVER_TIGGER_4 { | ||
MPI2_CONFIG_EXTENDED_PAGE_HEADER Header; /* 0x00 */ | ||
U16 NumIOCStatusLogInfoTrigger; /* 0x08 */ | ||
U16 Reserved0xA; /* 0x0A */ | ||
MPI26_DRIVER_IOCSTATUS_LOGINFO_TIGGER_ENTRY IOCStatusLoginfoTriggers[MPI26_MAX_LOGINFO_TRIGGERS]; /* 0x0C */ | ||
} MPI26_CONFIG_PAGE_DRIVER_TIGGER_4, Mpi26DriverTriggerPage4_t; | ||
|
||
#endif | ||
|