mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-26 05:20:53 +07:00
[SCSI] mpt2sas: Fix for little endian
1. Fixes for little endian issues. 2. Now Debug info for Discovery event is more readable. Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
This commit is contained in:
parent
b4344276f7
commit
e94f674721
@ -285,6 +285,9 @@ _base_sas_ioc_info(struct MPT2SAS_ADAPTER *ioc, MPI2DefaultReply_t *mpi_reply,
|
|||||||
request_hdr->Function == MPI2_FUNCTION_EVENT_NOTIFICATION)
|
request_hdr->Function == MPI2_FUNCTION_EVENT_NOTIFICATION)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (ioc_status == MPI2_IOCSTATUS_CONFIG_INVALID_PAGE)
|
||||||
|
return;
|
||||||
|
|
||||||
switch (ioc_status) {
|
switch (ioc_status) {
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -517,8 +520,18 @@ _base_display_event_data(struct MPT2SAS_ADAPTER *ioc,
|
|||||||
desc = "IR Operation Status";
|
desc = "IR Operation Status";
|
||||||
break;
|
break;
|
||||||
case MPI2_EVENT_SAS_DISCOVERY:
|
case MPI2_EVENT_SAS_DISCOVERY:
|
||||||
desc = "Discovery";
|
{
|
||||||
break;
|
Mpi2EventDataSasDiscovery_t *event_data =
|
||||||
|
(Mpi2EventDataSasDiscovery_t *)mpi_reply->EventData;
|
||||||
|
printk(MPT2SAS_INFO_FMT "Discovery: (%s)", ioc->name,
|
||||||
|
(event_data->ReasonCode == MPI2_EVENT_SAS_DISC_RC_STARTED) ?
|
||||||
|
"start" : "stop");
|
||||||
|
if (event_data->DiscoveryStatus)
|
||||||
|
printk("discovery_status(0x%08x)",
|
||||||
|
le32_to_cpu(event_data->DiscoveryStatus));
|
||||||
|
printk("\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
case MPI2_EVENT_SAS_BROADCAST_PRIMITIVE:
|
case MPI2_EVENT_SAS_BROADCAST_PRIMITIVE:
|
||||||
desc = "SAS Broadcast Primitive";
|
desc = "SAS Broadcast Primitive";
|
||||||
break;
|
break;
|
||||||
@ -3184,7 +3197,7 @@ _base_event_notification(struct MPT2SAS_ADAPTER *ioc, int sleep_flag)
|
|||||||
mpi_request->VP_ID = 0;
|
mpi_request->VP_ID = 0;
|
||||||
for (i = 0; i < MPI2_EVENT_NOTIFY_EVENTMASK_WORDS; i++)
|
for (i = 0; i < MPI2_EVENT_NOTIFY_EVENTMASK_WORDS; i++)
|
||||||
mpi_request->EventMasks[i] =
|
mpi_request->EventMasks[i] =
|
||||||
le32_to_cpu(ioc->event_masks[i]);
|
cpu_to_le32(ioc->event_masks[i]);
|
||||||
mpt2sas_base_put_smid_default(ioc, smid);
|
mpt2sas_base_put_smid_default(ioc, smid);
|
||||||
init_completion(&ioc->base_cmds.done);
|
init_completion(&ioc->base_cmds.done);
|
||||||
timeleft = wait_for_completion_timeout(&ioc->base_cmds.done, 30*HZ);
|
timeleft = wait_for_completion_timeout(&ioc->base_cmds.done, 30*HZ);
|
||||||
@ -3648,6 +3661,7 @@ mpt2sas_base_attach(struct MPT2SAS_ADAPTER *ioc)
|
|||||||
pci_set_drvdata(ioc->pdev, NULL);
|
pci_set_drvdata(ioc->pdev, NULL);
|
||||||
kfree(ioc->tm_cmds.reply);
|
kfree(ioc->tm_cmds.reply);
|
||||||
kfree(ioc->transport_cmds.reply);
|
kfree(ioc->transport_cmds.reply);
|
||||||
|
kfree(ioc->scsih_cmds.reply);
|
||||||
kfree(ioc->config_cmds.reply);
|
kfree(ioc->config_cmds.reply);
|
||||||
kfree(ioc->base_cmds.reply);
|
kfree(ioc->base_cmds.reply);
|
||||||
kfree(ioc->ctl_cmds.reply);
|
kfree(ioc->ctl_cmds.reply);
|
||||||
@ -3655,6 +3669,7 @@ mpt2sas_base_attach(struct MPT2SAS_ADAPTER *ioc)
|
|||||||
ioc->ctl_cmds.reply = NULL;
|
ioc->ctl_cmds.reply = NULL;
|
||||||
ioc->base_cmds.reply = NULL;
|
ioc->base_cmds.reply = NULL;
|
||||||
ioc->tm_cmds.reply = NULL;
|
ioc->tm_cmds.reply = NULL;
|
||||||
|
ioc->scsih_cmds.reply = NULL;
|
||||||
ioc->transport_cmds.reply = NULL;
|
ioc->transport_cmds.reply = NULL;
|
||||||
ioc->config_cmds.reply = NULL;
|
ioc->config_cmds.reply = NULL;
|
||||||
ioc->pfacts = NULL;
|
ioc->pfacts = NULL;
|
||||||
@ -3684,6 +3699,7 @@ mpt2sas_base_detach(struct MPT2SAS_ADAPTER *ioc)
|
|||||||
kfree(ioc->base_cmds.reply);
|
kfree(ioc->base_cmds.reply);
|
||||||
kfree(ioc->tm_cmds.reply);
|
kfree(ioc->tm_cmds.reply);
|
||||||
kfree(ioc->transport_cmds.reply);
|
kfree(ioc->transport_cmds.reply);
|
||||||
|
kfree(ioc->scsih_cmds.reply);
|
||||||
kfree(ioc->config_cmds.reply);
|
kfree(ioc->config_cmds.reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1390,12 +1390,12 @@ mpt2sas_config_get_volume_handle(struct MPT2SAS_ADAPTER *ioc, u16 pd_handle,
|
|||||||
if (ioc_status != MPI2_IOCSTATUS_SUCCESS)
|
if (ioc_status != MPI2_IOCSTATUS_SUCCESS)
|
||||||
goto out;
|
goto out;
|
||||||
for (i = 0; i < config_page->NumElements; i++) {
|
for (i = 0; i < config_page->NumElements; i++) {
|
||||||
if ((config_page->ConfigElement[i].ElementFlags &
|
if ((le16_to_cpu(config_page->ConfigElement[i].ElementFlags) &
|
||||||
MPI2_RAIDCONFIG0_EFLAGS_MASK_ELEMENT_TYPE) !=
|
MPI2_RAIDCONFIG0_EFLAGS_MASK_ELEMENT_TYPE) !=
|
||||||
MPI2_RAIDCONFIG0_EFLAGS_VOL_PHYS_DISK_ELEMENT)
|
MPI2_RAIDCONFIG0_EFLAGS_VOL_PHYS_DISK_ELEMENT)
|
||||||
continue;
|
continue;
|
||||||
if (config_page->ConfigElement[i].PhysDiskDevHandle ==
|
if (le16_to_cpu(config_page->ConfigElement[i].
|
||||||
pd_handle) {
|
PhysDiskDevHandle) == pd_handle) {
|
||||||
*volume_handle = le16_to_cpu(config_page->
|
*volume_handle = le16_to_cpu(config_page->
|
||||||
ConfigElement[i].VolDevHandle);
|
ConfigElement[i].VolDevHandle);
|
||||||
r = 0;
|
r = 0;
|
||||||
|
@ -533,7 +533,7 @@ _ctl_set_task_mid(struct MPT2SAS_ADAPTER *ioc, struct mpt2_ioctl_command *karg,
|
|||||||
if (!found) {
|
if (!found) {
|
||||||
dctlprintk(ioc, printk(MPT2SAS_DEBUG_FMT "%s: "
|
dctlprintk(ioc, printk(MPT2SAS_DEBUG_FMT "%s: "
|
||||||
"handle(0x%04x), lun(%d), no active mid!!\n", ioc->name,
|
"handle(0x%04x), lun(%d), no active mid!!\n", ioc->name,
|
||||||
desc, tm_request->DevHandle, lun));
|
desc, le16_to_cpu(tm_request->DevHandle), lun));
|
||||||
tm_reply = ioc->ctl_cmds.reply;
|
tm_reply = ioc->ctl_cmds.reply;
|
||||||
tm_reply->DevHandle = tm_request->DevHandle;
|
tm_reply->DevHandle = tm_request->DevHandle;
|
||||||
tm_reply->Function = MPI2_FUNCTION_SCSI_TASK_MGMT;
|
tm_reply->Function = MPI2_FUNCTION_SCSI_TASK_MGMT;
|
||||||
@ -551,7 +551,8 @@ _ctl_set_task_mid(struct MPT2SAS_ADAPTER *ioc, struct mpt2_ioctl_command *karg,
|
|||||||
|
|
||||||
dctlprintk(ioc, printk(MPT2SAS_DEBUG_FMT "%s: "
|
dctlprintk(ioc, printk(MPT2SAS_DEBUG_FMT "%s: "
|
||||||
"handle(0x%04x), lun(%d), task_mid(%d)\n", ioc->name,
|
"handle(0x%04x), lun(%d), task_mid(%d)\n", ioc->name,
|
||||||
desc, tm_request->DevHandle, lun, tm_request->TaskMID));
|
desc, le16_to_cpu(tm_request->DevHandle), lun,
|
||||||
|
le16_to_cpu(tm_request->TaskMID)));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -647,9 +648,9 @@ _ctl_do_mpt_command(struct MPT2SAS_ADAPTER *ioc,
|
|||||||
|
|
||||||
if (mpi_request->Function == MPI2_FUNCTION_SCSI_IO_REQUEST ||
|
if (mpi_request->Function == MPI2_FUNCTION_SCSI_IO_REQUEST ||
|
||||||
mpi_request->Function == MPI2_FUNCTION_RAID_SCSI_IO_PASSTHROUGH) {
|
mpi_request->Function == MPI2_FUNCTION_RAID_SCSI_IO_PASSTHROUGH) {
|
||||||
if (!mpi_request->FunctionDependent1 ||
|
if (!le16_to_cpu(mpi_request->FunctionDependent1) ||
|
||||||
mpi_request->FunctionDependent1 >
|
le16_to_cpu(mpi_request->FunctionDependent1) >
|
||||||
cpu_to_le16(ioc->facts.MaxDevHandle)) {
|
ioc->facts.MaxDevHandle) {
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
mpt2sas_base_free_smid(ioc, smid);
|
mpt2sas_base_free_smid(ioc, smid);
|
||||||
goto out;
|
goto out;
|
||||||
@ -897,11 +898,11 @@ _ctl_do_mpt_command(struct MPT2SAS_ADAPTER *ioc,
|
|||||||
MPI2_FUNCTION_RAID_SCSI_IO_PASSTHROUGH)) {
|
MPI2_FUNCTION_RAID_SCSI_IO_PASSTHROUGH)) {
|
||||||
printk(MPT2SAS_INFO_FMT "issue target reset: handle "
|
printk(MPT2SAS_INFO_FMT "issue target reset: handle "
|
||||||
"= (0x%04x)\n", ioc->name,
|
"= (0x%04x)\n", ioc->name,
|
||||||
mpi_request->FunctionDependent1);
|
le16_to_cpu(mpi_request->FunctionDependent1));
|
||||||
mpt2sas_halt_firmware(ioc);
|
mpt2sas_halt_firmware(ioc);
|
||||||
mutex_lock(&ioc->tm_cmds.mutex);
|
mutex_lock(&ioc->tm_cmds.mutex);
|
||||||
mpt2sas_scsih_issue_tm(ioc,
|
mpt2sas_scsih_issue_tm(ioc,
|
||||||
mpi_request->FunctionDependent1, 0,
|
le16_to_cpu(mpi_request->FunctionDependent1), 0,
|
||||||
MPI2_SCSITASKMGMT_TASKTYPE_TARGET_RESET, 0, 10);
|
MPI2_SCSITASKMGMT_TASKTYPE_TARGET_RESET, 0, 10);
|
||||||
ioc->tm_cmds.status = MPT2_CMD_NOT_USED;
|
ioc->tm_cmds.status = MPT2_CMD_NOT_USED;
|
||||||
mutex_unlock(&ioc->tm_cmds.mutex);
|
mutex_unlock(&ioc->tm_cmds.mutex);
|
||||||
@ -1373,7 +1374,8 @@ _ctl_diag_register_2(struct MPT2SAS_ADAPTER *ioc,
|
|||||||
|
|
||||||
dctlprintk(ioc, printk(MPT2SAS_DEBUG_FMT "%s: diag_buffer(0x%p), "
|
dctlprintk(ioc, printk(MPT2SAS_DEBUG_FMT "%s: diag_buffer(0x%p), "
|
||||||
"dma(0x%llx), sz(%d)\n", ioc->name, __func__, request_data,
|
"dma(0x%llx), sz(%d)\n", ioc->name, __func__, request_data,
|
||||||
(unsigned long long)request_data_dma, mpi_request->BufferLength));
|
(unsigned long long)request_data_dma,
|
||||||
|
le32_to_cpu(mpi_request->BufferLength)));
|
||||||
|
|
||||||
for (i = 0; i < MPT2_PRODUCT_SPECIFIC_DWORDS; i++)
|
for (i = 0; i < MPT2_PRODUCT_SPECIFIC_DWORDS; i++)
|
||||||
mpi_request->ProductSpecific[i] =
|
mpi_request->ProductSpecific[i] =
|
||||||
@ -2334,8 +2336,8 @@ _ctl_version_nvdata_persistent_show(struct device *cdev,
|
|||||||
struct Scsi_Host *shost = class_to_shost(cdev);
|
struct Scsi_Host *shost = class_to_shost(cdev);
|
||||||
struct MPT2SAS_ADAPTER *ioc = shost_priv(shost);
|
struct MPT2SAS_ADAPTER *ioc = shost_priv(shost);
|
||||||
|
|
||||||
return snprintf(buf, PAGE_SIZE, "%02xh\n",
|
return snprintf(buf, PAGE_SIZE, "%08xh\n",
|
||||||
le16_to_cpu(ioc->iounit_pg0.NvdataVersionPersistent.Word));
|
le32_to_cpu(ioc->iounit_pg0.NvdataVersionPersistent.Word));
|
||||||
}
|
}
|
||||||
static DEVICE_ATTR(version_nvdata_persistent, S_IRUGO,
|
static DEVICE_ATTR(version_nvdata_persistent, S_IRUGO,
|
||||||
_ctl_version_nvdata_persistent_show, NULL);
|
_ctl_version_nvdata_persistent_show, NULL);
|
||||||
@ -2354,8 +2356,8 @@ _ctl_version_nvdata_default_show(struct device *cdev,
|
|||||||
struct Scsi_Host *shost = class_to_shost(cdev);
|
struct Scsi_Host *shost = class_to_shost(cdev);
|
||||||
struct MPT2SAS_ADAPTER *ioc = shost_priv(shost);
|
struct MPT2SAS_ADAPTER *ioc = shost_priv(shost);
|
||||||
|
|
||||||
return snprintf(buf, PAGE_SIZE, "%02xh\n",
|
return snprintf(buf, PAGE_SIZE, "%08xh\n",
|
||||||
le16_to_cpu(ioc->iounit_pg0.NvdataVersionDefault.Word));
|
le32_to_cpu(ioc->iounit_pg0.NvdataVersionDefault.Word));
|
||||||
}
|
}
|
||||||
static DEVICE_ATTR(version_nvdata_default, S_IRUGO,
|
static DEVICE_ATTR(version_nvdata_default, S_IRUGO,
|
||||||
_ctl_version_nvdata_default_show, NULL);
|
_ctl_version_nvdata_default_show, NULL);
|
||||||
|
@ -1376,7 +1376,7 @@ _scsih_display_sata_capabilities(struct MPT2SAS_ADAPTER *ioc,
|
|||||||
}
|
}
|
||||||
|
|
||||||
flags = le16_to_cpu(sas_device_pg0.Flags);
|
flags = le16_to_cpu(sas_device_pg0.Flags);
|
||||||
device_info = le16_to_cpu(sas_device_pg0.DeviceInfo);
|
device_info = le32_to_cpu(sas_device_pg0.DeviceInfo);
|
||||||
|
|
||||||
sdev_printk(KERN_INFO, sdev,
|
sdev_printk(KERN_INFO, sdev,
|
||||||
"atapi(%s), ncq(%s), asyn_notify(%s), smart(%s), fua(%s), "
|
"atapi(%s), ncq(%s), asyn_notify(%s), smart(%s), fua(%s), "
|
||||||
@ -3210,8 +3210,8 @@ _scsih_scsi_ioc_info(struct MPT2SAS_ADAPTER *ioc, struct scsi_cmnd *scmd,
|
|||||||
struct sense_info data;
|
struct sense_info data;
|
||||||
_scsih_normalize_sense(scmd->sense_buffer, &data);
|
_scsih_normalize_sense(scmd->sense_buffer, &data);
|
||||||
printk(MPT2SAS_WARN_FMT "\t[sense_key,asc,ascq]: "
|
printk(MPT2SAS_WARN_FMT "\t[sense_key,asc,ascq]: "
|
||||||
"[0x%02x,0x%02x,0x%02x]\n", ioc->name, data.skey,
|
"[0x%02x,0x%02x,0x%02x], count(%d)\n", ioc->name, data.skey,
|
||||||
data.asc, data.ascq);
|
data.asc, data.ascq, le32_to_cpu(mpi_reply->SenseCount));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scsi_state & MPI2_SCSI_STATE_RESPONSE_INFO_VALID) {
|
if (scsi_state & MPI2_SCSI_STATE_RESPONSE_INFO_VALID) {
|
||||||
@ -3265,7 +3265,7 @@ _scsih_smart_predicted_fault(struct MPT2SAS_ADAPTER *ioc, u16 handle)
|
|||||||
mpi_request.Function = MPI2_FUNCTION_SCSI_ENCLOSURE_PROCESSOR;
|
mpi_request.Function = MPI2_FUNCTION_SCSI_ENCLOSURE_PROCESSOR;
|
||||||
mpi_request.Action = MPI2_SEP_REQ_ACTION_WRITE_STATUS;
|
mpi_request.Action = MPI2_SEP_REQ_ACTION_WRITE_STATUS;
|
||||||
mpi_request.SlotStatus =
|
mpi_request.SlotStatus =
|
||||||
MPI2_SEP_REQ_SLOTSTATUS_PREDICTED_FAULT;
|
cpu_to_le32(MPI2_SEP_REQ_SLOTSTATUS_PREDICTED_FAULT);
|
||||||
mpi_request.DevHandle = cpu_to_le16(handle);
|
mpi_request.DevHandle = cpu_to_le16(handle);
|
||||||
mpi_request.Flags = MPI2_SEP_REQ_FLAGS_DEVHANDLE_ADDRESS;
|
mpi_request.Flags = MPI2_SEP_REQ_FLAGS_DEVHANDLE_ADDRESS;
|
||||||
if ((mpt2sas_base_scsi_enclosure_processor(ioc, &mpi_reply,
|
if ((mpt2sas_base_scsi_enclosure_processor(ioc, &mpi_reply,
|
||||||
@ -5934,6 +5934,7 @@ mpt2sas_scsih_event_callback(struct MPT2SAS_ADAPTER *ioc, u8 msix_index,
|
|||||||
struct fw_event_work *fw_event;
|
struct fw_event_work *fw_event;
|
||||||
Mpi2EventNotificationReply_t *mpi_reply;
|
Mpi2EventNotificationReply_t *mpi_reply;
|
||||||
u16 event;
|
u16 event;
|
||||||
|
u16 sz;
|
||||||
|
|
||||||
/* events turned off due to host reset or driver unloading */
|
/* events turned off due to host reset or driver unloading */
|
||||||
if (ioc->remove_host)
|
if (ioc->remove_host)
|
||||||
@ -5984,8 +5985,8 @@ mpt2sas_scsih_event_callback(struct MPT2SAS_ADAPTER *ioc, u8 msix_index,
|
|||||||
ioc->name, __FILE__, __LINE__, __func__);
|
ioc->name, __FILE__, __LINE__, __func__);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
fw_event->event_data =
|
sz = le16_to_cpu(mpi_reply->EventDataLength) * 4;
|
||||||
kzalloc(mpi_reply->EventDataLength*4, GFP_ATOMIC);
|
fw_event->event_data = kzalloc(sz, GFP_ATOMIC);
|
||||||
if (!fw_event->event_data) {
|
if (!fw_event->event_data) {
|
||||||
printk(MPT2SAS_ERR_FMT "failure at %s:%d/%s()!\n",
|
printk(MPT2SAS_ERR_FMT "failure at %s:%d/%s()!\n",
|
||||||
ioc->name, __FILE__, __LINE__, __func__);
|
ioc->name, __FILE__, __LINE__, __func__);
|
||||||
@ -5994,7 +5995,7 @@ mpt2sas_scsih_event_callback(struct MPT2SAS_ADAPTER *ioc, u8 msix_index,
|
|||||||
}
|
}
|
||||||
|
|
||||||
memcpy(fw_event->event_data, mpi_reply->EventData,
|
memcpy(fw_event->event_data, mpi_reply->EventData,
|
||||||
mpi_reply->EventDataLength*4);
|
sz);
|
||||||
fw_event->ioc = ioc;
|
fw_event->ioc = ioc;
|
||||||
fw_event->VF_ID = mpi_reply->VF_ID;
|
fw_event->VF_ID = mpi_reply->VF_ID;
|
||||||
fw_event->VP_ID = mpi_reply->VP_ID;
|
fw_event->VP_ID = mpi_reply->VP_ID;
|
||||||
|
@ -1341,7 +1341,8 @@ _transport_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy,
|
|||||||
memcpy(req->sense, mpi_reply, sizeof(*mpi_reply));
|
memcpy(req->sense, mpi_reply, sizeof(*mpi_reply));
|
||||||
req->sense_len = sizeof(*mpi_reply);
|
req->sense_len = sizeof(*mpi_reply);
|
||||||
req->resid_len = 0;
|
req->resid_len = 0;
|
||||||
rsp->resid_len -= mpi_reply->ResponseDataLength;
|
rsp->resid_len -=
|
||||||
|
le16_to_cpu(mpi_reply->ResponseDataLength);
|
||||||
} else {
|
} else {
|
||||||
dtransportprintk(ioc, printk(MPT2SAS_DEBUG_FMT
|
dtransportprintk(ioc, printk(MPT2SAS_DEBUG_FMT
|
||||||
"%s - no reply\n", ioc->name, __func__));
|
"%s - no reply\n", ioc->name, __func__));
|
||||||
|
Loading…
Reference in New Issue
Block a user