.. | .. |
---|
146 | 146 | u32 ioc_status; |
---|
147 | 147 | |
---|
148 | 148 | if (ioc->shost_recovery || ioc->pci_error_recovery) { |
---|
149 | | - pr_info(MPT3SAS_FMT "%s: host reset in progress!\n", |
---|
150 | | - __func__, ioc->name); |
---|
| 149 | + ioc_info(ioc, "%s: host reset in progress!\n", __func__); |
---|
151 | 150 | return -EFAULT; |
---|
152 | 151 | } |
---|
153 | 152 | |
---|
154 | 153 | if ((mpt3sas_config_get_sas_device_pg0(ioc, &mpi_reply, &sas_device_pg0, |
---|
155 | 154 | MPI2_SAS_DEVICE_PGAD_FORM_HANDLE, handle))) { |
---|
156 | | - pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", |
---|
157 | | - ioc->name, __FILE__, __LINE__, __func__); |
---|
| 155 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", |
---|
| 156 | + __FILE__, __LINE__, __func__); |
---|
158 | 157 | return -ENXIO; |
---|
159 | 158 | } |
---|
160 | 159 | |
---|
161 | 160 | ioc_status = le16_to_cpu(mpi_reply.IOCStatus) & |
---|
162 | 161 | MPI2_IOCSTATUS_MASK; |
---|
163 | 162 | if (ioc_status != MPI2_IOCSTATUS_SUCCESS) { |
---|
164 | | - pr_err(MPT3SAS_FMT |
---|
165 | | - "handle(0x%04x), ioc_status(0x%04x)\nfailure at %s:%d/%s()!\n", |
---|
166 | | - ioc->name, handle, ioc_status, |
---|
167 | | - __FILE__, __LINE__, __func__); |
---|
| 163 | + ioc_err(ioc, "handle(0x%04x), ioc_status(0x%04x) failure at %s:%d/%s()!\n", |
---|
| 164 | + handle, ioc_status, __FILE__, __LINE__, __func__); |
---|
168 | 165 | return -EIO; |
---|
169 | 166 | } |
---|
170 | 167 | |
---|
.. | .. |
---|
299 | 296 | struct rep_manu_request *manufacture_request; |
---|
300 | 297 | int rc; |
---|
301 | 298 | u16 smid; |
---|
302 | | - u32 ioc_state; |
---|
303 | 299 | void *psge; |
---|
304 | 300 | u8 issue_reset = 0; |
---|
305 | 301 | void *data_out = NULL; |
---|
.. | .. |
---|
307 | 303 | dma_addr_t data_in_dma; |
---|
308 | 304 | size_t data_in_sz; |
---|
309 | 305 | size_t data_out_sz; |
---|
310 | | - u16 wait_state_count; |
---|
311 | 306 | |
---|
312 | 307 | if (ioc->shost_recovery || ioc->pci_error_recovery) { |
---|
313 | | - pr_info(MPT3SAS_FMT "%s: host reset in progress!\n", |
---|
314 | | - __func__, ioc->name); |
---|
| 308 | + ioc_info(ioc, "%s: host reset in progress!\n", __func__); |
---|
315 | 309 | return -EFAULT; |
---|
316 | 310 | } |
---|
317 | 311 | |
---|
318 | 312 | mutex_lock(&ioc->transport_cmds.mutex); |
---|
319 | 313 | |
---|
320 | 314 | if (ioc->transport_cmds.status != MPT3_CMD_NOT_USED) { |
---|
321 | | - pr_err(MPT3SAS_FMT "%s: transport_cmds in use\n", |
---|
322 | | - ioc->name, __func__); |
---|
| 315 | + ioc_err(ioc, "%s: transport_cmds in use\n", __func__); |
---|
323 | 316 | rc = -EAGAIN; |
---|
324 | 317 | goto out; |
---|
325 | 318 | } |
---|
326 | 319 | ioc->transport_cmds.status = MPT3_CMD_PENDING; |
---|
327 | 320 | |
---|
328 | | - wait_state_count = 0; |
---|
329 | | - ioc_state = mpt3sas_base_get_iocstate(ioc, 1); |
---|
330 | | - while (ioc_state != MPI2_IOC_STATE_OPERATIONAL) { |
---|
331 | | - if (wait_state_count++ == 10) { |
---|
332 | | - pr_err(MPT3SAS_FMT |
---|
333 | | - "%s: failed due to ioc not operational\n", |
---|
334 | | - ioc->name, __func__); |
---|
335 | | - rc = -EFAULT; |
---|
336 | | - goto out; |
---|
337 | | - } |
---|
338 | | - ssleep(1); |
---|
339 | | - ioc_state = mpt3sas_base_get_iocstate(ioc, 1); |
---|
340 | | - pr_info(MPT3SAS_FMT |
---|
341 | | - "%s: waiting for operational state(count=%d)\n", |
---|
342 | | - ioc->name, __func__, wait_state_count); |
---|
343 | | - } |
---|
344 | | - if (wait_state_count) |
---|
345 | | - pr_info(MPT3SAS_FMT "%s: ioc is operational\n", |
---|
346 | | - ioc->name, __func__); |
---|
| 321 | + rc = mpt3sas_wait_for_ioc(ioc, IOC_OPERATIONAL_WAIT_COUNT); |
---|
| 322 | + if (rc) |
---|
| 323 | + goto out; |
---|
347 | 324 | |
---|
348 | 325 | smid = mpt3sas_base_get_smid(ioc, ioc->transport_cb_idx); |
---|
349 | 326 | if (!smid) { |
---|
350 | | - pr_err(MPT3SAS_FMT "%s: failed obtaining a smid\n", |
---|
351 | | - ioc->name, __func__); |
---|
| 327 | + ioc_err(ioc, "%s: failed obtaining a smid\n", __func__); |
---|
352 | 328 | rc = -EAGAIN; |
---|
353 | 329 | goto out; |
---|
354 | 330 | } |
---|
.. | .. |
---|
359 | 335 | |
---|
360 | 336 | data_out_sz = sizeof(struct rep_manu_request); |
---|
361 | 337 | data_in_sz = sizeof(struct rep_manu_reply); |
---|
362 | | - data_out = pci_alloc_consistent(ioc->pdev, data_out_sz + data_in_sz, |
---|
363 | | - &data_out_dma); |
---|
364 | | - |
---|
| 338 | + data_out = dma_alloc_coherent(&ioc->pdev->dev, data_out_sz + data_in_sz, |
---|
| 339 | + &data_out_dma, GFP_KERNEL); |
---|
365 | 340 | if (!data_out) { |
---|
366 | 341 | pr_err("failure at %s:%d/%s()!\n", __FILE__, |
---|
367 | 342 | __LINE__, __func__); |
---|
.. | .. |
---|
388 | 363 | ioc->build_sg(ioc, psge, data_out_dma, data_out_sz, data_in_dma, |
---|
389 | 364 | data_in_sz); |
---|
390 | 365 | |
---|
391 | | - dtransportprintk(ioc, pr_info(MPT3SAS_FMT |
---|
392 | | - "report_manufacture - send to sas_addr(0x%016llx)\n", |
---|
393 | | - ioc->name, (unsigned long long)sas_address)); |
---|
| 366 | + dtransportprintk(ioc, |
---|
| 367 | + ioc_info(ioc, "report_manufacture - send to sas_addr(0x%016llx)\n", |
---|
| 368 | + (u64)sas_address)); |
---|
394 | 369 | init_completion(&ioc->transport_cmds.done); |
---|
395 | | - mpt3sas_base_put_smid_default(ioc, smid); |
---|
| 370 | + ioc->put_smid_default(ioc, smid); |
---|
396 | 371 | wait_for_completion_timeout(&ioc->transport_cmds.done, 10*HZ); |
---|
397 | 372 | |
---|
398 | 373 | if (!(ioc->transport_cmds.status & MPT3_CMD_COMPLETE)) { |
---|
399 | | - pr_err(MPT3SAS_FMT "%s: timeout\n", |
---|
400 | | - ioc->name, __func__); |
---|
| 374 | + ioc_err(ioc, "%s: timeout\n", __func__); |
---|
401 | 375 | _debug_dump_mf(mpi_request, |
---|
402 | 376 | sizeof(Mpi2SmpPassthroughRequest_t)/4); |
---|
403 | 377 | if (!(ioc->transport_cmds.status & MPT3_CMD_RESET)) |
---|
.. | .. |
---|
405 | 379 | goto issue_host_reset; |
---|
406 | 380 | } |
---|
407 | 381 | |
---|
408 | | - dtransportprintk(ioc, pr_info(MPT3SAS_FMT |
---|
409 | | - "report_manufacture - complete\n", ioc->name)); |
---|
| 382 | + dtransportprintk(ioc, ioc_info(ioc, "report_manufacture - complete\n")); |
---|
410 | 383 | |
---|
411 | 384 | if (ioc->transport_cmds.status & MPT3_CMD_REPLY_VALID) { |
---|
412 | 385 | u8 *tmp; |
---|
413 | 386 | |
---|
414 | 387 | mpi_reply = ioc->transport_cmds.reply; |
---|
415 | 388 | |
---|
416 | | - dtransportprintk(ioc, pr_info(MPT3SAS_FMT |
---|
417 | | - "report_manufacture - reply data transfer size(%d)\n", |
---|
418 | | - ioc->name, le16_to_cpu(mpi_reply->ResponseDataLength))); |
---|
| 389 | + dtransportprintk(ioc, |
---|
| 390 | + ioc_info(ioc, "report_manufacture - reply data transfer size(%d)\n", |
---|
| 391 | + le16_to_cpu(mpi_reply->ResponseDataLength))); |
---|
419 | 392 | |
---|
420 | 393 | if (le16_to_cpu(mpi_reply->ResponseDataLength) != |
---|
421 | 394 | sizeof(struct rep_manu_reply)) |
---|
.. | .. |
---|
439 | 412 | manufacture_reply->component_revision_id; |
---|
440 | 413 | } |
---|
441 | 414 | } else |
---|
442 | | - dtransportprintk(ioc, pr_info(MPT3SAS_FMT |
---|
443 | | - "report_manufacture - no reply\n", ioc->name)); |
---|
| 415 | + dtransportprintk(ioc, |
---|
| 416 | + ioc_info(ioc, "report_manufacture - no reply\n")); |
---|
444 | 417 | |
---|
445 | 418 | issue_host_reset: |
---|
446 | 419 | if (issue_reset) |
---|
.. | .. |
---|
448 | 421 | out: |
---|
449 | 422 | ioc->transport_cmds.status = MPT3_CMD_NOT_USED; |
---|
450 | 423 | if (data_out) |
---|
451 | | - pci_free_consistent(ioc->pdev, data_out_sz + data_in_sz, |
---|
| 424 | + dma_free_coherent(&ioc->pdev->dev, data_out_sz + data_in_sz, |
---|
452 | 425 | data_out, data_out_dma); |
---|
453 | 426 | |
---|
454 | 427 | mutex_unlock(&ioc->transport_cmds.mutex); |
---|
.. | .. |
---|
643 | 616 | mpt3sas_port = kzalloc(sizeof(struct _sas_port), |
---|
644 | 617 | GFP_KERNEL); |
---|
645 | 618 | if (!mpt3sas_port) { |
---|
646 | | - pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", |
---|
647 | | - ioc->name, __FILE__, __LINE__, __func__); |
---|
| 619 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", |
---|
| 620 | + __FILE__, __LINE__, __func__); |
---|
648 | 621 | return NULL; |
---|
649 | 622 | } |
---|
650 | 623 | |
---|
.. | .. |
---|
655 | 628 | spin_unlock_irqrestore(&ioc->sas_node_lock, flags); |
---|
656 | 629 | |
---|
657 | 630 | if (!sas_node) { |
---|
658 | | - pr_err(MPT3SAS_FMT |
---|
659 | | - "%s: Could not find parent sas_address(0x%016llx)!\n", |
---|
660 | | - ioc->name, __func__, (unsigned long long)sas_address); |
---|
| 631 | + ioc_err(ioc, "%s: Could not find parent sas_address(0x%016llx)!\n", |
---|
| 632 | + __func__, (u64)sas_address); |
---|
661 | 633 | goto out_fail; |
---|
662 | 634 | } |
---|
663 | 635 | |
---|
664 | 636 | if ((_transport_set_identify(ioc, handle, |
---|
665 | 637 | &mpt3sas_port->remote_identify))) { |
---|
666 | | - pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", |
---|
667 | | - ioc->name, __FILE__, __LINE__, __func__); |
---|
| 638 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", |
---|
| 639 | + __FILE__, __LINE__, __func__); |
---|
668 | 640 | goto out_fail; |
---|
669 | 641 | } |
---|
670 | 642 | |
---|
671 | 643 | if (mpt3sas_port->remote_identify.device_type == SAS_PHY_UNUSED) { |
---|
672 | | - pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", |
---|
673 | | - ioc->name, __FILE__, __LINE__, __func__); |
---|
| 644 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", |
---|
| 645 | + __FILE__, __LINE__, __func__); |
---|
674 | 646 | goto out_fail; |
---|
675 | 647 | } |
---|
676 | 648 | |
---|
.. | .. |
---|
687 | 659 | } |
---|
688 | 660 | |
---|
689 | 661 | if (!mpt3sas_port->num_phys) { |
---|
690 | | - pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", |
---|
691 | | - ioc->name, __FILE__, __LINE__, __func__); |
---|
| 662 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", |
---|
| 663 | + __FILE__, __LINE__, __func__); |
---|
692 | 664 | goto out_fail; |
---|
693 | 665 | } |
---|
694 | 666 | |
---|
695 | 667 | if (!sas_node->parent_dev) { |
---|
696 | | - pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", |
---|
697 | | - ioc->name, __FILE__, __LINE__, __func__); |
---|
| 668 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", |
---|
| 669 | + __FILE__, __LINE__, __func__); |
---|
698 | 670 | goto out_fail; |
---|
699 | 671 | } |
---|
700 | 672 | port = sas_port_alloc_num(sas_node->parent_dev); |
---|
701 | 673 | if ((sas_port_add(port))) { |
---|
702 | | - pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", |
---|
703 | | - ioc->name, __FILE__, __LINE__, __func__); |
---|
| 674 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", |
---|
| 675 | + __FILE__, __LINE__, __func__); |
---|
704 | 676 | goto out_fail; |
---|
705 | 677 | } |
---|
706 | 678 | |
---|
.. | .. |
---|
729 | 701 | sas_device = mpt3sas_get_sdev_by_addr(ioc, |
---|
730 | 702 | mpt3sas_port->remote_identify.sas_address); |
---|
731 | 703 | if (!sas_device) { |
---|
732 | | - dfailprintk(ioc, printk(MPT3SAS_FMT |
---|
733 | | - "failure at %s:%d/%s()!\n", |
---|
734 | | - ioc->name, __FILE__, __LINE__, __func__)); |
---|
| 704 | + dfailprintk(ioc, |
---|
| 705 | + ioc_info(ioc, "failure at %s:%d/%s()!\n", |
---|
| 706 | + __FILE__, __LINE__, __func__)); |
---|
735 | 707 | goto out_fail; |
---|
736 | 708 | } |
---|
737 | 709 | sas_device->pend_sas_rphy_add = 1; |
---|
738 | 710 | } |
---|
739 | 711 | |
---|
740 | 712 | if ((sas_rphy_add(rphy))) { |
---|
741 | | - pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", |
---|
742 | | - ioc->name, __FILE__, __LINE__, __func__); |
---|
| 713 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", |
---|
| 714 | + __FILE__, __LINE__, __func__); |
---|
743 | 715 | } |
---|
744 | 716 | |
---|
745 | 717 | if (mpt3sas_port->remote_identify.device_type == SAS_END_DEVICE) { |
---|
.. | .. |
---|
747 | 719 | sas_device_put(sas_device); |
---|
748 | 720 | } |
---|
749 | 721 | |
---|
750 | | - if ((ioc->logging_level & MPT_DEBUG_TRANSPORT)) |
---|
751 | | - dev_printk(KERN_INFO, &rphy->dev, |
---|
752 | | - "add: handle(0x%04x), sas_addr(0x%016llx)\n", |
---|
753 | | - handle, (unsigned long long) |
---|
754 | | - mpt3sas_port->remote_identify.sas_address); |
---|
| 722 | + dev_info(&rphy->dev, |
---|
| 723 | + "add: handle(0x%04x), sas_addr(0x%016llx)\n", handle, |
---|
| 724 | + (unsigned long long)mpt3sas_port->remote_identify.sas_address); |
---|
| 725 | + |
---|
755 | 726 | mpt3sas_port->rphy = rphy; |
---|
756 | 727 | spin_lock_irqsave(&ioc->sas_node_lock, flags); |
---|
757 | 728 | list_add_tail(&mpt3sas_port->port_list, &sas_node->sas_port_list); |
---|
.. | .. |
---|
841 | 812 | } |
---|
842 | 813 | if (!ioc->remove_host) |
---|
843 | 814 | sas_port_delete(mpt3sas_port->port); |
---|
| 815 | + ioc_info(ioc, "%s: removed: sas_addr(0x%016llx)\n", |
---|
| 816 | + __func__, (unsigned long long)sas_address); |
---|
844 | 817 | kfree(mpt3sas_port); |
---|
845 | 818 | } |
---|
846 | 819 | |
---|
.. | .. |
---|
864 | 837 | INIT_LIST_HEAD(&mpt3sas_phy->port_siblings); |
---|
865 | 838 | phy = sas_phy_alloc(parent_dev, phy_index); |
---|
866 | 839 | if (!phy) { |
---|
867 | | - pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", |
---|
868 | | - ioc->name, __FILE__, __LINE__, __func__); |
---|
| 840 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", |
---|
| 841 | + __FILE__, __LINE__, __func__); |
---|
869 | 842 | return -1; |
---|
870 | 843 | } |
---|
871 | 844 | if ((_transport_set_identify(ioc, mpt3sas_phy->handle, |
---|
872 | 845 | &mpt3sas_phy->identify))) { |
---|
873 | | - pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", |
---|
874 | | - ioc->name, __FILE__, __LINE__, __func__); |
---|
| 846 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", |
---|
| 847 | + __FILE__, __LINE__, __func__); |
---|
875 | 848 | sas_phy_free(phy); |
---|
876 | 849 | return -1; |
---|
877 | 850 | } |
---|
.. | .. |
---|
893 | 866 | phy_pg0.ProgrammedLinkRate >> 4); |
---|
894 | 867 | |
---|
895 | 868 | if ((sas_phy_add(phy))) { |
---|
896 | | - pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", |
---|
897 | | - ioc->name, __FILE__, __LINE__, __func__); |
---|
| 869 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", |
---|
| 870 | + __FILE__, __LINE__, __func__); |
---|
898 | 871 | sas_phy_free(phy); |
---|
899 | 872 | return -1; |
---|
900 | 873 | } |
---|
.. | .. |
---|
932 | 905 | INIT_LIST_HEAD(&mpt3sas_phy->port_siblings); |
---|
933 | 906 | phy = sas_phy_alloc(parent_dev, phy_index); |
---|
934 | 907 | if (!phy) { |
---|
935 | | - pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", |
---|
936 | | - ioc->name, __FILE__, __LINE__, __func__); |
---|
| 908 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", |
---|
| 909 | + __FILE__, __LINE__, __func__); |
---|
937 | 910 | return -1; |
---|
938 | 911 | } |
---|
939 | 912 | if ((_transport_set_identify(ioc, mpt3sas_phy->handle, |
---|
940 | 913 | &mpt3sas_phy->identify))) { |
---|
941 | | - pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", |
---|
942 | | - ioc->name, __FILE__, __LINE__, __func__); |
---|
| 914 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", |
---|
| 915 | + __FILE__, __LINE__, __func__); |
---|
943 | 916 | sas_phy_free(phy); |
---|
944 | 917 | return -1; |
---|
945 | 918 | } |
---|
.. | .. |
---|
963 | 936 | expander_pg1.ProgrammedLinkRate >> 4); |
---|
964 | 937 | |
---|
965 | 938 | if ((sas_phy_add(phy))) { |
---|
966 | | - pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", |
---|
967 | | - ioc->name, __FILE__, __LINE__, __func__); |
---|
| 939 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", |
---|
| 940 | + __FILE__, __LINE__, __func__); |
---|
968 | 941 | sas_phy_free(phy); |
---|
969 | 942 | return -1; |
---|
970 | 943 | } |
---|
.. | .. |
---|
1092 | 1065 | struct phy_error_log_reply *phy_error_log_reply; |
---|
1093 | 1066 | int rc; |
---|
1094 | 1067 | u16 smid; |
---|
1095 | | - u32 ioc_state; |
---|
1096 | 1068 | void *psge; |
---|
1097 | 1069 | u8 issue_reset = 0; |
---|
1098 | 1070 | void *data_out = NULL; |
---|
1099 | 1071 | dma_addr_t data_out_dma; |
---|
1100 | 1072 | u32 sz; |
---|
1101 | | - u16 wait_state_count; |
---|
1102 | 1073 | |
---|
1103 | 1074 | if (ioc->shost_recovery || ioc->pci_error_recovery) { |
---|
1104 | | - pr_info(MPT3SAS_FMT "%s: host reset in progress!\n", |
---|
1105 | | - __func__, ioc->name); |
---|
| 1075 | + ioc_info(ioc, "%s: host reset in progress!\n", __func__); |
---|
1106 | 1076 | return -EFAULT; |
---|
1107 | 1077 | } |
---|
1108 | 1078 | |
---|
1109 | 1079 | mutex_lock(&ioc->transport_cmds.mutex); |
---|
1110 | 1080 | |
---|
1111 | 1081 | if (ioc->transport_cmds.status != MPT3_CMD_NOT_USED) { |
---|
1112 | | - pr_err(MPT3SAS_FMT "%s: transport_cmds in use\n", |
---|
1113 | | - ioc->name, __func__); |
---|
| 1082 | + ioc_err(ioc, "%s: transport_cmds in use\n", __func__); |
---|
1114 | 1083 | rc = -EAGAIN; |
---|
1115 | 1084 | goto out; |
---|
1116 | 1085 | } |
---|
1117 | 1086 | ioc->transport_cmds.status = MPT3_CMD_PENDING; |
---|
1118 | 1087 | |
---|
1119 | | - wait_state_count = 0; |
---|
1120 | | - ioc_state = mpt3sas_base_get_iocstate(ioc, 1); |
---|
1121 | | - while (ioc_state != MPI2_IOC_STATE_OPERATIONAL) { |
---|
1122 | | - if (wait_state_count++ == 10) { |
---|
1123 | | - pr_err(MPT3SAS_FMT |
---|
1124 | | - "%s: failed due to ioc not operational\n", |
---|
1125 | | - ioc->name, __func__); |
---|
1126 | | - rc = -EFAULT; |
---|
1127 | | - goto out; |
---|
1128 | | - } |
---|
1129 | | - ssleep(1); |
---|
1130 | | - ioc_state = mpt3sas_base_get_iocstate(ioc, 1); |
---|
1131 | | - pr_info(MPT3SAS_FMT |
---|
1132 | | - "%s: waiting for operational state(count=%d)\n", |
---|
1133 | | - ioc->name, __func__, wait_state_count); |
---|
1134 | | - } |
---|
1135 | | - if (wait_state_count) |
---|
1136 | | - pr_info(MPT3SAS_FMT "%s: ioc is operational\n", |
---|
1137 | | - ioc->name, __func__); |
---|
| 1088 | + rc = mpt3sas_wait_for_ioc(ioc, IOC_OPERATIONAL_WAIT_COUNT); |
---|
| 1089 | + if (rc) |
---|
| 1090 | + goto out; |
---|
1138 | 1091 | |
---|
1139 | 1092 | smid = mpt3sas_base_get_smid(ioc, ioc->transport_cb_idx); |
---|
1140 | 1093 | if (!smid) { |
---|
1141 | | - pr_err(MPT3SAS_FMT "%s: failed obtaining a smid\n", |
---|
1142 | | - ioc->name, __func__); |
---|
| 1094 | + ioc_err(ioc, "%s: failed obtaining a smid\n", __func__); |
---|
1143 | 1095 | rc = -EAGAIN; |
---|
1144 | 1096 | goto out; |
---|
1145 | 1097 | } |
---|
.. | .. |
---|
1149 | 1101 | |
---|
1150 | 1102 | sz = sizeof(struct phy_error_log_request) + |
---|
1151 | 1103 | sizeof(struct phy_error_log_reply); |
---|
1152 | | - data_out = pci_alloc_consistent(ioc->pdev, sz, &data_out_dma); |
---|
| 1104 | + data_out = dma_alloc_coherent(&ioc->pdev->dev, sz, &data_out_dma, |
---|
| 1105 | + GFP_KERNEL); |
---|
1153 | 1106 | if (!data_out) { |
---|
1154 | 1107 | pr_err("failure at %s:%d/%s()!\n", __FILE__, |
---|
1155 | 1108 | __LINE__, __func__); |
---|
.. | .. |
---|
1182 | 1135 | data_out_dma + sizeof(struct phy_error_log_request), |
---|
1183 | 1136 | sizeof(struct phy_error_log_reply)); |
---|
1184 | 1137 | |
---|
1185 | | - dtransportprintk(ioc, pr_info(MPT3SAS_FMT |
---|
1186 | | - "phy_error_log - send to sas_addr(0x%016llx), phy(%d)\n", |
---|
1187 | | - ioc->name, (unsigned long long)phy->identify.sas_address, |
---|
1188 | | - phy->number)); |
---|
| 1138 | + dtransportprintk(ioc, |
---|
| 1139 | + ioc_info(ioc, "phy_error_log - send to sas_addr(0x%016llx), phy(%d)\n", |
---|
| 1140 | + (u64)phy->identify.sas_address, |
---|
| 1141 | + phy->number)); |
---|
1189 | 1142 | init_completion(&ioc->transport_cmds.done); |
---|
1190 | | - mpt3sas_base_put_smid_default(ioc, smid); |
---|
| 1143 | + ioc->put_smid_default(ioc, smid); |
---|
1191 | 1144 | wait_for_completion_timeout(&ioc->transport_cmds.done, 10*HZ); |
---|
1192 | 1145 | |
---|
1193 | 1146 | if (!(ioc->transport_cmds.status & MPT3_CMD_COMPLETE)) { |
---|
1194 | | - pr_err(MPT3SAS_FMT "%s: timeout\n", |
---|
1195 | | - ioc->name, __func__); |
---|
| 1147 | + ioc_err(ioc, "%s: timeout\n", __func__); |
---|
1196 | 1148 | _debug_dump_mf(mpi_request, |
---|
1197 | 1149 | sizeof(Mpi2SmpPassthroughRequest_t)/4); |
---|
1198 | 1150 | if (!(ioc->transport_cmds.status & MPT3_CMD_RESET)) |
---|
.. | .. |
---|
1200 | 1152 | goto issue_host_reset; |
---|
1201 | 1153 | } |
---|
1202 | 1154 | |
---|
1203 | | - dtransportprintk(ioc, pr_info(MPT3SAS_FMT |
---|
1204 | | - "phy_error_log - complete\n", ioc->name)); |
---|
| 1155 | + dtransportprintk(ioc, ioc_info(ioc, "phy_error_log - complete\n")); |
---|
1205 | 1156 | |
---|
1206 | 1157 | if (ioc->transport_cmds.status & MPT3_CMD_REPLY_VALID) { |
---|
1207 | 1158 | |
---|
1208 | 1159 | mpi_reply = ioc->transport_cmds.reply; |
---|
1209 | 1160 | |
---|
1210 | | - dtransportprintk(ioc, pr_info(MPT3SAS_FMT |
---|
1211 | | - "phy_error_log - reply data transfer size(%d)\n", |
---|
1212 | | - ioc->name, le16_to_cpu(mpi_reply->ResponseDataLength))); |
---|
| 1161 | + dtransportprintk(ioc, |
---|
| 1162 | + ioc_info(ioc, "phy_error_log - reply data transfer size(%d)\n", |
---|
| 1163 | + le16_to_cpu(mpi_reply->ResponseDataLength))); |
---|
1213 | 1164 | |
---|
1214 | 1165 | if (le16_to_cpu(mpi_reply->ResponseDataLength) != |
---|
1215 | 1166 | sizeof(struct phy_error_log_reply)) |
---|
.. | .. |
---|
1218 | 1169 | phy_error_log_reply = data_out + |
---|
1219 | 1170 | sizeof(struct phy_error_log_request); |
---|
1220 | 1171 | |
---|
1221 | | - dtransportprintk(ioc, pr_info(MPT3SAS_FMT |
---|
1222 | | - "phy_error_log - function_result(%d)\n", |
---|
1223 | | - ioc->name, phy_error_log_reply->function_result)); |
---|
| 1172 | + dtransportprintk(ioc, |
---|
| 1173 | + ioc_info(ioc, "phy_error_log - function_result(%d)\n", |
---|
| 1174 | + phy_error_log_reply->function_result)); |
---|
1224 | 1175 | |
---|
1225 | 1176 | phy->invalid_dword_count = |
---|
1226 | 1177 | be32_to_cpu(phy_error_log_reply->invalid_dword); |
---|
.. | .. |
---|
1232 | 1183 | be32_to_cpu(phy_error_log_reply->phy_reset_problem); |
---|
1233 | 1184 | rc = 0; |
---|
1234 | 1185 | } else |
---|
1235 | | - dtransportprintk(ioc, pr_info(MPT3SAS_FMT |
---|
1236 | | - "phy_error_log - no reply\n", ioc->name)); |
---|
| 1186 | + dtransportprintk(ioc, |
---|
| 1187 | + ioc_info(ioc, "phy_error_log - no reply\n")); |
---|
1237 | 1188 | |
---|
1238 | 1189 | issue_host_reset: |
---|
1239 | 1190 | if (issue_reset) |
---|
.. | .. |
---|
1241 | 1192 | out: |
---|
1242 | 1193 | ioc->transport_cmds.status = MPT3_CMD_NOT_USED; |
---|
1243 | 1194 | if (data_out) |
---|
1244 | | - pci_free_consistent(ioc->pdev, sz, data_out, data_out_dma); |
---|
| 1195 | + dma_free_coherent(&ioc->pdev->dev, sz, data_out, data_out_dma); |
---|
1245 | 1196 | |
---|
1246 | 1197 | mutex_unlock(&ioc->transport_cmds.mutex); |
---|
1247 | 1198 | return rc; |
---|
.. | .. |
---|
1276 | 1227 | /* get hba phy error logs */ |
---|
1277 | 1228 | if ((mpt3sas_config_get_phy_pg1(ioc, &mpi_reply, &phy_pg1, |
---|
1278 | 1229 | phy->number))) { |
---|
1279 | | - pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", |
---|
1280 | | - ioc->name, __FILE__, __LINE__, __func__); |
---|
| 1230 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", |
---|
| 1231 | + __FILE__, __LINE__, __func__); |
---|
1281 | 1232 | return -ENXIO; |
---|
1282 | 1233 | } |
---|
1283 | 1234 | |
---|
1284 | 1235 | if (mpi_reply.IOCStatus || mpi_reply.IOCLogInfo) |
---|
1285 | | - pr_info(MPT3SAS_FMT |
---|
1286 | | - "phy(%d), ioc_status (0x%04x), loginfo(0x%08x)\n", |
---|
1287 | | - ioc->name, phy->number, |
---|
1288 | | - le16_to_cpu(mpi_reply.IOCStatus), |
---|
1289 | | - le32_to_cpu(mpi_reply.IOCLogInfo)); |
---|
| 1236 | + ioc_info(ioc, "phy(%d), ioc_status (0x%04x), loginfo(0x%08x)\n", |
---|
| 1237 | + phy->number, |
---|
| 1238 | + le16_to_cpu(mpi_reply.IOCStatus), |
---|
| 1239 | + le32_to_cpu(mpi_reply.IOCLogInfo)); |
---|
1290 | 1240 | |
---|
1291 | 1241 | phy->invalid_dword_count = le32_to_cpu(phy_pg1.InvalidDwordCount); |
---|
1292 | 1242 | phy->running_disparity_error_count = |
---|
.. | .. |
---|
1405 | 1355 | struct phy_control_reply *phy_control_reply; |
---|
1406 | 1356 | int rc; |
---|
1407 | 1357 | u16 smid; |
---|
1408 | | - u32 ioc_state; |
---|
1409 | 1358 | void *psge; |
---|
1410 | 1359 | u8 issue_reset = 0; |
---|
1411 | 1360 | void *data_out = NULL; |
---|
1412 | 1361 | dma_addr_t data_out_dma; |
---|
1413 | 1362 | u32 sz; |
---|
1414 | | - u16 wait_state_count; |
---|
1415 | 1363 | |
---|
1416 | 1364 | if (ioc->shost_recovery || ioc->pci_error_recovery) { |
---|
1417 | | - pr_info(MPT3SAS_FMT "%s: host reset in progress!\n", |
---|
1418 | | - __func__, ioc->name); |
---|
| 1365 | + ioc_info(ioc, "%s: host reset in progress!\n", __func__); |
---|
1419 | 1366 | return -EFAULT; |
---|
1420 | 1367 | } |
---|
1421 | 1368 | |
---|
1422 | 1369 | mutex_lock(&ioc->transport_cmds.mutex); |
---|
1423 | 1370 | |
---|
1424 | 1371 | if (ioc->transport_cmds.status != MPT3_CMD_NOT_USED) { |
---|
1425 | | - pr_err(MPT3SAS_FMT "%s: transport_cmds in use\n", |
---|
1426 | | - ioc->name, __func__); |
---|
| 1372 | + ioc_err(ioc, "%s: transport_cmds in use\n", __func__); |
---|
1427 | 1373 | rc = -EAGAIN; |
---|
1428 | 1374 | goto out; |
---|
1429 | 1375 | } |
---|
1430 | 1376 | ioc->transport_cmds.status = MPT3_CMD_PENDING; |
---|
1431 | 1377 | |
---|
1432 | | - wait_state_count = 0; |
---|
1433 | | - ioc_state = mpt3sas_base_get_iocstate(ioc, 1); |
---|
1434 | | - while (ioc_state != MPI2_IOC_STATE_OPERATIONAL) { |
---|
1435 | | - if (wait_state_count++ == 10) { |
---|
1436 | | - pr_err(MPT3SAS_FMT |
---|
1437 | | - "%s: failed due to ioc not operational\n", |
---|
1438 | | - ioc->name, __func__); |
---|
1439 | | - rc = -EFAULT; |
---|
1440 | | - goto out; |
---|
1441 | | - } |
---|
1442 | | - ssleep(1); |
---|
1443 | | - ioc_state = mpt3sas_base_get_iocstate(ioc, 1); |
---|
1444 | | - pr_info(MPT3SAS_FMT |
---|
1445 | | - "%s: waiting for operational state(count=%d)\n", |
---|
1446 | | - ioc->name, __func__, wait_state_count); |
---|
1447 | | - } |
---|
1448 | | - if (wait_state_count) |
---|
1449 | | - pr_info(MPT3SAS_FMT "%s: ioc is operational\n", |
---|
1450 | | - ioc->name, __func__); |
---|
| 1378 | + rc = mpt3sas_wait_for_ioc(ioc, IOC_OPERATIONAL_WAIT_COUNT); |
---|
| 1379 | + if (rc) |
---|
| 1380 | + goto out; |
---|
1451 | 1381 | |
---|
1452 | 1382 | smid = mpt3sas_base_get_smid(ioc, ioc->transport_cb_idx); |
---|
1453 | 1383 | if (!smid) { |
---|
1454 | | - pr_err(MPT3SAS_FMT "%s: failed obtaining a smid\n", |
---|
1455 | | - ioc->name, __func__); |
---|
| 1384 | + ioc_err(ioc, "%s: failed obtaining a smid\n", __func__); |
---|
1456 | 1385 | rc = -EAGAIN; |
---|
1457 | 1386 | goto out; |
---|
1458 | 1387 | } |
---|
.. | .. |
---|
1462 | 1391 | |
---|
1463 | 1392 | sz = sizeof(struct phy_control_request) + |
---|
1464 | 1393 | sizeof(struct phy_control_reply); |
---|
1465 | | - data_out = pci_alloc_consistent(ioc->pdev, sz, &data_out_dma); |
---|
| 1394 | + data_out = dma_alloc_coherent(&ioc->pdev->dev, sz, &data_out_dma, |
---|
| 1395 | + GFP_KERNEL); |
---|
1466 | 1396 | if (!data_out) { |
---|
1467 | 1397 | pr_err("failure at %s:%d/%s()!\n", __FILE__, |
---|
1468 | 1398 | __LINE__, __func__); |
---|
.. | .. |
---|
1500 | 1430 | data_out_dma + sizeof(struct phy_control_request), |
---|
1501 | 1431 | sizeof(struct phy_control_reply)); |
---|
1502 | 1432 | |
---|
1503 | | - dtransportprintk(ioc, pr_info(MPT3SAS_FMT |
---|
1504 | | - "phy_control - send to sas_addr(0x%016llx), phy(%d), opcode(%d)\n", |
---|
1505 | | - ioc->name, (unsigned long long)phy->identify.sas_address, |
---|
1506 | | - phy->number, phy_operation)); |
---|
| 1433 | + dtransportprintk(ioc, |
---|
| 1434 | + ioc_info(ioc, "phy_control - send to sas_addr(0x%016llx), phy(%d), opcode(%d)\n", |
---|
| 1435 | + (u64)phy->identify.sas_address, |
---|
| 1436 | + phy->number, phy_operation)); |
---|
1507 | 1437 | init_completion(&ioc->transport_cmds.done); |
---|
1508 | | - mpt3sas_base_put_smid_default(ioc, smid); |
---|
| 1438 | + ioc->put_smid_default(ioc, smid); |
---|
1509 | 1439 | wait_for_completion_timeout(&ioc->transport_cmds.done, 10*HZ); |
---|
1510 | 1440 | |
---|
1511 | 1441 | if (!(ioc->transport_cmds.status & MPT3_CMD_COMPLETE)) { |
---|
1512 | | - pr_err(MPT3SAS_FMT "%s: timeout\n", |
---|
1513 | | - ioc->name, __func__); |
---|
| 1442 | + ioc_err(ioc, "%s: timeout\n", __func__); |
---|
1514 | 1443 | _debug_dump_mf(mpi_request, |
---|
1515 | 1444 | sizeof(Mpi2SmpPassthroughRequest_t)/4); |
---|
1516 | 1445 | if (!(ioc->transport_cmds.status & MPT3_CMD_RESET)) |
---|
.. | .. |
---|
1518 | 1447 | goto issue_host_reset; |
---|
1519 | 1448 | } |
---|
1520 | 1449 | |
---|
1521 | | - dtransportprintk(ioc, pr_info(MPT3SAS_FMT |
---|
1522 | | - "phy_control - complete\n", ioc->name)); |
---|
| 1450 | + dtransportprintk(ioc, ioc_info(ioc, "phy_control - complete\n")); |
---|
1523 | 1451 | |
---|
1524 | 1452 | if (ioc->transport_cmds.status & MPT3_CMD_REPLY_VALID) { |
---|
1525 | 1453 | |
---|
1526 | 1454 | mpi_reply = ioc->transport_cmds.reply; |
---|
1527 | 1455 | |
---|
1528 | | - dtransportprintk(ioc, pr_info(MPT3SAS_FMT |
---|
1529 | | - "phy_control - reply data transfer size(%d)\n", |
---|
1530 | | - ioc->name, le16_to_cpu(mpi_reply->ResponseDataLength))); |
---|
| 1456 | + dtransportprintk(ioc, |
---|
| 1457 | + ioc_info(ioc, "phy_control - reply data transfer size(%d)\n", |
---|
| 1458 | + le16_to_cpu(mpi_reply->ResponseDataLength))); |
---|
1531 | 1459 | |
---|
1532 | 1460 | if (le16_to_cpu(mpi_reply->ResponseDataLength) != |
---|
1533 | 1461 | sizeof(struct phy_control_reply)) |
---|
.. | .. |
---|
1536 | 1464 | phy_control_reply = data_out + |
---|
1537 | 1465 | sizeof(struct phy_control_request); |
---|
1538 | 1466 | |
---|
1539 | | - dtransportprintk(ioc, pr_info(MPT3SAS_FMT |
---|
1540 | | - "phy_control - function_result(%d)\n", |
---|
1541 | | - ioc->name, phy_control_reply->function_result)); |
---|
| 1467 | + dtransportprintk(ioc, |
---|
| 1468 | + ioc_info(ioc, "phy_control - function_result(%d)\n", |
---|
| 1469 | + phy_control_reply->function_result)); |
---|
1542 | 1470 | |
---|
1543 | 1471 | rc = 0; |
---|
1544 | 1472 | } else |
---|
1545 | | - dtransportprintk(ioc, pr_info(MPT3SAS_FMT |
---|
1546 | | - "phy_control - no reply\n", ioc->name)); |
---|
| 1473 | + dtransportprintk(ioc, |
---|
| 1474 | + ioc_info(ioc, "phy_control - no reply\n")); |
---|
1547 | 1475 | |
---|
1548 | 1476 | issue_host_reset: |
---|
1549 | 1477 | if (issue_reset) |
---|
.. | .. |
---|
1551 | 1479 | out: |
---|
1552 | 1480 | ioc->transport_cmds.status = MPT3_CMD_NOT_USED; |
---|
1553 | 1481 | if (data_out) |
---|
1554 | | - pci_free_consistent(ioc->pdev, sz, data_out, data_out_dma); |
---|
| 1482 | + dma_free_coherent(&ioc->pdev->dev, sz, data_out, |
---|
| 1483 | + data_out_dma); |
---|
1555 | 1484 | |
---|
1556 | 1485 | mutex_unlock(&ioc->transport_cmds.mutex); |
---|
1557 | 1486 | return rc; |
---|
.. | .. |
---|
1594 | 1523 | mpi_request.PhyNum = phy->number; |
---|
1595 | 1524 | |
---|
1596 | 1525 | if ((mpt3sas_base_sas_iounit_control(ioc, &mpi_reply, &mpi_request))) { |
---|
1597 | | - pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", |
---|
1598 | | - ioc->name, __FILE__, __LINE__, __func__); |
---|
| 1526 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", |
---|
| 1527 | + __FILE__, __LINE__, __func__); |
---|
1599 | 1528 | return -ENXIO; |
---|
1600 | 1529 | } |
---|
1601 | 1530 | |
---|
1602 | 1531 | if (mpi_reply.IOCStatus || mpi_reply.IOCLogInfo) |
---|
1603 | | - pr_info(MPT3SAS_FMT |
---|
1604 | | - "phy(%d), ioc_status(0x%04x), loginfo(0x%08x)\n", |
---|
1605 | | - ioc->name, phy->number, le16_to_cpu(mpi_reply.IOCStatus), |
---|
1606 | | - le32_to_cpu(mpi_reply.IOCLogInfo)); |
---|
| 1532 | + ioc_info(ioc, "phy(%d), ioc_status(0x%04x), loginfo(0x%08x)\n", |
---|
| 1533 | + phy->number, le16_to_cpu(mpi_reply.IOCStatus), |
---|
| 1534 | + le32_to_cpu(mpi_reply.IOCLogInfo)); |
---|
1607 | 1535 | |
---|
1608 | 1536 | return 0; |
---|
1609 | 1537 | } |
---|
.. | .. |
---|
1650 | 1578 | sizeof(Mpi2SasIOUnit0PhyData_t)); |
---|
1651 | 1579 | sas_iounit_pg0 = kzalloc(sz, GFP_KERNEL); |
---|
1652 | 1580 | if (!sas_iounit_pg0) { |
---|
1653 | | - pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", |
---|
1654 | | - ioc->name, __FILE__, __LINE__, __func__); |
---|
| 1581 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", |
---|
| 1582 | + __FILE__, __LINE__, __func__); |
---|
1655 | 1583 | rc = -ENOMEM; |
---|
1656 | 1584 | goto out; |
---|
1657 | 1585 | } |
---|
1658 | 1586 | if ((mpt3sas_config_get_sas_iounit_pg0(ioc, &mpi_reply, |
---|
1659 | 1587 | sas_iounit_pg0, sz))) { |
---|
1660 | | - pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", |
---|
1661 | | - ioc->name, __FILE__, __LINE__, __func__); |
---|
| 1588 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", |
---|
| 1589 | + __FILE__, __LINE__, __func__); |
---|
1662 | 1590 | rc = -ENXIO; |
---|
1663 | 1591 | goto out; |
---|
1664 | 1592 | } |
---|
1665 | 1593 | ioc_status = le16_to_cpu(mpi_reply.IOCStatus) & |
---|
1666 | 1594 | MPI2_IOCSTATUS_MASK; |
---|
1667 | 1595 | if (ioc_status != MPI2_IOCSTATUS_SUCCESS) { |
---|
1668 | | - pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", |
---|
1669 | | - ioc->name, __FILE__, __LINE__, __func__); |
---|
| 1596 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", |
---|
| 1597 | + __FILE__, __LINE__, __func__); |
---|
1670 | 1598 | rc = -EIO; |
---|
1671 | 1599 | goto out; |
---|
1672 | 1600 | } |
---|
.. | .. |
---|
1675 | 1603 | for (i = 0, discovery_active = 0; i < ioc->sas_hba.num_phys ; i++) { |
---|
1676 | 1604 | if (sas_iounit_pg0->PhyData[i].PortFlags & |
---|
1677 | 1605 | MPI2_SASIOUNIT0_PORTFLAGS_DISCOVERY_IN_PROGRESS) { |
---|
1678 | | - pr_err(MPT3SAS_FMT "discovery is active on " \ |
---|
1679 | | - "port = %d, phy = %d: unable to enable/disable " |
---|
1680 | | - "phys, try again later!\n", ioc->name, |
---|
1681 | | - sas_iounit_pg0->PhyData[i].Port, i); |
---|
| 1606 | + ioc_err(ioc, "discovery is active on port = %d, phy = %d: unable to enable/disable phys, try again later!\n", |
---|
| 1607 | + sas_iounit_pg0->PhyData[i].Port, i); |
---|
1682 | 1608 | discovery_active = 1; |
---|
1683 | 1609 | } |
---|
1684 | 1610 | } |
---|
.. | .. |
---|
1693 | 1619 | sizeof(Mpi2SasIOUnit1PhyData_t)); |
---|
1694 | 1620 | sas_iounit_pg1 = kzalloc(sz, GFP_KERNEL); |
---|
1695 | 1621 | if (!sas_iounit_pg1) { |
---|
1696 | | - pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", |
---|
1697 | | - ioc->name, __FILE__, __LINE__, __func__); |
---|
| 1622 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", |
---|
| 1623 | + __FILE__, __LINE__, __func__); |
---|
1698 | 1624 | rc = -ENOMEM; |
---|
1699 | 1625 | goto out; |
---|
1700 | 1626 | } |
---|
1701 | 1627 | if ((mpt3sas_config_get_sas_iounit_pg1(ioc, &mpi_reply, |
---|
1702 | 1628 | sas_iounit_pg1, sz))) { |
---|
1703 | | - pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", |
---|
1704 | | - ioc->name, __FILE__, __LINE__, __func__); |
---|
| 1629 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", |
---|
| 1630 | + __FILE__, __LINE__, __func__); |
---|
1705 | 1631 | rc = -ENXIO; |
---|
1706 | 1632 | goto out; |
---|
1707 | 1633 | } |
---|
1708 | 1634 | ioc_status = le16_to_cpu(mpi_reply.IOCStatus) & |
---|
1709 | 1635 | MPI2_IOCSTATUS_MASK; |
---|
1710 | 1636 | if (ioc_status != MPI2_IOCSTATUS_SUCCESS) { |
---|
1711 | | - pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", |
---|
1712 | | - ioc->name, __FILE__, __LINE__, __func__); |
---|
| 1637 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", |
---|
| 1638 | + __FILE__, __LINE__, __func__); |
---|
1713 | 1639 | rc = -EIO; |
---|
1714 | 1640 | goto out; |
---|
1715 | 1641 | } |
---|
.. | .. |
---|
1801 | 1727 | sizeof(Mpi2SasIOUnit1PhyData_t)); |
---|
1802 | 1728 | sas_iounit_pg1 = kzalloc(sz, GFP_KERNEL); |
---|
1803 | 1729 | if (!sas_iounit_pg1) { |
---|
1804 | | - pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", |
---|
1805 | | - ioc->name, __FILE__, __LINE__, __func__); |
---|
| 1730 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", |
---|
| 1731 | + __FILE__, __LINE__, __func__); |
---|
1806 | 1732 | rc = -ENOMEM; |
---|
1807 | 1733 | goto out; |
---|
1808 | 1734 | } |
---|
1809 | 1735 | if ((mpt3sas_config_get_sas_iounit_pg1(ioc, &mpi_reply, |
---|
1810 | 1736 | sas_iounit_pg1, sz))) { |
---|
1811 | | - pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", |
---|
1812 | | - ioc->name, __FILE__, __LINE__, __func__); |
---|
| 1737 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", |
---|
| 1738 | + __FILE__, __LINE__, __func__); |
---|
1813 | 1739 | rc = -ENXIO; |
---|
1814 | 1740 | goto out; |
---|
1815 | 1741 | } |
---|
1816 | 1742 | ioc_status = le16_to_cpu(mpi_reply.IOCStatus) & |
---|
1817 | 1743 | MPI2_IOCSTATUS_MASK; |
---|
1818 | 1744 | if (ioc_status != MPI2_IOCSTATUS_SUCCESS) { |
---|
1819 | | - pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", |
---|
1820 | | - ioc->name, __FILE__, __LINE__, __func__); |
---|
| 1745 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", |
---|
| 1746 | + __FILE__, __LINE__, __func__); |
---|
1821 | 1747 | rc = -EIO; |
---|
1822 | 1748 | goto out; |
---|
1823 | 1749 | } |
---|
.. | .. |
---|
1836 | 1762 | |
---|
1837 | 1763 | if (mpt3sas_config_set_sas_iounit_pg1(ioc, &mpi_reply, sas_iounit_pg1, |
---|
1838 | 1764 | sz)) { |
---|
1839 | | - pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", |
---|
1840 | | - ioc->name, __FILE__, __LINE__, __func__); |
---|
| 1765 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", |
---|
| 1766 | + __FILE__, __LINE__, __func__); |
---|
1841 | 1767 | rc = -ENXIO; |
---|
1842 | 1768 | goto out; |
---|
1843 | 1769 | } |
---|
.. | .. |
---|
1913 | 1839 | Mpi2SmpPassthroughReply_t *mpi_reply; |
---|
1914 | 1840 | int rc; |
---|
1915 | 1841 | u16 smid; |
---|
1916 | | - u32 ioc_state; |
---|
1917 | 1842 | void *psge; |
---|
1918 | 1843 | dma_addr_t dma_addr_in; |
---|
1919 | 1844 | dma_addr_t dma_addr_out; |
---|
.. | .. |
---|
1921 | 1846 | void *addr_out = NULL; |
---|
1922 | 1847 | size_t dma_len_in; |
---|
1923 | 1848 | size_t dma_len_out; |
---|
1924 | | - u16 wait_state_count; |
---|
1925 | 1849 | unsigned int reslen = 0; |
---|
1926 | 1850 | |
---|
1927 | 1851 | if (ioc->shost_recovery || ioc->pci_error_recovery) { |
---|
1928 | | - pr_info(MPT3SAS_FMT "%s: host reset in progress!\n", |
---|
1929 | | - __func__, ioc->name); |
---|
| 1852 | + ioc_info(ioc, "%s: host reset in progress!\n", __func__); |
---|
1930 | 1853 | rc = -EFAULT; |
---|
1931 | 1854 | goto job_done; |
---|
1932 | 1855 | } |
---|
.. | .. |
---|
1936 | 1859 | goto job_done; |
---|
1937 | 1860 | |
---|
1938 | 1861 | if (ioc->transport_cmds.status != MPT3_CMD_NOT_USED) { |
---|
1939 | | - pr_err(MPT3SAS_FMT "%s: transport_cmds in use\n", ioc->name, |
---|
1940 | | - __func__); |
---|
| 1862 | + ioc_err(ioc, "%s: transport_cmds in use\n", |
---|
| 1863 | + __func__); |
---|
1941 | 1864 | rc = -EAGAIN; |
---|
1942 | 1865 | goto out; |
---|
1943 | 1866 | } |
---|
.. | .. |
---|
1958 | 1881 | if (rc) |
---|
1959 | 1882 | goto unmap_out; |
---|
1960 | 1883 | |
---|
1961 | | - wait_state_count = 0; |
---|
1962 | | - ioc_state = mpt3sas_base_get_iocstate(ioc, 1); |
---|
1963 | | - while (ioc_state != MPI2_IOC_STATE_OPERATIONAL) { |
---|
1964 | | - if (wait_state_count++ == 10) { |
---|
1965 | | - pr_err(MPT3SAS_FMT |
---|
1966 | | - "%s: failed due to ioc not operational\n", |
---|
1967 | | - ioc->name, __func__); |
---|
1968 | | - rc = -EFAULT; |
---|
1969 | | - goto unmap_in; |
---|
1970 | | - } |
---|
1971 | | - ssleep(1); |
---|
1972 | | - ioc_state = mpt3sas_base_get_iocstate(ioc, 1); |
---|
1973 | | - pr_info(MPT3SAS_FMT |
---|
1974 | | - "%s: waiting for operational state(count=%d)\n", |
---|
1975 | | - ioc->name, __func__, wait_state_count); |
---|
1976 | | - } |
---|
1977 | | - if (wait_state_count) |
---|
1978 | | - pr_info(MPT3SAS_FMT "%s: ioc is operational\n", |
---|
1979 | | - ioc->name, __func__); |
---|
| 1884 | + rc = mpt3sas_wait_for_ioc(ioc, IOC_OPERATIONAL_WAIT_COUNT); |
---|
| 1885 | + if (rc) |
---|
| 1886 | + goto unmap_in; |
---|
1980 | 1887 | |
---|
1981 | 1888 | smid = mpt3sas_base_get_smid(ioc, ioc->transport_cb_idx); |
---|
1982 | 1889 | if (!smid) { |
---|
1983 | | - pr_err(MPT3SAS_FMT "%s: failed obtaining a smid\n", |
---|
1984 | | - ioc->name, __func__); |
---|
| 1890 | + ioc_err(ioc, "%s: failed obtaining a smid\n", __func__); |
---|
1985 | 1891 | rc = -EAGAIN; |
---|
1986 | 1892 | goto unmap_in; |
---|
1987 | 1893 | } |
---|
.. | .. |
---|
2002 | 1908 | ioc->build_sg(ioc, psge, dma_addr_out, dma_len_out - 4, dma_addr_in, |
---|
2003 | 1909 | dma_len_in - 4); |
---|
2004 | 1910 | |
---|
2005 | | - dtransportprintk(ioc, pr_info(MPT3SAS_FMT |
---|
2006 | | - "%s - sending smp request\n", ioc->name, __func__)); |
---|
| 1911 | + dtransportprintk(ioc, |
---|
| 1912 | + ioc_info(ioc, "%s: sending smp request\n", __func__)); |
---|
2007 | 1913 | |
---|
2008 | 1914 | init_completion(&ioc->transport_cmds.done); |
---|
2009 | | - mpt3sas_base_put_smid_default(ioc, smid); |
---|
| 1915 | + ioc->put_smid_default(ioc, smid); |
---|
2010 | 1916 | wait_for_completion_timeout(&ioc->transport_cmds.done, 10*HZ); |
---|
2011 | 1917 | |
---|
2012 | 1918 | if (!(ioc->transport_cmds.status & MPT3_CMD_COMPLETE)) { |
---|
2013 | | - pr_err(MPT3SAS_FMT "%s : timeout\n", |
---|
2014 | | - __func__, ioc->name); |
---|
| 1919 | + ioc_err(ioc, "%s: timeout\n", __func__); |
---|
2015 | 1920 | _debug_dump_mf(mpi_request, |
---|
2016 | 1921 | sizeof(Mpi2SmpPassthroughRequest_t)/4); |
---|
2017 | 1922 | if (!(ioc->transport_cmds.status & MPT3_CMD_RESET)) { |
---|
.. | .. |
---|
2021 | 1926 | } |
---|
2022 | 1927 | } |
---|
2023 | 1928 | |
---|
2024 | | - dtransportprintk(ioc, pr_info(MPT3SAS_FMT |
---|
2025 | | - "%s - complete\n", ioc->name, __func__)); |
---|
| 1929 | + dtransportprintk(ioc, ioc_info(ioc, "%s - complete\n", __func__)); |
---|
2026 | 1930 | |
---|
2027 | 1931 | if (!(ioc->transport_cmds.status & MPT3_CMD_REPLY_VALID)) { |
---|
2028 | | - dtransportprintk(ioc, pr_info(MPT3SAS_FMT |
---|
2029 | | - "%s - no reply\n", ioc->name, __func__)); |
---|
| 1932 | + dtransportprintk(ioc, |
---|
| 1933 | + ioc_info(ioc, "%s: no reply\n", __func__)); |
---|
2030 | 1934 | rc = -ENXIO; |
---|
2031 | 1935 | goto unmap_in; |
---|
2032 | 1936 | } |
---|
.. | .. |
---|
2034 | 1938 | mpi_reply = ioc->transport_cmds.reply; |
---|
2035 | 1939 | |
---|
2036 | 1940 | dtransportprintk(ioc, |
---|
2037 | | - pr_info(MPT3SAS_FMT "%s - reply data transfer size(%d)\n", |
---|
2038 | | - ioc->name, __func__, |
---|
2039 | | - le16_to_cpu(mpi_reply->ResponseDataLength))); |
---|
| 1941 | + ioc_info(ioc, "%s: reply data transfer size(%d)\n", |
---|
| 1942 | + __func__, |
---|
| 1943 | + le16_to_cpu(mpi_reply->ResponseDataLength))); |
---|
2040 | 1944 | |
---|
2041 | 1945 | memcpy(job->reply, mpi_reply, sizeof(*mpi_reply)); |
---|
2042 | 1946 | job->reply_len = sizeof(*mpi_reply); |
---|