scsi: mpt3sas: Convert uses of pr_<level> with MPT3SAS_FMT to ioc_<level>

Use a more common logging style.

Done using the perl script below and some typing

$ git grep --name-only -w MPT3SAS_FMT -- "*.c" | \
  xargs perl -i -e 'local $/; while (<>) { s/\bpr_(info|err|notice|warn)\s*\(\s*MPT3SAS_FMT\s*("[^"]+"(?:\s*\\?\s*"[^"]+"\s*){0,5}\s*),\s*ioc->name\s*/ioc_\1(ioc, \2/g; print;}'

Miscellanea for these conversions:

o Coalesce formats
o Realign arguments
o Remove unnecessary parentheses
o Use casts to u64 instead of unsigned long long where appropriate
o Convert broken pr_info uses to pr_cont
o Fix broken format string concatenation with line continuations and
  excess whitespace

Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: Suganath Prabu <suganath-prabu.subramani@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
Joe Perches 2018-09-17 08:01:09 -07:00 committed by Martin K. Petersen
parent 645a20c682
commit 919d8a3f3f
7 changed files with 1532 additions and 1981 deletions

File diff suppressed because it is too large Load Diff

View File

@ -175,9 +175,8 @@ _config_display_some_debug(struct MPT3SAS_ADAPTER *ioc, u16 smid,
if (!desc) if (!desc)
return; return;
pr_info(MPT3SAS_FMT ioc_info(ioc, "%s: %s(%d), action(%d), form(0x%08x), smid(%d)\n",
"%s: %s(%d), action(%d), form(0x%08x), smid(%d)\n", calling_function_name, desc,
ioc->name, calling_function_name, desc,
mpi_request->Header.PageNumber, mpi_request->Action, mpi_request->Header.PageNumber, mpi_request->Action,
le32_to_cpu(mpi_request->PageAddress), smid); le32_to_cpu(mpi_request->PageAddress), smid);
@ -185,9 +184,8 @@ _config_display_some_debug(struct MPT3SAS_ADAPTER *ioc, u16 smid,
return; return;
if (mpi_reply->IOCStatus || mpi_reply->IOCLogInfo) if (mpi_reply->IOCStatus || mpi_reply->IOCLogInfo)
pr_info(MPT3SAS_FMT ioc_info(ioc, "\tiocstatus(0x%04x), loginfo(0x%08x)\n",
"\tiocstatus(0x%04x), loginfo(0x%08x)\n", le16_to_cpu(mpi_reply->IOCStatus),
ioc->name, le16_to_cpu(mpi_reply->IOCStatus),
le32_to_cpu(mpi_reply->IOCLogInfo)); le32_to_cpu(mpi_reply->IOCLogInfo));
} }
@ -210,9 +208,8 @@ _config_alloc_config_dma_memory(struct MPT3SAS_ADAPTER *ioc,
mem->page = dma_alloc_coherent(&ioc->pdev->dev, mem->sz, mem->page = dma_alloc_coherent(&ioc->pdev->dev, mem->sz,
&mem->page_dma, GFP_KERNEL); &mem->page_dma, GFP_KERNEL);
if (!mem->page) { if (!mem->page) {
pr_err(MPT3SAS_FMT ioc_err(ioc, "%s: dma_alloc_coherent failed asking for (%d) bytes!!\n",
"%s: dma_alloc_coherent failed asking for (%d) bytes!!\n", __func__, mem->sz);
ioc->name, __func__, mem->sz);
r = -ENOMEM; r = -ENOMEM;
} }
} else { /* use tmp buffer if less than 512 bytes */ } else { /* use tmp buffer if less than 512 bytes */
@ -313,8 +310,7 @@ _config_request(struct MPT3SAS_ADAPTER *ioc, Mpi2ConfigRequest_t
mutex_lock(&ioc->config_cmds.mutex); mutex_lock(&ioc->config_cmds.mutex);
if (ioc->config_cmds.status != MPT3_CMD_NOT_USED) { if (ioc->config_cmds.status != MPT3_CMD_NOT_USED) {
pr_err(MPT3SAS_FMT "%s: config_cmd in use\n", ioc_err(ioc, "%s: config_cmd in use\n", __func__);
ioc->name, __func__);
mutex_unlock(&ioc->config_cmds.mutex); mutex_unlock(&ioc->config_cmds.mutex);
return -EAGAIN; return -EAGAIN;
} }
@ -362,34 +358,30 @@ _config_request(struct MPT3SAS_ADAPTER *ioc, Mpi2ConfigRequest_t
r = -EFAULT; r = -EFAULT;
goto free_mem; goto free_mem;
} }
pr_info(MPT3SAS_FMT "%s: attempting retry (%d)\n", ioc_info(ioc, "%s: attempting retry (%d)\n",
ioc->name, __func__, retry_count); __func__, retry_count);
} }
wait_state_count = 0; wait_state_count = 0;
ioc_state = mpt3sas_base_get_iocstate(ioc, 1); ioc_state = mpt3sas_base_get_iocstate(ioc, 1);
while (ioc_state != MPI2_IOC_STATE_OPERATIONAL) { while (ioc_state != MPI2_IOC_STATE_OPERATIONAL) {
if (wait_state_count++ == MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT) { if (wait_state_count++ == MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT) {
pr_err(MPT3SAS_FMT ioc_err(ioc, "%s: failed due to ioc not operational\n",
"%s: failed due to ioc not operational\n", __func__);
ioc->name, __func__);
ioc->config_cmds.status = MPT3_CMD_NOT_USED; ioc->config_cmds.status = MPT3_CMD_NOT_USED;
r = -EFAULT; r = -EFAULT;
goto free_mem; goto free_mem;
} }
ssleep(1); ssleep(1);
ioc_state = mpt3sas_base_get_iocstate(ioc, 1); ioc_state = mpt3sas_base_get_iocstate(ioc, 1);
pr_info(MPT3SAS_FMT ioc_info(ioc, "%s: waiting for operational state(count=%d)\n",
"%s: waiting for operational state(count=%d)\n", __func__, wait_state_count);
ioc->name, __func__, wait_state_count);
} }
if (wait_state_count) if (wait_state_count)
pr_info(MPT3SAS_FMT "%s: ioc is operational\n", ioc_info(ioc, "%s: ioc is operational\n", __func__);
ioc->name, __func__);
smid = mpt3sas_base_get_smid(ioc, ioc->config_cb_idx); smid = mpt3sas_base_get_smid(ioc, ioc->config_cb_idx);
if (!smid) { if (!smid) {
pr_err(MPT3SAS_FMT "%s: failed obtaining a smid\n", ioc_err(ioc, "%s: failed obtaining a smid\n", __func__);
ioc->name, __func__);
ioc->config_cmds.status = MPT3_CMD_NOT_USED; ioc->config_cmds.status = MPT3_CMD_NOT_USED;
r = -EAGAIN; r = -EAGAIN;
goto free_mem; goto free_mem;
@ -453,8 +445,8 @@ _config_request(struct MPT3SAS_ADAPTER *ioc, Mpi2ConfigRequest_t
} }
if (retry_count) if (retry_count)
pr_info(MPT3SAS_FMT "%s: retry (%d) completed!!\n", \ ioc_info(ioc, "%s: retry (%d) completed!!\n",
ioc->name, __func__, retry_count); __func__, retry_count);
if ((ioc_status == MPI2_IOCSTATUS_SUCCESS) && if ((ioc_status == MPI2_IOCSTATUS_SUCCESS) &&
config_page && mpi_request->Action == config_page && mpi_request->Action ==

View File

@ -185,16 +185,14 @@ _ctl_display_some_debug(struct MPT3SAS_ADAPTER *ioc, u16 smid,
if (!desc) if (!desc)
return; return;
pr_info(MPT3SAS_FMT "%s: %s, smid(%d)\n", ioc_info(ioc, "%s: %s, smid(%d)\n", calling_function_name, desc, smid);
ioc->name, calling_function_name, desc, smid);
if (!mpi_reply) if (!mpi_reply)
return; return;
if (mpi_reply->IOCStatus || mpi_reply->IOCLogInfo) if (mpi_reply->IOCStatus || mpi_reply->IOCLogInfo)
pr_info(MPT3SAS_FMT ioc_info(ioc, "\tiocstatus(0x%04x), loginfo(0x%08x)\n",
"\tiocstatus(0x%04x), loginfo(0x%08x)\n", le16_to_cpu(mpi_reply->IOCStatus),
ioc->name, le16_to_cpu(mpi_reply->IOCStatus),
le32_to_cpu(mpi_reply->IOCLogInfo)); le32_to_cpu(mpi_reply->IOCLogInfo));
if (mpi_request->Function == MPI2_FUNCTION_SCSI_IO_REQUEST || if (mpi_request->Function == MPI2_FUNCTION_SCSI_IO_REQUEST ||
@ -208,36 +206,30 @@ _ctl_display_some_debug(struct MPT3SAS_ADAPTER *ioc, u16 smid,
sas_device = mpt3sas_get_sdev_by_handle(ioc, sas_device = mpt3sas_get_sdev_by_handle(ioc,
le16_to_cpu(scsi_reply->DevHandle)); le16_to_cpu(scsi_reply->DevHandle));
if (sas_device) { if (sas_device) {
pr_warn(MPT3SAS_FMT "\tsas_address(0x%016llx), phy(%d)\n", ioc_warn(ioc, "\tsas_address(0x%016llx), phy(%d)\n",
ioc->name, (unsigned long long) (u64)sas_device->sas_address,
sas_device->sas_address, sas_device->phy); sas_device->phy);
pr_warn(MPT3SAS_FMT ioc_warn(ioc, "\tenclosure_logical_id(0x%016llx), slot(%d)\n",
"\tenclosure_logical_id(0x%016llx), slot(%d)\n", (u64)sas_device->enclosure_logical_id,
ioc->name, (unsigned long long) sas_device->slot);
sas_device->enclosure_logical_id, sas_device->slot);
sas_device_put(sas_device); sas_device_put(sas_device);
} }
if (!sas_device) { if (!sas_device) {
pcie_device = mpt3sas_get_pdev_by_handle(ioc, pcie_device = mpt3sas_get_pdev_by_handle(ioc,
le16_to_cpu(scsi_reply->DevHandle)); le16_to_cpu(scsi_reply->DevHandle));
if (pcie_device) { if (pcie_device) {
pr_warn(MPT3SAS_FMT ioc_warn(ioc, "\tWWID(0x%016llx), port(%d)\n",
"\tWWID(0x%016llx), port(%d)\n", ioc->name,
(unsigned long long)pcie_device->wwid, (unsigned long long)pcie_device->wwid,
pcie_device->port_num); pcie_device->port_num);
if (pcie_device->enclosure_handle != 0) if (pcie_device->enclosure_handle != 0)
pr_warn(MPT3SAS_FMT ioc_warn(ioc, "\tenclosure_logical_id(0x%016llx), slot(%d)\n",
"\tenclosure_logical_id(0x%016llx), slot(%d)\n", (u64)pcie_device->enclosure_logical_id,
ioc->name, (unsigned long long)
pcie_device->enclosure_logical_id,
pcie_device->slot); pcie_device->slot);
pcie_device_put(pcie_device); pcie_device_put(pcie_device);
} }
} }
if (scsi_reply->SCSIState || scsi_reply->SCSIStatus) if (scsi_reply->SCSIState || scsi_reply->SCSIStatus)
pr_info(MPT3SAS_FMT ioc_info(ioc, "\tscsi_state(0x%02x), scsi_status(0x%02x)\n",
"\tscsi_state(0x%02x), scsi_status"
"(0x%02x)\n", ioc->name,
scsi_reply->SCSIState, scsi_reply->SCSIState,
scsi_reply->SCSIStatus); scsi_reply->SCSIStatus);
} }
@ -466,8 +458,7 @@ void mpt3sas_ctl_pre_reset_handler(struct MPT3SAS_ADAPTER *ioc)
int i; int i;
u8 issue_reset; u8 issue_reset;
dtmprintk(ioc, pr_info(MPT3SAS_FMT dtmprintk(ioc, ioc_info(ioc, "%s: MPT3_IOC_PRE_RESET\n", __func__));
"%s: MPT3_IOC_PRE_RESET\n", ioc->name, __func__));
for (i = 0; i < MPI2_DIAG_BUF_TYPE_COUNT; i++) { for (i = 0; i < MPI2_DIAG_BUF_TYPE_COUNT; i++) {
if (!(ioc->diag_buffer_status[i] & if (!(ioc->diag_buffer_status[i] &
MPT3_DIAG_BUFFER_IS_REGISTERED)) MPT3_DIAG_BUFFER_IS_REGISTERED))
@ -487,8 +478,7 @@ void mpt3sas_ctl_pre_reset_handler(struct MPT3SAS_ADAPTER *ioc)
*/ */
void mpt3sas_ctl_after_reset_handler(struct MPT3SAS_ADAPTER *ioc) void mpt3sas_ctl_after_reset_handler(struct MPT3SAS_ADAPTER *ioc)
{ {
dtmprintk(ioc, pr_info(MPT3SAS_FMT dtmprintk(ioc, ioc_info(ioc, "%s: MPT3_IOC_AFTER_RESET\n", __func__));
"%s: MPT3_IOC_AFTER_RESET\n", ioc->name, __func__));
if (ioc->ctl_cmds.status & MPT3_CMD_PENDING) { if (ioc->ctl_cmds.status & MPT3_CMD_PENDING) {
ioc->ctl_cmds.status |= MPT3_CMD_RESET; ioc->ctl_cmds.status |= MPT3_CMD_RESET;
mpt3sas_base_free_smid(ioc, ioc->ctl_cmds.smid); mpt3sas_base_free_smid(ioc, ioc->ctl_cmds.smid);
@ -506,8 +496,7 @@ void mpt3sas_ctl_reset_done_handler(struct MPT3SAS_ADAPTER *ioc)
{ {
int i; int i;
dtmprintk(ioc, pr_info(MPT3SAS_FMT dtmprintk(ioc, ioc_info(ioc, "%s: MPT3_IOC_DONE_RESET\n", __func__));
"%s: MPT3_IOC_DONE_RESET\n", ioc->name, __func__));
for (i = 0; i < MPI2_DIAG_BUF_TYPE_COUNT; i++) { for (i = 0; i < MPI2_DIAG_BUF_TYPE_COUNT; i++) {
if (!(ioc->diag_buffer_status[i] & if (!(ioc->diag_buffer_status[i] &
@ -612,10 +601,10 @@ _ctl_set_task_mid(struct MPT3SAS_ADAPTER *ioc, struct mpt3_ioctl_command *karg,
} }
if (!found) { if (!found) {
dctlprintk(ioc, pr_info(MPT3SAS_FMT dctlprintk(ioc,
"%s: handle(0x%04x), lun(%d), no active mid!!\n", ioc_info(ioc, "%s: handle(0x%04x), lun(%d), no active mid!!\n",
ioc->name, desc, le16_to_cpu(tm_request->DevHandle),
desc, le16_to_cpu(tm_request->DevHandle), lun)); 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;
@ -631,8 +620,8 @@ _ctl_set_task_mid(struct MPT3SAS_ADAPTER *ioc, struct mpt3_ioctl_command *karg,
return 1; return 1;
} }
dctlprintk(ioc, pr_info(MPT3SAS_FMT dctlprintk(ioc,
"%s: handle(0x%04x), lun(%d), task_mid(%d)\n", ioc->name, ioc_info(ioc, "%s: handle(0x%04x), lun(%d), task_mid(%d)\n",
desc, le16_to_cpu(tm_request->DevHandle), lun, desc, le16_to_cpu(tm_request->DevHandle), lun,
le16_to_cpu(tm_request->TaskMID))); le16_to_cpu(tm_request->TaskMID)));
return 0; return 0;
@ -672,8 +661,7 @@ _ctl_do_mpt_command(struct MPT3SAS_ADAPTER *ioc, struct mpt3_ioctl_command karg,
issue_reset = 0; issue_reset = 0;
if (ioc->ctl_cmds.status != MPT3_CMD_NOT_USED) { if (ioc->ctl_cmds.status != MPT3_CMD_NOT_USED) {
pr_err(MPT3SAS_FMT "%s: ctl_cmd in use\n", ioc_err(ioc, "%s: ctl_cmd in use\n", __func__);
ioc->name, __func__);
ret = -EAGAIN; ret = -EAGAIN;
goto out; goto out;
} }
@ -682,28 +670,23 @@ _ctl_do_mpt_command(struct MPT3SAS_ADAPTER *ioc, struct mpt3_ioctl_command karg,
ioc_state = mpt3sas_base_get_iocstate(ioc, 1); ioc_state = mpt3sas_base_get_iocstate(ioc, 1);
while (ioc_state != MPI2_IOC_STATE_OPERATIONAL) { while (ioc_state != MPI2_IOC_STATE_OPERATIONAL) {
if (wait_state_count++ == 10) { if (wait_state_count++ == 10) {
pr_err(MPT3SAS_FMT ioc_err(ioc, "%s: failed due to ioc not operational\n",
"%s: failed due to ioc not operational\n", __func__);
ioc->name, __func__);
ret = -EFAULT; ret = -EFAULT;
goto out; goto out;
} }
ssleep(1); ssleep(1);
ioc_state = mpt3sas_base_get_iocstate(ioc, 1); ioc_state = mpt3sas_base_get_iocstate(ioc, 1);
pr_info(MPT3SAS_FMT ioc_info(ioc, "%s: waiting for operational state(count=%d)\n",
"%s: waiting for operational state(count=%d)\n",
ioc->name,
__func__, wait_state_count); __func__, wait_state_count);
} }
if (wait_state_count) if (wait_state_count)
pr_info(MPT3SAS_FMT "%s: ioc is operational\n", ioc_info(ioc, "%s: ioc is operational\n", __func__);
ioc->name, __func__);
mpi_request = kzalloc(ioc->request_sz, GFP_KERNEL); mpi_request = kzalloc(ioc->request_sz, GFP_KERNEL);
if (!mpi_request) { if (!mpi_request) {
pr_err(MPT3SAS_FMT ioc_err(ioc, "%s: failed obtaining a memory for mpi_request\n",
"%s: failed obtaining a memory for mpi_request\n", __func__);
ioc->name, __func__);
ret = -ENOMEM; ret = -ENOMEM;
goto out; goto out;
} }
@ -726,8 +709,7 @@ _ctl_do_mpt_command(struct MPT3SAS_ADAPTER *ioc, struct mpt3_ioctl_command karg,
if (mpi_request->Function == MPI2_FUNCTION_SCSI_TASK_MGMT) { if (mpi_request->Function == MPI2_FUNCTION_SCSI_TASK_MGMT) {
smid = mpt3sas_base_get_smid_hpr(ioc, ioc->ctl_cb_idx); smid = mpt3sas_base_get_smid_hpr(ioc, ioc->ctl_cb_idx);
if (!smid) { if (!smid) {
pr_err(MPT3SAS_FMT "%s: failed obtaining a smid\n", ioc_err(ioc, "%s: failed obtaining a smid\n", __func__);
ioc->name, __func__);
ret = -EAGAIN; ret = -EAGAIN;
goto out; goto out;
} }
@ -823,9 +805,9 @@ _ctl_do_mpt_command(struct MPT3SAS_ADAPTER *ioc, struct mpt3_ioctl_command karg,
ioc->build_nvme_prp(ioc, smid, nvme_encap_request, ioc->build_nvme_prp(ioc, smid, nvme_encap_request,
data_out_dma, data_out_sz, data_in_dma, data_in_sz); data_out_dma, data_out_sz, data_in_dma, data_in_sz);
if (test_bit(device_handle, ioc->device_remove_in_progress)) { if (test_bit(device_handle, ioc->device_remove_in_progress)) {
dtmprintk(ioc, pr_info(MPT3SAS_FMT "handle(0x%04x) :" dtmprintk(ioc,
"ioctl failed due to device removal in progress\n", ioc_info(ioc, "handle(0x%04x): ioctl failed due to device removal in progress\n",
ioc->name, device_handle)); device_handle));
mpt3sas_base_free_smid(ioc, smid); mpt3sas_base_free_smid(ioc, smid);
ret = -EINVAL; ret = -EINVAL;
goto out; goto out;
@ -843,9 +825,9 @@ _ctl_do_mpt_command(struct MPT3SAS_ADAPTER *ioc, struct mpt3_ioctl_command karg,
mpt3sas_base_get_sense_buffer_dma(ioc, smid); mpt3sas_base_get_sense_buffer_dma(ioc, smid);
memset(ioc->ctl_cmds.sense, 0, SCSI_SENSE_BUFFERSIZE); memset(ioc->ctl_cmds.sense, 0, SCSI_SENSE_BUFFERSIZE);
if (test_bit(device_handle, ioc->device_remove_in_progress)) { if (test_bit(device_handle, ioc->device_remove_in_progress)) {
dtmprintk(ioc, pr_info(MPT3SAS_FMT dtmprintk(ioc,
"handle(0x%04x) :ioctl failed due to device removal in progress\n", ioc_info(ioc, "handle(0x%04x) :ioctl failed due to device removal in progress\n",
ioc->name, device_handle)); device_handle));
mpt3sas_base_free_smid(ioc, smid); mpt3sas_base_free_smid(ioc, smid);
ret = -EINVAL; ret = -EINVAL;
goto out; goto out;
@ -863,10 +845,10 @@ _ctl_do_mpt_command(struct MPT3SAS_ADAPTER *ioc, struct mpt3_ioctl_command karg,
Mpi2SCSITaskManagementRequest_t *tm_request = Mpi2SCSITaskManagementRequest_t *tm_request =
(Mpi2SCSITaskManagementRequest_t *)request; (Mpi2SCSITaskManagementRequest_t *)request;
dtmprintk(ioc, pr_info(MPT3SAS_FMT dtmprintk(ioc,
"TASK_MGMT: handle(0x%04x), task_type(0x%02x)\n", ioc_info(ioc, "TASK_MGMT: handle(0x%04x), task_type(0x%02x)\n",
ioc->name, le16_to_cpu(tm_request->DevHandle),
le16_to_cpu(tm_request->DevHandle), tm_request->TaskType)); tm_request->TaskType));
ioc->got_task_abort_from_ioctl = 1; ioc->got_task_abort_from_ioctl = 1;
if (tm_request->TaskType == if (tm_request->TaskType ==
MPI2_SCSITASKMGMT_TASKTYPE_ABORT_TASK || MPI2_SCSITASKMGMT_TASKTYPE_ABORT_TASK ||
@ -881,9 +863,9 @@ _ctl_do_mpt_command(struct MPT3SAS_ADAPTER *ioc, struct mpt3_ioctl_command karg,
ioc->got_task_abort_from_ioctl = 0; ioc->got_task_abort_from_ioctl = 0;
if (test_bit(device_handle, ioc->device_remove_in_progress)) { if (test_bit(device_handle, ioc->device_remove_in_progress)) {
dtmprintk(ioc, pr_info(MPT3SAS_FMT dtmprintk(ioc,
"handle(0x%04x) :ioctl failed due to device removal in progress\n", ioc_info(ioc, "handle(0x%04x) :ioctl failed due to device removal in progress\n",
ioc->name, device_handle)); device_handle));
mpt3sas_base_free_smid(ioc, smid); mpt3sas_base_free_smid(ioc, smid);
ret = -EINVAL; ret = -EINVAL;
goto out; goto out;
@ -929,9 +911,9 @@ _ctl_do_mpt_command(struct MPT3SAS_ADAPTER *ioc, struct mpt3_ioctl_command karg,
case MPI2_FUNCTION_SATA_PASSTHROUGH: case MPI2_FUNCTION_SATA_PASSTHROUGH:
{ {
if (test_bit(device_handle, ioc->device_remove_in_progress)) { if (test_bit(device_handle, ioc->device_remove_in_progress)) {
dtmprintk(ioc, pr_info(MPT3SAS_FMT dtmprintk(ioc,
"handle(0x%04x) :ioctl failed due to device removal in progress\n", ioc_info(ioc, "handle(0x%04x) :ioctl failed due to device removal in progress\n",
ioc->name, device_handle)); device_handle));
mpt3sas_base_free_smid(ioc, smid); mpt3sas_base_free_smid(ioc, smid);
ret = -EINVAL; ret = -EINVAL;
goto out; goto out;
@ -1017,9 +999,7 @@ _ctl_do_mpt_command(struct MPT3SAS_ADAPTER *ioc, struct mpt3_ioctl_command karg,
Mpi2SCSITaskManagementReply_t *tm_reply = Mpi2SCSITaskManagementReply_t *tm_reply =
(Mpi2SCSITaskManagementReply_t *)mpi_reply; (Mpi2SCSITaskManagementReply_t *)mpi_reply;
pr_info(MPT3SAS_FMT "TASK_MGMT: " \ ioc_info(ioc, "TASK_MGMT: IOCStatus(0x%04x), IOCLogInfo(0x%08x), TerminationCount(0x%08x)\n",
"IOCStatus(0x%04x), IOCLogInfo(0x%08x), "
"TerminationCount(0x%08x)\n", ioc->name,
le16_to_cpu(tm_reply->IOCStatus), le16_to_cpu(tm_reply->IOCStatus),
le32_to_cpu(tm_reply->IOCLogInfo), le32_to_cpu(tm_reply->IOCLogInfo),
le32_to_cpu(tm_reply->TerminationCount)); le32_to_cpu(tm_reply->TerminationCount));
@ -1054,9 +1034,7 @@ _ctl_do_mpt_command(struct MPT3SAS_ADAPTER *ioc, struct mpt3_ioctl_command karg,
MPI2_FUNCTION_RAID_SCSI_IO_PASSTHROUGH || mpi_request->Function == MPI2_FUNCTION_RAID_SCSI_IO_PASSTHROUGH || mpi_request->Function ==
MPI2_FUNCTION_NVME_ENCAPSULATED)) { MPI2_FUNCTION_NVME_ENCAPSULATED)) {
if (karg.sense_data_ptr == NULL) { if (karg.sense_data_ptr == NULL) {
pr_info(MPT3SAS_FMT "Response buffer provided" ioc_info(ioc, "Response buffer provided by application is NULL; Response data will not be returned\n");
" by application is NULL; Response data will"
" not be returned.\n", ioc->name);
goto out; goto out;
} }
sz_arg = (mpi_request->Function == sz_arg = (mpi_request->Function ==
@ -1079,8 +1057,7 @@ _ctl_do_mpt_command(struct MPT3SAS_ADAPTER *ioc, struct mpt3_ioctl_command karg,
mpi_request->Function == mpi_request->Function ==
MPI2_FUNCTION_RAID_SCSI_IO_PASSTHROUGH || MPI2_FUNCTION_RAID_SCSI_IO_PASSTHROUGH ||
mpi_request->Function == MPI2_FUNCTION_SATA_PASSTHROUGH)) { mpi_request->Function == MPI2_FUNCTION_SATA_PASSTHROUGH)) {
pr_info(MPT3SAS_FMT "issue target reset: handle = (0x%04x)\n", ioc_info(ioc, "issue target reset: handle = (0x%04x)\n",
ioc->name,
le16_to_cpu(mpi_request->FunctionDependent1)); le16_to_cpu(mpi_request->FunctionDependent1));
mpt3sas_halt_firmware(ioc); mpt3sas_halt_firmware(ioc);
pcie_device = mpt3sas_get_pdev_by_handle(ioc, pcie_device = mpt3sas_get_pdev_by_handle(ioc,
@ -1128,7 +1105,7 @@ _ctl_getiocinfo(struct MPT3SAS_ADAPTER *ioc, void __user *arg)
{ {
struct mpt3_ioctl_iocinfo karg; struct mpt3_ioctl_iocinfo karg;
dctlprintk(ioc, pr_info(MPT3SAS_FMT "%s: enter\n", ioc->name, dctlprintk(ioc, ioc_info(ioc, "%s: enter\n",
__func__)); __func__));
memset(&karg, 0 , sizeof(karg)); memset(&karg, 0 , sizeof(karg));
@ -1188,7 +1165,7 @@ _ctl_eventquery(struct MPT3SAS_ADAPTER *ioc, void __user *arg)
return -EFAULT; return -EFAULT;
} }
dctlprintk(ioc, pr_info(MPT3SAS_FMT "%s: enter\n", ioc->name, dctlprintk(ioc, ioc_info(ioc, "%s: enter\n",
__func__)); __func__));
karg.event_entries = MPT3SAS_CTL_EVENT_LOG_SIZE; karg.event_entries = MPT3SAS_CTL_EVENT_LOG_SIZE;
@ -1219,7 +1196,7 @@ _ctl_eventenable(struct MPT3SAS_ADAPTER *ioc, void __user *arg)
return -EFAULT; return -EFAULT;
} }
dctlprintk(ioc, pr_info(MPT3SAS_FMT "%s: enter\n", ioc->name, dctlprintk(ioc, ioc_info(ioc, "%s: enter\n",
__func__)); __func__));
memcpy(ioc->event_type, karg.event_types, memcpy(ioc->event_type, karg.event_types,
@ -1259,7 +1236,7 @@ _ctl_eventreport(struct MPT3SAS_ADAPTER *ioc, void __user *arg)
return -EFAULT; return -EFAULT;
} }
dctlprintk(ioc, pr_info(MPT3SAS_FMT "%s: enter\n", ioc->name, dctlprintk(ioc, ioc_info(ioc, "%s: enter\n",
__func__)); __func__));
number_bytes = karg.hdr.max_data_size - number_bytes = karg.hdr.max_data_size -
@ -1306,12 +1283,11 @@ _ctl_do_reset(struct MPT3SAS_ADAPTER *ioc, void __user *arg)
ioc->is_driver_loading) ioc->is_driver_loading)
return -EAGAIN; return -EAGAIN;
dctlprintk(ioc, pr_info(MPT3SAS_FMT "%s: enter\n", ioc->name, dctlprintk(ioc, ioc_info(ioc, "%s: enter\n",
__func__)); __func__));
retval = mpt3sas_base_hard_reset_handler(ioc, FORCE_BIG_HAMMER); retval = mpt3sas_base_hard_reset_handler(ioc, FORCE_BIG_HAMMER);
pr_info(MPT3SAS_FMT "host reset: %s\n", ioc_info(ioc, "host reset: %s\n", ((!retval) ? "SUCCESS" : "FAILED"));
ioc->name, ((!retval) ? "SUCCESS" : "FAILED"));
return 0; return 0;
} }
@ -1440,7 +1416,7 @@ _ctl_btdh_mapping(struct MPT3SAS_ADAPTER *ioc, void __user *arg)
return -EFAULT; return -EFAULT;
} }
dctlprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name, dctlprintk(ioc, ioc_info(ioc, "%s\n",
__func__)); __func__));
rc = _ctl_btdh_search_sas_device(ioc, &karg); rc = _ctl_btdh_search_sas_device(ioc, &karg);
@ -1512,53 +1488,46 @@ _ctl_diag_register_2(struct MPT3SAS_ADAPTER *ioc,
u32 ioc_state; u32 ioc_state;
u8 issue_reset = 0; u8 issue_reset = 0;
dctlprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name, dctlprintk(ioc, ioc_info(ioc, "%s\n",
__func__)); __func__));
ioc_state = mpt3sas_base_get_iocstate(ioc, 1); ioc_state = mpt3sas_base_get_iocstate(ioc, 1);
if (ioc_state != MPI2_IOC_STATE_OPERATIONAL) { if (ioc_state != MPI2_IOC_STATE_OPERATIONAL) {
pr_err(MPT3SAS_FMT ioc_err(ioc, "%s: failed due to ioc not operational\n",
"%s: failed due to ioc not operational\n", __func__);
ioc->name, __func__);
rc = -EAGAIN; rc = -EAGAIN;
goto out; goto out;
} }
if (ioc->ctl_cmds.status != MPT3_CMD_NOT_USED) { if (ioc->ctl_cmds.status != MPT3_CMD_NOT_USED) {
pr_err(MPT3SAS_FMT "%s: ctl_cmd in use\n", ioc_err(ioc, "%s: ctl_cmd in use\n", __func__);
ioc->name, __func__);
rc = -EAGAIN; rc = -EAGAIN;
goto out; goto out;
} }
buffer_type = diag_register->buffer_type; buffer_type = diag_register->buffer_type;
if (!_ctl_diag_capability(ioc, buffer_type)) { if (!_ctl_diag_capability(ioc, buffer_type)) {
pr_err(MPT3SAS_FMT ioc_err(ioc, "%s: doesn't have capability for buffer_type(0x%02x)\n",
"%s: doesn't have capability for buffer_type(0x%02x)\n", __func__, buffer_type);
ioc->name, __func__, buffer_type);
return -EPERM; return -EPERM;
} }
if (ioc->diag_buffer_status[buffer_type] & if (ioc->diag_buffer_status[buffer_type] &
MPT3_DIAG_BUFFER_IS_REGISTERED) { MPT3_DIAG_BUFFER_IS_REGISTERED) {
pr_err(MPT3SAS_FMT ioc_err(ioc, "%s: already has a registered buffer for buffer_type(0x%02x)\n",
"%s: already has a registered buffer for buffer_type(0x%02x)\n", __func__, buffer_type);
ioc->name, __func__,
buffer_type);
return -EINVAL; return -EINVAL;
} }
if (diag_register->requested_buffer_size % 4) { if (diag_register->requested_buffer_size % 4) {
pr_err(MPT3SAS_FMT ioc_err(ioc, "%s: the requested_buffer_size is not 4 byte aligned\n",
"%s: the requested_buffer_size is not 4 byte aligned\n", __func__);
ioc->name, __func__);
return -EINVAL; return -EINVAL;
} }
smid = mpt3sas_base_get_smid(ioc, ioc->ctl_cb_idx); smid = mpt3sas_base_get_smid(ioc, ioc->ctl_cb_idx);
if (!smid) { if (!smid) {
pr_err(MPT3SAS_FMT "%s: failed obtaining a smid\n", ioc_err(ioc, "%s: failed obtaining a smid\n", __func__);
ioc->name, __func__);
rc = -EAGAIN; rc = -EAGAIN;
goto out; goto out;
} }
@ -1593,9 +1562,8 @@ _ctl_diag_register_2(struct MPT3SAS_ADAPTER *ioc,
request_data = pci_alloc_consistent( request_data = pci_alloc_consistent(
ioc->pdev, request_data_sz, &request_data_dma); ioc->pdev, request_data_sz, &request_data_dma);
if (request_data == NULL) { if (request_data == NULL) {
pr_err(MPT3SAS_FMT "%s: failed allocating memory" \ ioc_err(ioc, "%s: failed allocating memory for diag buffers, requested size(%d)\n",
" for diag buffers, requested size(%d)\n", __func__, request_data_sz);
ioc->name, __func__, request_data_sz);
mpt3sas_base_free_smid(ioc, smid); mpt3sas_base_free_smid(ioc, smid);
return -ENOMEM; return -ENOMEM;
} }
@ -1612,9 +1580,9 @@ _ctl_diag_register_2(struct MPT3SAS_ADAPTER *ioc,
mpi_request->VF_ID = 0; /* TODO */ mpi_request->VF_ID = 0; /* TODO */
mpi_request->VP_ID = 0; mpi_request->VP_ID = 0;
dctlprintk(ioc, pr_info(MPT3SAS_FMT dctlprintk(ioc,
"%s: diag_buffer(0x%p), dma(0x%llx), sz(%d)\n", ioc_info(ioc, "%s: diag_buffer(0x%p), dma(0x%llx), sz(%d)\n",
ioc->name, __func__, request_data, __func__, request_data,
(unsigned long long)request_data_dma, (unsigned long long)request_data_dma,
le32_to_cpu(mpi_request->BufferLength))); le32_to_cpu(mpi_request->BufferLength)));
@ -1637,8 +1605,7 @@ _ctl_diag_register_2(struct MPT3SAS_ADAPTER *ioc,
/* process the completed Reply Message Frame */ /* process the completed Reply Message Frame */
if ((ioc->ctl_cmds.status & MPT3_CMD_REPLY_VALID) == 0) { if ((ioc->ctl_cmds.status & MPT3_CMD_REPLY_VALID) == 0) {
pr_err(MPT3SAS_FMT "%s: no reply message\n", ioc_err(ioc, "%s: no reply message\n", __func__);
ioc->name, __func__);
rc = -EFAULT; rc = -EFAULT;
goto out; goto out;
} }
@ -1649,12 +1616,10 @@ _ctl_diag_register_2(struct MPT3SAS_ADAPTER *ioc,
if (ioc_status == MPI2_IOCSTATUS_SUCCESS) { if (ioc_status == MPI2_IOCSTATUS_SUCCESS) {
ioc->diag_buffer_status[buffer_type] |= ioc->diag_buffer_status[buffer_type] |=
MPT3_DIAG_BUFFER_IS_REGISTERED; MPT3_DIAG_BUFFER_IS_REGISTERED;
dctlprintk(ioc, pr_info(MPT3SAS_FMT "%s: success\n", dctlprintk(ioc, ioc_info(ioc, "%s: success\n", __func__));
ioc->name, __func__));
} else { } else {
pr_info(MPT3SAS_FMT ioc_info(ioc, "%s: ioc_status(0x%04x) log_info(0x%08x)\n",
"%s: ioc_status(0x%04x) log_info(0x%08x)\n", __func__,
ioc->name, __func__,
ioc_status, le32_to_cpu(mpi_reply->IOCLogInfo)); ioc_status, le32_to_cpu(mpi_reply->IOCLogInfo));
rc = -EFAULT; rc = -EFAULT;
} }
@ -1689,8 +1654,7 @@ mpt3sas_enable_diag_buffer(struct MPT3SAS_ADAPTER *ioc, u8 bits_to_register)
memset(&diag_register, 0, sizeof(struct mpt3_diag_register)); memset(&diag_register, 0, sizeof(struct mpt3_diag_register));
if (bits_to_register & 1) { if (bits_to_register & 1) {
pr_info(MPT3SAS_FMT "registering trace buffer support\n", ioc_info(ioc, "registering trace buffer support\n");
ioc->name);
ioc->diag_trigger_master.MasterData = ioc->diag_trigger_master.MasterData =
(MASTER_TRIGGER_FW_FAULT + MASTER_TRIGGER_ADAPTER_RESET); (MASTER_TRIGGER_FW_FAULT + MASTER_TRIGGER_ADAPTER_RESET);
diag_register.buffer_type = MPI2_DIAG_BUF_TYPE_TRACE; diag_register.buffer_type = MPI2_DIAG_BUF_TYPE_TRACE;
@ -1701,8 +1665,7 @@ mpt3sas_enable_diag_buffer(struct MPT3SAS_ADAPTER *ioc, u8 bits_to_register)
} }
if (bits_to_register & 2) { if (bits_to_register & 2) {
pr_info(MPT3SAS_FMT "registering snapshot buffer support\n", ioc_info(ioc, "registering snapshot buffer support\n");
ioc->name);
diag_register.buffer_type = MPI2_DIAG_BUF_TYPE_SNAPSHOT; diag_register.buffer_type = MPI2_DIAG_BUF_TYPE_SNAPSHOT;
/* register for 2MB buffers */ /* register for 2MB buffers */
diag_register.requested_buffer_size = 2 * (1024 * 1024); diag_register.requested_buffer_size = 2 * (1024 * 1024);
@ -1711,8 +1674,7 @@ mpt3sas_enable_diag_buffer(struct MPT3SAS_ADAPTER *ioc, u8 bits_to_register)
} }
if (bits_to_register & 4) { if (bits_to_register & 4) {
pr_info(MPT3SAS_FMT "registering extended buffer support\n", ioc_info(ioc, "registering extended buffer support\n");
ioc->name);
diag_register.buffer_type = MPI2_DIAG_BUF_TYPE_EXTENDED; diag_register.buffer_type = MPI2_DIAG_BUF_TYPE_EXTENDED;
/* register for 2MB buffers */ /* register for 2MB buffers */
diag_register.requested_buffer_size = 2 * (1024 * 1024); diag_register.requested_buffer_size = 2 * (1024 * 1024);
@ -1768,44 +1730,39 @@ _ctl_diag_unregister(struct MPT3SAS_ADAPTER *ioc, void __user *arg)
return -EFAULT; return -EFAULT;
} }
dctlprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name, dctlprintk(ioc, ioc_info(ioc, "%s\n",
__func__)); __func__));
buffer_type = karg.unique_id & 0x000000ff; buffer_type = karg.unique_id & 0x000000ff;
if (!_ctl_diag_capability(ioc, buffer_type)) { if (!_ctl_diag_capability(ioc, buffer_type)) {
pr_err(MPT3SAS_FMT ioc_err(ioc, "%s: doesn't have capability for buffer_type(0x%02x)\n",
"%s: doesn't have capability for buffer_type(0x%02x)\n", __func__, buffer_type);
ioc->name, __func__, buffer_type);
return -EPERM; return -EPERM;
} }
if ((ioc->diag_buffer_status[buffer_type] & if ((ioc->diag_buffer_status[buffer_type] &
MPT3_DIAG_BUFFER_IS_REGISTERED) == 0) { MPT3_DIAG_BUFFER_IS_REGISTERED) == 0) {
pr_err(MPT3SAS_FMT ioc_err(ioc, "%s: buffer_type(0x%02x) is not registered\n",
"%s: buffer_type(0x%02x) is not registered\n", __func__, buffer_type);
ioc->name, __func__, buffer_type);
return -EINVAL; return -EINVAL;
} }
if ((ioc->diag_buffer_status[buffer_type] & if ((ioc->diag_buffer_status[buffer_type] &
MPT3_DIAG_BUFFER_IS_RELEASED) == 0) { MPT3_DIAG_BUFFER_IS_RELEASED) == 0) {
pr_err(MPT3SAS_FMT ioc_err(ioc, "%s: buffer_type(0x%02x) has not been released\n",
"%s: buffer_type(0x%02x) has not been released\n", __func__, buffer_type);
ioc->name, __func__, buffer_type);
return -EINVAL; return -EINVAL;
} }
if (karg.unique_id != ioc->unique_id[buffer_type]) { if (karg.unique_id != ioc->unique_id[buffer_type]) {
pr_err(MPT3SAS_FMT ioc_err(ioc, "%s: unique_id(0x%08x) is not registered\n",
"%s: unique_id(0x%08x) is not registered\n", __func__, karg.unique_id);
ioc->name, __func__, karg.unique_id);
return -EINVAL; return -EINVAL;
} }
request_data = ioc->diag_buffer[buffer_type]; request_data = ioc->diag_buffer[buffer_type];
if (!request_data) { if (!request_data) {
pr_err(MPT3SAS_FMT ioc_err(ioc, "%s: doesn't have memory allocated for buffer_type(0x%02x)\n",
"%s: doesn't have memory allocated for buffer_type(0x%02x)\n", __func__, buffer_type);
ioc->name, __func__, buffer_type);
return -ENOMEM; return -ENOMEM;
} }
@ -1841,41 +1798,37 @@ _ctl_diag_query(struct MPT3SAS_ADAPTER *ioc, void __user *arg)
return -EFAULT; return -EFAULT;
} }
dctlprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name, dctlprintk(ioc, ioc_info(ioc, "%s\n",
__func__)); __func__));
karg.application_flags = 0; karg.application_flags = 0;
buffer_type = karg.buffer_type; buffer_type = karg.buffer_type;
if (!_ctl_diag_capability(ioc, buffer_type)) { if (!_ctl_diag_capability(ioc, buffer_type)) {
pr_err(MPT3SAS_FMT ioc_err(ioc, "%s: doesn't have capability for buffer_type(0x%02x)\n",
"%s: doesn't have capability for buffer_type(0x%02x)\n", __func__, buffer_type);
ioc->name, __func__, buffer_type);
return -EPERM; return -EPERM;
} }
if ((ioc->diag_buffer_status[buffer_type] & if ((ioc->diag_buffer_status[buffer_type] &
MPT3_DIAG_BUFFER_IS_REGISTERED) == 0) { MPT3_DIAG_BUFFER_IS_REGISTERED) == 0) {
pr_err(MPT3SAS_FMT ioc_err(ioc, "%s: buffer_type(0x%02x) is not registered\n",
"%s: buffer_type(0x%02x) is not registered\n", __func__, buffer_type);
ioc->name, __func__, buffer_type);
return -EINVAL; return -EINVAL;
} }
if (karg.unique_id & 0xffffff00) { if (karg.unique_id & 0xffffff00) {
if (karg.unique_id != ioc->unique_id[buffer_type]) { if (karg.unique_id != ioc->unique_id[buffer_type]) {
pr_err(MPT3SAS_FMT ioc_err(ioc, "%s: unique_id(0x%08x) is not registered\n",
"%s: unique_id(0x%08x) is not registered\n", __func__, karg.unique_id);
ioc->name, __func__, karg.unique_id);
return -EINVAL; return -EINVAL;
} }
} }
request_data = ioc->diag_buffer[buffer_type]; request_data = ioc->diag_buffer[buffer_type];
if (!request_data) { if (!request_data) {
pr_err(MPT3SAS_FMT ioc_err(ioc, "%s: doesn't have buffer for buffer_type(0x%02x)\n",
"%s: doesn't have buffer for buffer_type(0x%02x)\n", __func__, buffer_type);
ioc->name, __func__, buffer_type);
return -ENOMEM; return -ENOMEM;
} }
@ -1897,9 +1850,8 @@ _ctl_diag_query(struct MPT3SAS_ADAPTER *ioc, void __user *arg)
karg.diagnostic_flags = ioc->diagnostic_flags[buffer_type]; karg.diagnostic_flags = ioc->diagnostic_flags[buffer_type];
if (copy_to_user(arg, &karg, sizeof(struct mpt3_diag_query))) { if (copy_to_user(arg, &karg, sizeof(struct mpt3_diag_query))) {
pr_err(MPT3SAS_FMT ioc_err(ioc, "%s: unable to write mpt3_diag_query data @ %p\n",
"%s: unable to write mpt3_diag_query data @ %p\n", __func__, arg);
ioc->name, __func__, arg);
return -EFAULT; return -EFAULT;
} }
return 0; return 0;
@ -1923,7 +1875,7 @@ mpt3sas_send_diag_release(struct MPT3SAS_ADAPTER *ioc, u8 buffer_type,
u32 ioc_state; u32 ioc_state;
int rc; int rc;
dctlprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name, dctlprintk(ioc, ioc_info(ioc, "%s\n",
__func__)); __func__));
rc = 0; rc = 0;
@ -1935,24 +1887,22 @@ mpt3sas_send_diag_release(struct MPT3SAS_ADAPTER *ioc, u8 buffer_type,
MPT3_DIAG_BUFFER_IS_REGISTERED) MPT3_DIAG_BUFFER_IS_REGISTERED)
ioc->diag_buffer_status[buffer_type] |= ioc->diag_buffer_status[buffer_type] |=
MPT3_DIAG_BUFFER_IS_RELEASED; MPT3_DIAG_BUFFER_IS_RELEASED;
dctlprintk(ioc, pr_info(MPT3SAS_FMT dctlprintk(ioc,
"%s: skipping due to FAULT state\n", ioc->name, ioc_info(ioc, "%s: skipping due to FAULT state\n",
__func__)); __func__));
rc = -EAGAIN; rc = -EAGAIN;
goto out; goto out;
} }
if (ioc->ctl_cmds.status != MPT3_CMD_NOT_USED) { if (ioc->ctl_cmds.status != MPT3_CMD_NOT_USED) {
pr_err(MPT3SAS_FMT "%s: ctl_cmd in use\n", ioc_err(ioc, "%s: ctl_cmd in use\n", __func__);
ioc->name, __func__);
rc = -EAGAIN; rc = -EAGAIN;
goto out; goto out;
} }
smid = mpt3sas_base_get_smid(ioc, ioc->ctl_cb_idx); smid = mpt3sas_base_get_smid(ioc, ioc->ctl_cb_idx);
if (!smid) { if (!smid) {
pr_err(MPT3SAS_FMT "%s: failed obtaining a smid\n", ioc_err(ioc, "%s: failed obtaining a smid\n", __func__);
ioc->name, __func__);
rc = -EAGAIN; rc = -EAGAIN;
goto out; goto out;
} }
@ -1982,8 +1932,7 @@ mpt3sas_send_diag_release(struct MPT3SAS_ADAPTER *ioc, u8 buffer_type,
/* process the completed Reply Message Frame */ /* process the completed Reply Message Frame */
if ((ioc->ctl_cmds.status & MPT3_CMD_REPLY_VALID) == 0) { if ((ioc->ctl_cmds.status & MPT3_CMD_REPLY_VALID) == 0) {
pr_err(MPT3SAS_FMT "%s: no reply message\n", ioc_err(ioc, "%s: no reply message\n", __func__);
ioc->name, __func__);
rc = -EFAULT; rc = -EFAULT;
goto out; goto out;
} }
@ -1994,12 +1943,10 @@ mpt3sas_send_diag_release(struct MPT3SAS_ADAPTER *ioc, u8 buffer_type,
if (ioc_status == MPI2_IOCSTATUS_SUCCESS) { if (ioc_status == MPI2_IOCSTATUS_SUCCESS) {
ioc->diag_buffer_status[buffer_type] |= ioc->diag_buffer_status[buffer_type] |=
MPT3_DIAG_BUFFER_IS_RELEASED; MPT3_DIAG_BUFFER_IS_RELEASED;
dctlprintk(ioc, pr_info(MPT3SAS_FMT "%s: success\n", dctlprintk(ioc, ioc_info(ioc, "%s: success\n", __func__));
ioc->name, __func__));
} else { } else {
pr_info(MPT3SAS_FMT ioc_info(ioc, "%s: ioc_status(0x%04x) log_info(0x%08x)\n",
"%s: ioc_status(0x%04x) log_info(0x%08x)\n", __func__,
ioc->name, __func__,
ioc_status, le32_to_cpu(mpi_reply->IOCLogInfo)); ioc_status, le32_to_cpu(mpi_reply->IOCLogInfo));
rc = -EFAULT; rc = -EFAULT;
} }
@ -2033,47 +1980,41 @@ _ctl_diag_release(struct MPT3SAS_ADAPTER *ioc, void __user *arg)
return -EFAULT; return -EFAULT;
} }
dctlprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name, dctlprintk(ioc, ioc_info(ioc, "%s\n",
__func__)); __func__));
buffer_type = karg.unique_id & 0x000000ff; buffer_type = karg.unique_id & 0x000000ff;
if (!_ctl_diag_capability(ioc, buffer_type)) { if (!_ctl_diag_capability(ioc, buffer_type)) {
pr_err(MPT3SAS_FMT ioc_err(ioc, "%s: doesn't have capability for buffer_type(0x%02x)\n",
"%s: doesn't have capability for buffer_type(0x%02x)\n", __func__, buffer_type);
ioc->name, __func__, buffer_type);
return -EPERM; return -EPERM;
} }
if ((ioc->diag_buffer_status[buffer_type] & if ((ioc->diag_buffer_status[buffer_type] &
MPT3_DIAG_BUFFER_IS_REGISTERED) == 0) { MPT3_DIAG_BUFFER_IS_REGISTERED) == 0) {
pr_err(MPT3SAS_FMT ioc_err(ioc, "%s: buffer_type(0x%02x) is not registered\n",
"%s: buffer_type(0x%02x) is not registered\n", __func__, buffer_type);
ioc->name, __func__, buffer_type);
return -EINVAL; return -EINVAL;
} }
if (karg.unique_id != ioc->unique_id[buffer_type]) { if (karg.unique_id != ioc->unique_id[buffer_type]) {
pr_err(MPT3SAS_FMT ioc_err(ioc, "%s: unique_id(0x%08x) is not registered\n",
"%s: unique_id(0x%08x) is not registered\n", __func__, karg.unique_id);
ioc->name, __func__, karg.unique_id);
return -EINVAL; return -EINVAL;
} }
if (ioc->diag_buffer_status[buffer_type] & if (ioc->diag_buffer_status[buffer_type] &
MPT3_DIAG_BUFFER_IS_RELEASED) { MPT3_DIAG_BUFFER_IS_RELEASED) {
pr_err(MPT3SAS_FMT ioc_err(ioc, "%s: buffer_type(0x%02x) is already released\n",
"%s: buffer_type(0x%02x) is already released\n", __func__, buffer_type);
ioc->name, __func__,
buffer_type);
return 0; return 0;
} }
request_data = ioc->diag_buffer[buffer_type]; request_data = ioc->diag_buffer[buffer_type];
if (!request_data) { if (!request_data) {
pr_err(MPT3SAS_FMT ioc_err(ioc, "%s: doesn't have memory allocated for buffer_type(0x%02x)\n",
"%s: doesn't have memory allocated for buffer_type(0x%02x)\n", __func__, buffer_type);
ioc->name, __func__, buffer_type);
return -ENOMEM; return -ENOMEM;
} }
@ -2084,9 +2025,8 @@ _ctl_diag_release(struct MPT3SAS_ADAPTER *ioc, void __user *arg)
MPT3_DIAG_BUFFER_IS_RELEASED; MPT3_DIAG_BUFFER_IS_RELEASED;
ioc->diag_buffer_status[buffer_type] &= ioc->diag_buffer_status[buffer_type] &=
~MPT3_DIAG_BUFFER_IS_DIAG_RESET; ~MPT3_DIAG_BUFFER_IS_DIAG_RESET;
pr_err(MPT3SAS_FMT ioc_err(ioc, "%s: buffer_type(0x%02x) was released due to host reset\n",
"%s: buffer_type(0x%02x) was released due to host reset\n", __func__, buffer_type);
ioc->name, __func__, buffer_type);
return 0; return 0;
} }
@ -2124,37 +2064,33 @@ _ctl_diag_read_buffer(struct MPT3SAS_ADAPTER *ioc, void __user *arg)
return -EFAULT; return -EFAULT;
} }
dctlprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name, dctlprintk(ioc, ioc_info(ioc, "%s\n",
__func__)); __func__));
buffer_type = karg.unique_id & 0x000000ff; buffer_type = karg.unique_id & 0x000000ff;
if (!_ctl_diag_capability(ioc, buffer_type)) { if (!_ctl_diag_capability(ioc, buffer_type)) {
pr_err(MPT3SAS_FMT ioc_err(ioc, "%s: doesn't have capability for buffer_type(0x%02x)\n",
"%s: doesn't have capability for buffer_type(0x%02x)\n", __func__, buffer_type);
ioc->name, __func__, buffer_type);
return -EPERM; return -EPERM;
} }
if (karg.unique_id != ioc->unique_id[buffer_type]) { if (karg.unique_id != ioc->unique_id[buffer_type]) {
pr_err(MPT3SAS_FMT ioc_err(ioc, "%s: unique_id(0x%08x) is not registered\n",
"%s: unique_id(0x%08x) is not registered\n", __func__, karg.unique_id);
ioc->name, __func__, karg.unique_id);
return -EINVAL; return -EINVAL;
} }
request_data = ioc->diag_buffer[buffer_type]; request_data = ioc->diag_buffer[buffer_type];
if (!request_data) { if (!request_data) {
pr_err(MPT3SAS_FMT ioc_err(ioc, "%s: doesn't have buffer for buffer_type(0x%02x)\n",
"%s: doesn't have buffer for buffer_type(0x%02x)\n", __func__, buffer_type);
ioc->name, __func__, buffer_type);
return -ENOMEM; return -ENOMEM;
} }
request_size = ioc->diag_buffer_sz[buffer_type]; request_size = ioc->diag_buffer_sz[buffer_type];
if ((karg.starting_offset % 4) || (karg.bytes_to_read % 4)) { if ((karg.starting_offset % 4) || (karg.bytes_to_read % 4)) {
pr_err(MPT3SAS_FMT "%s: either the starting_offset " \ ioc_err(ioc, "%s: either the starting_offset or bytes_to_read are not 4 byte aligned\n",
"or bytes_to_read are not 4 byte aligned\n", ioc->name,
__func__); __func__);
return -EINVAL; return -EINVAL;
} }
@ -2163,10 +2099,10 @@ _ctl_diag_read_buffer(struct MPT3SAS_ADAPTER *ioc, void __user *arg)
return -EINVAL; return -EINVAL;
diag_data = (void *)(request_data + karg.starting_offset); diag_data = (void *)(request_data + karg.starting_offset);
dctlprintk(ioc, pr_info(MPT3SAS_FMT dctlprintk(ioc,
"%s: diag_buffer(%p), offset(%d), sz(%d)\n", ioc_info(ioc, "%s: diag_buffer(%p), offset(%d), sz(%d)\n",
ioc->name, __func__, __func__, diag_data, karg.starting_offset,
diag_data, karg.starting_offset, karg.bytes_to_read)); karg.bytes_to_read));
/* Truncate data on requests that are too large */ /* Truncate data on requests that are too large */
if ((diag_data + karg.bytes_to_read < diag_data) || if ((diag_data + karg.bytes_to_read < diag_data) ||
@ -2177,39 +2113,36 @@ _ctl_diag_read_buffer(struct MPT3SAS_ADAPTER *ioc, void __user *arg)
if (copy_to_user((void __user *)uarg->diagnostic_data, if (copy_to_user((void __user *)uarg->diagnostic_data,
diag_data, copy_size)) { diag_data, copy_size)) {
pr_err(MPT3SAS_FMT ioc_err(ioc, "%s: Unable to write mpt_diag_read_buffer_t data @ %p\n",
"%s: Unable to write mpt_diag_read_buffer_t data @ %p\n", __func__, diag_data);
ioc->name, __func__, diag_data);
return -EFAULT; return -EFAULT;
} }
if ((karg.flags & MPT3_FLAGS_REREGISTER) == 0) if ((karg.flags & MPT3_FLAGS_REREGISTER) == 0)
return 0; return 0;
dctlprintk(ioc, pr_info(MPT3SAS_FMT dctlprintk(ioc,
"%s: Reregister buffer_type(0x%02x)\n", ioc_info(ioc, "%s: Reregister buffer_type(0x%02x)\n",
ioc->name, __func__, buffer_type)); __func__, buffer_type));
if ((ioc->diag_buffer_status[buffer_type] & if ((ioc->diag_buffer_status[buffer_type] &
MPT3_DIAG_BUFFER_IS_RELEASED) == 0) { MPT3_DIAG_BUFFER_IS_RELEASED) == 0) {
dctlprintk(ioc, pr_info(MPT3SAS_FMT dctlprintk(ioc,
"%s: buffer_type(0x%02x) is still registered\n", ioc_info(ioc, "%s: buffer_type(0x%02x) is still registered\n",
ioc->name, __func__, buffer_type)); __func__, buffer_type));
return 0; return 0;
} }
/* Get a free request frame and save the message context. /* Get a free request frame and save the message context.
*/ */
if (ioc->ctl_cmds.status != MPT3_CMD_NOT_USED) { if (ioc->ctl_cmds.status != MPT3_CMD_NOT_USED) {
pr_err(MPT3SAS_FMT "%s: ctl_cmd in use\n", ioc_err(ioc, "%s: ctl_cmd in use\n", __func__);
ioc->name, __func__);
rc = -EAGAIN; rc = -EAGAIN;
goto out; goto out;
} }
smid = mpt3sas_base_get_smid(ioc, ioc->ctl_cb_idx); smid = mpt3sas_base_get_smid(ioc, ioc->ctl_cb_idx);
if (!smid) { if (!smid) {
pr_err(MPT3SAS_FMT "%s: failed obtaining a smid\n", ioc_err(ioc, "%s: failed obtaining a smid\n", __func__);
ioc->name, __func__);
rc = -EAGAIN; rc = -EAGAIN;
goto out; goto out;
} }
@ -2247,8 +2180,7 @@ _ctl_diag_read_buffer(struct MPT3SAS_ADAPTER *ioc, void __user *arg)
/* process the completed Reply Message Frame */ /* process the completed Reply Message Frame */
if ((ioc->ctl_cmds.status & MPT3_CMD_REPLY_VALID) == 0) { if ((ioc->ctl_cmds.status & MPT3_CMD_REPLY_VALID) == 0) {
pr_err(MPT3SAS_FMT "%s: no reply message\n", ioc_err(ioc, "%s: no reply message\n", __func__);
ioc->name, __func__);
rc = -EFAULT; rc = -EFAULT;
goto out; goto out;
} }
@ -2259,13 +2191,11 @@ _ctl_diag_read_buffer(struct MPT3SAS_ADAPTER *ioc, void __user *arg)
if (ioc_status == MPI2_IOCSTATUS_SUCCESS) { if (ioc_status == MPI2_IOCSTATUS_SUCCESS) {
ioc->diag_buffer_status[buffer_type] |= ioc->diag_buffer_status[buffer_type] |=
MPT3_DIAG_BUFFER_IS_REGISTERED; MPT3_DIAG_BUFFER_IS_REGISTERED;
dctlprintk(ioc, pr_info(MPT3SAS_FMT "%s: success\n", dctlprintk(ioc, ioc_info(ioc, "%s: success\n", __func__));
ioc->name, __func__));
} else { } else {
pr_info(MPT3SAS_FMT ioc_info(ioc, "%s: ioc_status(0x%04x) log_info(0x%08x)\n",
"%s: ioc_status(0x%04x) log_info(0x%08x)\n", __func__, ioc_status,
ioc->name, __func__, le32_to_cpu(mpi_reply->IOCLogInfo));
ioc_status, le32_to_cpu(mpi_reply->IOCLogInfo));
rc = -EFAULT; rc = -EFAULT;
} }
@ -2450,8 +2380,9 @@ _ctl_ioctl_main(struct file *file, unsigned int cmd, void __user *arg,
ret = _ctl_diag_read_buffer(ioc, arg); ret = _ctl_diag_read_buffer(ioc, arg);
break; break;
default: default:
dctlprintk(ioc, pr_info(MPT3SAS_FMT dctlprintk(ioc,
"unsupported ioctl opcode(0x%08x)\n", ioc->name, cmd)); ioc_info(ioc, "unsupported ioctl opcode(0x%08x)\n",
cmd));
break; break;
} }
@ -2840,7 +2771,7 @@ _ctl_logging_level_store(struct device *cdev, struct device_attribute *attr,
return -EINVAL; return -EINVAL;
ioc->logging_level = val; ioc->logging_level = val;
pr_info(MPT3SAS_FMT "logging_level=%08xh\n", ioc->name, ioc_info(ioc, "logging_level=%08xh\n",
ioc->logging_level); ioc->logging_level);
return strlen(buf); return strlen(buf);
} }
@ -2877,7 +2808,7 @@ _ctl_fwfault_debug_store(struct device *cdev, struct device_attribute *attr,
return -EINVAL; return -EINVAL;
ioc->fwfault_debug = val; ioc->fwfault_debug = val;
pr_info(MPT3SAS_FMT "fwfault_debug=%d\n", ioc->name, ioc_info(ioc, "fwfault_debug=%d\n",
ioc->fwfault_debug); ioc->fwfault_debug);
return strlen(buf); return strlen(buf);
} }
@ -2958,8 +2889,8 @@ _ctl_BRM_status_show(struct device *cdev, struct device_attribute *attr,
ssize_t rc = 0; ssize_t rc = 0;
if (!ioc->is_warpdrive) { if (!ioc->is_warpdrive) {
pr_err(MPT3SAS_FMT "%s: BRM attribute is only for" ioc_err(ioc, "%s: BRM attribute is only for warpdrive\n",
" warpdrive\n", ioc->name, __func__); __func__);
goto out; goto out;
} }
/* pci_access_mutex lock acquired by sysfs show path */ /* pci_access_mutex lock acquired by sysfs show path */
@ -2973,30 +2904,28 @@ _ctl_BRM_status_show(struct device *cdev, struct device_attribute *attr,
sz = offsetof(Mpi2IOUnitPage3_t, GPIOVal) + (sizeof(u16) * 36); sz = offsetof(Mpi2IOUnitPage3_t, GPIOVal) + (sizeof(u16) * 36);
io_unit_pg3 = kzalloc(sz, GFP_KERNEL); io_unit_pg3 = kzalloc(sz, GFP_KERNEL);
if (!io_unit_pg3) { if (!io_unit_pg3) {
pr_err(MPT3SAS_FMT "%s: failed allocating memory " ioc_err(ioc, "%s: failed allocating memory for iounit_pg3: (%d) bytes\n",
"for iounit_pg3: (%d) bytes\n", ioc->name, __func__, sz); __func__, sz);
goto out; goto out;
} }
if (mpt3sas_config_get_iounit_pg3(ioc, &mpi_reply, io_unit_pg3, sz) != if (mpt3sas_config_get_iounit_pg3(ioc, &mpi_reply, io_unit_pg3, sz) !=
0) { 0) {
pr_err(MPT3SAS_FMT ioc_err(ioc, "%s: failed reading iounit_pg3\n",
"%s: failed reading iounit_pg3\n", ioc->name,
__func__); __func__);
goto out; goto out;
} }
ioc_status = le16_to_cpu(mpi_reply.IOCStatus) & MPI2_IOCSTATUS_MASK; ioc_status = le16_to_cpu(mpi_reply.IOCStatus) & MPI2_IOCSTATUS_MASK;
if (ioc_status != MPI2_IOCSTATUS_SUCCESS) { if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
pr_err(MPT3SAS_FMT "%s: iounit_pg3 failed with " ioc_err(ioc, "%s: iounit_pg3 failed with ioc_status(0x%04x)\n",
"ioc_status(0x%04x)\n", ioc->name, __func__, ioc_status); __func__, ioc_status);
goto out; goto out;
} }
if (io_unit_pg3->GPIOCount < 25) { if (io_unit_pg3->GPIOCount < 25) {
pr_err(MPT3SAS_FMT "%s: iounit_pg3->GPIOCount less than " ioc_err(ioc, "%s: iounit_pg3->GPIOCount less than 25 entries, detected (%d) entries\n",
"25 entries, detected (%d) entries\n", ioc->name, __func__, __func__, io_unit_pg3->GPIOCount);
io_unit_pg3->GPIOCount);
goto out; goto out;
} }
@ -3039,17 +2968,15 @@ _ctl_host_trace_buffer_size_show(struct device *cdev,
struct DIAG_BUFFER_START *request_data; struct DIAG_BUFFER_START *request_data;
if (!ioc->diag_buffer[MPI2_DIAG_BUF_TYPE_TRACE]) { if (!ioc->diag_buffer[MPI2_DIAG_BUF_TYPE_TRACE]) {
pr_err(MPT3SAS_FMT ioc_err(ioc, "%s: host_trace_buffer is not registered\n",
"%s: host_trace_buffer is not registered\n", __func__);
ioc->name, __func__);
return 0; return 0;
} }
if ((ioc->diag_buffer_status[MPI2_DIAG_BUF_TYPE_TRACE] & if ((ioc->diag_buffer_status[MPI2_DIAG_BUF_TYPE_TRACE] &
MPT3_DIAG_BUFFER_IS_REGISTERED) == 0) { MPT3_DIAG_BUFFER_IS_REGISTERED) == 0) {
pr_err(MPT3SAS_FMT ioc_err(ioc, "%s: host_trace_buffer is not registered\n",
"%s: host_trace_buffer is not registered\n", __func__);
ioc->name, __func__);
return 0; return 0;
} }
@ -3089,17 +3016,15 @@ _ctl_host_trace_buffer_show(struct device *cdev, struct device_attribute *attr,
u32 size; u32 size;
if (!ioc->diag_buffer[MPI2_DIAG_BUF_TYPE_TRACE]) { if (!ioc->diag_buffer[MPI2_DIAG_BUF_TYPE_TRACE]) {
pr_err(MPT3SAS_FMT ioc_err(ioc, "%s: host_trace_buffer is not registered\n",
"%s: host_trace_buffer is not registered\n", __func__);
ioc->name, __func__);
return 0; return 0;
} }
if ((ioc->diag_buffer_status[MPI2_DIAG_BUF_TYPE_TRACE] & if ((ioc->diag_buffer_status[MPI2_DIAG_BUF_TYPE_TRACE] &
MPT3_DIAG_BUFFER_IS_REGISTERED) == 0) { MPT3_DIAG_BUFFER_IS_REGISTERED) == 0) {
pr_err(MPT3SAS_FMT ioc_err(ioc, "%s: host_trace_buffer is not registered\n",
"%s: host_trace_buffer is not registered\n", __func__);
ioc->name, __func__);
return 0; return 0;
} }
@ -3188,8 +3113,7 @@ _ctl_host_trace_buffer_enable_store(struct device *cdev,
MPT3_DIAG_BUFFER_IS_RELEASED) == 0)) MPT3_DIAG_BUFFER_IS_RELEASED) == 0))
goto out; goto out;
memset(&diag_register, 0, sizeof(struct mpt3_diag_register)); memset(&diag_register, 0, sizeof(struct mpt3_diag_register));
pr_info(MPT3SAS_FMT "posting host trace buffers\n", ioc_info(ioc, "posting host trace buffers\n");
ioc->name);
diag_register.buffer_type = MPI2_DIAG_BUF_TYPE_TRACE; diag_register.buffer_type = MPI2_DIAG_BUF_TYPE_TRACE;
diag_register.requested_buffer_size = (1024 * 1024); diag_register.requested_buffer_size = (1024 * 1024);
diag_register.unique_id = 0x7075900; diag_register.unique_id = 0x7075900;
@ -3205,8 +3129,7 @@ _ctl_host_trace_buffer_enable_store(struct device *cdev,
if ((ioc->diag_buffer_status[MPI2_DIAG_BUF_TYPE_TRACE] & if ((ioc->diag_buffer_status[MPI2_DIAG_BUF_TYPE_TRACE] &
MPT3_DIAG_BUFFER_IS_RELEASED)) MPT3_DIAG_BUFFER_IS_RELEASED))
goto out; goto out;
pr_info(MPT3SAS_FMT "releasing host trace buffer\n", ioc_info(ioc, "releasing host trace buffer\n");
ioc->name);
mpt3sas_send_diag_release(ioc, MPI2_DIAG_BUF_TYPE_TRACE, mpt3sas_send_diag_release(ioc, MPI2_DIAG_BUF_TYPE_TRACE,
&issue_reset); &issue_reset);
} }

File diff suppressed because it is too large Load Diff

View File

@ -153,18 +153,16 @@ _transport_set_identify(struct MPT3SAS_ADAPTER *ioc, u16 handle,
if ((mpt3sas_config_get_sas_device_pg0(ioc, &mpi_reply, &sas_device_pg0, if ((mpt3sas_config_get_sas_device_pg0(ioc, &mpi_reply, &sas_device_pg0,
MPI2_SAS_DEVICE_PGAD_FORM_HANDLE, handle))) { MPI2_SAS_DEVICE_PGAD_FORM_HANDLE, handle))) {
pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", ioc_err(ioc, "failure at %s:%d/%s()!\n",
ioc->name, __FILE__, __LINE__, __func__); __FILE__, __LINE__, __func__);
return -ENXIO; return -ENXIO;
} }
ioc_status = le16_to_cpu(mpi_reply.IOCStatus) & ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
MPI2_IOCSTATUS_MASK; MPI2_IOCSTATUS_MASK;
if (ioc_status != MPI2_IOCSTATUS_SUCCESS) { if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
pr_err(MPT3SAS_FMT ioc_err(ioc, "handle(0x%04x), ioc_status(0x%04x) failure at %s:%d/%s()!\n",
"handle(0x%04x), ioc_status(0x%04x)\nfailure at %s:%d/%s()!\n", handle, ioc_status, __FILE__, __LINE__, __func__);
ioc->name, handle, ioc_status,
__FILE__, __LINE__, __func__);
return -EIO; return -EIO;
} }
@ -318,8 +316,7 @@ _transport_expander_report_manufacture(struct MPT3SAS_ADAPTER *ioc,
mutex_lock(&ioc->transport_cmds.mutex); mutex_lock(&ioc->transport_cmds.mutex);
if (ioc->transport_cmds.status != MPT3_CMD_NOT_USED) { if (ioc->transport_cmds.status != MPT3_CMD_NOT_USED) {
pr_err(MPT3SAS_FMT "%s: transport_cmds in use\n", ioc_err(ioc, "%s: transport_cmds in use\n", __func__);
ioc->name, __func__);
rc = -EAGAIN; rc = -EAGAIN;
goto out; goto out;
} }
@ -329,26 +326,22 @@ _transport_expander_report_manufacture(struct MPT3SAS_ADAPTER *ioc,
ioc_state = mpt3sas_base_get_iocstate(ioc, 1); ioc_state = mpt3sas_base_get_iocstate(ioc, 1);
while (ioc_state != MPI2_IOC_STATE_OPERATIONAL) { while (ioc_state != MPI2_IOC_STATE_OPERATIONAL) {
if (wait_state_count++ == 10) { if (wait_state_count++ == 10) {
pr_err(MPT3SAS_FMT ioc_err(ioc, "%s: failed due to ioc not operational\n",
"%s: failed due to ioc not operational\n", __func__);
ioc->name, __func__);
rc = -EFAULT; rc = -EFAULT;
goto out; goto out;
} }
ssleep(1); ssleep(1);
ioc_state = mpt3sas_base_get_iocstate(ioc, 1); ioc_state = mpt3sas_base_get_iocstate(ioc, 1);
pr_info(MPT3SAS_FMT ioc_info(ioc, "%s: waiting for operational state(count=%d)\n",
"%s: waiting for operational state(count=%d)\n", __func__, wait_state_count);
ioc->name, __func__, wait_state_count);
} }
if (wait_state_count) if (wait_state_count)
pr_info(MPT3SAS_FMT "%s: ioc is operational\n", ioc_info(ioc, "%s: ioc is operational\n", __func__);
ioc->name, __func__);
smid = mpt3sas_base_get_smid(ioc, ioc->transport_cb_idx); smid = mpt3sas_base_get_smid(ioc, ioc->transport_cb_idx);
if (!smid) { if (!smid) {
pr_err(MPT3SAS_FMT "%s: failed obtaining a smid\n", ioc_err(ioc, "%s: failed obtaining a smid\n", __func__);
ioc->name, __func__);
rc = -EAGAIN; rc = -EAGAIN;
goto out; goto out;
} }
@ -388,16 +381,15 @@ _transport_expander_report_manufacture(struct MPT3SAS_ADAPTER *ioc,
ioc->build_sg(ioc, psge, data_out_dma, data_out_sz, data_in_dma, ioc->build_sg(ioc, psge, data_out_dma, data_out_sz, data_in_dma,
data_in_sz); data_in_sz);
dtransportprintk(ioc, pr_info(MPT3SAS_FMT dtransportprintk(ioc,
"report_manufacture - send to sas_addr(0x%016llx)\n", ioc_info(ioc, "report_manufacture - send to sas_addr(0x%016llx)\n",
ioc->name, (unsigned long long)sas_address)); (u64)sas_address));
init_completion(&ioc->transport_cmds.done); init_completion(&ioc->transport_cmds.done);
mpt3sas_base_put_smid_default(ioc, smid); mpt3sas_base_put_smid_default(ioc, smid);
wait_for_completion_timeout(&ioc->transport_cmds.done, 10*HZ); wait_for_completion_timeout(&ioc->transport_cmds.done, 10*HZ);
if (!(ioc->transport_cmds.status & MPT3_CMD_COMPLETE)) { if (!(ioc->transport_cmds.status & MPT3_CMD_COMPLETE)) {
pr_err(MPT3SAS_FMT "%s: timeout\n", ioc_err(ioc, "%s: timeout\n", __func__);
ioc->name, __func__);
_debug_dump_mf(mpi_request, _debug_dump_mf(mpi_request,
sizeof(Mpi2SmpPassthroughRequest_t)/4); sizeof(Mpi2SmpPassthroughRequest_t)/4);
if (!(ioc->transport_cmds.status & MPT3_CMD_RESET)) if (!(ioc->transport_cmds.status & MPT3_CMD_RESET))
@ -405,17 +397,16 @@ _transport_expander_report_manufacture(struct MPT3SAS_ADAPTER *ioc,
goto issue_host_reset; goto issue_host_reset;
} }
dtransportprintk(ioc, pr_info(MPT3SAS_FMT dtransportprintk(ioc, ioc_info(ioc, "report_manufacture - complete\n"));
"report_manufacture - complete\n", ioc->name));
if (ioc->transport_cmds.status & MPT3_CMD_REPLY_VALID) { if (ioc->transport_cmds.status & MPT3_CMD_REPLY_VALID) {
u8 *tmp; u8 *tmp;
mpi_reply = ioc->transport_cmds.reply; mpi_reply = ioc->transport_cmds.reply;
dtransportprintk(ioc, pr_info(MPT3SAS_FMT dtransportprintk(ioc,
"report_manufacture - reply data transfer size(%d)\n", ioc_info(ioc, "report_manufacture - reply data transfer size(%d)\n",
ioc->name, le16_to_cpu(mpi_reply->ResponseDataLength))); le16_to_cpu(mpi_reply->ResponseDataLength)));
if (le16_to_cpu(mpi_reply->ResponseDataLength) != if (le16_to_cpu(mpi_reply->ResponseDataLength) !=
sizeof(struct rep_manu_reply)) sizeof(struct rep_manu_reply))
@ -439,8 +430,8 @@ _transport_expander_report_manufacture(struct MPT3SAS_ADAPTER *ioc,
manufacture_reply->component_revision_id; manufacture_reply->component_revision_id;
} }
} else } else
dtransportprintk(ioc, pr_info(MPT3SAS_FMT dtransportprintk(ioc,
"report_manufacture - no reply\n", ioc->name)); ioc_info(ioc, "report_manufacture - no reply\n"));
issue_host_reset: issue_host_reset:
if (issue_reset) if (issue_reset)
@ -643,8 +634,8 @@ mpt3sas_transport_port_add(struct MPT3SAS_ADAPTER *ioc, u16 handle,
mpt3sas_port = kzalloc(sizeof(struct _sas_port), mpt3sas_port = kzalloc(sizeof(struct _sas_port),
GFP_KERNEL); GFP_KERNEL);
if (!mpt3sas_port) { if (!mpt3sas_port) {
pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", ioc_err(ioc, "failure at %s:%d/%s()!\n",
ioc->name, __FILE__, __LINE__, __func__); __FILE__, __LINE__, __func__);
return NULL; return NULL;
} }
@ -655,22 +646,21 @@ mpt3sas_transport_port_add(struct MPT3SAS_ADAPTER *ioc, u16 handle,
spin_unlock_irqrestore(&ioc->sas_node_lock, flags); spin_unlock_irqrestore(&ioc->sas_node_lock, flags);
if (!sas_node) { if (!sas_node) {
pr_err(MPT3SAS_FMT ioc_err(ioc, "%s: Could not find parent sas_address(0x%016llx)!\n",
"%s: Could not find parent sas_address(0x%016llx)!\n", __func__, (u64)sas_address);
ioc->name, __func__, (unsigned long long)sas_address);
goto out_fail; goto out_fail;
} }
if ((_transport_set_identify(ioc, handle, if ((_transport_set_identify(ioc, handle,
&mpt3sas_port->remote_identify))) { &mpt3sas_port->remote_identify))) {
pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", ioc_err(ioc, "failure at %s:%d/%s()!\n",
ioc->name, __FILE__, __LINE__, __func__); __FILE__, __LINE__, __func__);
goto out_fail; goto out_fail;
} }
if (mpt3sas_port->remote_identify.device_type == SAS_PHY_UNUSED) { if (mpt3sas_port->remote_identify.device_type == SAS_PHY_UNUSED) {
pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", ioc_err(ioc, "failure at %s:%d/%s()!\n",
ioc->name, __FILE__, __LINE__, __func__); __FILE__, __LINE__, __func__);
goto out_fail; goto out_fail;
} }
@ -687,20 +677,20 @@ mpt3sas_transport_port_add(struct MPT3SAS_ADAPTER *ioc, u16 handle,
} }
if (!mpt3sas_port->num_phys) { if (!mpt3sas_port->num_phys) {
pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", ioc_err(ioc, "failure at %s:%d/%s()!\n",
ioc->name, __FILE__, __LINE__, __func__); __FILE__, __LINE__, __func__);
goto out_fail; goto out_fail;
} }
if (!sas_node->parent_dev) { if (!sas_node->parent_dev) {
pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", ioc_err(ioc, "failure at %s:%d/%s()!\n",
ioc->name, __FILE__, __LINE__, __func__); __FILE__, __LINE__, __func__);
goto out_fail; goto out_fail;
} }
port = sas_port_alloc_num(sas_node->parent_dev); port = sas_port_alloc_num(sas_node->parent_dev);
if ((sas_port_add(port))) { if ((sas_port_add(port))) {
pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", ioc_err(ioc, "failure at %s:%d/%s()!\n",
ioc->name, __FILE__, __LINE__, __func__); __FILE__, __LINE__, __func__);
goto out_fail; goto out_fail;
} }
@ -738,8 +728,8 @@ mpt3sas_transport_port_add(struct MPT3SAS_ADAPTER *ioc, u16 handle,
} }
if ((sas_rphy_add(rphy))) { if ((sas_rphy_add(rphy))) {
pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", ioc_err(ioc, "failure at %s:%d/%s()!\n",
ioc->name, __FILE__, __LINE__, __func__); __FILE__, __LINE__, __func__);
} }
if (mpt3sas_port->remote_identify.device_type == SAS_END_DEVICE) { if (mpt3sas_port->remote_identify.device_type == SAS_END_DEVICE) {
@ -861,14 +851,14 @@ mpt3sas_transport_add_host_phy(struct MPT3SAS_ADAPTER *ioc, struct _sas_phy
INIT_LIST_HEAD(&mpt3sas_phy->port_siblings); INIT_LIST_HEAD(&mpt3sas_phy->port_siblings);
phy = sas_phy_alloc(parent_dev, phy_index); phy = sas_phy_alloc(parent_dev, phy_index);
if (!phy) { if (!phy) {
pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", ioc_err(ioc, "failure at %s:%d/%s()!\n",
ioc->name, __FILE__, __LINE__, __func__); __FILE__, __LINE__, __func__);
return -1; return -1;
} }
if ((_transport_set_identify(ioc, mpt3sas_phy->handle, if ((_transport_set_identify(ioc, mpt3sas_phy->handle,
&mpt3sas_phy->identify))) { &mpt3sas_phy->identify))) {
pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", ioc_err(ioc, "failure at %s:%d/%s()!\n",
ioc->name, __FILE__, __LINE__, __func__); __FILE__, __LINE__, __func__);
sas_phy_free(phy); sas_phy_free(phy);
return -1; return -1;
} }
@ -890,8 +880,8 @@ mpt3sas_transport_add_host_phy(struct MPT3SAS_ADAPTER *ioc, struct _sas_phy
phy_pg0.ProgrammedLinkRate >> 4); phy_pg0.ProgrammedLinkRate >> 4);
if ((sas_phy_add(phy))) { if ((sas_phy_add(phy))) {
pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", ioc_err(ioc, "failure at %s:%d/%s()!\n",
ioc->name, __FILE__, __LINE__, __func__); __FILE__, __LINE__, __func__);
sas_phy_free(phy); sas_phy_free(phy);
return -1; return -1;
} }
@ -929,14 +919,14 @@ mpt3sas_transport_add_expander_phy(struct MPT3SAS_ADAPTER *ioc, struct _sas_phy
INIT_LIST_HEAD(&mpt3sas_phy->port_siblings); INIT_LIST_HEAD(&mpt3sas_phy->port_siblings);
phy = sas_phy_alloc(parent_dev, phy_index); phy = sas_phy_alloc(parent_dev, phy_index);
if (!phy) { if (!phy) {
pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", ioc_err(ioc, "failure at %s:%d/%s()!\n",
ioc->name, __FILE__, __LINE__, __func__); __FILE__, __LINE__, __func__);
return -1; return -1;
} }
if ((_transport_set_identify(ioc, mpt3sas_phy->handle, if ((_transport_set_identify(ioc, mpt3sas_phy->handle,
&mpt3sas_phy->identify))) { &mpt3sas_phy->identify))) {
pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", ioc_err(ioc, "failure at %s:%d/%s()!\n",
ioc->name, __FILE__, __LINE__, __func__); __FILE__, __LINE__, __func__);
sas_phy_free(phy); sas_phy_free(phy);
return -1; return -1;
} }
@ -960,8 +950,8 @@ mpt3sas_transport_add_expander_phy(struct MPT3SAS_ADAPTER *ioc, struct _sas_phy
expander_pg1.ProgrammedLinkRate >> 4); expander_pg1.ProgrammedLinkRate >> 4);
if ((sas_phy_add(phy))) { if ((sas_phy_add(phy))) {
pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", ioc_err(ioc, "failure at %s:%d/%s()!\n",
ioc->name, __FILE__, __LINE__, __func__); __FILE__, __LINE__, __func__);
sas_phy_free(phy); sas_phy_free(phy);
return -1; return -1;
} }
@ -1106,8 +1096,7 @@ _transport_get_expander_phy_error_log(struct MPT3SAS_ADAPTER *ioc,
mutex_lock(&ioc->transport_cmds.mutex); mutex_lock(&ioc->transport_cmds.mutex);
if (ioc->transport_cmds.status != MPT3_CMD_NOT_USED) { if (ioc->transport_cmds.status != MPT3_CMD_NOT_USED) {
pr_err(MPT3SAS_FMT "%s: transport_cmds in use\n", ioc_err(ioc, "%s: transport_cmds in use\n", __func__);
ioc->name, __func__);
rc = -EAGAIN; rc = -EAGAIN;
goto out; goto out;
} }
@ -1117,26 +1106,22 @@ _transport_get_expander_phy_error_log(struct MPT3SAS_ADAPTER *ioc,
ioc_state = mpt3sas_base_get_iocstate(ioc, 1); ioc_state = mpt3sas_base_get_iocstate(ioc, 1);
while (ioc_state != MPI2_IOC_STATE_OPERATIONAL) { while (ioc_state != MPI2_IOC_STATE_OPERATIONAL) {
if (wait_state_count++ == 10) { if (wait_state_count++ == 10) {
pr_err(MPT3SAS_FMT ioc_err(ioc, "%s: failed due to ioc not operational\n",
"%s: failed due to ioc not operational\n", __func__);
ioc->name, __func__);
rc = -EFAULT; rc = -EFAULT;
goto out; goto out;
} }
ssleep(1); ssleep(1);
ioc_state = mpt3sas_base_get_iocstate(ioc, 1); ioc_state = mpt3sas_base_get_iocstate(ioc, 1);
pr_info(MPT3SAS_FMT ioc_info(ioc, "%s: waiting for operational state(count=%d)\n",
"%s: waiting for operational state(count=%d)\n", __func__, wait_state_count);
ioc->name, __func__, wait_state_count);
} }
if (wait_state_count) if (wait_state_count)
pr_info(MPT3SAS_FMT "%s: ioc is operational\n", ioc_info(ioc, "%s: ioc is operational\n", __func__);
ioc->name, __func__);
smid = mpt3sas_base_get_smid(ioc, ioc->transport_cb_idx); smid = mpt3sas_base_get_smid(ioc, ioc->transport_cb_idx);
if (!smid) { if (!smid) {
pr_err(MPT3SAS_FMT "%s: failed obtaining a smid\n", ioc_err(ioc, "%s: failed obtaining a smid\n", __func__);
ioc->name, __func__);
rc = -EAGAIN; rc = -EAGAIN;
goto out; goto out;
} }
@ -1179,17 +1164,16 @@ _transport_get_expander_phy_error_log(struct MPT3SAS_ADAPTER *ioc,
data_out_dma + sizeof(struct phy_error_log_request), data_out_dma + sizeof(struct phy_error_log_request),
sizeof(struct phy_error_log_reply)); sizeof(struct phy_error_log_reply));
dtransportprintk(ioc, pr_info(MPT3SAS_FMT dtransportprintk(ioc,
"phy_error_log - send to sas_addr(0x%016llx), phy(%d)\n", ioc_info(ioc, "phy_error_log - send to sas_addr(0x%016llx), phy(%d)\n",
ioc->name, (unsigned long long)phy->identify.sas_address, (u64)phy->identify.sas_address,
phy->number)); phy->number));
init_completion(&ioc->transport_cmds.done); init_completion(&ioc->transport_cmds.done);
mpt3sas_base_put_smid_default(ioc, smid); mpt3sas_base_put_smid_default(ioc, smid);
wait_for_completion_timeout(&ioc->transport_cmds.done, 10*HZ); wait_for_completion_timeout(&ioc->transport_cmds.done, 10*HZ);
if (!(ioc->transport_cmds.status & MPT3_CMD_COMPLETE)) { if (!(ioc->transport_cmds.status & MPT3_CMD_COMPLETE)) {
pr_err(MPT3SAS_FMT "%s: timeout\n", ioc_err(ioc, "%s: timeout\n", __func__);
ioc->name, __func__);
_debug_dump_mf(mpi_request, _debug_dump_mf(mpi_request,
sizeof(Mpi2SmpPassthroughRequest_t)/4); sizeof(Mpi2SmpPassthroughRequest_t)/4);
if (!(ioc->transport_cmds.status & MPT3_CMD_RESET)) if (!(ioc->transport_cmds.status & MPT3_CMD_RESET))
@ -1197,16 +1181,15 @@ _transport_get_expander_phy_error_log(struct MPT3SAS_ADAPTER *ioc,
goto issue_host_reset; goto issue_host_reset;
} }
dtransportprintk(ioc, pr_info(MPT3SAS_FMT dtransportprintk(ioc, ioc_info(ioc, "phy_error_log - complete\n"));
"phy_error_log - complete\n", ioc->name));
if (ioc->transport_cmds.status & MPT3_CMD_REPLY_VALID) { if (ioc->transport_cmds.status & MPT3_CMD_REPLY_VALID) {
mpi_reply = ioc->transport_cmds.reply; mpi_reply = ioc->transport_cmds.reply;
dtransportprintk(ioc, pr_info(MPT3SAS_FMT dtransportprintk(ioc,
"phy_error_log - reply data transfer size(%d)\n", ioc_info(ioc, "phy_error_log - reply data transfer size(%d)\n",
ioc->name, le16_to_cpu(mpi_reply->ResponseDataLength))); le16_to_cpu(mpi_reply->ResponseDataLength)));
if (le16_to_cpu(mpi_reply->ResponseDataLength) != if (le16_to_cpu(mpi_reply->ResponseDataLength) !=
sizeof(struct phy_error_log_reply)) sizeof(struct phy_error_log_reply))
@ -1215,9 +1198,9 @@ _transport_get_expander_phy_error_log(struct MPT3SAS_ADAPTER *ioc,
phy_error_log_reply = data_out + phy_error_log_reply = data_out +
sizeof(struct phy_error_log_request); sizeof(struct phy_error_log_request);
dtransportprintk(ioc, pr_info(MPT3SAS_FMT dtransportprintk(ioc,
"phy_error_log - function_result(%d)\n", ioc_info(ioc, "phy_error_log - function_result(%d)\n",
ioc->name, phy_error_log_reply->function_result)); phy_error_log_reply->function_result));
phy->invalid_dword_count = phy->invalid_dword_count =
be32_to_cpu(phy_error_log_reply->invalid_dword); be32_to_cpu(phy_error_log_reply->invalid_dword);
@ -1229,8 +1212,8 @@ _transport_get_expander_phy_error_log(struct MPT3SAS_ADAPTER *ioc,
be32_to_cpu(phy_error_log_reply->phy_reset_problem); be32_to_cpu(phy_error_log_reply->phy_reset_problem);
rc = 0; rc = 0;
} else } else
dtransportprintk(ioc, pr_info(MPT3SAS_FMT dtransportprintk(ioc,
"phy_error_log - no reply\n", ioc->name)); ioc_info(ioc, "phy_error_log - no reply\n"));
issue_host_reset: issue_host_reset:
if (issue_reset) if (issue_reset)
@ -1273,15 +1256,14 @@ _transport_get_linkerrors(struct sas_phy *phy)
/* get hba phy error logs */ /* get hba phy error logs */
if ((mpt3sas_config_get_phy_pg1(ioc, &mpi_reply, &phy_pg1, if ((mpt3sas_config_get_phy_pg1(ioc, &mpi_reply, &phy_pg1,
phy->number))) { phy->number))) {
pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", ioc_err(ioc, "failure at %s:%d/%s()!\n",
ioc->name, __FILE__, __LINE__, __func__); __FILE__, __LINE__, __func__);
return -ENXIO; return -ENXIO;
} }
if (mpi_reply.IOCStatus || mpi_reply.IOCLogInfo) if (mpi_reply.IOCStatus || mpi_reply.IOCLogInfo)
pr_info(MPT3SAS_FMT ioc_info(ioc, "phy(%d), ioc_status (0x%04x), loginfo(0x%08x)\n",
"phy(%d), ioc_status (0x%04x), loginfo(0x%08x)\n", phy->number,
ioc->name, phy->number,
le16_to_cpu(mpi_reply.IOCStatus), le16_to_cpu(mpi_reply.IOCStatus),
le32_to_cpu(mpi_reply.IOCLogInfo)); le32_to_cpu(mpi_reply.IOCLogInfo));
@ -1419,8 +1401,7 @@ _transport_expander_phy_control(struct MPT3SAS_ADAPTER *ioc,
mutex_lock(&ioc->transport_cmds.mutex); mutex_lock(&ioc->transport_cmds.mutex);
if (ioc->transport_cmds.status != MPT3_CMD_NOT_USED) { if (ioc->transport_cmds.status != MPT3_CMD_NOT_USED) {
pr_err(MPT3SAS_FMT "%s: transport_cmds in use\n", ioc_err(ioc, "%s: transport_cmds in use\n", __func__);
ioc->name, __func__);
rc = -EAGAIN; rc = -EAGAIN;
goto out; goto out;
} }
@ -1430,26 +1411,22 @@ _transport_expander_phy_control(struct MPT3SAS_ADAPTER *ioc,
ioc_state = mpt3sas_base_get_iocstate(ioc, 1); ioc_state = mpt3sas_base_get_iocstate(ioc, 1);
while (ioc_state != MPI2_IOC_STATE_OPERATIONAL) { while (ioc_state != MPI2_IOC_STATE_OPERATIONAL) {
if (wait_state_count++ == 10) { if (wait_state_count++ == 10) {
pr_err(MPT3SAS_FMT ioc_err(ioc, "%s: failed due to ioc not operational\n",
"%s: failed due to ioc not operational\n", __func__);
ioc->name, __func__);
rc = -EFAULT; rc = -EFAULT;
goto out; goto out;
} }
ssleep(1); ssleep(1);
ioc_state = mpt3sas_base_get_iocstate(ioc, 1); ioc_state = mpt3sas_base_get_iocstate(ioc, 1);
pr_info(MPT3SAS_FMT ioc_info(ioc, "%s: waiting for operational state(count=%d)\n",
"%s: waiting for operational state(count=%d)\n", __func__, wait_state_count);
ioc->name, __func__, wait_state_count);
} }
if (wait_state_count) if (wait_state_count)
pr_info(MPT3SAS_FMT "%s: ioc is operational\n", ioc_info(ioc, "%s: ioc is operational\n", __func__);
ioc->name, __func__);
smid = mpt3sas_base_get_smid(ioc, ioc->transport_cb_idx); smid = mpt3sas_base_get_smid(ioc, ioc->transport_cb_idx);
if (!smid) { if (!smid) {
pr_err(MPT3SAS_FMT "%s: failed obtaining a smid\n", ioc_err(ioc, "%s: failed obtaining a smid\n", __func__);
ioc->name, __func__);
rc = -EAGAIN; rc = -EAGAIN;
goto out; goto out;
} }
@ -1497,17 +1474,16 @@ _transport_expander_phy_control(struct MPT3SAS_ADAPTER *ioc,
data_out_dma + sizeof(struct phy_control_request), data_out_dma + sizeof(struct phy_control_request),
sizeof(struct phy_control_reply)); sizeof(struct phy_control_reply));
dtransportprintk(ioc, pr_info(MPT3SAS_FMT dtransportprintk(ioc,
"phy_control - send to sas_addr(0x%016llx), phy(%d), opcode(%d)\n", ioc_info(ioc, "phy_control - send to sas_addr(0x%016llx), phy(%d), opcode(%d)\n",
ioc->name, (unsigned long long)phy->identify.sas_address, (u64)phy->identify.sas_address,
phy->number, phy_operation)); phy->number, phy_operation));
init_completion(&ioc->transport_cmds.done); init_completion(&ioc->transport_cmds.done);
mpt3sas_base_put_smid_default(ioc, smid); mpt3sas_base_put_smid_default(ioc, smid);
wait_for_completion_timeout(&ioc->transport_cmds.done, 10*HZ); wait_for_completion_timeout(&ioc->transport_cmds.done, 10*HZ);
if (!(ioc->transport_cmds.status & MPT3_CMD_COMPLETE)) { if (!(ioc->transport_cmds.status & MPT3_CMD_COMPLETE)) {
pr_err(MPT3SAS_FMT "%s: timeout\n", ioc_err(ioc, "%s: timeout\n", __func__);
ioc->name, __func__);
_debug_dump_mf(mpi_request, _debug_dump_mf(mpi_request,
sizeof(Mpi2SmpPassthroughRequest_t)/4); sizeof(Mpi2SmpPassthroughRequest_t)/4);
if (!(ioc->transport_cmds.status & MPT3_CMD_RESET)) if (!(ioc->transport_cmds.status & MPT3_CMD_RESET))
@ -1515,16 +1491,15 @@ _transport_expander_phy_control(struct MPT3SAS_ADAPTER *ioc,
goto issue_host_reset; goto issue_host_reset;
} }
dtransportprintk(ioc, pr_info(MPT3SAS_FMT dtransportprintk(ioc, ioc_info(ioc, "phy_control - complete\n"));
"phy_control - complete\n", ioc->name));
if (ioc->transport_cmds.status & MPT3_CMD_REPLY_VALID) { if (ioc->transport_cmds.status & MPT3_CMD_REPLY_VALID) {
mpi_reply = ioc->transport_cmds.reply; mpi_reply = ioc->transport_cmds.reply;
dtransportprintk(ioc, pr_info(MPT3SAS_FMT dtransportprintk(ioc,
"phy_control - reply data transfer size(%d)\n", ioc_info(ioc, "phy_control - reply data transfer size(%d)\n",
ioc->name, le16_to_cpu(mpi_reply->ResponseDataLength))); le16_to_cpu(mpi_reply->ResponseDataLength)));
if (le16_to_cpu(mpi_reply->ResponseDataLength) != if (le16_to_cpu(mpi_reply->ResponseDataLength) !=
sizeof(struct phy_control_reply)) sizeof(struct phy_control_reply))
@ -1533,14 +1508,14 @@ _transport_expander_phy_control(struct MPT3SAS_ADAPTER *ioc,
phy_control_reply = data_out + phy_control_reply = data_out +
sizeof(struct phy_control_request); sizeof(struct phy_control_request);
dtransportprintk(ioc, pr_info(MPT3SAS_FMT dtransportprintk(ioc,
"phy_control - function_result(%d)\n", ioc_info(ioc, "phy_control - function_result(%d)\n",
ioc->name, phy_control_reply->function_result)); phy_control_reply->function_result));
rc = 0; rc = 0;
} else } else
dtransportprintk(ioc, pr_info(MPT3SAS_FMT dtransportprintk(ioc,
"phy_control - no reply\n", ioc->name)); ioc_info(ioc, "phy_control - no reply\n"));
issue_host_reset: issue_host_reset:
if (issue_reset) if (issue_reset)
@ -1591,15 +1566,14 @@ _transport_phy_reset(struct sas_phy *phy, int hard_reset)
mpi_request.PhyNum = phy->number; mpi_request.PhyNum = phy->number;
if ((mpt3sas_base_sas_iounit_control(ioc, &mpi_reply, &mpi_request))) { if ((mpt3sas_base_sas_iounit_control(ioc, &mpi_reply, &mpi_request))) {
pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", ioc_err(ioc, "failure at %s:%d/%s()!\n",
ioc->name, __FILE__, __LINE__, __func__); __FILE__, __LINE__, __func__);
return -ENXIO; return -ENXIO;
} }
if (mpi_reply.IOCStatus || mpi_reply.IOCLogInfo) if (mpi_reply.IOCStatus || mpi_reply.IOCLogInfo)
pr_info(MPT3SAS_FMT ioc_info(ioc, "phy(%d), ioc_status(0x%04x), loginfo(0x%08x)\n",
"phy(%d), ioc_status(0x%04x), loginfo(0x%08x)\n", phy->number, le16_to_cpu(mpi_reply.IOCStatus),
ioc->name, phy->number, le16_to_cpu(mpi_reply.IOCStatus),
le32_to_cpu(mpi_reply.IOCLogInfo)); le32_to_cpu(mpi_reply.IOCLogInfo));
return 0; return 0;
@ -1647,23 +1621,23 @@ _transport_phy_enable(struct sas_phy *phy, int enable)
sizeof(Mpi2SasIOUnit0PhyData_t)); sizeof(Mpi2SasIOUnit0PhyData_t));
sas_iounit_pg0 = kzalloc(sz, GFP_KERNEL); sas_iounit_pg0 = kzalloc(sz, GFP_KERNEL);
if (!sas_iounit_pg0) { if (!sas_iounit_pg0) {
pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", ioc_err(ioc, "failure at %s:%d/%s()!\n",
ioc->name, __FILE__, __LINE__, __func__); __FILE__, __LINE__, __func__);
rc = -ENOMEM; rc = -ENOMEM;
goto out; goto out;
} }
if ((mpt3sas_config_get_sas_iounit_pg0(ioc, &mpi_reply, if ((mpt3sas_config_get_sas_iounit_pg0(ioc, &mpi_reply,
sas_iounit_pg0, sz))) { sas_iounit_pg0, sz))) {
pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", ioc_err(ioc, "failure at %s:%d/%s()!\n",
ioc->name, __FILE__, __LINE__, __func__); __FILE__, __LINE__, __func__);
rc = -ENXIO; rc = -ENXIO;
goto out; goto out;
} }
ioc_status = le16_to_cpu(mpi_reply.IOCStatus) & ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
MPI2_IOCSTATUS_MASK; MPI2_IOCSTATUS_MASK;
if (ioc_status != MPI2_IOCSTATUS_SUCCESS) { if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", ioc_err(ioc, "failure at %s:%d/%s()!\n",
ioc->name, __FILE__, __LINE__, __func__); __FILE__, __LINE__, __func__);
rc = -EIO; rc = -EIO;
goto out; goto out;
} }
@ -1672,9 +1646,7 @@ _transport_phy_enable(struct sas_phy *phy, int enable)
for (i = 0, discovery_active = 0; i < ioc->sas_hba.num_phys ; i++) { for (i = 0, discovery_active = 0; i < ioc->sas_hba.num_phys ; i++) {
if (sas_iounit_pg0->PhyData[i].PortFlags & if (sas_iounit_pg0->PhyData[i].PortFlags &
MPI2_SASIOUNIT0_PORTFLAGS_DISCOVERY_IN_PROGRESS) { MPI2_SASIOUNIT0_PORTFLAGS_DISCOVERY_IN_PROGRESS) {
pr_err(MPT3SAS_FMT "discovery is active on " \ ioc_err(ioc, "discovery is active on port = %d, phy = %d: unable to enable/disable phys, try again later!\n",
"port = %d, phy = %d: unable to enable/disable "
"phys, try again later!\n", ioc->name,
sas_iounit_pg0->PhyData[i].Port, i); sas_iounit_pg0->PhyData[i].Port, i);
discovery_active = 1; discovery_active = 1;
} }
@ -1690,23 +1662,23 @@ _transport_phy_enable(struct sas_phy *phy, int enable)
sizeof(Mpi2SasIOUnit1PhyData_t)); sizeof(Mpi2SasIOUnit1PhyData_t));
sas_iounit_pg1 = kzalloc(sz, GFP_KERNEL); sas_iounit_pg1 = kzalloc(sz, GFP_KERNEL);
if (!sas_iounit_pg1) { if (!sas_iounit_pg1) {
pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", ioc_err(ioc, "failure at %s:%d/%s()!\n",
ioc->name, __FILE__, __LINE__, __func__); __FILE__, __LINE__, __func__);
rc = -ENOMEM; rc = -ENOMEM;
goto out; goto out;
} }
if ((mpt3sas_config_get_sas_iounit_pg1(ioc, &mpi_reply, if ((mpt3sas_config_get_sas_iounit_pg1(ioc, &mpi_reply,
sas_iounit_pg1, sz))) { sas_iounit_pg1, sz))) {
pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", ioc_err(ioc, "failure at %s:%d/%s()!\n",
ioc->name, __FILE__, __LINE__, __func__); __FILE__, __LINE__, __func__);
rc = -ENXIO; rc = -ENXIO;
goto out; goto out;
} }
ioc_status = le16_to_cpu(mpi_reply.IOCStatus) & ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
MPI2_IOCSTATUS_MASK; MPI2_IOCSTATUS_MASK;
if (ioc_status != MPI2_IOCSTATUS_SUCCESS) { if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", ioc_err(ioc, "failure at %s:%d/%s()!\n",
ioc->name, __FILE__, __LINE__, __func__); __FILE__, __LINE__, __func__);
rc = -EIO; rc = -EIO;
goto out; goto out;
} }
@ -1798,23 +1770,23 @@ _transport_phy_speed(struct sas_phy *phy, struct sas_phy_linkrates *rates)
sizeof(Mpi2SasIOUnit1PhyData_t)); sizeof(Mpi2SasIOUnit1PhyData_t));
sas_iounit_pg1 = kzalloc(sz, GFP_KERNEL); sas_iounit_pg1 = kzalloc(sz, GFP_KERNEL);
if (!sas_iounit_pg1) { if (!sas_iounit_pg1) {
pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", ioc_err(ioc, "failure at %s:%d/%s()!\n",
ioc->name, __FILE__, __LINE__, __func__); __FILE__, __LINE__, __func__);
rc = -ENOMEM; rc = -ENOMEM;
goto out; goto out;
} }
if ((mpt3sas_config_get_sas_iounit_pg1(ioc, &mpi_reply, if ((mpt3sas_config_get_sas_iounit_pg1(ioc, &mpi_reply,
sas_iounit_pg1, sz))) { sas_iounit_pg1, sz))) {
pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", ioc_err(ioc, "failure at %s:%d/%s()!\n",
ioc->name, __FILE__, __LINE__, __func__); __FILE__, __LINE__, __func__);
rc = -ENXIO; rc = -ENXIO;
goto out; goto out;
} }
ioc_status = le16_to_cpu(mpi_reply.IOCStatus) & ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
MPI2_IOCSTATUS_MASK; MPI2_IOCSTATUS_MASK;
if (ioc_status != MPI2_IOCSTATUS_SUCCESS) { if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", ioc_err(ioc, "failure at %s:%d/%s()!\n",
ioc->name, __FILE__, __LINE__, __func__); __FILE__, __LINE__, __func__);
rc = -EIO; rc = -EIO;
goto out; goto out;
} }
@ -1833,8 +1805,8 @@ _transport_phy_speed(struct sas_phy *phy, struct sas_phy_linkrates *rates)
if (mpt3sas_config_set_sas_iounit_pg1(ioc, &mpi_reply, sas_iounit_pg1, if (mpt3sas_config_set_sas_iounit_pg1(ioc, &mpi_reply, sas_iounit_pg1,
sz)) { sz)) {
pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", ioc_err(ioc, "failure at %s:%d/%s()!\n",
ioc->name, __FILE__, __LINE__, __func__); __FILE__, __LINE__, __func__);
rc = -ENXIO; rc = -ENXIO;
goto out; goto out;
} }
@ -1933,7 +1905,7 @@ _transport_smp_handler(struct bsg_job *job, struct Scsi_Host *shost,
goto job_done; goto job_done;
if (ioc->transport_cmds.status != MPT3_CMD_NOT_USED) { if (ioc->transport_cmds.status != MPT3_CMD_NOT_USED) {
pr_err(MPT3SAS_FMT "%s: transport_cmds in use\n", ioc->name, ioc_err(ioc, "%s: transport_cmds in use\n",
__func__); __func__);
rc = -EAGAIN; rc = -EAGAIN;
goto out; goto out;
@ -1959,26 +1931,22 @@ _transport_smp_handler(struct bsg_job *job, struct Scsi_Host *shost,
ioc_state = mpt3sas_base_get_iocstate(ioc, 1); ioc_state = mpt3sas_base_get_iocstate(ioc, 1);
while (ioc_state != MPI2_IOC_STATE_OPERATIONAL) { while (ioc_state != MPI2_IOC_STATE_OPERATIONAL) {
if (wait_state_count++ == 10) { if (wait_state_count++ == 10) {
pr_err(MPT3SAS_FMT ioc_err(ioc, "%s: failed due to ioc not operational\n",
"%s: failed due to ioc not operational\n", __func__);
ioc->name, __func__);
rc = -EFAULT; rc = -EFAULT;
goto unmap_in; goto unmap_in;
} }
ssleep(1); ssleep(1);
ioc_state = mpt3sas_base_get_iocstate(ioc, 1); ioc_state = mpt3sas_base_get_iocstate(ioc, 1);
pr_info(MPT3SAS_FMT ioc_info(ioc, "%s: waiting for operational state(count=%d)\n",
"%s: waiting for operational state(count=%d)\n", __func__, wait_state_count);
ioc->name, __func__, wait_state_count);
} }
if (wait_state_count) if (wait_state_count)
pr_info(MPT3SAS_FMT "%s: ioc is operational\n", ioc_info(ioc, "%s: ioc is operational\n", __func__);
ioc->name, __func__);
smid = mpt3sas_base_get_smid(ioc, ioc->transport_cb_idx); smid = mpt3sas_base_get_smid(ioc, ioc->transport_cb_idx);
if (!smid) { if (!smid) {
pr_err(MPT3SAS_FMT "%s: failed obtaining a smid\n", ioc_err(ioc, "%s: failed obtaining a smid\n", __func__);
ioc->name, __func__);
rc = -EAGAIN; rc = -EAGAIN;
goto unmap_in; goto unmap_in;
} }
@ -1999,8 +1967,8 @@ _transport_smp_handler(struct bsg_job *job, struct Scsi_Host *shost,
ioc->build_sg(ioc, psge, dma_addr_out, dma_len_out - 4, dma_addr_in, ioc->build_sg(ioc, psge, dma_addr_out, dma_len_out - 4, dma_addr_in,
dma_len_in - 4); dma_len_in - 4);
dtransportprintk(ioc, pr_info(MPT3SAS_FMT dtransportprintk(ioc,
"%s - sending smp request\n", ioc->name, __func__)); ioc_info(ioc, "%s: sending smp request\n", __func__));
init_completion(&ioc->transport_cmds.done); init_completion(&ioc->transport_cmds.done);
mpt3sas_base_put_smid_default(ioc, smid); mpt3sas_base_put_smid_default(ioc, smid);
@ -2018,12 +1986,11 @@ _transport_smp_handler(struct bsg_job *job, struct Scsi_Host *shost,
} }
} }
dtransportprintk(ioc, pr_info(MPT3SAS_FMT dtransportprintk(ioc, ioc_info(ioc, "%s - complete\n", __func__));
"%s - complete\n", ioc->name, __func__));
if (!(ioc->transport_cmds.status & MPT3_CMD_REPLY_VALID)) { if (!(ioc->transport_cmds.status & MPT3_CMD_REPLY_VALID)) {
dtransportprintk(ioc, pr_info(MPT3SAS_FMT dtransportprintk(ioc,
"%s - no reply\n", ioc->name, __func__)); ioc_info(ioc, "%s: no reply\n", __func__));
rc = -ENXIO; rc = -ENXIO;
goto unmap_in; goto unmap_in;
} }
@ -2031,8 +1998,8 @@ _transport_smp_handler(struct bsg_job *job, struct Scsi_Host *shost,
mpi_reply = ioc->transport_cmds.reply; mpi_reply = ioc->transport_cmds.reply;
dtransportprintk(ioc, dtransportprintk(ioc,
pr_info(MPT3SAS_FMT "%s - reply data transfer size(%d)\n", ioc_info(ioc, "%s: reply data transfer size(%d)\n",
ioc->name, __func__, __func__,
le16_to_cpu(mpi_reply->ResponseDataLength))); le16_to_cpu(mpi_reply->ResponseDataLength)));
memcpy(job->reply, mpi_reply, sizeof(*mpi_reply)); memcpy(job->reply, mpi_reply, sizeof(*mpi_reply));

View File

@ -72,8 +72,7 @@ _mpt3sas_raise_sigio(struct MPT3SAS_ADAPTER *ioc,
u16 sz, event_data_sz; u16 sz, event_data_sz;
unsigned long flags; unsigned long flags;
dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT "%s: enter\n", dTriggerDiagPrintk(ioc, ioc_info(ioc, "%s: enter\n", __func__));
ioc->name, __func__));
sz = offsetof(Mpi2EventNotificationReply_t, EventData) + sz = offsetof(Mpi2EventNotificationReply_t, EventData) +
sizeof(struct SL_WH_TRIGGERS_EVENT_DATA_T) + 4; sizeof(struct SL_WH_TRIGGERS_EVENT_DATA_T) + 4;
@ -85,22 +84,22 @@ _mpt3sas_raise_sigio(struct MPT3SAS_ADAPTER *ioc,
mpi_reply->EventDataLength = cpu_to_le16(event_data_sz); mpi_reply->EventDataLength = cpu_to_le16(event_data_sz);
memcpy(&mpi_reply->EventData, event_data, memcpy(&mpi_reply->EventData, event_data,
sizeof(struct SL_WH_TRIGGERS_EVENT_DATA_T)); sizeof(struct SL_WH_TRIGGERS_EVENT_DATA_T));
dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT dTriggerDiagPrintk(ioc,
"%s: add to driver event log\n", ioc_info(ioc, "%s: add to driver event log\n",
ioc->name, __func__)); __func__));
mpt3sas_ctl_add_to_event_log(ioc, mpi_reply); mpt3sas_ctl_add_to_event_log(ioc, mpi_reply);
kfree(mpi_reply); kfree(mpi_reply);
out: out:
/* clearing the diag_trigger_active flag */ /* clearing the diag_trigger_active flag */
spin_lock_irqsave(&ioc->diag_trigger_lock, flags); spin_lock_irqsave(&ioc->diag_trigger_lock, flags);
dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT dTriggerDiagPrintk(ioc,
"%s: clearing diag_trigger_active flag\n", ioc_info(ioc, "%s: clearing diag_trigger_active flag\n",
ioc->name, __func__)); __func__));
ioc->diag_trigger_active = 0; ioc->diag_trigger_active = 0;
spin_unlock_irqrestore(&ioc->diag_trigger_lock, flags); spin_unlock_irqrestore(&ioc->diag_trigger_lock, flags);
dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT "%s: exit\n", ioc->name, dTriggerDiagPrintk(ioc, ioc_info(ioc, "%s: exit\n",
__func__)); __func__));
} }
@ -115,21 +114,21 @@ mpt3sas_process_trigger_data(struct MPT3SAS_ADAPTER *ioc,
{ {
u8 issue_reset = 0; u8 issue_reset = 0;
dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT "%s: enter\n", dTriggerDiagPrintk(ioc, ioc_info(ioc, "%s: enter\n", __func__));
ioc->name, __func__));
/* release the diag buffer trace */ /* release the diag buffer trace */
if ((ioc->diag_buffer_status[MPI2_DIAG_BUF_TYPE_TRACE] & if ((ioc->diag_buffer_status[MPI2_DIAG_BUF_TYPE_TRACE] &
MPT3_DIAG_BUFFER_IS_RELEASED) == 0) { MPT3_DIAG_BUFFER_IS_RELEASED) == 0) {
dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT dTriggerDiagPrintk(ioc,
"%s: release trace diag buffer\n", ioc->name, __func__)); ioc_info(ioc, "%s: release trace diag buffer\n",
__func__));
mpt3sas_send_diag_release(ioc, MPI2_DIAG_BUF_TYPE_TRACE, mpt3sas_send_diag_release(ioc, MPI2_DIAG_BUF_TYPE_TRACE,
&issue_reset); &issue_reset);
} }
_mpt3sas_raise_sigio(ioc, event_data); _mpt3sas_raise_sigio(ioc, event_data);
dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT "%s: exit\n", ioc->name, dTriggerDiagPrintk(ioc, ioc_info(ioc, "%s: exit\n",
__func__)); __func__));
} }
@ -168,9 +167,9 @@ mpt3sas_trigger_master(struct MPT3SAS_ADAPTER *ioc, u32 trigger_bitmask)
by_pass_checks: by_pass_checks:
dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT dTriggerDiagPrintk(ioc,
"%s: enter - trigger_bitmask = 0x%08x\n", ioc_info(ioc, "%s: enter - trigger_bitmask = 0x%08x\n",
ioc->name, __func__, trigger_bitmask)); __func__, trigger_bitmask));
/* don't send trigger if an trigger is currently active */ /* don't send trigger if an trigger is currently active */
if (ioc->diag_trigger_active) { if (ioc->diag_trigger_active) {
@ -182,9 +181,9 @@ mpt3sas_trigger_master(struct MPT3SAS_ADAPTER *ioc, u32 trigger_bitmask)
if (ioc->diag_trigger_master.MasterData & trigger_bitmask) { if (ioc->diag_trigger_master.MasterData & trigger_bitmask) {
found_match = 1; found_match = 1;
ioc->diag_trigger_active = 1; ioc->diag_trigger_active = 1;
dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT dTriggerDiagPrintk(ioc,
"%s: setting diag_trigger_active flag\n", ioc_info(ioc, "%s: setting diag_trigger_active flag\n",
ioc->name, __func__)); __func__));
} }
spin_unlock_irqrestore(&ioc->diag_trigger_lock, flags); spin_unlock_irqrestore(&ioc->diag_trigger_lock, flags);
@ -202,7 +201,7 @@ mpt3sas_trigger_master(struct MPT3SAS_ADAPTER *ioc, u32 trigger_bitmask)
mpt3sas_send_trigger_data_event(ioc, &event_data); mpt3sas_send_trigger_data_event(ioc, &event_data);
out: out:
dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT "%s: exit\n", ioc->name, dTriggerDiagPrintk(ioc, ioc_info(ioc, "%s: exit\n",
__func__)); __func__));
} }
@ -239,9 +238,9 @@ mpt3sas_trigger_event(struct MPT3SAS_ADAPTER *ioc, u16 event,
return; return;
} }
dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT dTriggerDiagPrintk(ioc,
"%s: enter - event = 0x%04x, log_entry_qualifier = 0x%04x\n", ioc_info(ioc, "%s: enter - event = 0x%04x, log_entry_qualifier = 0x%04x\n",
ioc->name, __func__, event, log_entry_qualifier)); __func__, event, log_entry_qualifier));
/* don't send trigger if an trigger is currently active */ /* don't send trigger if an trigger is currently active */
if (ioc->diag_trigger_active) { if (ioc->diag_trigger_active) {
@ -263,25 +262,25 @@ mpt3sas_trigger_event(struct MPT3SAS_ADAPTER *ioc, u16 event,
} }
found_match = 1; found_match = 1;
ioc->diag_trigger_active = 1; ioc->diag_trigger_active = 1;
dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT dTriggerDiagPrintk(ioc,
"%s: setting diag_trigger_active flag\n", ioc_info(ioc, "%s: setting diag_trigger_active flag\n",
ioc->name, __func__)); __func__));
} }
spin_unlock_irqrestore(&ioc->diag_trigger_lock, flags); spin_unlock_irqrestore(&ioc->diag_trigger_lock, flags);
if (!found_match) if (!found_match)
goto out; goto out;
dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT dTriggerDiagPrintk(ioc,
"%s: setting diag_trigger_active flag\n", ioc_info(ioc, "%s: setting diag_trigger_active flag\n",
ioc->name, __func__)); __func__));
memset(&event_data, 0, sizeof(struct SL_WH_TRIGGERS_EVENT_DATA_T)); memset(&event_data, 0, sizeof(struct SL_WH_TRIGGERS_EVENT_DATA_T));
event_data.trigger_type = MPT3SAS_TRIGGER_EVENT; event_data.trigger_type = MPT3SAS_TRIGGER_EVENT;
event_data.u.event.EventValue = event; event_data.u.event.EventValue = event;
event_data.u.event.LogEntryQualifier = log_entry_qualifier; event_data.u.event.LogEntryQualifier = log_entry_qualifier;
mpt3sas_send_trigger_data_event(ioc, &event_data); mpt3sas_send_trigger_data_event(ioc, &event_data);
out: out:
dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT "%s: exit\n", ioc->name, dTriggerDiagPrintk(ioc, ioc_info(ioc, "%s: exit\n",
__func__)); __func__));
} }
@ -319,9 +318,9 @@ mpt3sas_trigger_scsi(struct MPT3SAS_ADAPTER *ioc, u8 sense_key, u8 asc,
return; return;
} }
dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT dTriggerDiagPrintk(ioc,
"%s: enter - sense_key = 0x%02x, asc = 0x%02x, ascq = 0x%02x\n", ioc_info(ioc, "%s: enter - sense_key = 0x%02x, asc = 0x%02x, ascq = 0x%02x\n",
ioc->name, __func__, sense_key, asc, ascq)); __func__, sense_key, asc, ascq));
/* don't send trigger if an trigger is currently active */ /* don't send trigger if an trigger is currently active */
if (ioc->diag_trigger_active) { if (ioc->diag_trigger_active) {
@ -347,9 +346,9 @@ mpt3sas_trigger_scsi(struct MPT3SAS_ADAPTER *ioc, u8 sense_key, u8 asc,
if (!found_match) if (!found_match)
goto out; goto out;
dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT dTriggerDiagPrintk(ioc,
"%s: setting diag_trigger_active flag\n", ioc_info(ioc, "%s: setting diag_trigger_active flag\n",
ioc->name, __func__)); __func__));
memset(&event_data, 0, sizeof(struct SL_WH_TRIGGERS_EVENT_DATA_T)); memset(&event_data, 0, sizeof(struct SL_WH_TRIGGERS_EVENT_DATA_T));
event_data.trigger_type = MPT3SAS_TRIGGER_SCSI; event_data.trigger_type = MPT3SAS_TRIGGER_SCSI;
event_data.u.scsi.SenseKey = sense_key; event_data.u.scsi.SenseKey = sense_key;
@ -357,7 +356,7 @@ mpt3sas_trigger_scsi(struct MPT3SAS_ADAPTER *ioc, u8 sense_key, u8 asc,
event_data.u.scsi.ASCQ = ascq; event_data.u.scsi.ASCQ = ascq;
mpt3sas_send_trigger_data_event(ioc, &event_data); mpt3sas_send_trigger_data_event(ioc, &event_data);
out: out:
dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT "%s: exit\n", ioc->name, dTriggerDiagPrintk(ioc, ioc_info(ioc, "%s: exit\n",
__func__)); __func__));
} }
@ -393,9 +392,9 @@ mpt3sas_trigger_mpi(struct MPT3SAS_ADAPTER *ioc, u16 ioc_status, u32 loginfo)
return; return;
} }
dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT dTriggerDiagPrintk(ioc,
"%s: enter - ioc_status = 0x%04x, loginfo = 0x%08x\n", ioc_info(ioc, "%s: enter - ioc_status = 0x%04x, loginfo = 0x%08x\n",
ioc->name, __func__, ioc_status, loginfo)); __func__, ioc_status, loginfo));
/* don't send trigger if an trigger is currently active */ /* don't send trigger if an trigger is currently active */
if (ioc->diag_trigger_active) { if (ioc->diag_trigger_active) {
@ -420,15 +419,15 @@ mpt3sas_trigger_mpi(struct MPT3SAS_ADAPTER *ioc, u16 ioc_status, u32 loginfo)
if (!found_match) if (!found_match)
goto out; goto out;
dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT dTriggerDiagPrintk(ioc,
"%s: setting diag_trigger_active flag\n", ioc_info(ioc, "%s: setting diag_trigger_active flag\n",
ioc->name, __func__)); __func__));
memset(&event_data, 0, sizeof(struct SL_WH_TRIGGERS_EVENT_DATA_T)); memset(&event_data, 0, sizeof(struct SL_WH_TRIGGERS_EVENT_DATA_T));
event_data.trigger_type = MPT3SAS_TRIGGER_MPI; event_data.trigger_type = MPT3SAS_TRIGGER_MPI;
event_data.u.mpi.IOCStatus = ioc_status; event_data.u.mpi.IOCStatus = ioc_status;
event_data.u.mpi.IocLogInfo = loginfo; event_data.u.mpi.IocLogInfo = loginfo;
mpt3sas_send_trigger_data_event(ioc, &event_data); mpt3sas_send_trigger_data_event(ioc, &event_data);
out: out:
dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT "%s: exit\n", ioc->name, dTriggerDiagPrintk(ioc, ioc_info(ioc, "%s: exit\n",
__func__)); __func__));
} }

View File

@ -127,20 +127,17 @@ mpt3sas_init_warpdrive_properties(struct MPT3SAS_ADAPTER *ioc,
return; return;
if (ioc->mfg_pg10_hide_flag == MFG_PAGE10_EXPOSE_ALL_DISKS) { if (ioc->mfg_pg10_hide_flag == MFG_PAGE10_EXPOSE_ALL_DISKS) {
pr_info(MPT3SAS_FMT "WarpDrive : Direct IO is disabled " ioc_info(ioc, "WarpDrive : Direct IO is disabled globally as drives are exposed\n");
"globally as drives are exposed\n", ioc->name);
return; return;
} }
if (mpt3sas_get_num_volumes(ioc) > 1) { if (mpt3sas_get_num_volumes(ioc) > 1) {
_warpdrive_disable_ddio(ioc); _warpdrive_disable_ddio(ioc);
pr_info(MPT3SAS_FMT "WarpDrive : Direct IO is disabled " ioc_info(ioc, "WarpDrive : Direct IO is disabled globally as number of drives > 1\n");
"globally as number of drives > 1\n", ioc->name);
return; return;
} }
if ((mpt3sas_config_get_number_pds(ioc, raid_device->handle, if ((mpt3sas_config_get_number_pds(ioc, raid_device->handle,
&num_pds)) || !num_pds) { &num_pds)) || !num_pds) {
pr_info(MPT3SAS_FMT "WarpDrive : Direct IO is disabled " ioc_info(ioc, "WarpDrive : Direct IO is disabled Failure in computing number of drives\n");
"Failure in computing number of drives\n", ioc->name);
return; return;
} }
@ -148,15 +145,13 @@ mpt3sas_init_warpdrive_properties(struct MPT3SAS_ADAPTER *ioc,
sizeof(Mpi2RaidVol0PhysDisk_t)); sizeof(Mpi2RaidVol0PhysDisk_t));
vol_pg0 = kzalloc(sz, GFP_KERNEL); vol_pg0 = kzalloc(sz, GFP_KERNEL);
if (!vol_pg0) { if (!vol_pg0) {
pr_info(MPT3SAS_FMT "WarpDrive : Direct IO is disabled " ioc_info(ioc, "WarpDrive : Direct IO is disabled Memory allocation failure for RVPG0\n");
"Memory allocation failure for RVPG0\n", ioc->name);
return; return;
} }
if ((mpt3sas_config_get_raid_volume_pg0(ioc, &mpi_reply, vol_pg0, if ((mpt3sas_config_get_raid_volume_pg0(ioc, &mpi_reply, vol_pg0,
MPI2_RAID_VOLUME_PGAD_FORM_HANDLE, raid_device->handle, sz))) { MPI2_RAID_VOLUME_PGAD_FORM_HANDLE, raid_device->handle, sz))) {
pr_info(MPT3SAS_FMT "WarpDrive : Direct IO is disabled " ioc_info(ioc, "WarpDrive : Direct IO is disabled Failure in retrieving RVPG0\n");
"Failure in retrieving RVPG0\n", ioc->name);
kfree(vol_pg0); kfree(vol_pg0);
return; return;
} }
@ -166,10 +161,8 @@ mpt3sas_init_warpdrive_properties(struct MPT3SAS_ADAPTER *ioc,
* assumed for WARPDRIVE, disable direct I/O * assumed for WARPDRIVE, disable direct I/O
*/ */
if (num_pds > MPT_MAX_WARPDRIVE_PDS) { if (num_pds > MPT_MAX_WARPDRIVE_PDS) {
pr_warn(MPT3SAS_FMT "WarpDrive : Direct IO is disabled " ioc_warn(ioc, "WarpDrive : Direct IO is disabled for the drive with handle(0x%04x): num_mem=%d, max_mem_allowed=%d\n",
"for the drive with handle(0x%04x): num_mem=%d, " raid_device->handle, num_pds, MPT_MAX_WARPDRIVE_PDS);
"max_mem_allowed=%d\n", ioc->name, raid_device->handle,
num_pds, MPT_MAX_WARPDRIVE_PDS);
kfree(vol_pg0); kfree(vol_pg0);
return; return;
} }
@ -179,22 +172,18 @@ mpt3sas_init_warpdrive_properties(struct MPT3SAS_ADAPTER *ioc,
vol_pg0->PhysDisk[count].PhysDiskNum) || vol_pg0->PhysDisk[count].PhysDiskNum) ||
le16_to_cpu(pd_pg0.DevHandle) == le16_to_cpu(pd_pg0.DevHandle) ==
MPT3SAS_INVALID_DEVICE_HANDLE) { MPT3SAS_INVALID_DEVICE_HANDLE) {
pr_info(MPT3SAS_FMT "WarpDrive : Direct IO is " ioc_info(ioc, "WarpDrive : Direct IO is disabled for the drive with handle(0x%04x) member handle retrieval failed for member number=%d\n",
"disabled for the drive with handle(0x%04x) member" raid_device->handle,
"handle retrieval failed for member number=%d\n",
ioc->name, raid_device->handle,
vol_pg0->PhysDisk[count].PhysDiskNum); vol_pg0->PhysDisk[count].PhysDiskNum);
goto out_error; goto out_error;
} }
/* Disable direct I/O if member drive lba exceeds 4 bytes */ /* Disable direct I/O if member drive lba exceeds 4 bytes */
dev_max_lba = le64_to_cpu(pd_pg0.DeviceMaxLBA); dev_max_lba = le64_to_cpu(pd_pg0.DeviceMaxLBA);
if (dev_max_lba >> 32) { if (dev_max_lba >> 32) {
pr_info(MPT3SAS_FMT "WarpDrive : Direct IO is " ioc_info(ioc, "WarpDrive : Direct IO is disabled for the drive with handle(0x%04x) member handle (0x%04x) unsupported max lba 0x%016llx\n",
"disabled for the drive with handle(0x%04x) member" raid_device->handle,
" handle (0x%04x) unsupported max lba 0x%016llx\n",
ioc->name, raid_device->handle,
le16_to_cpu(pd_pg0.DevHandle), le16_to_cpu(pd_pg0.DevHandle),
(unsigned long long)dev_max_lba); (u64)dev_max_lba);
goto out_error; goto out_error;
} }
@ -206,9 +195,7 @@ mpt3sas_init_warpdrive_properties(struct MPT3SAS_ADAPTER *ioc,
* not RAID0 * not RAID0
*/ */
if (raid_device->volume_type != MPI2_RAID_VOL_TYPE_RAID0) { if (raid_device->volume_type != MPI2_RAID_VOL_TYPE_RAID0) {
pr_info(MPT3SAS_FMT "WarpDrive : Direct IO is disabled " ioc_info(ioc, "WarpDrive : Direct IO is disabled for the drive with handle(0x%04x): type=%d, s_sz=%uK, blk_size=%u\n",
"for the drive with handle(0x%04x): type=%d, "
"s_sz=%uK, blk_size=%u\n", ioc->name,
raid_device->handle, raid_device->volume_type, raid_device->handle, raid_device->volume_type,
(le32_to_cpu(vol_pg0->StripeSize) * (le32_to_cpu(vol_pg0->StripeSize) *
le16_to_cpu(vol_pg0->BlockSize)) / 1024, le16_to_cpu(vol_pg0->BlockSize)) / 1024,
@ -219,9 +206,8 @@ mpt3sas_init_warpdrive_properties(struct MPT3SAS_ADAPTER *ioc,
stripe_sz = le32_to_cpu(vol_pg0->StripeSize); stripe_sz = le32_to_cpu(vol_pg0->StripeSize);
stripe_exp = find_first_bit(&stripe_sz, 32); stripe_exp = find_first_bit(&stripe_sz, 32);
if (stripe_exp == 32) { if (stripe_exp == 32) {
pr_info(MPT3SAS_FMT "WarpDrive : Direct IO is disabled " ioc_info(ioc, "WarpDrive : Direct IO is disabled for the drive with handle(0x%04x) invalid stripe sz %uK\n",
"for the drive with handle(0x%04x) invalid stripe sz %uK\n", raid_device->handle,
ioc->name, raid_device->handle,
(le32_to_cpu(vol_pg0->StripeSize) * (le32_to_cpu(vol_pg0->StripeSize) *
le16_to_cpu(vol_pg0->BlockSize)) / 1024); le16_to_cpu(vol_pg0->BlockSize)) / 1024);
goto out_error; goto out_error;
@ -230,17 +216,15 @@ mpt3sas_init_warpdrive_properties(struct MPT3SAS_ADAPTER *ioc,
block_sz = le16_to_cpu(vol_pg0->BlockSize); block_sz = le16_to_cpu(vol_pg0->BlockSize);
block_exp = find_first_bit(&block_sz, 16); block_exp = find_first_bit(&block_sz, 16);
if (block_exp == 16) { if (block_exp == 16) {
pr_info(MPT3SAS_FMT "WarpDrive : Direct IO is disabled " ioc_info(ioc, "WarpDrive : Direct IO is disabled for the drive with handle(0x%04x) invalid block sz %u\n",
"for the drive with handle(0x%04x) invalid block sz %u\n", raid_device->handle, le16_to_cpu(vol_pg0->BlockSize));
ioc->name, raid_device->handle,
le16_to_cpu(vol_pg0->BlockSize));
goto out_error; goto out_error;
} }
raid_device->block_exponent = block_exp; raid_device->block_exponent = block_exp;
raid_device->direct_io_enabled = 1; raid_device->direct_io_enabled = 1;
pr_info(MPT3SAS_FMT "WarpDrive : Direct IO is Enabled for the drive" ioc_info(ioc, "WarpDrive : Direct IO is Enabled for the drive with handle(0x%04x)\n",
" with handle(0x%04x)\n", ioc->name, raid_device->handle); raid_device->handle);
/* /*
* WARPDRIVE: Though the following fields are not used for direct IO, * WARPDRIVE: Though the following fields are not used for direct IO,
* stored for future purpose: * stored for future purpose: