Skip to content

Commit 95cca8d

Browse files
sreekanthbrcmmartinkpetersen
authored andcommitted
scsi: mpi3mr: Print cable mngnt and temp threshold events
Print cable management & temperature threshold event data. Use vendor id & device id macro definitions from MPI3 headers. Link: https://lore.kernel.org/r/20211220141159.16117-21-sreekanth.reddy@broadcom.com Signed-off-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent 78b76a0 commit 95cca8d

2 files changed

Lines changed: 73 additions & 3 deletions

File tree

drivers/scsi/mpi3mr/mpi3mr_fw.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3503,6 +3503,7 @@ static int mpi3mr_enable_events(struct mpi3mr_ioc *mrioc)
35033503
mpi3mr_unmask_events(mrioc, MPI3_EVENT_PREPARE_FOR_RESET);
35043504
mpi3mr_unmask_events(mrioc, MPI3_EVENT_CABLE_MGMT);
35053505
mpi3mr_unmask_events(mrioc, MPI3_EVENT_ENERGY_PACK_CHANGE);
3506+
mpi3mr_unmask_events(mrioc, MPI3_EVENT_TEMP_THRESHOLD);
35063507

35073508
retval = mpi3mr_issue_event_notification(mrioc);
35083509
if (retval)

drivers/scsi/mpi3mr/mpi3mr_os.c

Lines changed: 72 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2051,6 +2051,66 @@ static void mpi3mr_energypackchg_evt_th(struct mpi3mr_ioc *mrioc,
20512051
mrioc->facts.shutdown_timeout = shutdown_timeout;
20522052
}
20532053

2054+
/**
2055+
* mpi3mr_tempthreshold_evt_th - Temp threshold event tophalf
2056+
* @mrioc: Adapter instance reference
2057+
* @event_reply: event data
2058+
*
2059+
* Displays temperature threshold event details and fault code
2060+
* if any is hit due to temperature exceeding threshold.
2061+
*
2062+
* Return: Nothing
2063+
*/
2064+
static void mpi3mr_tempthreshold_evt_th(struct mpi3mr_ioc *mrioc,
2065+
struct mpi3_event_notification_reply *event_reply)
2066+
{
2067+
struct mpi3_event_data_temp_threshold *evtdata =
2068+
(struct mpi3_event_data_temp_threshold *)event_reply->event_data;
2069+
2070+
ioc_err(mrioc, "Temperature threshold levels %s%s%s exceeded for sensor: %d !!! Current temperature in Celsius: %d\n",
2071+
(le16_to_cpu(evtdata->status) & 0x1) ? "Warning " : " ",
2072+
(le16_to_cpu(evtdata->status) & 0x2) ? "Critical " : " ",
2073+
(le16_to_cpu(evtdata->status) & 0x4) ? "Fatal " : " ", evtdata->sensor_num,
2074+
le16_to_cpu(evtdata->current_temperature));
2075+
mpi3mr_print_fault_info(mrioc);
2076+
}
2077+
2078+
/**
2079+
* mpi3mr_cablemgmt_evt_th - Cable management event tophalf
2080+
* @mrioc: Adapter instance reference
2081+
* @event_reply: event data
2082+
*
2083+
* Displays Cable manegemt event details.
2084+
*
2085+
* Return: Nothing
2086+
*/
2087+
static void mpi3mr_cablemgmt_evt_th(struct mpi3mr_ioc *mrioc,
2088+
struct mpi3_event_notification_reply *event_reply)
2089+
{
2090+
struct mpi3_event_data_cable_management *evtdata =
2091+
(struct mpi3_event_data_cable_management *)event_reply->event_data;
2092+
2093+
switch (evtdata->status) {
2094+
case MPI3_EVENT_CABLE_MGMT_STATUS_INSUFFICIENT_POWER:
2095+
{
2096+
ioc_info(mrioc, "An active cable with receptacle_id %d cannot be powered.\n"
2097+
"Devices connected to this cable are not detected.\n"
2098+
"This cable requires %d mW of power.\n",
2099+
evtdata->receptacle_id,
2100+
le32_to_cpu(evtdata->active_cable_power_requirement));
2101+
break;
2102+
}
2103+
case MPI3_EVENT_CABLE_MGMT_STATUS_DEGRADED:
2104+
{
2105+
ioc_info(mrioc, "A cable with receptacle_id %d is not running at optimal speed\n",
2106+
evtdata->receptacle_id);
2107+
break;
2108+
}
2109+
default:
2110+
break;
2111+
}
2112+
}
2113+
20542114
/**
20552115
* mpi3mr_os_handle_events - Firmware event handler
20562116
* @mrioc: Adapter instance reference
@@ -2125,9 +2185,18 @@ void mpi3mr_os_handle_events(struct mpi3mr_ioc *mrioc,
21252185
mpi3mr_energypackchg_evt_th(mrioc, event_reply);
21262186
break;
21272187
}
2188+
case MPI3_EVENT_TEMP_THRESHOLD:
2189+
{
2190+
mpi3mr_tempthreshold_evt_th(mrioc, event_reply);
2191+
break;
2192+
}
2193+
case MPI3_EVENT_CABLE_MGMT:
2194+
{
2195+
mpi3mr_cablemgmt_evt_th(mrioc, event_reply);
2196+
break;
2197+
}
21282198
case MPI3_EVENT_ENCL_DEVICE_STATUS_CHANGE:
21292199
case MPI3_EVENT_SAS_DISCOVERY:
2130-
case MPI3_EVENT_CABLE_MGMT:
21312200
case MPI3_EVENT_SAS_DEVICE_DISCOVERY_ERROR:
21322201
case MPI3_EVENT_SAS_BROADCAST_PRIMITIVE:
21332202
case MPI3_EVENT_PCIE_ENUMERATION:
@@ -4247,8 +4316,8 @@ static int mpi3mr_resume(struct pci_dev *pdev)
42474316

42484317
static const struct pci_device_id mpi3mr_pci_id_table[] = {
42494318
{
4250-
PCI_DEVICE_SUB(PCI_VENDOR_ID_LSI_LOGIC, 0x00A5,
4251-
PCI_ANY_ID, PCI_ANY_ID)
4319+
PCI_DEVICE_SUB(MPI3_MFGPAGE_VENDORID_BROADCOM,
4320+
MPI3_MFGPAGE_DEVID_SAS4116, PCI_ANY_ID, PCI_ANY_ID)
42524321
},
42534322
{ 0 }
42544323
};

0 commit comments

Comments
 (0)