aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorSreekanth Reddy <sreekanth.reddy@avagotech.com>2014-09-12 06:05:26 -0400
committerChristoph Hellwig <hch@lst.de>2014-09-16 12:14:18 -0400
commit0f624c391ecbf18e69b20d681f7e3c52b4ef02c1 (patch)
tree5debd9c5370127afbf4383786e46300292171e27 /drivers
parent861ff736c8d8ae574dcc1ef81e5da84ff85e70c9 (diff)
mpt3sas: Clear PFA Status on SGPIO when PFA Drive is Removed or Replaced
Added code to send an SEP message that turns off the Predictive Failure LED when a drive is removed (if Predictive Failure LED was turned on). Added a new flag 'pfa_led_on' per device that tracks the status of Predictive Failure LED. When the drive is removed, this flag is checked and sends an SEP message to turn off the respective Predictive Failure LED. Signed-off-by: Sreekanth Reddy <Sreekanth.Reddy@avagotech.com> Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/scsi/mpt3sas/mpt3sas_base.h5
-rw-r--r--drivers/scsi/mpt3sas/mpt3sas_scsih.c67
2 files changed, 61 insertions, 11 deletions
diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.h b/drivers/scsi/mpt3sas/mpt3sas_base.h
index 9b90a6fef706..184826c20874 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.h
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.h
@@ -272,8 +272,10 @@ struct _internal_cmd {
272 * @channel: target channel 272 * @channel: target channel
273 * @slot: number number 273 * @slot: number number
274 * @phy: phy identifier provided in sas device page 0 274 * @phy: phy identifier provided in sas device page 0
275 * @fast_path: fast path feature enable bit
276 * @responding: used in _scsih_sas_device_mark_responding 275 * @responding: used in _scsih_sas_device_mark_responding
276 * @fast_path: fast path feature enable bit
277 * @pfa_led_on: flag for PFA LED status
278 *
277 */ 279 */
278struct _sas_device { 280struct _sas_device {
279 struct list_head list; 281 struct list_head list;
@@ -293,6 +295,7 @@ struct _sas_device {
293 u8 phy; 295 u8 phy;
294 u8 responding; 296 u8 responding;
295 u8 fast_path; 297 u8 fast_path;
298 u8 pfa_led_on;
296}; 299};
297 300
298/** 301/**
diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
index 135f12c20ecf..77a5bfa100f8 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
@@ -159,7 +159,7 @@ struct sense_info {
159}; 159};
160 160
161#define MPT3SAS_PROCESS_TRIGGER_DIAG (0xFFFB) 161#define MPT3SAS_PROCESS_TRIGGER_DIAG (0xFFFB)
162#define MPT3SAS_TURN_ON_FAULT_LED (0xFFFC) 162#define MPT3SAS_TURN_ON_PFA_LED (0xFFFC)
163#define MPT3SAS_PORT_ENABLE_COMPLETE (0xFFFD) 163#define MPT3SAS_PORT_ENABLE_COMPLETE (0xFFFD)
164#define MPT3SAS_ABRT_TASK_SET (0xFFFE) 164#define MPT3SAS_ABRT_TASK_SET (0xFFFE)
165#define MPT3SAS_REMOVE_UNRESPONDING_DEVICES (0xFFFF) 165#define MPT3SAS_REMOVE_UNRESPONDING_DEVICES (0xFFFF)
@@ -3885,7 +3885,7 @@ _scsih_scsi_ioc_info(struct MPT3SAS_ADAPTER *ioc, struct scsi_cmnd *scmd,
3885#endif 3885#endif
3886 3886
3887/** 3887/**
3888 * _scsih_turn_on_fault_led - illuminate Fault LED 3888 * _scsih_turn_on_pfa_led - illuminate PFA LED
3889 * @ioc: per adapter object 3889 * @ioc: per adapter object
3890 * @handle: device handle 3890 * @handle: device handle
3891 * Context: process 3891 * Context: process
@@ -3893,10 +3893,15 @@ _scsih_scsi_ioc_info(struct MPT3SAS_ADAPTER *ioc, struct scsi_cmnd *scmd,
3893 * Return nothing. 3893 * Return nothing.
3894 */ 3894 */
3895static void 3895static void
3896_scsih_turn_on_fault_led(struct MPT3SAS_ADAPTER *ioc, u16 handle) 3896_scsih_turn_on_pfa_led(struct MPT3SAS_ADAPTER *ioc, u16 handle)
3897{ 3897{
3898 Mpi2SepReply_t mpi_reply; 3898 Mpi2SepReply_t mpi_reply;
3899 Mpi2SepRequest_t mpi_request; 3899 Mpi2SepRequest_t mpi_request;
3900 struct _sas_device *sas_device;
3901
3902 sas_device = _scsih_sas_device_find_by_handle(ioc, handle);
3903 if (!sas_device)
3904 return;
3900 3905
3901 memset(&mpi_request, 0, sizeof(Mpi2SepRequest_t)); 3906 memset(&mpi_request, 0, sizeof(Mpi2SepRequest_t));
3902 mpi_request.Function = MPI2_FUNCTION_SCSI_ENCLOSURE_PROCESSOR; 3907 mpi_request.Function = MPI2_FUNCTION_SCSI_ENCLOSURE_PROCESSOR;
@@ -3911,6 +3916,7 @@ _scsih_turn_on_fault_led(struct MPT3SAS_ADAPTER *ioc, u16 handle)
3911 __FILE__, __LINE__, __func__); 3916 __FILE__, __LINE__, __func__);
3912 return; 3917 return;
3913 } 3918 }
3919 sas_device->pfa_led_on = 1;
3914 3920
3915 if (mpi_reply.IOCStatus || mpi_reply.IOCLogInfo) { 3921 if (mpi_reply.IOCStatus || mpi_reply.IOCLogInfo) {
3916 dewtprintk(ioc, pr_info(MPT3SAS_FMT 3922 dewtprintk(ioc, pr_info(MPT3SAS_FMT
@@ -3920,9 +3926,46 @@ _scsih_turn_on_fault_led(struct MPT3SAS_ADAPTER *ioc, u16 handle)
3920 return; 3926 return;
3921 } 3927 }
3922} 3928}
3929/**
3930 * _scsih_turn_off_pfa_led - turn off Fault LED
3931 * @ioc: per adapter object
3932 * @sas_device: sas device whose PFA LED has to turned off
3933 * Context: process
3934 *
3935 * Return nothing.
3936 */
3937static void
3938_scsih_turn_off_pfa_led(struct MPT3SAS_ADAPTER *ioc,
3939 struct _sas_device *sas_device)
3940{
3941 Mpi2SepReply_t mpi_reply;
3942 Mpi2SepRequest_t mpi_request;
3923 3943
3944 memset(&mpi_request, 0, sizeof(Mpi2SepRequest_t));
3945 mpi_request.Function = MPI2_FUNCTION_SCSI_ENCLOSURE_PROCESSOR;
3946 mpi_request.Action = MPI2_SEP_REQ_ACTION_WRITE_STATUS;
3947 mpi_request.SlotStatus = 0;
3948 mpi_request.Slot = cpu_to_le16(sas_device->slot);
3949 mpi_request.DevHandle = 0;
3950 mpi_request.EnclosureHandle = cpu_to_le16(sas_device->enclosure_handle);
3951 mpi_request.Flags = MPI2_SEP_REQ_FLAGS_ENCLOSURE_SLOT_ADDRESS;
3952 if ((mpt3sas_base_scsi_enclosure_processor(ioc, &mpi_reply,
3953 &mpi_request)) != 0) {
3954 printk(MPT3SAS_FMT "failure at %s:%d/%s()!\n", ioc->name,
3955 __FILE__, __LINE__, __func__);
3956 return;
3957 }
3958
3959 if (mpi_reply.IOCStatus || mpi_reply.IOCLogInfo) {
3960 dewtprintk(ioc, printk(MPT3SAS_FMT
3961 "enclosure_processor: ioc_status (0x%04x), loginfo(0x%08x)\n",
3962 ioc->name, le16_to_cpu(mpi_reply.IOCStatus),
3963 le32_to_cpu(mpi_reply.IOCLogInfo)));
3964 return;
3965 }
3966}
3924/** 3967/**
3925 * _scsih_send_event_to_turn_on_fault_led - fire delayed event 3968 * _scsih_send_event_to_turn_on_pfa_led - fire delayed event
3926 * @ioc: per adapter object 3969 * @ioc: per adapter object
3927 * @handle: device handle 3970 * @handle: device handle
3928 * Context: interrupt. 3971 * Context: interrupt.
@@ -3930,14 +3973,14 @@ _scsih_turn_on_fault_led(struct MPT3SAS_ADAPTER *ioc, u16 handle)
3930 * Return nothing. 3973 * Return nothing.
3931 */ 3974 */
3932static void 3975static void
3933_scsih_send_event_to_turn_on_fault_led(struct MPT3SAS_ADAPTER *ioc, u16 handle) 3976_scsih_send_event_to_turn_on_pfa_led(struct MPT3SAS_ADAPTER *ioc, u16 handle)
3934{ 3977{
3935 struct fw_event_work *fw_event; 3978 struct fw_event_work *fw_event;
3936 3979
3937 fw_event = kzalloc(sizeof(struct fw_event_work), GFP_ATOMIC); 3980 fw_event = kzalloc(sizeof(struct fw_event_work), GFP_ATOMIC);
3938 if (!fw_event) 3981 if (!fw_event)
3939 return; 3982 return;
3940 fw_event->event = MPT3SAS_TURN_ON_FAULT_LED; 3983 fw_event->event = MPT3SAS_TURN_ON_PFA_LED;
3941 fw_event->device_handle = handle; 3984 fw_event->device_handle = handle;
3942 fw_event->ioc = ioc; 3985 fw_event->ioc = ioc;
3943 _scsih_fw_event_add(ioc, fw_event); 3986 _scsih_fw_event_add(ioc, fw_event);
@@ -3981,7 +4024,7 @@ _scsih_smart_predicted_fault(struct MPT3SAS_ADAPTER *ioc, u16 handle)
3981 spin_unlock_irqrestore(&ioc->sas_device_lock, flags); 4024 spin_unlock_irqrestore(&ioc->sas_device_lock, flags);
3982 4025
3983 if (ioc->pdev->subsystem_vendor == PCI_VENDOR_ID_IBM) 4026 if (ioc->pdev->subsystem_vendor == PCI_VENDOR_ID_IBM)
3984 _scsih_send_event_to_turn_on_fault_led(ioc, handle); 4027 _scsih_send_event_to_turn_on_pfa_led(ioc, handle);
3985 4028
3986 /* insert into event log */ 4029 /* insert into event log */
3987 sz = offsetof(Mpi2EventNotificationReply_t, EventData) + 4030 sz = offsetof(Mpi2EventNotificationReply_t, EventData) +
@@ -4911,7 +4954,11 @@ _scsih_remove_device(struct MPT3SAS_ADAPTER *ioc,
4911{ 4954{
4912 struct MPT3SAS_TARGET *sas_target_priv_data; 4955 struct MPT3SAS_TARGET *sas_target_priv_data;
4913 4956
4914 4957 if ((ioc->pdev->subsystem_vendor == PCI_VENDOR_ID_IBM) &&
4958 (sas_device->pfa_led_on)) {
4959 _scsih_turn_off_pfa_led(ioc, sas_device);
4960 sas_device->pfa_led_on = 0;
4961 }
4915 dewtprintk(ioc, pr_info(MPT3SAS_FMT 4962 dewtprintk(ioc, pr_info(MPT3SAS_FMT
4916 "%s: enter: handle(0x%04x), sas_addr(0x%016llx)\n", 4963 "%s: enter: handle(0x%04x), sas_addr(0x%016llx)\n",
4917 ioc->name, __func__, 4964 ioc->name, __func__,
@@ -7065,8 +7112,8 @@ _mpt3sas_fw_work(struct MPT3SAS_ADAPTER *ioc, struct fw_event_work *fw_event)
7065 "port enable: complete from worker thread\n", 7112 "port enable: complete from worker thread\n",
7066 ioc->name)); 7113 ioc->name));
7067 break; 7114 break;
7068 case MPT3SAS_TURN_ON_FAULT_LED: 7115 case MPT3SAS_TURN_ON_PFA_LED:
7069 _scsih_turn_on_fault_led(ioc, fw_event->device_handle); 7116 _scsih_turn_on_pfa_led(ioc, fw_event->device_handle);
7070 break; 7117 break;
7071 case MPI2_EVENT_SAS_TOPOLOGY_CHANGE_LIST: 7118 case MPI2_EVENT_SAS_TOPOLOGY_CHANGE_LIST:
7072 _scsih_sas_topology_change_event(ioc, fw_event); 7119 _scsih_sas_topology_change_event(ioc, fw_event);