Commit 919d8a3f authored by Joe Perches's avatar Joe Perches Committed by Martin K. Petersen

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: default avatarJoe Perches <joe@perches.com>
Acked-by: default avatarSuganath Prabu <suganath-prabu.subramani@broadcom.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 645a20c6
...@@ -122,8 +122,8 @@ mpt3sas_base_check_cmd_timeout(struct MPT3SAS_ADAPTER *ioc, ...@@ -122,8 +122,8 @@ mpt3sas_base_check_cmd_timeout(struct MPT3SAS_ADAPTER *ioc,
if (!(status & MPT3_CMD_RESET)) if (!(status & MPT3_CMD_RESET))
issue_reset = 1; issue_reset = 1;
pr_err(MPT3SAS_FMT "Command %s\n", ioc->name, ioc_err(ioc, "Command %s\n",
((issue_reset == 0) ? "terminated due to Host Reset" : "Timeout")); issue_reset == 0 ? "terminated due to Host Reset" : "Timeout");
_debug_dump_mf(mpi_request, sz); _debug_dump_mf(mpi_request, sz);
return issue_reset; return issue_reset;
...@@ -336,9 +336,7 @@ _base_get_chain_buffer_dma_to_chain_buffer(struct MPT3SAS_ADAPTER *ioc, ...@@ -336,9 +336,7 @@ _base_get_chain_buffer_dma_to_chain_buffer(struct MPT3SAS_ADAPTER *ioc,
return ct->chain_buffer; return ct->chain_buffer;
} }
} }
pr_info(MPT3SAS_FMT ioc_info(ioc, "Provided chain_buffer_dma address is not in the lookup list\n");
"Provided chain_buffer_dma address is not in the lookup list\n",
ioc->name);
return NULL; return NULL;
} }
...@@ -394,7 +392,7 @@ static void _clone_sg_entries(struct MPT3SAS_ADAPTER *ioc, ...@@ -394,7 +392,7 @@ static void _clone_sg_entries(struct MPT3SAS_ADAPTER *ioc,
/* Get scsi_cmd using smid */ /* Get scsi_cmd using smid */
scmd = mpt3sas_scsih_scsi_lookup_get(ioc, smid); scmd = mpt3sas_scsih_scsi_lookup_get(ioc, smid);
if (scmd == NULL) { if (scmd == NULL) {
pr_err(MPT3SAS_FMT "scmd is NULL\n", ioc->name); ioc_err(ioc, "scmd is NULL\n");
return; return;
} }
...@@ -566,8 +564,7 @@ _base_fault_reset_work(struct work_struct *work) ...@@ -566,8 +564,7 @@ _base_fault_reset_work(struct work_struct *work)
doorbell = mpt3sas_base_get_iocstate(ioc, 0); doorbell = mpt3sas_base_get_iocstate(ioc, 0);
if ((doorbell & MPI2_IOC_STATE_MASK) == MPI2_IOC_STATE_MASK) { if ((doorbell & MPI2_IOC_STATE_MASK) == MPI2_IOC_STATE_MASK) {
pr_err(MPT3SAS_FMT "SAS host is non-operational !!!!\n", ioc_err(ioc, "SAS host is non-operational !!!!\n");
ioc->name);
/* It may be possible that EEH recovery can resolve some of /* It may be possible that EEH recovery can resolve some of
* pci bus failure issues rather removing the dead ioc function * pci bus failure issues rather removing the dead ioc function
...@@ -600,13 +597,11 @@ _base_fault_reset_work(struct work_struct *work) ...@@ -600,13 +597,11 @@ _base_fault_reset_work(struct work_struct *work)
p = kthread_run(mpt3sas_remove_dead_ioc_func, ioc, p = kthread_run(mpt3sas_remove_dead_ioc_func, ioc,
"%s_dead_ioc_%d", ioc->driver_name, ioc->id); "%s_dead_ioc_%d", ioc->driver_name, ioc->id);
if (IS_ERR(p)) if (IS_ERR(p))
pr_err(MPT3SAS_FMT ioc_err(ioc, "%s: Running mpt3sas_dead_ioc thread failed !!!!\n",
"%s: Running mpt3sas_dead_ioc thread failed !!!!\n", __func__);
ioc->name, __func__);
else else
pr_err(MPT3SAS_FMT ioc_err(ioc, "%s: Running mpt3sas_dead_ioc thread success !!!!\n",
"%s: Running mpt3sas_dead_ioc thread success !!!!\n", __func__);
ioc->name, __func__);
return; /* don't rearm timer */ return; /* don't rearm timer */
} }
...@@ -614,8 +609,8 @@ _base_fault_reset_work(struct work_struct *work) ...@@ -614,8 +609,8 @@ _base_fault_reset_work(struct work_struct *work)
if ((doorbell & MPI2_IOC_STATE_MASK) != MPI2_IOC_STATE_OPERATIONAL) { if ((doorbell & MPI2_IOC_STATE_MASK) != MPI2_IOC_STATE_OPERATIONAL) {
rc = mpt3sas_base_hard_reset_handler(ioc, FORCE_BIG_HAMMER); rc = mpt3sas_base_hard_reset_handler(ioc, FORCE_BIG_HAMMER);
pr_warn(MPT3SAS_FMT "%s: hard reset: %s\n", ioc->name, ioc_warn(ioc, "%s: hard reset: %s\n",
__func__, (rc == 0) ? "success" : "failed"); __func__, rc == 0 ? "success" : "failed");
doorbell = mpt3sas_base_get_iocstate(ioc, 0); doorbell = mpt3sas_base_get_iocstate(ioc, 0);
if ((doorbell & MPI2_IOC_STATE_MASK) == MPI2_IOC_STATE_FAULT) if ((doorbell & MPI2_IOC_STATE_MASK) == MPI2_IOC_STATE_FAULT)
mpt3sas_base_fault_info(ioc, doorbell & mpt3sas_base_fault_info(ioc, doorbell &
...@@ -657,8 +652,7 @@ mpt3sas_base_start_watchdog(struct MPT3SAS_ADAPTER *ioc) ...@@ -657,8 +652,7 @@ mpt3sas_base_start_watchdog(struct MPT3SAS_ADAPTER *ioc)
ioc->fault_reset_work_q = ioc->fault_reset_work_q =
create_singlethread_workqueue(ioc->fault_reset_work_q_name); create_singlethread_workqueue(ioc->fault_reset_work_q_name);
if (!ioc->fault_reset_work_q) { if (!ioc->fault_reset_work_q) {
pr_err(MPT3SAS_FMT "%s: failed (line=%d)\n", ioc_err(ioc, "%s: failed (line=%d)\n", __func__, __LINE__);
ioc->name, __func__, __LINE__);
return; return;
} }
spin_lock_irqsave(&ioc->ioc_reset_in_progress_lock, flags); spin_lock_irqsave(&ioc->ioc_reset_in_progress_lock, flags);
...@@ -700,8 +694,7 @@ mpt3sas_base_stop_watchdog(struct MPT3SAS_ADAPTER *ioc) ...@@ -700,8 +694,7 @@ mpt3sas_base_stop_watchdog(struct MPT3SAS_ADAPTER *ioc)
void void
mpt3sas_base_fault_info(struct MPT3SAS_ADAPTER *ioc , u16 fault_code) mpt3sas_base_fault_info(struct MPT3SAS_ADAPTER *ioc , u16 fault_code)
{ {
pr_err(MPT3SAS_FMT "fault_state(0x%04x)!\n", ioc_err(ioc, "fault_state(0x%04x)!\n", fault_code);
ioc->name, fault_code);
} }
/** /**
...@@ -728,8 +721,7 @@ mpt3sas_halt_firmware(struct MPT3SAS_ADAPTER *ioc) ...@@ -728,8 +721,7 @@ mpt3sas_halt_firmware(struct MPT3SAS_ADAPTER *ioc)
mpt3sas_base_fault_info(ioc , doorbell); mpt3sas_base_fault_info(ioc , doorbell);
else { else {
writel(0xC0FFEE00, &ioc->chip->Doorbell); writel(0xC0FFEE00, &ioc->chip->Doorbell);
pr_err(MPT3SAS_FMT "Firmware is halted due to command timeout\n", ioc_err(ioc, "Firmware is halted due to command timeout\n");
ioc->name);
} }
if (ioc->fwfault_debug == 2) if (ioc->fwfault_debug == 2)
...@@ -956,8 +948,8 @@ _base_sas_ioc_info(struct MPT3SAS_ADAPTER *ioc, MPI2DefaultReply_t *mpi_reply, ...@@ -956,8 +948,8 @@ _base_sas_ioc_info(struct MPT3SAS_ADAPTER *ioc, MPI2DefaultReply_t *mpi_reply,
break; break;
} }
pr_warn(MPT3SAS_FMT "ioc_status: %s(0x%04x), request(0x%p),(%s)\n", ioc_warn(ioc, "ioc_status: %s(0x%04x), request(0x%p),(%s)\n",
ioc->name, desc, ioc_status, request_hdr, func_str); desc, ioc_status, request_hdr, func_str);
_debug_dump_mf(request_hdr, frame_sz/4); _debug_dump_mf(request_hdr, frame_sz/4);
} }
...@@ -1003,9 +995,9 @@ _base_display_event_data(struct MPT3SAS_ADAPTER *ioc, ...@@ -1003,9 +995,9 @@ _base_display_event_data(struct MPT3SAS_ADAPTER *ioc,
{ {
Mpi2EventDataSasDiscovery_t *event_data = Mpi2EventDataSasDiscovery_t *event_data =
(Mpi2EventDataSasDiscovery_t *)mpi_reply->EventData; (Mpi2EventDataSasDiscovery_t *)mpi_reply->EventData;
pr_info(MPT3SAS_FMT "Discovery: (%s)", ioc->name, ioc_info(ioc, "Discovery: (%s)",
(event_data->ReasonCode == MPI2_EVENT_SAS_DISC_RC_STARTED) ? event_data->ReasonCode == MPI2_EVENT_SAS_DISC_RC_STARTED ?
"start" : "stop"); "start" : "stop");
if (event_data->DiscoveryStatus) if (event_data->DiscoveryStatus)
pr_cont(" discovery_status(0x%08x)", pr_cont(" discovery_status(0x%08x)",
le32_to_cpu(event_data->DiscoveryStatus)); le32_to_cpu(event_data->DiscoveryStatus));
...@@ -1059,14 +1051,13 @@ _base_display_event_data(struct MPT3SAS_ADAPTER *ioc, ...@@ -1059,14 +1051,13 @@ _base_display_event_data(struct MPT3SAS_ADAPTER *ioc,
{ {
Mpi26EventDataPCIeEnumeration_t *event_data = Mpi26EventDataPCIeEnumeration_t *event_data =
(Mpi26EventDataPCIeEnumeration_t *)mpi_reply->EventData; (Mpi26EventDataPCIeEnumeration_t *)mpi_reply->EventData;
pr_info(MPT3SAS_FMT "PCIE Enumeration: (%s)", ioc->name, ioc_info(ioc, "PCIE Enumeration: (%s)",
(event_data->ReasonCode == event_data->ReasonCode == MPI26_EVENT_PCIE_ENUM_RC_STARTED ?
MPI26_EVENT_PCIE_ENUM_RC_STARTED) ? "start" : "stop");
"start" : "stop");
if (event_data->EnumerationStatus) if (event_data->EnumerationStatus)
pr_info("enumeration_status(0x%08x)", pr_cont("enumeration_status(0x%08x)",
le32_to_cpu(event_data->EnumerationStatus)); le32_to_cpu(event_data->EnumerationStatus));
pr_info("\n"); pr_cont("\n");
return; return;
} }
case MPI2_EVENT_PCIE_TOPOLOGY_CHANGE_LIST: case MPI2_EVENT_PCIE_TOPOLOGY_CHANGE_LIST:
...@@ -1077,7 +1068,7 @@ _base_display_event_data(struct MPT3SAS_ADAPTER *ioc, ...@@ -1077,7 +1068,7 @@ _base_display_event_data(struct MPT3SAS_ADAPTER *ioc,
if (!desc) if (!desc)
return; return;
pr_info(MPT3SAS_FMT "%s\n", ioc->name, desc); ioc_info(ioc, "%s\n", desc);
} }
/** /**
...@@ -1128,11 +1119,9 @@ _base_sas_log_info(struct MPT3SAS_ADAPTER *ioc , u32 log_info) ...@@ -1128,11 +1119,9 @@ _base_sas_log_info(struct MPT3SAS_ADAPTER *ioc , u32 log_info)
break; break;
} }
pr_warn(MPT3SAS_FMT ioc_warn(ioc, "log_info(0x%08x): originator(%s), code(0x%02x), sub_code(0x%04x)\n",
"log_info(0x%08x): originator(%s), code(0x%02x), sub_code(0x%04x)\n", log_info,
ioc->name, log_info, originator_str, sas_loginfo.dw.code, sas_loginfo.dw.subcode);
originator_str, sas_loginfo.dw.code,
sas_loginfo.dw.subcode);
} }
/** /**
...@@ -1152,8 +1141,8 @@ _base_display_reply_info(struct MPT3SAS_ADAPTER *ioc, u16 smid, u8 msix_index, ...@@ -1152,8 +1141,8 @@ _base_display_reply_info(struct MPT3SAS_ADAPTER *ioc, u16 smid, u8 msix_index,
mpi_reply = mpt3sas_base_get_reply_virt_addr(ioc, reply); mpi_reply = mpt3sas_base_get_reply_virt_addr(ioc, reply);
if (unlikely(!mpi_reply)) { if (unlikely(!mpi_reply)) {
pr_err(MPT3SAS_FMT "mpi_reply not valid at %s:%d/%s()!\n", ioc_err(ioc, "mpi_reply not valid at %s:%d/%s()!\n",
ioc->name, __FILE__, __LINE__, __func__); __FILE__, __LINE__, __func__);
return; return;
} }
ioc_status = le16_to_cpu(mpi_reply->IOCStatus); ioc_status = le16_to_cpu(mpi_reply->IOCStatus);
...@@ -1249,9 +1238,9 @@ _base_async_event(struct MPT3SAS_ADAPTER *ioc, u8 msix_index, u32 reply) ...@@ -1249,9 +1238,9 @@ _base_async_event(struct MPT3SAS_ADAPTER *ioc, u8 msix_index, u32 reply)
delayed_event_ack->EventContext = mpi_reply->EventContext; delayed_event_ack->EventContext = mpi_reply->EventContext;
list_add_tail(&delayed_event_ack->list, list_add_tail(&delayed_event_ack->list,
&ioc->delayed_event_ack_list); &ioc->delayed_event_ack_list);
dewtprintk(ioc, pr_info(MPT3SAS_FMT dewtprintk(ioc,
"DELAYED: EVENT ACK: event (0x%04x)\n", ioc_info(ioc, "DELAYED: EVENT ACK: event (0x%04x)\n",
ioc->name, le16_to_cpu(mpi_reply->Event))); le16_to_cpu(mpi_reply->Event)));
goto out; goto out;
} }
...@@ -2598,9 +2587,8 @@ _base_config_dma_addressing(struct MPT3SAS_ADAPTER *ioc, struct pci_dev *pdev) ...@@ -2598,9 +2587,8 @@ _base_config_dma_addressing(struct MPT3SAS_ADAPTER *ioc, struct pci_dev *pdev)
out: out:
si_meminfo(&s); si_meminfo(&s);
pr_info(MPT3SAS_FMT ioc_info(ioc, "%d BIT PCI BUS DMA ADDRESSING SUPPORTED, total mem (%ld kB)\n",
"%d BIT PCI BUS DMA ADDRESSING SUPPORTED, total mem (%ld kB)\n", ioc->dma_mask, convert_to_kb(s.totalram));
ioc->name, ioc->dma_mask, convert_to_kb(s.totalram));
return 0; return 0;
} }
...@@ -2639,8 +2627,7 @@ _base_check_enable_msix(struct MPT3SAS_ADAPTER *ioc) ...@@ -2639,8 +2627,7 @@ _base_check_enable_msix(struct MPT3SAS_ADAPTER *ioc)
base = pci_find_capability(ioc->pdev, PCI_CAP_ID_MSIX); base = pci_find_capability(ioc->pdev, PCI_CAP_ID_MSIX);
if (!base) { if (!base) {
dfailprintk(ioc, pr_info(MPT3SAS_FMT "msix not supported\n", dfailprintk(ioc, ioc_info(ioc, "msix not supported\n"));
ioc->name));
return -EINVAL; return -EINVAL;
} }
...@@ -2658,9 +2645,8 @@ _base_check_enable_msix(struct MPT3SAS_ADAPTER *ioc) ...@@ -2658,9 +2645,8 @@ _base_check_enable_msix(struct MPT3SAS_ADAPTER *ioc)
pci_read_config_word(ioc->pdev, base + 2, &message_control); pci_read_config_word(ioc->pdev, base + 2, &message_control);
ioc->msix_vector_count = (message_control & 0x3FF) + 1; ioc->msix_vector_count = (message_control & 0x3FF) + 1;
} }
dinitprintk(ioc, pr_info(MPT3SAS_FMT dinitprintk(ioc, ioc_info(ioc, "msix is supported, vector_count(%d)\n",
"msix is supported, vector_count(%d)\n", ioc->msix_vector_count));
ioc->name, ioc->msix_vector_count));
return 0; return 0;
} }
...@@ -2702,8 +2688,8 @@ _base_request_irq(struct MPT3SAS_ADAPTER *ioc, u8 index) ...@@ -2702,8 +2688,8 @@ _base_request_irq(struct MPT3SAS_ADAPTER *ioc, u8 index)
reply_q = kzalloc(sizeof(struct adapter_reply_queue), GFP_KERNEL); reply_q = kzalloc(sizeof(struct adapter_reply_queue), GFP_KERNEL);
if (!reply_q) { if (!reply_q) {
pr_err(MPT3SAS_FMT "unable to allocate memory %d!\n", ioc_err(ioc, "unable to allocate memory %zu!\n",
ioc->name, (int)sizeof(struct adapter_reply_queue)); sizeof(struct adapter_reply_queue));
return -ENOMEM; return -ENOMEM;
} }
reply_q->ioc = ioc; reply_q->ioc = ioc;
...@@ -2761,8 +2747,8 @@ _base_assign_reply_queues(struct MPT3SAS_ADAPTER *ioc) ...@@ -2761,8 +2747,8 @@ _base_assign_reply_queues(struct MPT3SAS_ADAPTER *ioc)
const cpumask_t *mask = pci_irq_get_affinity(ioc->pdev, const cpumask_t *mask = pci_irq_get_affinity(ioc->pdev,
reply_q->msix_index); reply_q->msix_index);
if (!mask) { if (!mask) {
pr_warn(MPT3SAS_FMT "no affinity for msi %x\n", ioc_warn(ioc, "no affinity for msi %x\n",
ioc->name, reply_q->msix_index); reply_q->msix_index);
continue; continue;
} }
...@@ -2857,9 +2843,9 @@ _base_enable_msix(struct MPT3SAS_ADAPTER *ioc) ...@@ -2857,9 +2843,9 @@ _base_enable_msix(struct MPT3SAS_ADAPTER *ioc)
r = pci_alloc_irq_vectors(ioc->pdev, 1, ioc->reply_queue_count, r = pci_alloc_irq_vectors(ioc->pdev, 1, ioc->reply_queue_count,
irq_flags); irq_flags);
if (r < 0) { if (r < 0) {
dfailprintk(ioc, pr_info(MPT3SAS_FMT dfailprintk(ioc,
"pci_alloc_irq_vectors failed (r=%d) !!!\n", ioc_info(ioc, "pci_alloc_irq_vectors failed (r=%d) !!!\n",
ioc->name, r)); r));
goto try_ioapic; goto try_ioapic;
} }
...@@ -2882,9 +2868,9 @@ _base_enable_msix(struct MPT3SAS_ADAPTER *ioc) ...@@ -2882,9 +2868,9 @@ _base_enable_msix(struct MPT3SAS_ADAPTER *ioc)
ioc->reply_queue_count = 1; ioc->reply_queue_count = 1;
r = pci_alloc_irq_vectors(ioc->pdev, 1, 1, PCI_IRQ_LEGACY); r = pci_alloc_irq_vectors(ioc->pdev, 1, 1, PCI_IRQ_LEGACY);
if (r < 0) { if (r < 0) {
dfailprintk(ioc, pr_info(MPT3SAS_FMT dfailprintk(ioc,
"pci_alloc_irq_vector(legacy) failed (r=%d) !!!\n", ioc_info(ioc, "pci_alloc_irq_vector(legacy) failed (r=%d) !!!\n",
ioc->name, r)); r));
} else } else
r = _base_request_irq(ioc, 0); r = _base_request_irq(ioc, 0);
...@@ -2939,13 +2925,11 @@ mpt3sas_base_map_resources(struct MPT3SAS_ADAPTER *ioc) ...@@ -2939,13 +2925,11 @@ mpt3sas_base_map_resources(struct MPT3SAS_ADAPTER *ioc)
phys_addr_t chip_phys = 0; phys_addr_t chip_phys = 0;
struct adapter_reply_queue *reply_q; struct adapter_reply_queue *reply_q;
dinitprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", dinitprintk(ioc, ioc_info(ioc, "%s\n", __func__));
ioc->name, __func__));
ioc->bars = pci_select_bars(pdev, IORESOURCE_MEM); ioc->bars = pci_select_bars(pdev, IORESOURCE_MEM);
if (pci_enable_device_mem(pdev)) { if (pci_enable_device_mem(pdev)) {
pr_warn(MPT3SAS_FMT "pci_enable_device_mem: failed\n", ioc_warn(ioc, "pci_enable_device_mem: failed\n");
ioc->name);
ioc->bars = 0; ioc->bars = 0;
return -ENODEV; return -ENODEV;
} }
...@@ -2953,8 +2937,7 @@ mpt3sas_base_map_resources(struct MPT3SAS_ADAPTER *ioc) ...@@ -2953,8 +2937,7 @@ mpt3sas_base_map_resources(struct MPT3SAS_ADAPTER *ioc)
if (pci_request_selected_regions(pdev, ioc->bars, if (pci_request_selected_regions(pdev, ioc->bars,
ioc->driver_name)) { ioc->driver_name)) {
pr_warn(MPT3SAS_FMT "pci_request_selected_regions: failed\n", ioc_warn(ioc, "pci_request_selected_regions: failed\n");
ioc->name);
ioc->bars = 0; ioc->bars = 0;
r = -ENODEV; r = -ENODEV;
goto out_fail; goto out_fail;
...@@ -2967,8 +2950,7 @@ mpt3sas_base_map_resources(struct MPT3SAS_ADAPTER *ioc) ...@@ -2967,8 +2950,7 @@ mpt3sas_base_map_resources(struct MPT3SAS_ADAPTER *ioc)
if (_base_config_dma_addressing(ioc, pdev) != 0) { if (_base_config_dma_addressing(ioc, pdev) != 0) {
pr_warn(MPT3SAS_FMT "no suitable DMA mask for %s\n", ioc_warn(ioc, "no suitable DMA mask for %s\n", pci_name(pdev));
ioc->name, pci_name(pdev));
r = -ENODEV; r = -ENODEV;
goto out_fail; goto out_fail;
} }
...@@ -2991,8 +2973,7 @@ mpt3sas_base_map_resources(struct MPT3SAS_ADAPTER *ioc) ...@@ -2991,8 +2973,7 @@ mpt3sas_base_map_resources(struct MPT3SAS_ADAPTER *ioc)
} }
if (ioc->chip == NULL) { if (ioc->chip == NULL) {
pr_err(MPT3SAS_FMT "unable to map adapter memory! " ioc_err(ioc, "unable to map adapter memory! or resource not found\n");
" or resource not found\n", ioc->name);
r = -EINVAL; r = -EINVAL;
goto out_fail; goto out_fail;
} }
...@@ -3058,10 +3039,10 @@ mpt3sas_base_map_resources(struct MPT3SAS_ADAPTER *ioc) ...@@ -3058,10 +3039,10 @@ mpt3sas_base_map_resources(struct MPT3SAS_ADAPTER *ioc)
"IO-APIC enabled"), "IO-APIC enabled"),
pci_irq_vector(ioc->pdev, reply_q->msix_index)); pci_irq_vector(ioc->pdev, reply_q->msix_index));
pr_info(MPT3SAS_FMT "iomem(%pap), mapped(0x%p), size(%d)\n", ioc_info(ioc, "iomem(%pap), mapped(0x%p), size(%d)\n",
ioc->name, &chip_phys, ioc->chip, memap_sz); &chip_phys, ioc->chip, memap_sz);
pr_info(MPT3SAS_FMT "ioport(0x%016llx), size(%d)\n", ioc_info(ioc, "ioport(0x%016llx), size(%d)\n",
ioc->name, (unsigned long long)pio_chip, pio_sz); (unsigned long long)pio_chip, pio_sz);
/* Save PCI configuration state for recovery from PCI AER/EEH errors */ /* Save PCI configuration state for recovery from PCI AER/EEH errors */
pci_save_state(pdev); pci_save_state(pdev);
...@@ -3176,8 +3157,7 @@ mpt3sas_base_get_smid(struct MPT3SAS_ADAPTER *ioc, u8 cb_idx) ...@@ -3176,8 +3157,7 @@ mpt3sas_base_get_smid(struct MPT3SAS_ADAPTER *ioc, u8 cb_idx)
spin_lock_irqsave(&ioc->scsi_lookup_lock, flags); spin_lock_irqsave(&ioc->scsi_lookup_lock, flags);
if (list_empty(&ioc->internal_free_list)) { if (list_empty(&ioc->internal_free_list)) {
spin_unlock_irqrestore(&ioc->scsi_lookup_lock, flags); spin_unlock_irqrestore(&ioc->scsi_lookup_lock, flags);
pr_err(MPT3SAS_FMT "%s: smid not available\n", ioc_err(ioc, "%s: smid not available\n", __func__);
ioc->name, __func__);
return 0; return 0;
} }
...@@ -3545,89 +3525,85 @@ _base_display_OEMs_branding(struct MPT3SAS_ADAPTER *ioc) ...@@ -3545,89 +3525,85 @@ _base_display_OEMs_branding(struct MPT3SAS_ADAPTER *ioc)
case MPI2_MFGPAGE_DEVID_SAS2008: case MPI2_MFGPAGE_DEVID_SAS2008:
switch (ioc->pdev->subsystem_device) { switch (ioc->pdev->subsystem_device) {
case MPT2SAS_INTEL_RMS2LL080_SSDID: case MPT2SAS_INTEL_RMS2LL080_SSDID:
pr_info(MPT3SAS_FMT "%s\n", ioc->name, ioc_info(ioc, "%s\n",
MPT2SAS_INTEL_RMS2LL080_BRANDING); MPT2SAS_INTEL_RMS2LL080_BRANDING);
break; break;
case MPT2SAS_INTEL_RMS2LL040_SSDID: case MPT2SAS_INTEL_RMS2LL040_SSDID:
pr_info(MPT3SAS_FMT "%s\n", ioc->name, ioc_info(ioc, "%s\n",
MPT2SAS_INTEL_RMS2LL040_BRANDING); MPT2SAS_INTEL_RMS2LL040_BRANDING);
break; break;
case MPT2SAS_INTEL_SSD910_SSDID: case MPT2SAS_INTEL_SSD910_SSDID:
pr_info(MPT3SAS_FMT "%s\n", ioc->name, ioc_info(ioc, "%s\n",
MPT2SAS_INTEL_SSD910_BRANDING); MPT2SAS_INTEL_SSD910_BRANDING);
break; break;
default: default:
pr_info(MPT3SAS_FMT ioc_info(ioc, "Intel(R) Controller: Subsystem ID: 0x%X\n",
"Intel(R) Controller: Subsystem ID: 0x%X\n", ioc->pdev->subsystem_device);
ioc->name, ioc->pdev->subsystem_device);
break; break;
} }
case MPI2_MFGPAGE_DEVID_SAS2308_2: case MPI2_MFGPAGE_DEVID_SAS2308_2:
switch (ioc->pdev->subsystem_device) { switch (ioc->pdev->subsystem_device) {
case MPT2SAS_INTEL_RS25GB008_SSDID: case MPT2SAS_INTEL_RS25GB008_SSDID:
pr_info(MPT3SAS_FMT "%s\n", ioc->name, ioc_info(ioc, "%s\n",
MPT2SAS_INTEL_RS25GB008_BRANDING); MPT2SAS_INTEL_RS25GB008_BRANDING);
break; break;
case MPT2SAS_INTEL_RMS25JB080_SSDID: case MPT2SAS_INTEL_RMS25JB080_SSDID:
pr_info(MPT3SAS_FMT "%s\n", ioc->name, ioc_info(ioc, "%s\n",
MPT2SAS_INTEL_RMS25JB080_BRANDING); MPT2SAS_INTEL_RMS25JB080_BRANDING);
break; break;
case MPT2SAS_INTEL_RMS25JB040_SSDID: case MPT2SAS_INTEL_RMS25JB040_SSDID:
pr_info(MPT3SAS_FMT "%s\n", ioc->name, ioc_info(ioc, "%s\n",
MPT2SAS_INTEL_RMS25JB040_BRANDING); MPT2SAS_INTEL_RMS25JB040_BRANDING);
break; break;
case MPT2SAS_INTEL_RMS25KB080_SSDID: case MPT2SAS_INTEL_RMS25KB080_SSDID:
pr_info(MPT3SAS_FMT "%s\n", ioc->name, ioc_info(ioc, "%s\n",
MPT2SAS_INTEL_RMS25KB080_BRANDING); MPT2SAS_INTEL_RMS25KB080_BRANDING);
break; break;
case MPT2SAS_INTEL_RMS25KB040_SSDID: case MPT2SAS_INTEL_RMS25KB040_SSDID:
pr_info(MPT3SAS_FMT "%s\n", ioc->name, ioc_info(ioc, "%s\n",
MPT2SAS_INTEL_RMS25KB040_BRANDING); MPT2SAS_INTEL_RMS25KB040_BRANDING);
break; break;
case MPT2SAS_INTEL_RMS25LB040_SSDID: case MPT2SAS_INTEL_RMS25LB040_SSDID:
pr_info(MPT3SAS_FMT "%s\n", ioc->name, ioc_info(ioc, "%s\n",
MPT2SAS_INTEL_RMS25LB040_BRANDING); MPT2SAS_INTEL_RMS25LB040_BRANDING);
break; break;
case MPT2SAS_INTEL_RMS25LB080_SSDID: case MPT2SAS_INTEL_RMS25LB080_SSDID:
pr_info(MPT3SAS_FMT "%s\n", ioc->name, ioc_info(ioc, "%s\n",
MPT2SAS_INTEL_RMS25LB080_BRANDING); MPT2SAS_INTEL_RMS25LB080_BRANDING);
break; break;
default: default:
pr_info(MPT3SAS_FMT ioc_info(ioc, "Intel(R) Controller: Subsystem ID: 0x%X\n",
"Intel(R) Controller: Subsystem ID: 0x%X\n", ioc->pdev->subsystem_device);
ioc->name, ioc->pdev->subsystem_device);
break; break;
} }
case MPI25_MFGPAGE_DEVID_SAS3008: case MPI25_MFGPAGE_DEVID_SAS3008:
switch (ioc->pdev->subsystem_device) { switch (ioc->pdev->subsystem_device) {
case MPT3SAS_INTEL_RMS3JC080_SSDID: case MPT3SAS_INTEL_RMS3JC080_SSDID:
pr_info(MPT3SAS_FMT "%s\n", ioc->name, ioc_info(ioc, "%s\n",
MPT3SAS_INTEL_RMS3JC080_BRANDING); MPT3SAS_INTEL_RMS3JC080_BRANDING);
break; break;
case MPT3SAS_INTEL_RS3GC008_SSDID: case MPT3SAS_INTEL_RS3GC008_SSDID:
pr_info(MPT3SAS_FMT "%s\n", ioc->name, ioc_info(ioc, "%s\n",
MPT3SAS_INTEL_RS3GC008_BRANDING); MPT3SAS_INTEL_RS3GC008_BRANDING);
break; break;
case MPT3SAS_INTEL_RS3FC044_SSDID: case MPT3SAS_INTEL_RS3FC044_SSDID:
pr_info(MPT3SAS_FMT "%s\n", ioc->name, ioc_info(ioc, "%s\n",
MPT3SAS_INTEL_RS3FC044_BRANDING); MPT3SAS_INTEL_RS3FC044_BRANDING);
break; break;
case MPT3SAS_INTEL_RS3UC080_SSDID: case MPT3SAS_INTEL_RS3UC080_SSDID:
pr_info(MPT3SAS_FMT "%s\n", ioc->name, ioc_info(ioc, "%s\n",
MPT3SAS_INTEL_RS3UC080_BRANDING); MPT3SAS_INTEL_RS3UC080_BRANDING);
break; break;
default: default:
pr_info(MPT3SAS_FMT ioc_info(ioc, "Intel(R) Controller: Subsystem ID: 0x%X\n",
"Intel(R) Controller: Subsystem ID: 0x%X\n", ioc->pdev->subsystem_device);
ioc->name, ioc->pdev->subsystem_device);
break; break;
} }
break; break;
default: default:
pr_info(MPT3SAS_FMT ioc_info(ioc, "Intel(R) Controller: Subsystem ID: 0x%X\n",
"Intel(R) Controller: Subsystem ID: 0x%X\n", ioc->pdev->subsystem_device);
ioc->name, ioc->pdev->subsystem_device);
break; break;
} }
break; break;
...@@ -3636,57 +3612,54 @@ _base_display_OEMs_branding(struct MPT3SAS_ADAPTER *ioc) ...@@ -3636,57 +3612,54 @@ _base_display_OEMs_branding(struct MPT3SAS_ADAPTER *ioc)
case MPI2_MFGPAGE_DEVID_SAS2008: case MPI2_MFGPAGE_DEVID_SAS2008:
switch (ioc->pdev->subsystem_device) { switch (ioc->pdev->subsystem_device) {
case MPT2SAS_DELL_6GBPS_SAS_HBA_SSDID: case MPT2SAS_DELL_6GBPS_SAS_HBA_SSDID:
pr_info(MPT3SAS_FMT "%s\n", ioc->name, ioc_info(ioc, "%s\n",
MPT2SAS_DELL_6GBPS_SAS_HBA_BRANDING); MPT2SAS_DELL_6GBPS_SAS_HBA_BRANDING);
break; break;
case MPT2SAS_DELL_PERC_H200_ADAPTER_SSDID: case MPT2SAS_DELL_PERC_H200_ADAPTER_SSDID:
pr_info(MPT3SAS_FMT "%s\n", ioc->name, ioc_info(ioc, "%s\n",
MPT2SAS_DELL_PERC_H200_ADAPTER_BRANDING); MPT2SAS_DELL_PERC_H200_ADAPTER_BRANDING);
break; break;
case MPT2SAS_DELL_PERC_H200_INTEGRATED_SSDID: case MPT2SAS_DELL_PERC_H200_INTEGRATED_SSDID:
pr_info(MPT3SAS_FMT "%s\n", ioc->name, ioc_info(ioc, "%s\n",
MPT2SAS_DELL_PERC_H200_INTEGRATED_BRANDING); MPT2SAS_DELL_PERC_H200_INTEGRATED_BRANDING);
break; break;
case MPT2SAS_DELL_PERC_H200_MODULAR_SSDID: case MPT2SAS_DELL_PERC_H200_MODULAR_SSDID:
pr_info(MPT3SAS_FMT "%s\n", ioc->name, ioc_info(ioc, "%s\n",
MPT2SAS_DELL_PERC_H200_MODULAR_BRANDING); MPT2SAS_DELL_PERC_H200_MODULAR_BRANDING);
break; break;
case MPT2SAS_DELL_PERC_H200_EMBEDDED_SSDID: case MPT2SAS_DELL_PERC_H200_EMBEDDED_SSDID:
pr_info(MPT3SAS_FMT "%s\n", ioc->name, ioc_info(ioc, "%s\n",
MPT2SAS_DELL_PERC_H200_EMBEDDED_BRANDING); MPT2SAS_DELL_PERC_H200_EMBEDDED_BRANDING);
break; break;
case MPT2SAS_DELL_PERC_H200_SSDID: case MPT2SAS_DELL_PERC_H200_SSDID:
pr_info(MPT3SAS_FMT "%s\n", ioc->name, ioc_info(ioc, "%s\n",
MPT2SAS_DELL_PERC_H200_BRANDING); MPT2SAS_DELL_PERC_H200_BRANDING);
break; break;
case MPT2SAS_DELL_6GBPS_SAS_SSDID: case MPT2SAS_DELL_6GBPS_SAS_SSDID:
pr_info(MPT3SAS_FMT "%s\n", ioc->name, ioc_info(ioc, "%s\n",
MPT2SAS_DELL_6GBPS_SAS_BRANDING); MPT2SAS_DELL_6GBPS_SAS_BRANDING);
break; break;
default: default:
pr_info(MPT3SAS_FMT ioc_info(ioc, "Dell 6Gbps HBA: Subsystem ID: 0x%X\n",
"Dell 6Gbps HBA: Subsystem ID: 0x%X\n", ioc->pdev->subsystem_device);
ioc->name, ioc->pdev->subsystem_device);
break; break;
} }
break; break;
case MPI25_MFGPAGE_DEVID_SAS3008: case MPI25_MFGPAGE_DEVID_SAS3008:
switch (ioc->pdev->subsystem_device) { switch (ioc->pdev->subsystem_device) {
case MPT3SAS_DELL_12G_HBA_SSDID: case MPT3SAS_DELL_12G_HBA_SSDID:
pr_info(MPT3SAS_FMT "%s\n", ioc->name, ioc_info(ioc, "%s\n",
MPT3SAS_DELL_12G_HBA_BRANDING); MPT3SAS_DELL_12G_HBA_BRANDING);
break; break;
default: default:
pr_info(MPT3SAS_FMT ioc_info(ioc, "Dell 12Gbps HBA: Subsystem ID: 0x%X\n",
"Dell 12Gbps HBA: Subsystem ID: 0x%X\n", ioc->pdev->subsystem_device);
ioc->name, ioc->pdev->subsystem_device);
break; break;
} }
break; break;
default: default:
pr_info(MPT3SAS_FMT ioc_info(ioc, "Dell HBA: Subsystem ID: 0x%X\n",
"Dell HBA: Subsystem ID: 0x%X\n", ioc->name, ioc->pdev->subsystem_device);
ioc->pdev->subsystem_device);
break; break;
} }
break; break;
...@@ -3695,46 +3668,42 @@ _base_display_OEMs_branding(struct MPT3SAS_ADAPTER *ioc) ...@@ -3695,46 +3668,42 @@ _base_display_OEMs_branding(struct MPT3SAS_ADAPTER *ioc)
case MPI25_MFGPAGE_DEVID_SAS3008: case MPI25_MFGPAGE_DEVID_SAS3008:
switch (ioc->pdev->subsystem_device) { switch (ioc->pdev->subsystem_device) {
case MPT3SAS_CISCO_12G_8E_HBA_SSDID: case MPT3SAS_CISCO_12G_8E_HBA_SSDID:
pr_info(MPT3SAS_FMT "%s\n", ioc->name, ioc_info(ioc, "%s\n",
MPT3SAS_CISCO_12G_8E_HBA_BRANDING); MPT3SAS_CISCO_12G_8E_HBA_BRANDING);
break; break;
case MPT3SAS_CISCO_12G_8I_HBA_SSDID: case MPT3SAS_CISCO_12G_8I_HBA_SSDID:
pr_info(MPT3SAS_FMT "%s\n", ioc->name, ioc_info(ioc, "%s\n",
MPT3SAS_CISCO_12G_8I_HBA_BRANDING); MPT3SAS_CISCO_12G_8I_HBA_BRANDING);
break; break;
case MPT3SAS_CISCO_12G_AVILA_HBA_SSDID: case MPT3SAS_CISCO_12G_AVILA_HBA_SSDID:
pr_info(MPT3SAS_FMT "%s\n", ioc->name, ioc_info(ioc, "%s\n",
MPT3SAS_CISCO_12G_AVILA_HBA_BRANDING); MPT3SAS_CISCO_12G_AVILA_HBA_BRANDING);
break; break;
default: default:
pr_info(MPT3SAS_FMT ioc_info(ioc, "Cisco 12Gbps SAS HBA: Subsystem ID: 0x%X\n",
"Cisco 12Gbps SAS HBA: Subsystem ID: 0x%X\n", ioc->pdev->subsystem_device);
ioc->name, ioc->pdev->subsystem_device);
break; break;
} }
break; break;
case MPI25_MFGPAGE_DEVID_SAS3108_1: case MPI25_MFGPAGE_DEVID_SAS3108_1:
switch (ioc->pdev->subsystem_device) { switch (ioc->pdev->subsystem_device) {
case MPT3SAS_CISCO_12G_AVILA_HBA_SSDID: case MPT3SAS_CISCO_12G_AVILA_HBA_SSDID:
pr_info(MPT3SAS_FMT "%s\n", ioc->name, ioc_info(ioc, "%s\n",
MPT3SAS_CISCO_12G_AVILA_HBA_BRANDING); MPT3SAS_CISCO_12G_AVILA_HBA_BRANDING);
break; break;
case MPT3SAS_CISCO_12G_COLUSA_MEZZANINE_HBA_SSDID: case MPT3SAS_CISCO_12G_COLUSA_MEZZANINE_HBA_SSDID:
pr_info(MPT3SAS_FMT "%s\n", ioc->name, ioc_info(ioc, "%s\n",
MPT3SAS_CISCO_12G_COLUSA_MEZZANINE_HBA_BRANDING MPT3SAS_CISCO_12G_COLUSA_MEZZANINE_HBA_BRANDING);
);
break; break;
default: default:
pr_info(MPT3SAS_FMT ioc_info(ioc, "Cisco 12Gbps SAS HBA: Subsystem ID: 0x%X\n",
"Cisco 12Gbps SAS HBA: Subsystem ID: 0x%X\n", ioc->pdev->subsystem_device);
ioc->name, ioc->pdev->subsystem_device);
break; break;
} }
break; break;
default: default:
pr_info(MPT3SAS_FMT ioc_info(ioc, "Cisco SAS HBA: Subsystem ID: 0x%X\n",
"Cisco SAS HBA: Subsystem ID: 0x%X\n", ioc->pdev->subsystem_device);
ioc->name, ioc->pdev->subsystem_device);
break; break;
} }
break; break;
...@@ -3743,43 +3712,40 @@ _base_display_OEMs_branding(struct MPT3SAS_ADAPTER *ioc) ...@@ -3743,43 +3712,40 @@ _base_display_OEMs_branding(struct MPT3SAS_ADAPTER *ioc)
case MPI2_MFGPAGE_DEVID_SAS2004: case MPI2_MFGPAGE_DEVID_SAS2004:
switch (ioc->pdev->subsystem_device) { switch (ioc->pdev->subsystem_device) {
case MPT2SAS_HP_DAUGHTER_2_4_INTERNAL_SSDID: case MPT2SAS_HP_DAUGHTER_2_4_INTERNAL_SSDID:
pr_info(MPT3SAS_FMT "%s\n", ioc->name, ioc_info(ioc, "%s\n",
MPT2SAS_HP_DAUGHTER_2_4_INTERNAL_BRANDING); MPT2SAS_HP_DAUGHTER_2_4_INTERNAL_BRANDING);
break; break;
default: default:
pr_info(MPT3SAS_FMT ioc_info(ioc, "HP 6Gbps SAS HBA: Subsystem ID: 0x%X\n",
"HP 6Gbps SAS HBA: Subsystem ID: 0x%X\n", ioc->pdev->subsystem_device);
ioc->name, ioc->pdev->subsystem_device);
break; break;
} }
case MPI2_MFGPAGE_DEVID_SAS2308_2: case MPI2_MFGPAGE_DEVID_SAS2308_2:
switch (ioc->pdev->subsystem_device) { switch (ioc->pdev->subsystem_device) {
case MPT2SAS_HP_2_4_INTERNAL_SSDID: case MPT2SAS_HP_2_4_INTERNAL_SSDID:
pr_info(MPT3SAS_FMT "%s\n", ioc->name, ioc_info(ioc, "%s\n",
MPT2SAS_HP_2_4_INTERNAL_BRANDING); MPT2SAS_HP_2_4_INTERNAL_BRANDING);
break; break;
case MPT2SAS_HP_2_4_EXTERNAL_SSDID: case MPT2SAS_HP_2_4_EXTERNAL_SSDID:
pr_info(MPT3SAS_FMT "%s\n", ioc->name, ioc_info(ioc, "%s\n",
MPT2SAS_HP_2_4_EXTERNAL_BRANDING); MPT2SAS_HP_2_4_EXTERNAL_BRANDING);
break; break;
case MPT2SAS_HP_1_4_INTERNAL_1_4_EXTERNAL_SSDID: case MPT2SAS_HP_1_4_INTERNAL_1_4_EXTERNAL_SSDID:
pr_info(MPT3SAS_FMT "%s\n", ioc->name, ioc_info(ioc, "%s\n",
MPT2SAS_HP_1_4_INTERNAL_1_4_EXTERNAL_BRANDING); MPT2SAS_HP_1_4_INTERNAL_1_4_EXTERNAL_BRANDING);
break; break;
case MPT2SAS_HP_EMBEDDED_2_4_INTERNAL_SSDID: case MPT2SAS_HP_EMBEDDED_2_4_INTERNAL_SSDID:
pr_info(MPT3SAS_FMT "%s\n", ioc->name, ioc_info(ioc, "%s\n",
MPT2SAS_HP_EMBEDDED_2_4_INTERNAL_BRANDING); MPT2SAS_HP_EMBEDDED_2_4_INTERNAL_BRANDING);
break; break;
default: default:
pr_info(MPT3SAS_FMT ioc_info(ioc, "HP 6Gbps SAS HBA: Subsystem ID: 0x%X\n",
"HP 6Gbps SAS HBA: Subsystem ID: 0x%X\n", ioc->pdev->subsystem_device);
ioc->name, ioc->pdev->subsystem_device);
break; break;
} }
default: default:
pr_info(MPT3SAS_FMT ioc_info(ioc, "HP SAS HBA: Subsystem ID: 0x%X\n",
"HP SAS HBA: Subsystem ID: 0x%X\n", ioc->pdev->subsystem_device);
ioc->name, ioc->pdev->subsystem_device);
break; break;
} }
default: default:
...@@ -3806,12 +3772,10 @@ _base_display_fwpkg_version(struct MPT3SAS_ADAPTER *ioc) ...@@ -3806,12 +3772,10 @@ _base_display_fwpkg_version(struct MPT3SAS_ADAPTER *ioc)
u16 smid, ioc_status; u16 smid, ioc_status;
size_t data_length; size_t data_length;
dinitprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name, dinitprintk(ioc, ioc_info(ioc, "%s\n", __func__));
__func__));
if (ioc->base_cmds.status & MPT3_CMD_PENDING) { if (ioc->base_cmds.status & MPT3_CMD_PENDING) {
pr_err(MPT3SAS_FMT "%s: internal command already in use\n", ioc_err(ioc, "%s: internal command already in use\n", __func__);
ioc->name, __func__);
return -EAGAIN; return -EAGAIN;
} }
...@@ -3819,15 +3783,14 @@ _base_display_fwpkg_version(struct MPT3SAS_ADAPTER *ioc) ...@@ -3819,15 +3783,14 @@ _base_display_fwpkg_version(struct MPT3SAS_ADAPTER *ioc)
fwpkg_data = pci_alloc_consistent(ioc->pdev, data_length, fwpkg_data = pci_alloc_consistent(ioc->pdev, data_length,
&fwpkg_data_dma); &fwpkg_data_dma);
if (!fwpkg_data) { if (!fwpkg_data) {
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 -ENOMEM; return -ENOMEM;
} }
smid = mpt3sas_base_get_smid(ioc, ioc->base_cb_idx); smid = mpt3sas_base_get_smid(ioc, ioc->base_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__);
r = -EAGAIN; r = -EAGAIN;
goto out; goto out;
} }
...@@ -3846,11 +3809,9 @@ _base_display_fwpkg_version(struct MPT3SAS_ADAPTER *ioc) ...@@ -3846,11 +3809,9 @@ _base_display_fwpkg_version(struct MPT3SAS_ADAPTER *ioc)
/* Wait for 15 seconds */ /* Wait for 15 seconds */
wait_for_completion_timeout(&ioc->base_cmds.done, wait_for_completion_timeout(&ioc->base_cmds.done,
FW_IMG_HDR_READ_TIMEOUT*HZ); FW_IMG_HDR_READ_TIMEOUT*HZ);
pr_info(MPT3SAS_FMT "%s: complete\n", ioc_info(ioc, "%s: complete\n", __func__);
ioc->name, __func__);
if (!(ioc->base_cmds.status & MPT3_CMD_COMPLETE)) { if (!(ioc->base_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(Mpi25FWUploadRequest_t)/4); sizeof(Mpi25FWUploadRequest_t)/4);
r = -ETIME; r = -ETIME;
...@@ -3864,13 +3825,11 @@ _base_display_fwpkg_version(struct MPT3SAS_ADAPTER *ioc) ...@@ -3864,13 +3825,11 @@ _base_display_fwpkg_version(struct MPT3SAS_ADAPTER *ioc)
if (ioc_status == MPI2_IOCSTATUS_SUCCESS) { if (ioc_status == MPI2_IOCSTATUS_SUCCESS) {
FWImgHdr = (Mpi2FWImageHeader_t *)fwpkg_data; FWImgHdr = (Mpi2FWImageHeader_t *)fwpkg_data;
if (FWImgHdr->PackageVersion.Word) { if (FWImgHdr->PackageVersion.Word) {
pr_info(MPT3SAS_FMT "FW Package Version" ioc_info(ioc, "FW Package Version (%02d.%02d.%02d.%02d)\n",
"(%02d.%02d.%02d.%02d)\n", FWImgHdr->PackageVersion.Struct.Major,
ioc->name, FWImgHdr->PackageVersion.Struct.Minor,
FWImgHdr->PackageVersion.Struct.Major, FWImgHdr->PackageVersion.Struct.Unit,
FWImgHdr->PackageVersion.Struct.Minor, FWImgHdr->PackageVersion.Struct.Dev);
FWImgHdr->PackageVersion.Struct.Unit,
FWImgHdr->PackageVersion.Struct.Dev);
} }
} else { } else {
_debug_dump_mf(&mpi_reply, _debug_dump_mf(&mpi_reply,
...@@ -3900,18 +3859,17 @@ _base_display_ioc_capabilities(struct MPT3SAS_ADAPTER *ioc) ...@@ -3900,18 +3859,17 @@ _base_display_ioc_capabilities(struct MPT3SAS_ADAPTER *ioc)
bios_version = le32_to_cpu(ioc->bios_pg3.BiosVersion); bios_version = le32_to_cpu(ioc->bios_pg3.BiosVersion);
strncpy(desc, ioc->manu_pg0.ChipName, 16); strncpy(desc, ioc->manu_pg0.ChipName, 16);
pr_info(MPT3SAS_FMT "%s: FWVersion(%02d.%02d.%02d.%02d), "\ ioc_info(ioc, "%s: FWVersion(%02d.%02d.%02d.%02d), ChipRevision(0x%02x), BiosVersion(%02d.%02d.%02d.%02d)\n",
"ChipRevision(0x%02x), BiosVersion(%02d.%02d.%02d.%02d)\n", desc,
ioc->name, desc, (ioc->facts.FWVersion.Word & 0xFF000000) >> 24,
(ioc->facts.FWVersion.Word & 0xFF000000) >> 24, (ioc->facts.FWVersion.Word & 0x00FF0000) >> 16,
(ioc->facts.FWVersion.Word & 0x00FF0000) >> 16, (ioc->facts.FWVersion.Word & 0x0000FF00) >> 8,
(ioc->facts.FWVersion.Word & 0x0000FF00) >> 8, ioc->facts.FWVersion.Word & 0x000000FF,
ioc->facts.FWVersion.Word & 0x000000FF, ioc->pdev->revision,
ioc->pdev->revision, (bios_version & 0xFF000000) >> 24,
(bios_version & 0xFF000000) >> 24, (bios_version & 0x00FF0000) >> 16,
(bios_version & 0x00FF0000) >> 16, (bios_version & 0x0000FF00) >> 8,
(bios_version & 0x0000FF00) >> 8, bios_version & 0x000000FF);
bios_version & 0x000000FF);
_base_display_OEMs_branding(ioc); _base_display_OEMs_branding(ioc);
...@@ -3920,82 +3878,81 @@ _base_display_ioc_capabilities(struct MPT3SAS_ADAPTER *ioc) ...@@ -3920,82 +3878,81 @@ _base_display_ioc_capabilities(struct MPT3SAS_ADAPTER *ioc)
i++; i++;
} }
pr_info(MPT3SAS_FMT "Protocol=(", ioc->name); ioc_info(ioc, "Protocol=(");
if (ioc->facts.ProtocolFlags & MPI2_IOCFACTS_PROTOCOL_SCSI_INITIATOR) { if (ioc->facts.ProtocolFlags & MPI2_IOCFACTS_PROTOCOL_SCSI_INITIATOR) {
pr_info("Initiator"); pr_cont("Initiator");
i++; i++;
} }
if (ioc->facts.ProtocolFlags & MPI2_IOCFACTS_PROTOCOL_SCSI_TARGET) { if (ioc->facts.ProtocolFlags & MPI2_IOCFACTS_PROTOCOL_SCSI_TARGET) {
pr_info("%sTarget", i ? "," : ""); pr_cont("%sTarget", i ? "," : "");
i++; i++;
} }
i = 0; i = 0;
pr_info("), "); pr_cont("), Capabilities=(");
pr_info("Capabilities=(");
if (!ioc->hide_ir_msg) { if (!ioc->hide_ir_msg) {
if (ioc->facts.IOCCapabilities & if (ioc->facts.IOCCapabilities &
MPI2_IOCFACTS_CAPABILITY_INTEGRATED_RAID) { MPI2_IOCFACTS_CAPABILITY_INTEGRATED_RAID) {
pr_info("Raid"); pr_cont("Raid");
i++; i++;
} }
} }
if (ioc->facts.IOCCapabilities & MPI2_IOCFACTS_CAPABILITY_TLR) { if (ioc->facts.IOCCapabilities & MPI2_IOCFACTS_CAPABILITY_TLR) {
pr_info("%sTLR", i ? "," : ""); pr_cont("%sTLR", i ? "," : "");
i++; i++;
} }
if (ioc->facts.IOCCapabilities & MPI2_IOCFACTS_CAPABILITY_MULTICAST) { if (ioc->facts.IOCCapabilities & MPI2_IOCFACTS_CAPABILITY_MULTICAST) {
pr_info("%sMulticast", i ? "," : ""); pr_cont("%sMulticast", i ? "," : "");
i++; i++;
} }
if (ioc->facts.IOCCapabilities & if (ioc->facts.IOCCapabilities &
MPI2_IOCFACTS_CAPABILITY_BIDIRECTIONAL_TARGET) { MPI2_IOCFACTS_CAPABILITY_BIDIRECTIONAL_TARGET) {
pr_info("%sBIDI Target", i ? "," : ""); pr_cont("%sBIDI Target", i ? "," : "");
i++; i++;
} }
if (ioc->facts.IOCCapabilities & MPI2_IOCFACTS_CAPABILITY_EEDP) { if (ioc->facts.IOCCapabilities & MPI2_IOCFACTS_CAPABILITY_EEDP) {
pr_info("%sEEDP", i ? "," : ""); pr_cont("%sEEDP", i ? "," : "");
i++; i++;
} }
if (ioc->facts.IOCCapabilities & if (ioc->facts.IOCCapabilities &
MPI2_IOCFACTS_CAPABILITY_SNAPSHOT_BUFFER) { MPI2_IOCFACTS_CAPABILITY_SNAPSHOT_BUFFER) {
pr_info("%sSnapshot Buffer", i ? "," : ""); pr_cont("%sSnapshot Buffer", i ? "," : "");
i++; i++;
} }
if (ioc->facts.IOCCapabilities & if (ioc->facts.IOCCapabilities &
MPI2_IOCFACTS_CAPABILITY_DIAG_TRACE_BUFFER) { MPI2_IOCFACTS_CAPABILITY_DIAG_TRACE_BUFFER) {
pr_info("%sDiag Trace Buffer", i ? "," : ""); pr_cont("%sDiag Trace Buffer", i ? "," : "");
i++; i++;
} }
if (ioc->facts.IOCCapabilities & if (ioc->facts.IOCCapabilities &
MPI2_IOCFACTS_CAPABILITY_EXTENDED_BUFFER) { MPI2_IOCFACTS_CAPABILITY_EXTENDED_BUFFER) {
pr_info("%sDiag Extended Buffer", i ? "," : ""); pr_cont("%sDiag Extended Buffer", i ? "," : "");
i++; i++;
} }
if (ioc->facts.IOCCapabilities & if (ioc->facts.IOCCapabilities &
MPI2_IOCFACTS_CAPABILITY_TASK_SET_FULL_HANDLING) { MPI2_IOCFACTS_CAPABILITY_TASK_SET_FULL_HANDLING) {
pr_info("%sTask Set Full", i ? "," : ""); pr_cont("%sTask Set Full", i ? "," : "");
i++; i++;
} }
iounit_pg1_flags = le32_to_cpu(ioc->iounit_pg1.Flags); iounit_pg1_flags = le32_to_cpu(ioc->iounit_pg1.Flags);
if (!(iounit_pg1_flags & MPI2_IOUNITPAGE1_NATIVE_COMMAND_Q_DISABLE)) { if (!(iounit_pg1_flags & MPI2_IOUNITPAGE1_NATIVE_COMMAND_Q_DISABLE)) {
pr_info("%sNCQ", i ? "," : ""); pr_cont("%sNCQ", i ? "," : "");
i++; i++;
} }
pr_info(")\n"); pr_cont(")\n");
} }
/** /**
...@@ -4028,21 +3985,21 @@ mpt3sas_base_update_missing_delay(struct MPT3SAS_ADAPTER *ioc, ...@@ -4028,21 +3985,21 @@ mpt3sas_base_update_missing_delay(struct MPT3SAS_ADAPTER *ioc,
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__);
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__);
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__);
goto out; goto out;
} }
...@@ -4074,11 +4031,11 @@ mpt3sas_base_update_missing_delay(struct MPT3SAS_ADAPTER *ioc, ...@@ -4074,11 +4031,11 @@ mpt3sas_base_update_missing_delay(struct MPT3SAS_ADAPTER *ioc,
else else
dmd_new = dmd_new =
dmd & MPI2_SASIOUNIT1_REPORT_MISSING_TIMEOUT_MASK; dmd & MPI2_SASIOUNIT1_REPORT_MISSING_TIMEOUT_MASK;
pr_info(MPT3SAS_FMT "device_missing_delay: old(%d), new(%d)\n", ioc_info(ioc, "device_missing_delay: old(%d), new(%d)\n",
ioc->name, dmd_orignal, dmd_new); dmd_orignal, dmd_new);
pr_info(MPT3SAS_FMT "ioc_missing_delay: old(%d), new(%d)\n", ioc_info(ioc, "ioc_missing_delay: old(%d), new(%d)\n",
ioc->name, io_missing_delay_original, io_missing_delay_original,
io_missing_delay); io_missing_delay);
ioc->device_missing_delay = dmd_new; ioc->device_missing_delay = dmd_new;
ioc->io_missing_delay = io_missing_delay; ioc->io_missing_delay = io_missing_delay;
} }
...@@ -4189,33 +4146,32 @@ _base_release_memory_pools(struct MPT3SAS_ADAPTER *ioc) ...@@ -4189,33 +4146,32 @@ _base_release_memory_pools(struct MPT3SAS_ADAPTER *ioc)
struct chain_tracker *ct; struct chain_tracker *ct;
struct reply_post_struct *rps; struct reply_post_struct *rps;
dexitprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name, dexitprintk(ioc, ioc_info(ioc, "%s\n", __func__));
__func__));
if (ioc->request) { if (ioc->request) {
pci_free_consistent(ioc->pdev, ioc->request_dma_sz, pci_free_consistent(ioc->pdev, ioc->request_dma_sz,
ioc->request, ioc->request_dma); ioc->request, ioc->request_dma);
dexitprintk(ioc, pr_info(MPT3SAS_FMT dexitprintk(ioc,
"request_pool(0x%p): free\n", ioc_info(ioc, "request_pool(0x%p): free\n",
ioc->name, ioc->request)); ioc->request));
ioc->request = NULL; ioc->request = NULL;
} }
if (ioc->sense) { if (ioc->sense) {
dma_pool_free(ioc->sense_dma_pool, ioc->sense, ioc->sense_dma); dma_pool_free(ioc->sense_dma_pool, ioc->sense, ioc->sense_dma);
dma_pool_destroy(ioc->sense_dma_pool); dma_pool_destroy(ioc->sense_dma_pool);
dexitprintk(ioc, pr_info(MPT3SAS_FMT dexitprintk(ioc,
"sense_pool(0x%p): free\n", ioc_info(ioc, "sense_pool(0x%p): free\n",
ioc->name, ioc->sense)); ioc->sense));
ioc->sense = NULL; ioc->sense = NULL;
} }
if (ioc->reply) { if (ioc->reply) {
dma_pool_free(ioc->reply_dma_pool, ioc->reply, ioc->reply_dma); dma_pool_free(ioc->reply_dma_pool, ioc->reply, ioc->reply_dma);
dma_pool_destroy(ioc->reply_dma_pool); dma_pool_destroy(ioc->reply_dma_pool);
dexitprintk(ioc, pr_info(MPT3SAS_FMT dexitprintk(ioc,
"reply_pool(0x%p): free\n", ioc_info(ioc, "reply_pool(0x%p): free\n",
ioc->name, ioc->reply)); ioc->reply));
ioc->reply = NULL; ioc->reply = NULL;
} }
...@@ -4223,9 +4179,9 @@ _base_release_memory_pools(struct MPT3SAS_ADAPTER *ioc) ...@@ -4223,9 +4179,9 @@ _base_release_memory_pools(struct MPT3SAS_ADAPTER *ioc)
dma_pool_free(ioc->reply_free_dma_pool, ioc->reply_free, dma_pool_free(ioc->reply_free_dma_pool, ioc->reply_free,
ioc->reply_free_dma); ioc->reply_free_dma);
dma_pool_destroy(ioc->reply_free_dma_pool); dma_pool_destroy(ioc->reply_free_dma_pool);
dexitprintk(ioc, pr_info(MPT3SAS_FMT dexitprintk(ioc,
"reply_free_pool(0x%p): free\n", ioc_info(ioc, "reply_free_pool(0x%p): free\n",
ioc->name, ioc->reply_free)); ioc->reply_free));
ioc->reply_free = NULL; ioc->reply_free = NULL;
} }
...@@ -4237,9 +4193,9 @@ _base_release_memory_pools(struct MPT3SAS_ADAPTER *ioc) ...@@ -4237,9 +4193,9 @@ _base_release_memory_pools(struct MPT3SAS_ADAPTER *ioc)
ioc->reply_post_free_dma_pool, ioc->reply_post_free_dma_pool,
rps->reply_post_free, rps->reply_post_free,
rps->reply_post_free_dma); rps->reply_post_free_dma);
dexitprintk(ioc, pr_info(MPT3SAS_FMT dexitprintk(ioc,
"reply_post_free_pool(0x%p): free\n", ioc_info(ioc, "reply_post_free_pool(0x%p): free\n",
ioc->name, rps->reply_post_free)); rps->reply_post_free));
rps->reply_post_free = NULL; rps->reply_post_free = NULL;
} }
} while (ioc->rdpq_array_enable && } while (ioc->rdpq_array_enable &&
...@@ -4267,9 +4223,9 @@ _base_release_memory_pools(struct MPT3SAS_ADAPTER *ioc) ...@@ -4267,9 +4223,9 @@ _base_release_memory_pools(struct MPT3SAS_ADAPTER *ioc)
} }
if (ioc->config_page) { if (ioc->config_page) {
dexitprintk(ioc, pr_info(MPT3SAS_FMT dexitprintk(ioc,
"config_page(0x%p): free\n", ioc->name, ioc_info(ioc, "config_page(0x%p): free\n",
ioc->config_page)); ioc->config_page));
pci_free_consistent(ioc->pdev, ioc->config_page_sz, pci_free_consistent(ioc->pdev, ioc->config_page_sz,
ioc->config_page, ioc->config_page_dma); ioc->config_page, ioc->config_page_dma);
} }
...@@ -4338,8 +4294,7 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) ...@@ -4338,8 +4294,7 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc)
int i, j; int i, j;
struct chain_tracker *ct; struct chain_tracker *ct;
dinitprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name, dinitprintk(ioc, ioc_info(ioc, "%s\n", __func__));
__func__));
retry_sz = 0; retry_sz = 0;
...@@ -4368,10 +4323,8 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) ...@@ -4368,10 +4323,8 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc)
else if (sg_tablesize > MPT_MAX_PHYS_SEGMENTS) { else if (sg_tablesize > MPT_MAX_PHYS_SEGMENTS) {
sg_tablesize = min_t(unsigned short, sg_tablesize, sg_tablesize = min_t(unsigned short, sg_tablesize,
SG_MAX_SEGMENTS); SG_MAX_SEGMENTS);
pr_warn(MPT3SAS_FMT ioc_warn(ioc, "sg_tablesize(%u) is bigger than kernel defined SG_CHUNK_SIZE(%u)\n",
"sg_tablesize(%u) is bigger than kernel " sg_tablesize, MPT_MAX_PHYS_SEGMENTS);
"defined SG_CHUNK_SIZE(%u)\n", ioc->name,
sg_tablesize, MPT_MAX_PHYS_SEGMENTS);
} }
ioc->shost->sg_tablesize = sg_tablesize; ioc->shost->sg_tablesize = sg_tablesize;
} }
...@@ -4381,9 +4334,8 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) ...@@ -4381,9 +4334,8 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc)
if (ioc->internal_depth < INTERNAL_CMDS_COUNT) { if (ioc->internal_depth < INTERNAL_CMDS_COUNT) {
if (facts->RequestCredit <= (INTERNAL_CMDS_COUNT + if (facts->RequestCredit <= (INTERNAL_CMDS_COUNT +
INTERNAL_SCSIIO_CMDS_COUNT)) { INTERNAL_SCSIIO_CMDS_COUNT)) {
pr_err(MPT3SAS_FMT "IOC doesn't have enough Request \ ioc_err(ioc, "IOC doesn't have enough Request Credits, it has just %d number of credits\n",
Credits, it has just %d number of credits\n", facts->RequestCredit);
ioc->name, facts->RequestCredit);
return -ENOMEM; return -ENOMEM;
} }
ioc->internal_depth = 10; ioc->internal_depth = 10;
...@@ -4482,11 +4434,12 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) ...@@ -4482,11 +4434,12 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc)
ioc->reply_free_queue_depth = ioc->hba_queue_depth + 64; ioc->reply_free_queue_depth = ioc->hba_queue_depth + 64;
} }
dinitprintk(ioc, pr_info(MPT3SAS_FMT "scatter gather: " \ dinitprintk(ioc,
"sge_in_main_msg(%d), sge_per_chain(%d), sge_per_io(%d), " ioc_info(ioc, "scatter gather: sge_in_main_msg(%d), sge_per_chain(%d), sge_per_io(%d), chains_per_io(%d)\n",
"chains_per_io(%d)\n", ioc->name, ioc->max_sges_in_main_message, ioc->max_sges_in_main_message,
ioc->max_sges_in_chain_message, ioc->shost->sg_tablesize, ioc->max_sges_in_chain_message,
ioc->chains_needed_per_io)); ioc->shost->sg_tablesize,
ioc->chains_needed_per_io));
/* reply post queue, 16 byte align */ /* reply post queue, 16 byte align */
reply_post_free_sz = ioc->reply_post_queue_depth * reply_post_free_sz = ioc->reply_post_queue_depth *
...@@ -4501,16 +4454,13 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) ...@@ -4501,16 +4454,13 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc)
sizeof(struct reply_post_struct), GFP_KERNEL); sizeof(struct reply_post_struct), GFP_KERNEL);
if (!ioc->reply_post) { if (!ioc->reply_post) {
pr_err(MPT3SAS_FMT "reply_post_free pool: kcalloc failed\n", ioc_err(ioc, "reply_post_free pool: kcalloc failed\n");
ioc->name);
goto out; goto out;
} }
ioc->reply_post_free_dma_pool = dma_pool_create("reply_post_free pool", ioc->reply_post_free_dma_pool = dma_pool_create("reply_post_free pool",
&ioc->pdev->dev, sz, 16, 0); &ioc->pdev->dev, sz, 16, 0);
if (!ioc->reply_post_free_dma_pool) { if (!ioc->reply_post_free_dma_pool) {
pr_err(MPT3SAS_FMT ioc_err(ioc, "reply_post_free pool: dma_pool_create failed\n");
"reply_post_free pool: dma_pool_create failed\n",
ioc->name);
goto out; goto out;
} }
i = 0; i = 0;
...@@ -4520,29 +4470,25 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) ...@@ -4520,29 +4470,25 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc)
GFP_KERNEL, GFP_KERNEL,
&ioc->reply_post[i].reply_post_free_dma); &ioc->reply_post[i].reply_post_free_dma);
if (!ioc->reply_post[i].reply_post_free) { if (!ioc->reply_post[i].reply_post_free) {
pr_err(MPT3SAS_FMT ioc_err(ioc, "reply_post_free pool: dma_pool_alloc failed\n");
"reply_post_free pool: dma_pool_alloc failed\n",
ioc->name);
goto out; goto out;
} }
memset(ioc->reply_post[i].reply_post_free, 0, sz); memset(ioc->reply_post[i].reply_post_free, 0, sz);
dinitprintk(ioc, pr_info(MPT3SAS_FMT dinitprintk(ioc,
"reply post free pool (0x%p): depth(%d)," ioc_info(ioc, "reply post free pool (0x%p): depth(%d), element_size(%d), pool_size(%d kB)\n",
"element_size(%d), pool_size(%d kB)\n", ioc->name, ioc->reply_post[i].reply_post_free,
ioc->reply_post[i].reply_post_free, ioc->reply_post_queue_depth,
ioc->reply_post_queue_depth, 8, sz/1024)); 8, sz / 1024));
dinitprintk(ioc, pr_info(MPT3SAS_FMT dinitprintk(ioc,
"reply_post_free_dma = (0x%llx)\n", ioc->name, ioc_info(ioc, "reply_post_free_dma = (0x%llx)\n",
(unsigned long long) (u64)ioc->reply_post[i].reply_post_free_dma));
ioc->reply_post[i].reply_post_free_dma));
total_sz += sz; total_sz += sz;
} while (ioc->rdpq_array_enable && (++i < ioc->reply_queue_count)); } while (ioc->rdpq_array_enable && (++i < ioc->reply_queue_count));
if (ioc->dma_mask == 64) { if (ioc->dma_mask == 64) {
if (_base_change_consistent_dma_mask(ioc, ioc->pdev) != 0) { if (_base_change_consistent_dma_mask(ioc, ioc->pdev) != 0) {
pr_warn(MPT3SAS_FMT ioc_warn(ioc, "no suitable consistent DMA mask for %s\n",
"no suitable consistent DMA mask for %s\n", pci_name(ioc->pdev));
ioc->name, pci_name(ioc->pdev));
goto out; goto out;
} }
} }
...@@ -4554,9 +4500,9 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) ...@@ -4554,9 +4500,9 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc)
* with some internal commands that could be outstanding * with some internal commands that could be outstanding
*/ */
ioc->shost->can_queue = ioc->scsiio_depth - INTERNAL_SCSIIO_CMDS_COUNT; ioc->shost->can_queue = ioc->scsiio_depth - INTERNAL_SCSIIO_CMDS_COUNT;
dinitprintk(ioc, pr_info(MPT3SAS_FMT dinitprintk(ioc,
"scsi host: can_queue depth (%d)\n", ioc_info(ioc, "scsi host: can_queue depth (%d)\n",
ioc->name, ioc->shost->can_queue)); ioc->shost->can_queue));
/* contiguous pool for request and chains, 16 byte align, one extra " /* contiguous pool for request and chains, 16 byte align, one extra "
...@@ -4574,10 +4520,9 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) ...@@ -4574,10 +4520,9 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc)
ioc->request_dma_sz = sz; ioc->request_dma_sz = sz;
ioc->request = pci_alloc_consistent(ioc->pdev, sz, &ioc->request_dma); ioc->request = pci_alloc_consistent(ioc->pdev, sz, &ioc->request_dma);
if (!ioc->request) { if (!ioc->request) {
pr_err(MPT3SAS_FMT "request pool: pci_alloc_consistent " \ ioc_err(ioc, "request pool: pci_alloc_consistent failed: hba_depth(%d), chains_per_io(%d), frame_sz(%d), total(%d kB)\n",
"failed: hba_depth(%d), chains_per_io(%d), frame_sz(%d), " ioc->hba_queue_depth, ioc->chains_needed_per_io,
"total(%d kB)\n", ioc->name, ioc->hba_queue_depth, ioc->request_sz, sz / 1024);
ioc->chains_needed_per_io, ioc->request_sz, sz/1024);
if (ioc->scsiio_depth < MPT3SAS_SAS_QUEUE_DEPTH) if (ioc->scsiio_depth < MPT3SAS_SAS_QUEUE_DEPTH)
goto out; goto out;
retry_sz = 64; retry_sz = 64;
...@@ -4587,10 +4532,9 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) ...@@ -4587,10 +4532,9 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc)
} }
if (retry_sz) if (retry_sz)
pr_err(MPT3SAS_FMT "request pool: pci_alloc_consistent " \ ioc_err(ioc, "request pool: pci_alloc_consistent succeed: hba_depth(%d), chains_per_io(%d), frame_sz(%d), total(%d kb)\n",
"succeed: hba_depth(%d), chains_per_io(%d), frame_sz(%d), " ioc->hba_queue_depth, ioc->chains_needed_per_io,
"total(%d kb)\n", ioc->name, ioc->hba_queue_depth, ioc->request_sz, sz / 1024);
ioc->chains_needed_per_io, ioc->request_sz, sz/1024);
/* hi-priority queue */ /* hi-priority queue */
ioc->hi_priority = ioc->request + ((ioc->scsiio_depth + 1) * ioc->hi_priority = ioc->request + ((ioc->scsiio_depth + 1) *
...@@ -4604,24 +4548,26 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) ...@@ -4604,24 +4548,26 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc)
ioc->internal_dma = ioc->hi_priority_dma + (ioc->hi_priority_depth * ioc->internal_dma = ioc->hi_priority_dma + (ioc->hi_priority_depth *
ioc->request_sz); ioc->request_sz);
dinitprintk(ioc, pr_info(MPT3SAS_FMT dinitprintk(ioc,
"request pool(0x%p): depth(%d), frame_size(%d), pool_size(%d kB)\n", ioc_info(ioc, "request pool(0x%p): depth(%d), frame_size(%d), pool_size(%d kB)\n",
ioc->name, ioc->request, ioc->hba_queue_depth, ioc->request_sz, ioc->request, ioc->hba_queue_depth,
(ioc->hba_queue_depth * ioc->request_sz)/1024)); ioc->request_sz,
(ioc->hba_queue_depth * ioc->request_sz) / 1024));
dinitprintk(ioc, pr_info(MPT3SAS_FMT "request pool: dma(0x%llx)\n", dinitprintk(ioc,
ioc->name, (unsigned long long) ioc->request_dma)); ioc_info(ioc, "request pool: dma(0x%llx)\n",
(unsigned long long)ioc->request_dma));
total_sz += sz; total_sz += sz;
dinitprintk(ioc, pr_info(MPT3SAS_FMT "scsiio(0x%p): depth(%d)\n", dinitprintk(ioc,
ioc->name, ioc->request, ioc->scsiio_depth)); ioc_info(ioc, "scsiio(0x%p): depth(%d)\n",
ioc->request, ioc->scsiio_depth));
ioc->chain_depth = min_t(u32, ioc->chain_depth, MAX_CHAIN_DEPTH); ioc->chain_depth = min_t(u32, ioc->chain_depth, MAX_CHAIN_DEPTH);
sz = ioc->scsiio_depth * sizeof(struct chain_lookup); sz = ioc->scsiio_depth * sizeof(struct chain_lookup);
ioc->chain_lookup = kzalloc(sz, GFP_KERNEL); ioc->chain_lookup = kzalloc(sz, GFP_KERNEL);
if (!ioc->chain_lookup) { if (!ioc->chain_lookup) {
pr_err(MPT3SAS_FMT "chain_lookup: __get_free_pages " ioc_err(ioc, "chain_lookup: __get_free_pages failed\n");
"failed\n", ioc->name);
goto out; goto out;
} }
...@@ -4629,8 +4575,7 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) ...@@ -4629,8 +4575,7 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc)
for (i = 0; i < ioc->scsiio_depth; i++) { for (i = 0; i < ioc->scsiio_depth; i++) {
ioc->chain_lookup[i].chains_per_smid = kzalloc(sz, GFP_KERNEL); ioc->chain_lookup[i].chains_per_smid = kzalloc(sz, GFP_KERNEL);
if (!ioc->chain_lookup[i].chains_per_smid) { if (!ioc->chain_lookup[i].chains_per_smid) {
pr_err(MPT3SAS_FMT "chain_lookup: " ioc_err(ioc, "chain_lookup: kzalloc failed\n");
" kzalloc failed\n", ioc->name);
goto out; goto out;
} }
} }
...@@ -4639,29 +4584,27 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) ...@@ -4639,29 +4584,27 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc)
ioc->hpr_lookup = kcalloc(ioc->hi_priority_depth, ioc->hpr_lookup = kcalloc(ioc->hi_priority_depth,
sizeof(struct request_tracker), GFP_KERNEL); sizeof(struct request_tracker), GFP_KERNEL);
if (!ioc->hpr_lookup) { if (!ioc->hpr_lookup) {
pr_err(MPT3SAS_FMT "hpr_lookup: kcalloc failed\n", ioc_err(ioc, "hpr_lookup: kcalloc failed\n");
ioc->name);
goto out; goto out;
} }
ioc->hi_priority_smid = ioc->scsiio_depth + 1; ioc->hi_priority_smid = ioc->scsiio_depth + 1;
dinitprintk(ioc, pr_info(MPT3SAS_FMT dinitprintk(ioc,
"hi_priority(0x%p): depth(%d), start smid(%d)\n", ioc_info(ioc, "hi_priority(0x%p): depth(%d), start smid(%d)\n",
ioc->name, ioc->hi_priority, ioc->hi_priority,
ioc->hi_priority_depth, ioc->hi_priority_smid)); ioc->hi_priority_depth, ioc->hi_priority_smid));
/* initialize internal queue smid's */ /* initialize internal queue smid's */
ioc->internal_lookup = kcalloc(ioc->internal_depth, ioc->internal_lookup = kcalloc(ioc->internal_depth,
sizeof(struct request_tracker), GFP_KERNEL); sizeof(struct request_tracker), GFP_KERNEL);
if (!ioc->internal_lookup) { if (!ioc->internal_lookup) {
pr_err(MPT3SAS_FMT "internal_lookup: kcalloc failed\n", ioc_err(ioc, "internal_lookup: kcalloc failed\n");
ioc->name);
goto out; goto out;
} }
ioc->internal_smid = ioc->hi_priority_smid + ioc->hi_priority_depth; ioc->internal_smid = ioc->hi_priority_smid + ioc->hi_priority_depth;
dinitprintk(ioc, pr_info(MPT3SAS_FMT dinitprintk(ioc,
"internal(0x%p): depth(%d), start smid(%d)\n", ioc_info(ioc, "internal(0x%p): depth(%d), start smid(%d)\n",
ioc->name, ioc->internal, ioc->internal,
ioc->internal_depth, ioc->internal_smid)); ioc->internal_depth, ioc->internal_smid));
/* /*
* The number of NVMe page sized blocks needed is: * The number of NVMe page sized blocks needed is:
* (((sg_tablesize * 8) - 1) / (page_size - 8)) + 1 * (((sg_tablesize * 8) - 1) / (page_size - 8)) + 1
...@@ -4685,17 +4628,14 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) ...@@ -4685,17 +4628,14 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc)
sz = sizeof(struct pcie_sg_list) * ioc->scsiio_depth; sz = sizeof(struct pcie_sg_list) * ioc->scsiio_depth;
ioc->pcie_sg_lookup = kzalloc(sz, GFP_KERNEL); ioc->pcie_sg_lookup = kzalloc(sz, GFP_KERNEL);
if (!ioc->pcie_sg_lookup) { if (!ioc->pcie_sg_lookup) {
pr_info(MPT3SAS_FMT ioc_info(ioc, "PCIe SGL lookup: kzalloc failed\n");
"PCIe SGL lookup: kzalloc failed\n", ioc->name);
goto out; goto out;
} }
sz = nvme_blocks_needed * ioc->page_size; sz = nvme_blocks_needed * ioc->page_size;
ioc->pcie_sgl_dma_pool = ioc->pcie_sgl_dma_pool =
dma_pool_create("PCIe SGL pool", &ioc->pdev->dev, sz, 16, 0); dma_pool_create("PCIe SGL pool", &ioc->pdev->dev, sz, 16, 0);
if (!ioc->pcie_sgl_dma_pool) { if (!ioc->pcie_sgl_dma_pool) {
pr_info(MPT3SAS_FMT ioc_info(ioc, "PCIe SGL pool: dma_pool_create failed\n");
"PCIe SGL pool: dma_pool_create failed\n",
ioc->name);
goto out; goto out;
} }
...@@ -4708,9 +4648,7 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) ...@@ -4708,9 +4648,7 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc)
ioc->pcie_sgl_dma_pool, GFP_KERNEL, ioc->pcie_sgl_dma_pool, GFP_KERNEL,
&ioc->pcie_sg_lookup[i].pcie_sgl_dma); &ioc->pcie_sg_lookup[i].pcie_sgl_dma);
if (!ioc->pcie_sg_lookup[i].pcie_sgl) { if (!ioc->pcie_sg_lookup[i].pcie_sgl) {
pr_info(MPT3SAS_FMT ioc_info(ioc, "PCIe SGL pool: dma_pool_alloc failed\n");
"PCIe SGL pool: dma_pool_alloc failed\n",
ioc->name);
goto out; goto out;
} }
for (j = 0; j < ioc->chains_per_prp_buffer; j++) { for (j = 0; j < ioc->chains_per_prp_buffer; j++) {
...@@ -4724,20 +4662,20 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) ...@@ -4724,20 +4662,20 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc)
} }
} }
dinitprintk(ioc, pr_info(MPT3SAS_FMT "PCIe sgl pool depth(%d), " dinitprintk(ioc,
"element_size(%d), pool_size(%d kB)\n", ioc->name, ioc_info(ioc, "PCIe sgl pool depth(%d), element_size(%d), pool_size(%d kB)\n",
ioc->scsiio_depth, sz, (sz * ioc->scsiio_depth)/1024)); ioc->scsiio_depth, sz,
dinitprintk(ioc, pr_info(MPT3SAS_FMT "Number of chains can " (sz * ioc->scsiio_depth) / 1024));
"fit in a PRP page(%d)\n", ioc->name, dinitprintk(ioc,
ioc->chains_per_prp_buffer)); ioc_info(ioc, "Number of chains can fit in a PRP page(%d)\n",
ioc->chains_per_prp_buffer));
total_sz += sz * ioc->scsiio_depth; total_sz += sz * ioc->scsiio_depth;
} }
ioc->chain_dma_pool = dma_pool_create("chain pool", &ioc->pdev->dev, ioc->chain_dma_pool = dma_pool_create("chain pool", &ioc->pdev->dev,
ioc->chain_segment_sz, 16, 0); ioc->chain_segment_sz, 16, 0);
if (!ioc->chain_dma_pool) { if (!ioc->chain_dma_pool) {
pr_err(MPT3SAS_FMT "chain_dma_pool: dma_pool_create failed\n", ioc_err(ioc, "chain_dma_pool: dma_pool_create failed\n");
ioc->name);
goto out; goto out;
} }
for (i = 0; i < ioc->scsiio_depth; i++) { for (i = 0; i < ioc->scsiio_depth; i++) {
...@@ -4748,8 +4686,7 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) ...@@ -4748,8 +4686,7 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc)
ioc->chain_dma_pool, GFP_KERNEL, ioc->chain_dma_pool, GFP_KERNEL,
&ct->chain_buffer_dma); &ct->chain_buffer_dma);
if (!ct->chain_buffer) { if (!ct->chain_buffer) {
pr_err(MPT3SAS_FMT "chain_lookup: " ioc_err(ioc, "chain_lookup: pci_pool_alloc failed\n");
" pci_pool_alloc failed\n", ioc->name);
_base_release_memory_pools(ioc); _base_release_memory_pools(ioc);
goto out; goto out;
} }
...@@ -4757,25 +4694,23 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) ...@@ -4757,25 +4694,23 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc)
total_sz += ioc->chain_segment_sz; total_sz += ioc->chain_segment_sz;
} }
dinitprintk(ioc, pr_info(MPT3SAS_FMT dinitprintk(ioc,
"chain pool depth(%d), frame_size(%d), pool_size(%d kB)\n", ioc_info(ioc, "chain pool depth(%d), frame_size(%d), pool_size(%d kB)\n",
ioc->name, ioc->chain_depth, ioc->chain_segment_sz, ioc->chain_depth, ioc->chain_segment_sz,
((ioc->chain_depth * ioc->chain_segment_sz))/1024)); (ioc->chain_depth * ioc->chain_segment_sz) / 1024));
/* sense buffers, 4 byte align */ /* sense buffers, 4 byte align */
sz = ioc->scsiio_depth * SCSI_SENSE_BUFFERSIZE; sz = ioc->scsiio_depth * SCSI_SENSE_BUFFERSIZE;
ioc->sense_dma_pool = dma_pool_create("sense pool", &ioc->pdev->dev, sz, ioc->sense_dma_pool = dma_pool_create("sense pool", &ioc->pdev->dev, sz,
4, 0); 4, 0);
if (!ioc->sense_dma_pool) { if (!ioc->sense_dma_pool) {
pr_err(MPT3SAS_FMT "sense pool: dma_pool_create failed\n", ioc_err(ioc, "sense pool: dma_pool_create failed\n");
ioc->name);
goto out; goto out;
} }
ioc->sense = dma_pool_alloc(ioc->sense_dma_pool, GFP_KERNEL, ioc->sense = dma_pool_alloc(ioc->sense_dma_pool, GFP_KERNEL,
&ioc->sense_dma); &ioc->sense_dma);
if (!ioc->sense) { if (!ioc->sense) {
pr_err(MPT3SAS_FMT "sense pool: dma_pool_alloc failed\n", ioc_err(ioc, "sense pool: dma_pool_alloc failed\n");
ioc->name);
goto out; goto out;
} }
/* sense buffer requires to be in same 4 gb region. /* sense buffer requires to be in same 4 gb region.
...@@ -4797,24 +4732,23 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) ...@@ -4797,24 +4732,23 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc)
dma_pool_create("sense pool", &ioc->pdev->dev, sz, dma_pool_create("sense pool", &ioc->pdev->dev, sz,
roundup_pow_of_two(sz), 0); roundup_pow_of_two(sz), 0);
if (!ioc->sense_dma_pool) { if (!ioc->sense_dma_pool) {
pr_err(MPT3SAS_FMT "sense pool: pci_pool_create failed\n", ioc_err(ioc, "sense pool: pci_pool_create failed\n");
ioc->name);
goto out; goto out;
} }
ioc->sense = dma_pool_alloc(ioc->sense_dma_pool, GFP_KERNEL, ioc->sense = dma_pool_alloc(ioc->sense_dma_pool, GFP_KERNEL,
&ioc->sense_dma); &ioc->sense_dma);
if (!ioc->sense) { if (!ioc->sense) {
pr_err(MPT3SAS_FMT "sense pool: pci_pool_alloc failed\n", ioc_err(ioc, "sense pool: pci_pool_alloc failed\n");
ioc->name);
goto out; goto out;
} }
} }
dinitprintk(ioc, pr_info(MPT3SAS_FMT dinitprintk(ioc,
"sense pool(0x%p): depth(%d), element_size(%d), pool_size" ioc_info(ioc, "sense pool(0x%p): depth(%d), element_size(%d), pool_size(%d kB)\n",
"(%d kB)\n", ioc->name, ioc->sense, ioc->scsiio_depth, ioc->sense, ioc->scsiio_depth,
SCSI_SENSE_BUFFERSIZE, sz/1024)); SCSI_SENSE_BUFFERSIZE, sz / 1024));
dinitprintk(ioc, pr_info(MPT3SAS_FMT "sense_dma(0x%llx)\n", dinitprintk(ioc,
ioc->name, (unsigned long long)ioc->sense_dma)); ioc_info(ioc, "sense_dma(0x%llx)\n",
(unsigned long long)ioc->sense_dma));
total_sz += sz; total_sz += sz;
/* reply pool, 4 byte align */ /* reply pool, 4 byte align */
...@@ -4822,25 +4756,24 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) ...@@ -4822,25 +4756,24 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc)
ioc->reply_dma_pool = dma_pool_create("reply pool", &ioc->pdev->dev, sz, ioc->reply_dma_pool = dma_pool_create("reply pool", &ioc->pdev->dev, sz,
4, 0); 4, 0);
if (!ioc->reply_dma_pool) { if (!ioc->reply_dma_pool) {
pr_err(MPT3SAS_FMT "reply pool: dma_pool_create failed\n", ioc_err(ioc, "reply pool: dma_pool_create failed\n");
ioc->name);
goto out; goto out;
} }
ioc->reply = dma_pool_alloc(ioc->reply_dma_pool, GFP_KERNEL, ioc->reply = dma_pool_alloc(ioc->reply_dma_pool, GFP_KERNEL,
&ioc->reply_dma); &ioc->reply_dma);
if (!ioc->reply) { if (!ioc->reply) {
pr_err(MPT3SAS_FMT "reply pool: dma_pool_alloc failed\n", ioc_err(ioc, "reply pool: dma_pool_alloc failed\n");
ioc->name);
goto out; goto out;
} }
ioc->reply_dma_min_address = (u32)(ioc->reply_dma); ioc->reply_dma_min_address = (u32)(ioc->reply_dma);
ioc->reply_dma_max_address = (u32)(ioc->reply_dma) + sz; ioc->reply_dma_max_address = (u32)(ioc->reply_dma) + sz;
dinitprintk(ioc, pr_info(MPT3SAS_FMT dinitprintk(ioc,
"reply pool(0x%p): depth(%d), frame_size(%d), pool_size(%d kB)\n", ioc_info(ioc, "reply pool(0x%p): depth(%d), frame_size(%d), pool_size(%d kB)\n",
ioc->name, ioc->reply, ioc->reply, ioc->reply_free_queue_depth,
ioc->reply_free_queue_depth, ioc->reply_sz, sz/1024)); ioc->reply_sz, sz / 1024));
dinitprintk(ioc, pr_info(MPT3SAS_FMT "reply_dma(0x%llx)\n", dinitprintk(ioc,
ioc->name, (unsigned long long)ioc->reply_dma)); ioc_info(ioc, "reply_dma(0x%llx)\n",
(unsigned long long)ioc->reply_dma));
total_sz += sz; total_sz += sz;
/* reply free queue, 16 byte align */ /* reply free queue, 16 byte align */
...@@ -4848,24 +4781,23 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) ...@@ -4848,24 +4781,23 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc)
ioc->reply_free_dma_pool = dma_pool_create("reply_free pool", ioc->reply_free_dma_pool = dma_pool_create("reply_free pool",
&ioc->pdev->dev, sz, 16, 0); &ioc->pdev->dev, sz, 16, 0);
if (!ioc->reply_free_dma_pool) { if (!ioc->reply_free_dma_pool) {
pr_err(MPT3SAS_FMT "reply_free pool: dma_pool_create failed\n", ioc_err(ioc, "reply_free pool: dma_pool_create failed\n");
ioc->name);
goto out; goto out;
} }
ioc->reply_free = dma_pool_alloc(ioc->reply_free_dma_pool, GFP_KERNEL, ioc->reply_free = dma_pool_alloc(ioc->reply_free_dma_pool, GFP_KERNEL,
&ioc->reply_free_dma); &ioc->reply_free_dma);
if (!ioc->reply_free) { if (!ioc->reply_free) {
pr_err(MPT3SAS_FMT "reply_free pool: dma_pool_alloc failed\n", ioc_err(ioc, "reply_free pool: dma_pool_alloc failed\n");
ioc->name);
goto out; goto out;
} }
memset(ioc->reply_free, 0, sz); memset(ioc->reply_free, 0, sz);
dinitprintk(ioc, pr_info(MPT3SAS_FMT "reply_free pool(0x%p): " \ dinitprintk(ioc,
"depth(%d), element_size(%d), pool_size(%d kB)\n", ioc->name, ioc_info(ioc, "reply_free pool(0x%p): depth(%d), element_size(%d), pool_size(%d kB)\n",
ioc->reply_free, ioc->reply_free_queue_depth, 4, sz/1024)); ioc->reply_free, ioc->reply_free_queue_depth,
dinitprintk(ioc, pr_info(MPT3SAS_FMT 4, sz / 1024));
"reply_free_dma (0x%llx)\n", dinitprintk(ioc,
ioc->name, (unsigned long long)ioc->reply_free_dma)); ioc_info(ioc, "reply_free_dma (0x%llx)\n",
(unsigned long long)ioc->reply_free_dma));
total_sz += sz; total_sz += sz;
if (ioc->rdpq_array_enable) { if (ioc->rdpq_array_enable) {
...@@ -4876,8 +4808,7 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) ...@@ -4876,8 +4808,7 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc)
&ioc->pdev->dev, reply_post_free_array_sz, 16, 0); &ioc->pdev->dev, reply_post_free_array_sz, 16, 0);
if (!ioc->reply_post_free_array_dma_pool) { if (!ioc->reply_post_free_array_dma_pool) {
dinitprintk(ioc, dinitprintk(ioc,
pr_info(MPT3SAS_FMT "reply_post_free_array pool: " ioc_info(ioc, "reply_post_free_array pool: dma_pool_create failed\n"));
"dma_pool_create failed\n", ioc->name));
goto out; goto out;
} }
ioc->reply_post_free_array = ioc->reply_post_free_array =
...@@ -4885,8 +4816,7 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) ...@@ -4885,8 +4816,7 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc)
GFP_KERNEL, &ioc->reply_post_free_array_dma); GFP_KERNEL, &ioc->reply_post_free_array_dma);
if (!ioc->reply_post_free_array) { if (!ioc->reply_post_free_array) {
dinitprintk(ioc, dinitprintk(ioc,
pr_info(MPT3SAS_FMT "reply_post_free_array pool: " ioc_info(ioc, "reply_post_free_array pool: dma_pool_alloc failed\n"));
"dma_pool_alloc failed\n", ioc->name));
goto out; goto out;
} }
} }
...@@ -4894,25 +4824,23 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) ...@@ -4894,25 +4824,23 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc)
ioc->config_page = pci_alloc_consistent(ioc->pdev, ioc->config_page = pci_alloc_consistent(ioc->pdev,
ioc->config_page_sz, &ioc->config_page_dma); ioc->config_page_sz, &ioc->config_page_dma);
if (!ioc->config_page) { if (!ioc->config_page) {
pr_err(MPT3SAS_FMT ioc_err(ioc, "config page: dma_pool_alloc failed\n");
"config page: dma_pool_alloc failed\n",
ioc->name);
goto out; goto out;
} }
dinitprintk(ioc, pr_info(MPT3SAS_FMT dinitprintk(ioc,
"config page(0x%p): size(%d)\n", ioc_info(ioc, "config page(0x%p): size(%d)\n",
ioc->name, ioc->config_page, ioc->config_page_sz)); ioc->config_page, ioc->config_page_sz));
dinitprintk(ioc, pr_info(MPT3SAS_FMT "config_page_dma(0x%llx)\n", dinitprintk(ioc,
ioc->name, (unsigned long long)ioc->config_page_dma)); ioc_info(ioc, "config_page_dma(0x%llx)\n",
(unsigned long long)ioc->config_page_dma));
total_sz += ioc->config_page_sz; total_sz += ioc->config_page_sz;
pr_info(MPT3SAS_FMT "Allocated physical memory: size(%d kB)\n", ioc_info(ioc, "Allocated physical memory: size(%d kB)\n",
ioc->name, total_sz/1024); total_sz / 1024);
pr_info(MPT3SAS_FMT ioc_info(ioc, "Current Controller Queue Depth(%d),Max Controller Queue Depth(%d)\n",
"Current Controller Queue Depth(%d),Max Controller Queue Depth(%d)\n", ioc->shost->can_queue, facts->RequestCredit);
ioc->name, ioc->shost->can_queue, facts->RequestCredit); ioc_info(ioc, "Scatter Gather Elements per IO(%d)\n",
pr_info(MPT3SAS_FMT "Scatter Gather Elements per IO(%d)\n", ioc->shost->sg_tablesize);
ioc->name, ioc->shost->sg_tablesize);
return 0; return 0;
out: out:
...@@ -4990,9 +4918,9 @@ _base_wait_for_doorbell_int(struct MPT3SAS_ADAPTER *ioc, int timeout) ...@@ -4990,9 +4918,9 @@ _base_wait_for_doorbell_int(struct MPT3SAS_ADAPTER *ioc, int timeout)
do { do {
int_status = readl(&ioc->chip->HostInterruptStatus); int_status = readl(&ioc->chip->HostInterruptStatus);
if (int_status & MPI2_HIS_IOC2SYS_DB_STATUS) { if (int_status & MPI2_HIS_IOC2SYS_DB_STATUS) {
dhsprintk(ioc, pr_info(MPT3SAS_FMT dhsprintk(ioc,
"%s: successful count(%d), timeout(%d)\n", ioc_info(ioc, "%s: successful count(%d), timeout(%d)\n",
ioc->name, __func__, count, timeout)); __func__, count, timeout));
return 0; return 0;
} }
...@@ -5000,9 +4928,8 @@ _base_wait_for_doorbell_int(struct MPT3SAS_ADAPTER *ioc, int timeout) ...@@ -5000,9 +4928,8 @@ _base_wait_for_doorbell_int(struct MPT3SAS_ADAPTER *ioc, int timeout)
count++; count++;
} while (--cntdn); } while (--cntdn);
pr_err(MPT3SAS_FMT ioc_err(ioc, "%s: failed due to timeout count(%d), int_status(%x)!\n",
"%s: failed due to timeout count(%d), int_status(%x)!\n", __func__, count, int_status);
ioc->name, __func__, count, int_status);
return -EFAULT; return -EFAULT;
} }
...@@ -5017,9 +4944,9 @@ _base_spin_on_doorbell_int(struct MPT3SAS_ADAPTER *ioc, int timeout) ...@@ -5017,9 +4944,9 @@ _base_spin_on_doorbell_int(struct MPT3SAS_ADAPTER *ioc, int timeout)
do { do {
int_status = readl(&ioc->chip->HostInterruptStatus); int_status = readl(&ioc->chip->HostInterruptStatus);
if (int_status & MPI2_HIS_IOC2SYS_DB_STATUS) { if (int_status & MPI2_HIS_IOC2SYS_DB_STATUS) {
dhsprintk(ioc, pr_info(MPT3SAS_FMT dhsprintk(ioc,
"%s: successful count(%d), timeout(%d)\n", ioc_info(ioc, "%s: successful count(%d), timeout(%d)\n",
ioc->name, __func__, count, timeout)); __func__, count, timeout));
return 0; return 0;
} }
...@@ -5027,9 +4954,8 @@ _base_spin_on_doorbell_int(struct MPT3SAS_ADAPTER *ioc, int timeout) ...@@ -5027,9 +4954,8 @@ _base_spin_on_doorbell_int(struct MPT3SAS_ADAPTER *ioc, int timeout)
count++; count++;
} while (--cntdn); } while (--cntdn);
pr_err(MPT3SAS_FMT ioc_err(ioc, "%s: failed due to timeout count(%d), int_status(%x)!\n",
"%s: failed due to timeout count(%d), int_status(%x)!\n", __func__, count, int_status);
ioc->name, __func__, count, int_status);
return -EFAULT; return -EFAULT;
} }
...@@ -5056,9 +4982,9 @@ _base_wait_for_doorbell_ack(struct MPT3SAS_ADAPTER *ioc, int timeout) ...@@ -5056,9 +4982,9 @@ _base_wait_for_doorbell_ack(struct MPT3SAS_ADAPTER *ioc, int timeout)
do { do {
int_status = readl(&ioc->chip->HostInterruptStatus); int_status = readl(&ioc->chip->HostInterruptStatus);
if (!(int_status & MPI2_HIS_SYS2IOC_DB_STATUS)) { if (!(int_status & MPI2_HIS_SYS2IOC_DB_STATUS)) {
dhsprintk(ioc, pr_info(MPT3SAS_FMT dhsprintk(ioc,
"%s: successful count(%d), timeout(%d)\n", ioc_info(ioc, "%s: successful count(%d), timeout(%d)\n",
ioc->name, __func__, count, timeout)); __func__, count, timeout));
return 0; return 0;
} else if (int_status & MPI2_HIS_IOC2SYS_DB_STATUS) { } else if (int_status & MPI2_HIS_IOC2SYS_DB_STATUS) {
doorbell = readl(&ioc->chip->Doorbell); doorbell = readl(&ioc->chip->Doorbell);
...@@ -5075,9 +5001,8 @@ _base_wait_for_doorbell_ack(struct MPT3SAS_ADAPTER *ioc, int timeout) ...@@ -5075,9 +5001,8 @@ _base_wait_for_doorbell_ack(struct MPT3SAS_ADAPTER *ioc, int timeout)
} while (--cntdn); } while (--cntdn);
out: out:
pr_err(MPT3SAS_FMT ioc_err(ioc, "%s: failed due to timeout count(%d), int_status(%x)!\n",
"%s: failed due to timeout count(%d), int_status(%x)!\n", __func__, count, int_status);
ioc->name, __func__, count, int_status);
return -EFAULT; return -EFAULT;
} }
...@@ -5099,9 +5024,9 @@ _base_wait_for_doorbell_not_used(struct MPT3SAS_ADAPTER *ioc, int timeout) ...@@ -5099,9 +5024,9 @@ _base_wait_for_doorbell_not_used(struct MPT3SAS_ADAPTER *ioc, int timeout)
do { do {
doorbell_reg = readl(&ioc->chip->Doorbell); doorbell_reg = readl(&ioc->chip->Doorbell);
if (!(doorbell_reg & MPI2_DOORBELL_USED)) { if (!(doorbell_reg & MPI2_DOORBELL_USED)) {
dhsprintk(ioc, pr_info(MPT3SAS_FMT dhsprintk(ioc,
"%s: successful count(%d), timeout(%d)\n", ioc_info(ioc, "%s: successful count(%d), timeout(%d)\n",
ioc->name, __func__, count, timeout)); __func__, count, timeout));
return 0; return 0;
} }
...@@ -5109,9 +5034,8 @@ _base_wait_for_doorbell_not_used(struct MPT3SAS_ADAPTER *ioc, int timeout) ...@@ -5109,9 +5034,8 @@ _base_wait_for_doorbell_not_used(struct MPT3SAS_ADAPTER *ioc, int timeout)
count++; count++;
} while (--cntdn); } while (--cntdn);
pr_err(MPT3SAS_FMT ioc_err(ioc, "%s: failed due to timeout count(%d), doorbell_reg(%x)!\n",
"%s: failed due to timeout count(%d), doorbell_reg(%x)!\n", __func__, count, doorbell_reg);
ioc->name, __func__, count, doorbell_reg);
return -EFAULT; return -EFAULT;
} }
...@@ -5130,8 +5054,7 @@ _base_send_ioc_reset(struct MPT3SAS_ADAPTER *ioc, u8 reset_type, int timeout) ...@@ -5130,8 +5054,7 @@ _base_send_ioc_reset(struct MPT3SAS_ADAPTER *ioc, u8 reset_type, int timeout)
int r = 0; int r = 0;
if (reset_type != MPI2_FUNCTION_IOC_MESSAGE_UNIT_RESET) { if (reset_type != MPI2_FUNCTION_IOC_MESSAGE_UNIT_RESET) {
pr_err(MPT3SAS_FMT "%s: unknown reset_type\n", ioc_err(ioc, "%s: unknown reset_type\n", __func__);
ioc->name, __func__);
return -EFAULT; return -EFAULT;
} }
...@@ -5139,7 +5062,7 @@ _base_send_ioc_reset(struct MPT3SAS_ADAPTER *ioc, u8 reset_type, int timeout) ...@@ -5139,7 +5062,7 @@ _base_send_ioc_reset(struct MPT3SAS_ADAPTER *ioc, u8 reset_type, int timeout)
MPI2_IOCFACTS_CAPABILITY_EVENT_REPLAY)) MPI2_IOCFACTS_CAPABILITY_EVENT_REPLAY))
return -EFAULT; return -EFAULT;
pr_info(MPT3SAS_FMT "sending message unit reset !!\n", ioc->name); ioc_info(ioc, "sending message unit reset !!\n");
writel(reset_type << MPI2_DOORBELL_FUNCTION_SHIFT, writel(reset_type << MPI2_DOORBELL_FUNCTION_SHIFT,
&ioc->chip->Doorbell); &ioc->chip->Doorbell);
...@@ -5149,15 +5072,14 @@ _base_send_ioc_reset(struct MPT3SAS_ADAPTER *ioc, u8 reset_type, int timeout) ...@@ -5149,15 +5072,14 @@ _base_send_ioc_reset(struct MPT3SAS_ADAPTER *ioc, u8 reset_type, int timeout)
} }
ioc_state = _base_wait_on_iocstate(ioc, MPI2_IOC_STATE_READY, timeout); ioc_state = _base_wait_on_iocstate(ioc, MPI2_IOC_STATE_READY, timeout);
if (ioc_state) { if (ioc_state) {
pr_err(MPT3SAS_FMT ioc_err(ioc, "%s: failed going to ready state (ioc_state=0x%x)\n",
"%s: failed going to ready state (ioc_state=0x%x)\n", __func__, ioc_state);
ioc->name, __func__, ioc_state);
r = -EFAULT; r = -EFAULT;
goto out; goto out;
} }
out: out:
pr_info(MPT3SAS_FMT "message unit reset: %s\n", ioc_info(ioc, "message unit reset: %s\n",
ioc->name, ((r == 0) ? "SUCCESS" : "FAILED")); r == 0 ? "SUCCESS" : "FAILED");
return r; return r;
} }
...@@ -5183,9 +5105,7 @@ _base_handshake_req_reply_wait(struct MPT3SAS_ADAPTER *ioc, int request_bytes, ...@@ -5183,9 +5105,7 @@ _base_handshake_req_reply_wait(struct MPT3SAS_ADAPTER *ioc, int request_bytes,
/* make sure doorbell is not in use */ /* make sure doorbell is not in use */
if ((readl(&ioc->chip->Doorbell) & MPI2_DOORBELL_USED)) { if ((readl(&ioc->chip->Doorbell) & MPI2_DOORBELL_USED)) {
pr_err(MPT3SAS_FMT ioc_err(ioc, "doorbell is in use (line=%d)\n", __LINE__);
"doorbell is in use (line=%d)\n",
ioc->name, __LINE__);
return -EFAULT; return -EFAULT;
} }
...@@ -5200,17 +5120,15 @@ _base_handshake_req_reply_wait(struct MPT3SAS_ADAPTER *ioc, int request_bytes, ...@@ -5200,17 +5120,15 @@ _base_handshake_req_reply_wait(struct MPT3SAS_ADAPTER *ioc, int request_bytes,
&ioc->chip->Doorbell); &ioc->chip->Doorbell);
if ((_base_spin_on_doorbell_int(ioc, 5))) { if ((_base_spin_on_doorbell_int(ioc, 5))) {
pr_err(MPT3SAS_FMT ioc_err(ioc, "doorbell handshake int failed (line=%d)\n",
"doorbell handshake int failed (line=%d)\n", __LINE__);
ioc->name, __LINE__);
return -EFAULT; return -EFAULT;
} }
writel(0, &ioc->chip->HostInterruptStatus); writel(0, &ioc->chip->HostInterruptStatus);
if ((_base_wait_for_doorbell_ack(ioc, 5))) { if ((_base_wait_for_doorbell_ack(ioc, 5))) {
pr_err(MPT3SAS_FMT ioc_err(ioc, "doorbell handshake ack failed (line=%d)\n",
"doorbell handshake ack failed (line=%d)\n", __LINE__);
ioc->name, __LINE__);
return -EFAULT; return -EFAULT;
} }
...@@ -5222,17 +5140,15 @@ _base_handshake_req_reply_wait(struct MPT3SAS_ADAPTER *ioc, int request_bytes, ...@@ -5222,17 +5140,15 @@ _base_handshake_req_reply_wait(struct MPT3SAS_ADAPTER *ioc, int request_bytes,
} }
if (failed) { if (failed) {
pr_err(MPT3SAS_FMT ioc_err(ioc, "doorbell handshake sending request failed (line=%d)\n",
"doorbell handshake sending request failed (line=%d)\n", __LINE__);
ioc->name, __LINE__);
return -EFAULT; return -EFAULT;
} }
/* now wait for the reply */ /* now wait for the reply */
if ((_base_wait_for_doorbell_int(ioc, timeout))) { if ((_base_wait_for_doorbell_int(ioc, timeout))) {
pr_err(MPT3SAS_FMT ioc_err(ioc, "doorbell handshake int failed (line=%d)\n",
"doorbell handshake int failed (line=%d)\n", __LINE__);
ioc->name, __LINE__);
return -EFAULT; return -EFAULT;
} }
...@@ -5241,9 +5157,8 @@ _base_handshake_req_reply_wait(struct MPT3SAS_ADAPTER *ioc, int request_bytes, ...@@ -5241,9 +5157,8 @@ _base_handshake_req_reply_wait(struct MPT3SAS_ADAPTER *ioc, int request_bytes,
& MPI2_DOORBELL_DATA_MASK); & MPI2_DOORBELL_DATA_MASK);
writel(0, &ioc->chip->HostInterruptStatus); writel(0, &ioc->chip->HostInterruptStatus);
if ((_base_wait_for_doorbell_int(ioc, 5))) { if ((_base_wait_for_doorbell_int(ioc, 5))) {
pr_err(MPT3SAS_FMT ioc_err(ioc, "doorbell handshake int failed (line=%d)\n",
"doorbell handshake int failed (line=%d)\n", __LINE__);
ioc->name, __LINE__);
return -EFAULT; return -EFAULT;
} }
reply[1] = le16_to_cpu(readl(&ioc->chip->Doorbell) reply[1] = le16_to_cpu(readl(&ioc->chip->Doorbell)
...@@ -5252,9 +5167,8 @@ _base_handshake_req_reply_wait(struct MPT3SAS_ADAPTER *ioc, int request_bytes, ...@@ -5252,9 +5167,8 @@ _base_handshake_req_reply_wait(struct MPT3SAS_ADAPTER *ioc, int request_bytes,
for (i = 2; i < default_reply->MsgLength * 2; i++) { for (i = 2; i < default_reply->MsgLength * 2; i++) {
if ((_base_wait_for_doorbell_int(ioc, 5))) { if ((_base_wait_for_doorbell_int(ioc, 5))) {
pr_err(MPT3SAS_FMT ioc_err(ioc, "doorbell handshake int failed (line=%d)\n",
"doorbell handshake int failed (line=%d)\n", __LINE__);
ioc->name, __LINE__);
return -EFAULT; return -EFAULT;
} }
if (i >= reply_bytes/2) /* overflow case */ if (i >= reply_bytes/2) /* overflow case */
...@@ -5267,8 +5181,9 @@ _base_handshake_req_reply_wait(struct MPT3SAS_ADAPTER *ioc, int request_bytes, ...@@ -5267,8 +5181,9 @@ _base_handshake_req_reply_wait(struct MPT3SAS_ADAPTER *ioc, int request_bytes,
_base_wait_for_doorbell_int(ioc, 5); _base_wait_for_doorbell_int(ioc, 5);
if (_base_wait_for_doorbell_not_used(ioc, 5) != 0) { if (_base_wait_for_doorbell_not_used(ioc, 5) != 0) {
dhsprintk(ioc, pr_info(MPT3SAS_FMT dhsprintk(ioc,
"doorbell is in use (line=%d)\n", ioc->name, __LINE__)); ioc_info(ioc, "doorbell is in use (line=%d)\n",
__LINE__));
} }
writel(0, &ioc->chip->HostInterruptStatus); writel(0, &ioc->chip->HostInterruptStatus);
...@@ -5308,14 +5223,12 @@ mpt3sas_base_sas_iounit_control(struct MPT3SAS_ADAPTER *ioc, ...@@ -5308,14 +5223,12 @@ mpt3sas_base_sas_iounit_control(struct MPT3SAS_ADAPTER *ioc,
void *request; void *request;
u16 wait_state_count; u16 wait_state_count;
dinitprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name, dinitprintk(ioc, ioc_info(ioc, "%s\n", __func__));
__func__));
mutex_lock(&ioc->base_cmds.mutex); mutex_lock(&ioc->base_cmds.mutex);
if (ioc->base_cmds.status != MPT3_CMD_NOT_USED) { if (ioc->base_cmds.status != MPT3_CMD_NOT_USED) {
pr_err(MPT3SAS_FMT "%s: base_cmd in use\n", ioc_err(ioc, "%s: base_cmd in use\n", __func__);
ioc->name, __func__);
rc = -EAGAIN; rc = -EAGAIN;
goto out; goto out;
} }
...@@ -5324,23 +5237,20 @@ mpt3sas_base_sas_iounit_control(struct MPT3SAS_ADAPTER *ioc, ...@@ -5324,23 +5237,20 @@ mpt3sas_base_sas_iounit_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);
} }
smid = mpt3sas_base_get_smid(ioc, ioc->base_cb_idx); smid = mpt3sas_base_get_smid(ioc, ioc->base_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;
} }
...@@ -5408,14 +5318,12 @@ mpt3sas_base_scsi_enclosure_processor(struct MPT3SAS_ADAPTER *ioc, ...@@ -5408,14 +5318,12 @@ mpt3sas_base_scsi_enclosure_processor(struct MPT3SAS_ADAPTER *ioc,
void *request; void *request;
u16 wait_state_count; u16 wait_state_count;
dinitprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name, dinitprintk(ioc, ioc_info(ioc, "%s\n", __func__));
__func__));
mutex_lock(&ioc->base_cmds.mutex); mutex_lock(&ioc->base_cmds.mutex);
if (ioc->base_cmds.status != MPT3_CMD_NOT_USED) { if (ioc->base_cmds.status != MPT3_CMD_NOT_USED) {
pr_err(MPT3SAS_FMT "%s: base_cmd in use\n", ioc_err(ioc, "%s: base_cmd in use\n", __func__);
ioc->name, __func__);
rc = -EAGAIN; rc = -EAGAIN;
goto out; goto out;
} }
...@@ -5424,24 +5332,20 @@ mpt3sas_base_scsi_enclosure_processor(struct MPT3SAS_ADAPTER *ioc, ...@@ -5424,24 +5332,20 @@ mpt3sas_base_scsi_enclosure_processor(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);
} }
smid = mpt3sas_base_get_smid(ioc, ioc->base_cb_idx); smid = mpt3sas_base_get_smid(ioc, ioc->base_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;
} }
...@@ -5495,8 +5399,7 @@ _base_get_port_facts(struct MPT3SAS_ADAPTER *ioc, int port) ...@@ -5495,8 +5399,7 @@ _base_get_port_facts(struct MPT3SAS_ADAPTER *ioc, int port)
struct mpt3sas_port_facts *pfacts; struct mpt3sas_port_facts *pfacts;
int mpi_reply_sz, mpi_request_sz, r; int mpi_reply_sz, mpi_request_sz, r;
dinitprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name, dinitprintk(ioc, ioc_info(ioc, "%s\n", __func__));
__func__));
mpi_reply_sz = sizeof(Mpi2PortFactsReply_t); mpi_reply_sz = sizeof(Mpi2PortFactsReply_t);
mpi_request_sz = sizeof(Mpi2PortFactsRequest_t); mpi_request_sz = sizeof(Mpi2PortFactsRequest_t);
...@@ -5507,8 +5410,7 @@ _base_get_port_facts(struct MPT3SAS_ADAPTER *ioc, int port) ...@@ -5507,8 +5410,7 @@ _base_get_port_facts(struct MPT3SAS_ADAPTER *ioc, int port)
(u32 *)&mpi_request, mpi_reply_sz, (u16 *)&mpi_reply, 5); (u32 *)&mpi_request, mpi_reply_sz, (u16 *)&mpi_reply, 5);
if (r != 0) { if (r != 0) {
pr_err(MPT3SAS_FMT "%s: handshake failed (r=%d)\n", ioc_err(ioc, "%s: handshake failed (r=%d)\n", __func__, r);
ioc->name, __func__, r);
return r; return r;
} }
...@@ -5592,8 +5494,7 @@ _base_get_ioc_facts(struct MPT3SAS_ADAPTER *ioc) ...@@ -5592,8 +5494,7 @@ _base_get_ioc_facts(struct MPT3SAS_ADAPTER *ioc)
struct mpt3sas_facts *facts; struct mpt3sas_facts *facts;
int mpi_reply_sz, mpi_request_sz, r; int mpi_reply_sz, mpi_request_sz, r;
dinitprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name, dinitprintk(ioc, ioc_info(ioc, "%s\n", __func__));
__func__));
r = _base_wait_for_iocstate(ioc, 10); r = _base_wait_for_iocstate(ioc, 10);
if (r) { if (r) {
...@@ -5610,8 +5511,7 @@ _base_get_ioc_facts(struct MPT3SAS_ADAPTER *ioc) ...@@ -5610,8 +5511,7 @@ _base_get_ioc_facts(struct MPT3SAS_ADAPTER *ioc)
(u32 *)&mpi_request, mpi_reply_sz, (u16 *)&mpi_reply, 5); (u32 *)&mpi_request, mpi_reply_sz, (u16 *)&mpi_reply, 5);
if (r != 0) { if (r != 0) {
pr_err(MPT3SAS_FMT "%s: handshake failed (r=%d)\n", ioc_err(ioc, "%s: handshake failed (r=%d)\n", __func__, r);
ioc->name, __func__, r);
return r; return r;
} }
...@@ -5663,20 +5563,20 @@ _base_get_ioc_facts(struct MPT3SAS_ADAPTER *ioc) ...@@ -5663,20 +5563,20 @@ _base_get_ioc_facts(struct MPT3SAS_ADAPTER *ioc)
*/ */
ioc->page_size = 1 << facts->CurrentHostPageSize; ioc->page_size = 1 << facts->CurrentHostPageSize;
if (ioc->page_size == 1) { if (ioc->page_size == 1) {
pr_info(MPT3SAS_FMT "CurrentHostPageSize is 0: Setting " ioc_info(ioc, "CurrentHostPageSize is 0: Setting default host page size to 4k\n");
"default host page size to 4k\n", ioc->name);
ioc->page_size = 1 << MPT3SAS_HOST_PAGE_SIZE_4K; ioc->page_size = 1 << MPT3SAS_HOST_PAGE_SIZE_4K;
} }
dinitprintk(ioc, pr_info(MPT3SAS_FMT "CurrentHostPageSize(%d)\n", dinitprintk(ioc,
ioc->name, facts->CurrentHostPageSize)); ioc_info(ioc, "CurrentHostPageSize(%d)\n",
facts->CurrentHostPageSize));
dinitprintk(ioc, pr_info(MPT3SAS_FMT
"hba queue depth(%d), max chains per io(%d)\n", dinitprintk(ioc,
ioc->name, facts->RequestCredit, ioc_info(ioc, "hba queue depth(%d), max chains per io(%d)\n",
facts->MaxChainDepth)); facts->RequestCredit, facts->MaxChainDepth));
dinitprintk(ioc, pr_info(MPT3SAS_FMT dinitprintk(ioc,
"request frame size(%d), reply frame size(%d)\n", ioc->name, ioc_info(ioc, "request frame size(%d), reply frame size(%d)\n",
facts->IOCRequestFrameSize * 4, facts->ReplyFrameSize * 4)); facts->IOCRequestFrameSize * 4,
facts->ReplyFrameSize * 4));
return 0; return 0;
} }
...@@ -5696,8 +5596,7 @@ _base_send_ioc_init(struct MPT3SAS_ADAPTER *ioc) ...@@ -5696,8 +5596,7 @@ _base_send_ioc_init(struct MPT3SAS_ADAPTER *ioc)
u16 ioc_status; u16 ioc_status;
u32 reply_post_free_array_sz = 0; u32 reply_post_free_array_sz = 0;
dinitprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name, dinitprintk(ioc, ioc_info(ioc, "%s\n", __func__));
__func__));
memset(&mpi_request, 0, sizeof(Mpi2IOCInitRequest_t)); memset(&mpi_request, 0, sizeof(Mpi2IOCInitRequest_t));
mpi_request.Function = MPI2_FUNCTION_IOC_INIT; mpi_request.Function = MPI2_FUNCTION_IOC_INIT;
...@@ -5763,15 +5662,14 @@ _base_send_ioc_init(struct MPT3SAS_ADAPTER *ioc) ...@@ -5763,15 +5662,14 @@ _base_send_ioc_init(struct MPT3SAS_ADAPTER *ioc)
sizeof(Mpi2IOCInitReply_t), (u16 *)&mpi_reply, 10); sizeof(Mpi2IOCInitReply_t), (u16 *)&mpi_reply, 10);
if (r != 0) { if (r != 0) {
pr_err(MPT3SAS_FMT "%s: handshake failed (r=%d)\n", ioc_err(ioc, "%s: handshake failed (r=%d)\n", __func__, r);
ioc->name, __func__, r);
return r; return r;
} }
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 ||
mpi_reply.IOCLogInfo) { mpi_reply.IOCLogInfo) {
pr_err(MPT3SAS_FMT "%s: failed\n", ioc->name, __func__); ioc_err(ioc, "%s: failed\n", __func__);
r = -EIO; r = -EIO;
} }
...@@ -5842,18 +5740,16 @@ _base_send_port_enable(struct MPT3SAS_ADAPTER *ioc) ...@@ -5842,18 +5740,16 @@ _base_send_port_enable(struct MPT3SAS_ADAPTER *ioc)
u16 smid; u16 smid;
u16 ioc_status; u16 ioc_status;
pr_info(MPT3SAS_FMT "sending port enable !!\n", ioc->name); ioc_info(ioc, "sending port enable !!\n");
if (ioc->port_enable_cmds.status & MPT3_CMD_PENDING) { if (ioc->port_enable_cmds.status & MPT3_CMD_PENDING) {
pr_err(MPT3SAS_FMT "%s: internal command already in use\n", ioc_err(ioc, "%s: internal command already in use\n", __func__);
ioc->name, __func__);
return -EAGAIN; return -EAGAIN;
} }
smid = mpt3sas_base_get_smid(ioc, ioc->port_enable_cb_idx); smid = mpt3sas_base_get_smid(ioc, ioc->port_enable_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__);
return -EAGAIN; return -EAGAIN;
} }
...@@ -5867,8 +5763,7 @@ _base_send_port_enable(struct MPT3SAS_ADAPTER *ioc) ...@@ -5867,8 +5763,7 @@ _base_send_port_enable(struct MPT3SAS_ADAPTER *ioc)
mpt3sas_base_put_smid_default(ioc, smid); mpt3sas_base_put_smid_default(ioc, smid);
wait_for_completion_timeout(&ioc->port_enable_cmds.done, 300*HZ); wait_for_completion_timeout(&ioc->port_enable_cmds.done, 300*HZ);
if (!(ioc->port_enable_cmds.status & MPT3_CMD_COMPLETE)) { if (!(ioc->port_enable_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(Mpi2PortEnableRequest_t)/4); sizeof(Mpi2PortEnableRequest_t)/4);
if (ioc->port_enable_cmds.status & MPT3_CMD_RESET) if (ioc->port_enable_cmds.status & MPT3_CMD_RESET)
...@@ -5881,16 +5776,15 @@ _base_send_port_enable(struct MPT3SAS_ADAPTER *ioc) ...@@ -5881,16 +5776,15 @@ _base_send_port_enable(struct MPT3SAS_ADAPTER *ioc)
mpi_reply = ioc->port_enable_cmds.reply; mpi_reply = ioc->port_enable_cmds.reply;
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: failed with (ioc_status=0x%08x)\n", ioc_err(ioc, "%s: failed with (ioc_status=0x%08x)\n",
ioc->name, __func__, ioc_status); __func__, ioc_status);
r = -EFAULT; r = -EFAULT;
goto out; goto out;
} }
out: out:
ioc->port_enable_cmds.status = MPT3_CMD_NOT_USED; ioc->port_enable_cmds.status = MPT3_CMD_NOT_USED;
pr_info(MPT3SAS_FMT "port enable: %s\n", ioc->name, ((r == 0) ? ioc_info(ioc, "port enable: %s\n", r == 0 ? "SUCCESS" : "FAILED");
"SUCCESS" : "FAILED"));
return r; return r;
} }
...@@ -5906,18 +5800,16 @@ mpt3sas_port_enable(struct MPT3SAS_ADAPTER *ioc) ...@@ -5906,18 +5800,16 @@ mpt3sas_port_enable(struct MPT3SAS_ADAPTER *ioc)
Mpi2PortEnableRequest_t *mpi_request; Mpi2PortEnableRequest_t *mpi_request;
u16 smid; u16 smid;
pr_info(MPT3SAS_FMT "sending port enable !!\n", ioc->name); ioc_info(ioc, "sending port enable !!\n");
if (ioc->port_enable_cmds.status & MPT3_CMD_PENDING) { if (ioc->port_enable_cmds.status & MPT3_CMD_PENDING) {
pr_err(MPT3SAS_FMT "%s: internal command already in use\n", ioc_err(ioc, "%s: internal command already in use\n", __func__);
ioc->name, __func__);
return -EAGAIN; return -EAGAIN;
} }
smid = mpt3sas_base_get_smid(ioc, ioc->port_enable_cb_idx); smid = mpt3sas_base_get_smid(ioc, ioc->port_enable_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__);
return -EAGAIN; return -EAGAIN;
} }
...@@ -6020,19 +5912,16 @@ _base_event_notification(struct MPT3SAS_ADAPTER *ioc) ...@@ -6020,19 +5912,16 @@ _base_event_notification(struct MPT3SAS_ADAPTER *ioc)
int r = 0; int r = 0;
int i; int i;
dinitprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name, dinitprintk(ioc, ioc_info(ioc, "%s\n", __func__));
__func__));
if (ioc->base_cmds.status & MPT3_CMD_PENDING) { if (ioc->base_cmds.status & MPT3_CMD_PENDING) {
pr_err(MPT3SAS_FMT "%s: internal command already in use\n", ioc_err(ioc, "%s: internal command already in use\n", __func__);
ioc->name, __func__);
return -EAGAIN; return -EAGAIN;
} }
smid = mpt3sas_base_get_smid(ioc, ioc->base_cb_idx); smid = mpt3sas_base_get_smid(ioc, ioc->base_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__);
return -EAGAIN; return -EAGAIN;
} }
ioc->base_cmds.status = MPT3_CMD_PENDING; ioc->base_cmds.status = MPT3_CMD_PENDING;
...@@ -6049,8 +5938,7 @@ _base_event_notification(struct MPT3SAS_ADAPTER *ioc) ...@@ -6049,8 +5938,7 @@ _base_event_notification(struct MPT3SAS_ADAPTER *ioc)
mpt3sas_base_put_smid_default(ioc, smid); mpt3sas_base_put_smid_default(ioc, smid);
wait_for_completion_timeout(&ioc->base_cmds.done, 30*HZ); wait_for_completion_timeout(&ioc->base_cmds.done, 30*HZ);
if (!(ioc->base_cmds.status & MPT3_CMD_COMPLETE)) { if (!(ioc->base_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(Mpi2EventNotificationRequest_t)/4); sizeof(Mpi2EventNotificationRequest_t)/4);
if (ioc->base_cmds.status & MPT3_CMD_RESET) if (ioc->base_cmds.status & MPT3_CMD_RESET)
...@@ -6058,8 +5946,7 @@ _base_event_notification(struct MPT3SAS_ADAPTER *ioc) ...@@ -6058,8 +5946,7 @@ _base_event_notification(struct MPT3SAS_ADAPTER *ioc)
else else
r = -ETIME; r = -ETIME;
} else } else
dinitprintk(ioc, pr_info(MPT3SAS_FMT "%s: complete\n", dinitprintk(ioc, ioc_info(ioc, "%s: complete\n", __func__));
ioc->name, __func__));
ioc->base_cmds.status = MPT3_CMD_NOT_USED; ioc->base_cmds.status = MPT3_CMD_NOT_USED;
return r; return r;
} }
...@@ -6115,18 +6002,16 @@ _base_diag_reset(struct MPT3SAS_ADAPTER *ioc) ...@@ -6115,18 +6002,16 @@ _base_diag_reset(struct MPT3SAS_ADAPTER *ioc)
u32 count; u32 count;
u32 hcb_size; u32 hcb_size;
pr_info(MPT3SAS_FMT "sending diag reset !!\n", ioc->name); ioc_info(ioc, "sending diag reset !!\n");
drsprintk(ioc, pr_info(MPT3SAS_FMT "clear interrupts\n", drsprintk(ioc, ioc_info(ioc, "clear interrupts\n"));
ioc->name));
count = 0; count = 0;
do { do {
/* Write magic sequence to WriteSequence register /* Write magic sequence to WriteSequence register
* Loop until in diagnostic mode * Loop until in diagnostic mode
*/ */
drsprintk(ioc, pr_info(MPT3SAS_FMT drsprintk(ioc, ioc_info(ioc, "write magic sequence\n"));
"write magic sequence\n", ioc->name));
writel(MPI2_WRSEQ_FLUSH_KEY_VALUE, &ioc->chip->WriteSequence); writel(MPI2_WRSEQ_FLUSH_KEY_VALUE, &ioc->chip->WriteSequence);
writel(MPI2_WRSEQ_1ST_KEY_VALUE, &ioc->chip->WriteSequence); writel(MPI2_WRSEQ_1ST_KEY_VALUE, &ioc->chip->WriteSequence);
writel(MPI2_WRSEQ_2ND_KEY_VALUE, &ioc->chip->WriteSequence); writel(MPI2_WRSEQ_2ND_KEY_VALUE, &ioc->chip->WriteSequence);
...@@ -6142,16 +6027,15 @@ _base_diag_reset(struct MPT3SAS_ADAPTER *ioc) ...@@ -6142,16 +6027,15 @@ _base_diag_reset(struct MPT3SAS_ADAPTER *ioc)
goto out; goto out;
host_diagnostic = readl(&ioc->chip->HostDiagnostic); host_diagnostic = readl(&ioc->chip->HostDiagnostic);
drsprintk(ioc, pr_info(MPT3SAS_FMT drsprintk(ioc,
"wrote magic sequence: count(%d), host_diagnostic(0x%08x)\n", ioc_info(ioc, "wrote magic sequence: count(%d), host_diagnostic(0x%08x)\n",
ioc->name, count, host_diagnostic)); count, host_diagnostic));
} while ((host_diagnostic & MPI2_DIAG_DIAG_WRITE_ENABLE) == 0); } while ((host_diagnostic & MPI2_DIAG_DIAG_WRITE_ENABLE) == 0);
hcb_size = readl(&ioc->chip->HCBSize); hcb_size = readl(&ioc->chip->HCBSize);
drsprintk(ioc, pr_info(MPT3SAS_FMT "diag reset: issued\n", drsprintk(ioc, ioc_info(ioc, "diag reset: issued\n"));
ioc->name));
writel(host_diagnostic | MPI2_DIAG_RESET_ADAPTER, writel(host_diagnostic | MPI2_DIAG_RESET_ADAPTER,
&ioc->chip->HostDiagnostic); &ioc->chip->HostDiagnostic);
...@@ -6174,43 +6058,38 @@ _base_diag_reset(struct MPT3SAS_ADAPTER *ioc) ...@@ -6174,43 +6058,38 @@ _base_diag_reset(struct MPT3SAS_ADAPTER *ioc)
if (host_diagnostic & MPI2_DIAG_HCB_MODE) { if (host_diagnostic & MPI2_DIAG_HCB_MODE) {
drsprintk(ioc, pr_info(MPT3SAS_FMT drsprintk(ioc,
"restart the adapter assuming the HCB Address points to good F/W\n", ioc_info(ioc, "restart the adapter assuming the HCB Address points to good F/W\n"));
ioc->name));
host_diagnostic &= ~MPI2_DIAG_BOOT_DEVICE_SELECT_MASK; host_diagnostic &= ~MPI2_DIAG_BOOT_DEVICE_SELECT_MASK;
host_diagnostic |= MPI2_DIAG_BOOT_DEVICE_SELECT_HCDW; host_diagnostic |= MPI2_DIAG_BOOT_DEVICE_SELECT_HCDW;
writel(host_diagnostic, &ioc->chip->HostDiagnostic); writel(host_diagnostic, &ioc->chip->HostDiagnostic);
drsprintk(ioc, pr_info(MPT3SAS_FMT drsprintk(ioc, ioc_info(ioc, "re-enable the HCDW\n"));
"re-enable the HCDW\n", ioc->name));
writel(hcb_size | MPI2_HCB_SIZE_HCB_ENABLE, writel(hcb_size | MPI2_HCB_SIZE_HCB_ENABLE,
&ioc->chip->HCBSize); &ioc->chip->HCBSize);
} }
drsprintk(ioc, pr_info(MPT3SAS_FMT "restart the adapter\n", drsprintk(ioc, ioc_info(ioc, "restart the adapter\n"));
ioc->name));
writel(host_diagnostic & ~MPI2_DIAG_HOLD_IOC_RESET, writel(host_diagnostic & ~MPI2_DIAG_HOLD_IOC_RESET,
&ioc->chip->HostDiagnostic); &ioc->chip->HostDiagnostic);
drsprintk(ioc, pr_info(MPT3SAS_FMT drsprintk(ioc,
"disable writes to the diagnostic register\n", ioc->name)); ioc_info(ioc, "disable writes to the diagnostic register\n"));
writel(MPI2_WRSEQ_FLUSH_KEY_VALUE, &ioc->chip->WriteSequence); writel(MPI2_WRSEQ_FLUSH_KEY_VALUE, &ioc->chip->WriteSequence);
drsprintk(ioc, pr_info(MPT3SAS_FMT drsprintk(ioc, ioc_info(ioc, "Wait for FW to go to the READY state\n"));
"Wait for FW to go to the READY state\n", ioc->name));
ioc_state = _base_wait_on_iocstate(ioc, MPI2_IOC_STATE_READY, 20); ioc_state = _base_wait_on_iocstate(ioc, MPI2_IOC_STATE_READY, 20);
if (ioc_state) { if (ioc_state) {
pr_err(MPT3SAS_FMT ioc_err(ioc, "%s: failed going to ready state (ioc_state=0x%x)\n",
"%s: failed going to ready state (ioc_state=0x%x)\n", __func__, ioc_state);
ioc->name, __func__, ioc_state);
goto out; goto out;
} }
pr_info(MPT3SAS_FMT "diag reset: SUCCESS\n", ioc->name); ioc_info(ioc, "diag reset: SUCCESS\n");
return 0; return 0;
out: out:
pr_err(MPT3SAS_FMT "diag reset: FAILED\n", ioc->name); ioc_err(ioc, "diag reset: FAILED\n");
return -EFAULT; return -EFAULT;
} }
...@@ -6228,15 +6107,15 @@ _base_make_ioc_ready(struct MPT3SAS_ADAPTER *ioc, enum reset_type type) ...@@ -6228,15 +6107,15 @@ _base_make_ioc_ready(struct MPT3SAS_ADAPTER *ioc, enum reset_type type)
int rc; int rc;
int count; int count;
dinitprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name, dinitprintk(ioc, ioc_info(ioc, "%s\n", __func__));
__func__));
if (ioc->pci_error_recovery) if (ioc->pci_error_recovery)
return 0; return 0;
ioc_state = mpt3sas_base_get_iocstate(ioc, 0); ioc_state = mpt3sas_base_get_iocstate(ioc, 0);
dhsprintk(ioc, pr_info(MPT3SAS_FMT "%s: ioc_state(0x%08x)\n", dhsprintk(ioc,
ioc->name, __func__, ioc_state)); ioc_info(ioc, "%s: ioc_state(0x%08x)\n",
__func__, ioc_state));
/* if in RESET state, it should move to READY state shortly */ /* if in RESET state, it should move to READY state shortly */
count = 0; count = 0;
...@@ -6244,9 +6123,8 @@ _base_make_ioc_ready(struct MPT3SAS_ADAPTER *ioc, enum reset_type type) ...@@ -6244,9 +6123,8 @@ _base_make_ioc_ready(struct MPT3SAS_ADAPTER *ioc, enum reset_type type)
while ((ioc_state & MPI2_IOC_STATE_MASK) != while ((ioc_state & MPI2_IOC_STATE_MASK) !=
MPI2_IOC_STATE_READY) { MPI2_IOC_STATE_READY) {
if (count++ == 10) { if (count++ == 10) {
pr_err(MPT3SAS_FMT ioc_err(ioc, "%s: failed going to ready state (ioc_state=0x%x)\n",
"%s: failed going to ready state (ioc_state=0x%x)\n", __func__, ioc_state);
ioc->name, __func__, ioc_state);
return -EFAULT; return -EFAULT;
} }
ssleep(1); ssleep(1);
...@@ -6258,9 +6136,7 @@ _base_make_ioc_ready(struct MPT3SAS_ADAPTER *ioc, enum reset_type type) ...@@ -6258,9 +6136,7 @@ _base_make_ioc_ready(struct MPT3SAS_ADAPTER *ioc, enum reset_type type)
return 0; return 0;
if (ioc_state & MPI2_DOORBELL_USED) { if (ioc_state & MPI2_DOORBELL_USED) {
dhsprintk(ioc, pr_info(MPT3SAS_FMT dhsprintk(ioc, ioc_info(ioc, "unexpected doorbell active!\n"));
"unexpected doorbell active!\n",
ioc->name));
goto issue_diag_reset; goto issue_diag_reset;
} }
...@@ -6304,8 +6180,7 @@ _base_make_ioc_operational(struct MPT3SAS_ADAPTER *ioc) ...@@ -6304,8 +6180,7 @@ _base_make_ioc_operational(struct MPT3SAS_ADAPTER *ioc)
struct adapter_reply_queue *reply_q; struct adapter_reply_queue *reply_q;
Mpi2ReplyDescriptorsUnion_t *reply_post_free_contig; Mpi2ReplyDescriptorsUnion_t *reply_post_free_contig;
dinitprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name, dinitprintk(ioc, ioc_info(ioc, "%s\n", __func__));
__func__));
/* clean the delayed target reset list */ /* clean the delayed target reset list */
list_for_each_entry_safe(delayed_tr, delayed_tr_next, list_for_each_entry_safe(delayed_tr, delayed_tr_next,
...@@ -6465,8 +6340,7 @@ _base_make_ioc_operational(struct MPT3SAS_ADAPTER *ioc) ...@@ -6465,8 +6340,7 @@ _base_make_ioc_operational(struct MPT3SAS_ADAPTER *ioc)
void void
mpt3sas_base_free_resources(struct MPT3SAS_ADAPTER *ioc) mpt3sas_base_free_resources(struct MPT3SAS_ADAPTER *ioc)
{ {
dexitprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name, dexitprintk(ioc, ioc_info(ioc, "%s\n", __func__));
__func__));
/* synchronizing freeing resource with pci_access_mutex lock */ /* synchronizing freeing resource with pci_access_mutex lock */
mutex_lock(&ioc->pci_access_mutex); mutex_lock(&ioc->pci_access_mutex);
...@@ -6494,8 +6368,7 @@ mpt3sas_base_attach(struct MPT3SAS_ADAPTER *ioc) ...@@ -6494,8 +6368,7 @@ mpt3sas_base_attach(struct MPT3SAS_ADAPTER *ioc)
int r, i; int r, i;
int cpu_id, last_cpu_id = 0; int cpu_id, last_cpu_id = 0;
dinitprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name, dinitprintk(ioc, ioc_info(ioc, "%s\n", __func__));
__func__));
/* setup cpu_msix_table */ /* setup cpu_msix_table */
ioc->cpu_count = num_online_cpus(); ioc->cpu_count = num_online_cpus();
...@@ -6505,9 +6378,8 @@ mpt3sas_base_attach(struct MPT3SAS_ADAPTER *ioc) ...@@ -6505,9 +6378,8 @@ mpt3sas_base_attach(struct MPT3SAS_ADAPTER *ioc)
ioc->cpu_msix_table = kzalloc(ioc->cpu_msix_table_sz, GFP_KERNEL); ioc->cpu_msix_table = kzalloc(ioc->cpu_msix_table_sz, GFP_KERNEL);
ioc->reply_queue_count = 1; ioc->reply_queue_count = 1;
if (!ioc->cpu_msix_table) { if (!ioc->cpu_msix_table) {
dfailprintk(ioc, pr_info(MPT3SAS_FMT dfailprintk(ioc,
"allocation for cpu_msix_table failed!!!\n", ioc_info(ioc, "allocation for cpu_msix_table failed!!!\n"));
ioc->name));
r = -ENOMEM; r = -ENOMEM;
goto out_free_resources; goto out_free_resources;
} }
...@@ -6516,9 +6388,8 @@ mpt3sas_base_attach(struct MPT3SAS_ADAPTER *ioc) ...@@ -6516,9 +6388,8 @@ mpt3sas_base_attach(struct MPT3SAS_ADAPTER *ioc)
ioc->reply_post_host_index = kcalloc(ioc->cpu_msix_table_sz, ioc->reply_post_host_index = kcalloc(ioc->cpu_msix_table_sz,
sizeof(resource_size_t *), GFP_KERNEL); sizeof(resource_size_t *), GFP_KERNEL);
if (!ioc->reply_post_host_index) { if (!ioc->reply_post_host_index) {
dfailprintk(ioc, pr_info(MPT3SAS_FMT "allocation " dfailprintk(ioc,
"for reply_post_host_index failed!!!\n", ioc_info(ioc, "allocation for reply_post_host_index failed!!!\n"));
ioc->name));
r = -ENOMEM; r = -ENOMEM;
goto out_free_resources; goto out_free_resources;
} }
...@@ -6747,8 +6618,7 @@ mpt3sas_base_attach(struct MPT3SAS_ADAPTER *ioc) ...@@ -6747,8 +6618,7 @@ mpt3sas_base_attach(struct MPT3SAS_ADAPTER *ioc)
void void
mpt3sas_base_detach(struct MPT3SAS_ADAPTER *ioc) mpt3sas_base_detach(struct MPT3SAS_ADAPTER *ioc)
{ {
dexitprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name, dexitprintk(ioc, ioc_info(ioc, "%s\n", __func__));
__func__));
mpt3sas_base_stop_watchdog(ioc); mpt3sas_base_stop_watchdog(ioc);
mpt3sas_base_free_resources(ioc); mpt3sas_base_free_resources(ioc);
...@@ -6781,8 +6651,7 @@ static void _base_pre_reset_handler(struct MPT3SAS_ADAPTER *ioc) ...@@ -6781,8 +6651,7 @@ static void _base_pre_reset_handler(struct MPT3SAS_ADAPTER *ioc)
{ {
mpt3sas_scsih_pre_reset_handler(ioc); mpt3sas_scsih_pre_reset_handler(ioc);
mpt3sas_ctl_pre_reset_handler(ioc); mpt3sas_ctl_pre_reset_handler(ioc);
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__));
} }
/** /**
...@@ -6793,8 +6662,7 @@ static void _base_after_reset_handler(struct MPT3SAS_ADAPTER *ioc) ...@@ -6793,8 +6662,7 @@ static void _base_after_reset_handler(struct MPT3SAS_ADAPTER *ioc)
{ {
mpt3sas_scsih_after_reset_handler(ioc); mpt3sas_scsih_after_reset_handler(ioc);
mpt3sas_ctl_after_reset_handler(ioc); mpt3sas_ctl_after_reset_handler(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->transport_cmds.status & MPT3_CMD_PENDING) { if (ioc->transport_cmds.status & MPT3_CMD_PENDING) {
ioc->transport_cmds.status |= MPT3_CMD_RESET; ioc->transport_cmds.status |= MPT3_CMD_RESET;
mpt3sas_base_free_smid(ioc, ioc->transport_cmds.smid); mpt3sas_base_free_smid(ioc, ioc->transport_cmds.smid);
...@@ -6835,8 +6703,7 @@ static void _base_reset_done_handler(struct MPT3SAS_ADAPTER *ioc) ...@@ -6835,8 +6703,7 @@ static void _base_reset_done_handler(struct MPT3SAS_ADAPTER *ioc)
{ {
mpt3sas_scsih_reset_done_handler(ioc); mpt3sas_scsih_reset_done_handler(ioc);
mpt3sas_ctl_reset_done_handler(ioc); mpt3sas_ctl_reset_done_handler(ioc);
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__));
} }
/** /**
...@@ -6883,12 +6750,10 @@ mpt3sas_base_hard_reset_handler(struct MPT3SAS_ADAPTER *ioc, ...@@ -6883,12 +6750,10 @@ mpt3sas_base_hard_reset_handler(struct MPT3SAS_ADAPTER *ioc,
u32 ioc_state; u32 ioc_state;
u8 is_fault = 0, is_trigger = 0; u8 is_fault = 0, is_trigger = 0;
dtmprintk(ioc, pr_info(MPT3SAS_FMT "%s: enter\n", ioc->name, dtmprintk(ioc, ioc_info(ioc, "%s: enter\n", __func__));
__func__));
if (ioc->pci_error_recovery) { if (ioc->pci_error_recovery) {
pr_err(MPT3SAS_FMT "%s: pci error recovery reset\n", ioc_err(ioc, "%s: pci error recovery reset\n", __func__);
ioc->name, __func__);
r = 0; r = 0;
goto out_unlocked; goto out_unlocked;
} }
...@@ -6942,8 +6807,9 @@ mpt3sas_base_hard_reset_handler(struct MPT3SAS_ADAPTER *ioc, ...@@ -6942,8 +6807,9 @@ mpt3sas_base_hard_reset_handler(struct MPT3SAS_ADAPTER *ioc,
_base_reset_done_handler(ioc); _base_reset_done_handler(ioc);
out: out:
dtmprintk(ioc, pr_info(MPT3SAS_FMT "%s: %s\n", dtmprintk(ioc,
ioc->name, __func__, ((r == 0) ? "SUCCESS" : "FAILED"))); ioc_info(ioc, "%s: %s\n",
__func__, r == 0 ? "SUCCESS" : "FAILED"));
spin_lock_irqsave(&ioc->ioc_reset_in_progress_lock, flags); spin_lock_irqsave(&ioc->ioc_reset_in_progress_lock, flags);
ioc->shost_recovery = 0; ioc->shost_recovery = 0;
...@@ -6959,7 +6825,6 @@ mpt3sas_base_hard_reset_handler(struct MPT3SAS_ADAPTER *ioc, ...@@ -6959,7 +6825,6 @@ mpt3sas_base_hard_reset_handler(struct MPT3SAS_ADAPTER *ioc,
mpt3sas_trigger_master(ioc, mpt3sas_trigger_master(ioc,
MASTER_TRIGGER_ADAPTER_RESET); MASTER_TRIGGER_ADAPTER_RESET);
} }
dtmprintk(ioc, pr_info(MPT3SAS_FMT "%s: exit\n", ioc->name, dtmprintk(ioc, ioc_info(ioc, "%s: exit\n", __func__));
__func__));
return r; return r;
} }
...@@ -175,20 +175,18 @@ _config_display_some_debug(struct MPT3SAS_ADAPTER *ioc, u16 smid, ...@@ -175,20 +175,18 @@ _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);
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));
} }
/** /**
...@@ -210,9 +208,8 @@ _config_alloc_config_dma_memory(struct MPT3SAS_ADAPTER *ioc, ...@@ -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 ...@@ -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 ...@@ -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 ...@@ -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 ==
......
...@@ -185,17 +185,15 @@ _ctl_display_some_debug(struct MPT3SAS_ADAPTER *ioc, u16 smid, ...@@ -185,17 +185,15 @@ _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 ||
mpi_request->Function == mpi_request->Function ==
...@@ -208,38 +206,32 @@ _ctl_display_some_debug(struct MPT3SAS_ADAPTER *ioc, u16 smid, ...@@ -208,38 +206,32 @@ _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->slot);
pcie_device->enclosure_logical_id,
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" scsi_reply->SCSIState,
"(0x%02x)\n", ioc->name, scsi_reply->SCSIStatus);
scsi_reply->SCSIState,
scsi_reply->SCSIStatus);
} }
} }
...@@ -466,8 +458,7 @@ void mpt3sas_ctl_pre_reset_handler(struct MPT3SAS_ADAPTER *ioc) ...@@ -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) ...@@ -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) ...@@ -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, ...@@ -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,10 +620,10 @@ _ctl_set_task_mid(struct MPT3SAS_ADAPTER *ioc, struct mpt3_ioctl_command *karg, ...@@ -631,10 +620,10 @@ _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, ...@@ -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, ...@@ -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", __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__);
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, ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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,12 +999,10 @@ _ctl_do_mpt_command(struct MPT3SAS_ADAPTER *ioc, struct mpt3_ioctl_command karg, ...@@ -1017,12 +999,10 @@ _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), " le16_to_cpu(tm_reply->IOCStatus),
"TerminationCount(0x%08x)\n", ioc->name, le32_to_cpu(tm_reply->IOCLogInfo),
le16_to_cpu(tm_reply->IOCStatus), le32_to_cpu(tm_reply->TerminationCount));
le32_to_cpu(tm_reply->IOCLogInfo),
le32_to_cpu(tm_reply->TerminationCount));
} }
/* copy out xdata to user */ /* copy out xdata to user */
...@@ -1054,9 +1034,7 @@ _ctl_do_mpt_command(struct MPT3SAS_ADAPTER *ioc, struct mpt3_ioctl_command karg, ...@@ -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,9 +1057,8 @@ _ctl_do_mpt_command(struct MPT3SAS_ADAPTER *ioc, struct mpt3_ioctl_command karg, ...@@ -1079,9 +1057,8 @@ _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,
le16_to_cpu(mpi_request->FunctionDependent1)); le16_to_cpu(mpi_request->FunctionDependent1));
...@@ -1128,8 +1105,8 @@ _ctl_getiocinfo(struct MPT3SAS_ADAPTER *ioc, void __user *arg) ...@@ -1128,8 +1105,8 @@ _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));
if (ioc->pfacts) if (ioc->pfacts)
...@@ -1188,8 +1165,8 @@ _ctl_eventquery(struct MPT3SAS_ADAPTER *ioc, void __user *arg) ...@@ -1188,8 +1165,8 @@ _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;
memcpy(karg.event_types, ioc->event_type, memcpy(karg.event_types, ioc->event_type,
...@@ -1219,8 +1196,8 @@ _ctl_eventenable(struct MPT3SAS_ADAPTER *ioc, void __user *arg) ...@@ -1219,8 +1196,8 @@ _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,
MPI2_EVENT_NOTIFY_EVENTMASK_WORDS * sizeof(u32)); MPI2_EVENT_NOTIFY_EVENTMASK_WORDS * sizeof(u32));
...@@ -1259,8 +1236,8 @@ _ctl_eventreport(struct MPT3SAS_ADAPTER *ioc, void __user *arg) ...@@ -1259,8 +1236,8 @@ _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 -
sizeof(struct mpt3_ioctl_header); sizeof(struct mpt3_ioctl_header);
...@@ -1306,12 +1283,11 @@ _ctl_do_reset(struct MPT3SAS_ADAPTER *ioc, void __user *arg) ...@@ -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,8 +1416,8 @@ _ctl_btdh_mapping(struct MPT3SAS_ADAPTER *ioc, void __user *arg) ...@@ -1440,8 +1416,8 @@ _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);
if (!rc) if (!rc)
...@@ -1512,53 +1488,46 @@ _ctl_diag_register_2(struct MPT3SAS_ADAPTER *ioc, ...@@ -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, ...@@ -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,11 +1580,11 @@ _ctl_diag_register_2(struct MPT3SAS_ADAPTER *ioc, ...@@ -1612,11 +1580,11 @@ _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)));
for (i = 0; i < MPT3_PRODUCT_SPECIFIC_DWORDS; i++) for (i = 0; i < MPT3_PRODUCT_SPECIFIC_DWORDS; i++)
mpi_request->ProductSpecific[i] = mpi_request->ProductSpecific[i] =
...@@ -1637,8 +1605,7 @@ _ctl_diag_register_2(struct MPT3SAS_ADAPTER *ioc, ...@@ -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,13 +1616,11 @@ _ctl_diag_register_2(struct MPT3SAS_ADAPTER *ioc, ...@@ -1649,13 +1616,11 @@ _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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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,8 +1875,8 @@ mpt3sas_send_diag_release(struct MPT3SAS_ADAPTER *ioc, u8 buffer_type, ...@@ -1923,8 +1875,8 @@ 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;
*issue_reset = 0; *issue_reset = 0;
...@@ -1935,24 +1887,22 @@ mpt3sas_send_diag_release(struct MPT3SAS_ADAPTER *ioc, u8 buffer_type, ...@@ -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, ...@@ -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,13 +1943,11 @@ mpt3sas_send_diag_release(struct MPT3SAS_ADAPTER *ioc, u8 buffer_type, ...@@ -1994,13 +1943,11 @@ 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) ...@@ -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) ...@@ -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,38 +2064,34 @@ _ctl_diag_read_buffer(struct MPT3SAS_ADAPTER *ioc, void __user *arg) ...@@ -2124,38 +2064,34 @@ _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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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, ...@@ -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,8 +2771,8 @@ _ctl_logging_level_store(struct device *cdev, struct device_attribute *attr, ...@@ -2840,8 +2771,8 @@ _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);
} }
static DEVICE_ATTR(logging_level, S_IRUGO | S_IWUSR, _ctl_logging_level_show, static DEVICE_ATTR(logging_level, S_IRUGO | S_IWUSR, _ctl_logging_level_show,
...@@ -2877,8 +2808,8 @@ _ctl_fwfault_debug_store(struct device *cdev, struct device_attribute *attr, ...@@ -2877,8 +2808,8 @@ _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);
} }
static DEVICE_ATTR(fwfault_debug, S_IRUGO | S_IWUSR, static DEVICE_ATTR(fwfault_debug, S_IRUGO | S_IWUSR,
...@@ -2958,8 +2889,8 @@ _ctl_BRM_status_show(struct device *cdev, struct device_attribute *attr, ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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);
} }
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -153,18 +153,16 @@ _transport_set_identify(struct MPT3SAS_ADAPTER *ioc, u16 handle, ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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 ...@@ -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 ...@@ -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 ...@@ -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 ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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,17 +1256,16 @@ _transport_get_linkerrors(struct sas_phy *phy) ...@@ -1273,17 +1256,16 @@ _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));
phy->invalid_dword_count = le32_to_cpu(phy_pg1.InvalidDwordCount); phy->invalid_dword_count = le32_to_cpu(phy_pg1.InvalidDwordCount);
phy->running_disparity_error_count = phy->running_disparity_error_count =
...@@ -1419,8 +1401,7 @@ _transport_expander_phy_control(struct MPT3SAS_ADAPTER *ioc, ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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,16 +1566,15 @@ _transport_phy_reset(struct sas_phy *phy, int hard_reset) ...@@ -1591,16 +1566,15 @@ _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) ...@@ -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,10 +1646,8 @@ _transport_phy_enable(struct sas_phy *phy, int enable) ...@@ -1672,10 +1646,8 @@ _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 " sas_iounit_pg0->PhyData[i].Port, i);
"phys, try again later!\n", ioc->name,
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) ...@@ -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) ...@@ -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) ...@@ -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,8 +1905,8 @@ _transport_smp_handler(struct bsg_job *job, struct Scsi_Host *shost, ...@@ -1933,8 +1905,8 @@ _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, ...@@ -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, ...@@ -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, ...@@ -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,9 +1998,9 @@ _transport_smp_handler(struct bsg_job *job, struct Scsi_Host *shost, ...@@ -2031,9 +1998,9 @@ _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));
job->reply_len = sizeof(*mpi_reply); job->reply_len = sizeof(*mpi_reply);
......
...@@ -72,8 +72,7 @@ _mpt3sas_raise_sigio(struct MPT3SAS_ADAPTER *ioc, ...@@ -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,23 +84,23 @@ _mpt3sas_raise_sigio(struct MPT3SAS_ADAPTER *ioc, ...@@ -85,23 +84,23 @@ _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,22 +114,22 @@ mpt3sas_process_trigger_data(struct MPT3SAS_ADAPTER *ioc, ...@@ -115,22 +114,22 @@ 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) ...@@ -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) ...@@ -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,8 +201,8 @@ mpt3sas_trigger_master(struct MPT3SAS_ADAPTER *ioc, u32 trigger_bitmask) ...@@ -202,8 +201,8 @@ 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, ...@@ -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,26 +262,26 @@ mpt3sas_trigger_event(struct MPT3SAS_ADAPTER *ioc, u16 event, ...@@ -263,26 +262,26 @@ 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, ...@@ -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, ...@@ -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,8 +356,8 @@ mpt3sas_trigger_scsi(struct MPT3SAS_ADAPTER *ioc, u8 sense_key, u8 asc, ...@@ -357,8 +356,8 @@ 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) ...@@ -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) ...@@ -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__));
} }
...@@ -127,20 +127,17 @@ mpt3sas_init_warpdrive_properties(struct MPT3SAS_ADAPTER *ioc, ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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", vol_pg0->PhysDisk[count].PhysDiskNum);
ioc->name, raid_device->handle,
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", le16_to_cpu(pd_pg0.DevHandle),
ioc->name, raid_device->handle, (u64)dev_max_lba);
le16_to_cpu(pd_pg0.DevHandle),
(unsigned long long)dev_max_lba);
goto out_error; goto out_error;
} }
...@@ -206,41 +195,36 @@ mpt3sas_init_warpdrive_properties(struct MPT3SAS_ADAPTER *ioc, ...@@ -206,41 +195,36 @@ 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, " raid_device->handle, raid_device->volume_type,
"s_sz=%uK, blk_size=%u\n", ioc->name, (le32_to_cpu(vol_pg0->StripeSize) *
raid_device->handle, raid_device->volume_type, le16_to_cpu(vol_pg0->BlockSize)) / 1024,
(le32_to_cpu(vol_pg0->StripeSize) * le16_to_cpu(vol_pg0->BlockSize));
le16_to_cpu(vol_pg0->BlockSize)) / 1024,
le16_to_cpu(vol_pg0->BlockSize));
goto out_error; goto out_error;
} }
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;
} }
raid_device->stripe_exponent = stripe_exp; raid_device->stripe_exponent = stripe_exp;
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:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment