Commit 79c67c54 authored by Martin K. Petersen's avatar Martin K. Petersen

Merge patch series "scsi: pm80xx: Enhanced debug logs for HW events"

Pranav Prasad <pranavpp@google.com> says:

This patch series enhances debug logs for pm80xx HW events, and provides a
minor fix in the case of a hard reset. The log enhancement involves changing
the log severity level to enable logging for HW events which consequently
help debug disk discovery issues.

 1. Changed log severity level from MSG to EVENT for HW events.  Enhanced
    the HW event logs by adding the phyid.

 2. Enabled INIT logging.

 3. Log portid along with the PHY_UP event.

 4. Print phyid and portid sent as part of device registration request.

 5. Log port state during HW events.

 6. Update phy_state and phy_attached to correct values after a hard reset.

Link: https://lore.kernel.org/r/20230418190101.696345-1-pranavpp@google.comSigned-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parents 44fcce67 14a8f116
......@@ -43,7 +43,8 @@
#include "pm8001_chips.h"
#include "pm80xx_hwi.h"
static ulong logging_level = PM8001_FAIL_LOGGING | PM8001_IOERR_LOGGING;
static ulong logging_level = PM8001_FAIL_LOGGING | PM8001_IOERR_LOGGING |
PM8001_EVENT_LOGGING | PM8001_INIT_LOGGING;
module_param(logging_level, ulong, 0644);
MODULE_PARM_DESC(logging_level, " bits for enabling logging info.");
......@@ -666,7 +667,7 @@ static void pm8001_post_sas_ha_init(struct Scsi_Host *shost,
* Currently we just set the fixed SAS address to our HBA, for manufacture,
* it should read from the EEPROM
*/
static void pm8001_init_sas_add(struct pm8001_hba_info *pm8001_ha)
static int pm8001_init_sas_add(struct pm8001_hba_info *pm8001_ha)
{
u8 i, j;
u8 sas_add[8];
......@@ -679,6 +680,12 @@ static void pm8001_init_sas_add(struct pm8001_hba_info *pm8001_ha)
struct pm8001_ioctl_payload payload;
u16 deviceid;
int rc;
unsigned long time_remaining;
if (PM8001_CHIP_DISP->fatal_errors(pm8001_ha)) {
pm8001_dbg(pm8001_ha, FAIL, "controller is in fatal error state\n");
return -EIO;
}
pci_read_config_word(pm8001_ha->pdev, PCI_DEVICE_ID, &deviceid);
pm8001_ha->nvmd_completion = &completion;
......@@ -703,16 +710,23 @@ static void pm8001_init_sas_add(struct pm8001_hba_info *pm8001_ha)
payload.offset = 0;
payload.func_specific = kzalloc(payload.rd_length, GFP_KERNEL);
if (!payload.func_specific) {
pm8001_dbg(pm8001_ha, INIT, "mem alloc fail\n");
return;
pm8001_dbg(pm8001_ha, FAIL, "mem alloc fail\n");
return -ENOMEM;
}
rc = PM8001_CHIP_DISP->get_nvmd_req(pm8001_ha, &payload);
if (rc) {
kfree(payload.func_specific);
pm8001_dbg(pm8001_ha, INIT, "nvmd failed\n");
return;
pm8001_dbg(pm8001_ha, FAIL, "nvmd failed\n");
return -EIO;
}
time_remaining = wait_for_completion_timeout(&completion,
msecs_to_jiffies(60*1000)); // 1 min
if (!time_remaining) {
kfree(payload.func_specific);
pm8001_dbg(pm8001_ha, FAIL, "get_nvmd_req timeout\n");
return -EIO;
}
wait_for_completion(&completion);
for (i = 0, j = 0; i <= 7; i++, j++) {
if (pm8001_ha->chip_id == chip_8001) {
......@@ -751,6 +765,7 @@ static void pm8001_init_sas_add(struct pm8001_hba_info *pm8001_ha)
memcpy(pm8001_ha->sas_addr, &pm8001_ha->phy[0].dev_sas_addr,
SAS_ADDR_SIZE);
#endif
return 0;
}
/*
......@@ -1166,7 +1181,8 @@ static int pm8001_pci_probe(struct pci_dev *pdev,
pm80xx_set_thermal_config(pm8001_ha);
}
pm8001_init_sas_add(pm8001_ha);
if (pm8001_init_sas_add(pm8001_ha))
goto err_out_shost;
/* phy setting support for motherboard controller */
rc = pm8001_configure_phy_settings(pm8001_ha);
if (rc)
......
......@@ -71,6 +71,7 @@
#define PM8001_DEV_LOGGING 0x80 /* development message logging */
#define PM8001_DEVIO_LOGGING 0x100 /* development io message logging */
#define PM8001_IOERR_LOGGING 0x200 /* development io err message logging */
#define PM8001_EVENT_LOGGING 0x400 /* HW event logging */
#define pm8001_info(HBA, fmt, ...) \
pr_info("%s:: %s %d: " fmt, \
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment