| .. | .. |
|---|
| 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 | | - if ((sas_port_add(port))) { |
|---|
| 702 | | - pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", |
|---|
| 703 | | - ioc->name, __FILE__, __LINE__, __func__); |
|---|
| 673 | + if (!port || (sas_port_add(port))) { |
|---|
| 674 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", |
|---|
| 675 | + __FILE__, __LINE__, __func__); |
|---|
| 704 | 676 | goto out_fail; |
|---|
| 705 | 677 | } |
|---|
| 706 | 678 | |
|---|
| .. | .. |
|---|
| 723 | 695 | rphy = sas_expander_alloc(port, |
|---|
| 724 | 696 | mpt3sas_port->remote_identify.device_type); |
|---|
| 725 | 697 | |
|---|
| 698 | + if (!rphy) { |
|---|
| 699 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", |
|---|
| 700 | + __FILE__, __LINE__, __func__); |
|---|
| 701 | + goto out_delete_port; |
|---|
| 702 | + } |
|---|
| 703 | + |
|---|
| 726 | 704 | rphy->identify = mpt3sas_port->remote_identify; |
|---|
| 727 | 705 | |
|---|
| 728 | 706 | if (mpt3sas_port->remote_identify.device_type == SAS_END_DEVICE) { |
|---|
| 729 | 707 | sas_device = mpt3sas_get_sdev_by_addr(ioc, |
|---|
| 730 | 708 | mpt3sas_port->remote_identify.sas_address); |
|---|
| 731 | 709 | if (!sas_device) { |
|---|
| 732 | | - dfailprintk(ioc, printk(MPT3SAS_FMT |
|---|
| 733 | | - "failure at %s:%d/%s()!\n", |
|---|
| 734 | | - ioc->name, __FILE__, __LINE__, __func__)); |
|---|
| 710 | + dfailprintk(ioc, |
|---|
| 711 | + ioc_info(ioc, "failure at %s:%d/%s()!\n", |
|---|
| 712 | + __FILE__, __LINE__, __func__)); |
|---|
| 735 | 713 | goto out_fail; |
|---|
| 736 | 714 | } |
|---|
| 737 | 715 | sas_device->pend_sas_rphy_add = 1; |
|---|
| 738 | 716 | } |
|---|
| 739 | 717 | |
|---|
| 740 | 718 | if ((sas_rphy_add(rphy))) { |
|---|
| 741 | | - pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", |
|---|
| 742 | | - ioc->name, __FILE__, __LINE__, __func__); |
|---|
| 719 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", |
|---|
| 720 | + __FILE__, __LINE__, __func__); |
|---|
| 721 | + sas_rphy_free(rphy); |
|---|
| 722 | + rphy = NULL; |
|---|
| 723 | + goto out_delete_port; |
|---|
| 743 | 724 | } |
|---|
| 744 | 725 | |
|---|
| 745 | 726 | if (mpt3sas_port->remote_identify.device_type == SAS_END_DEVICE) { |
|---|
| .. | .. |
|---|
| 747 | 728 | sas_device_put(sas_device); |
|---|
| 748 | 729 | } |
|---|
| 749 | 730 | |
|---|
| 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); |
|---|
| 731 | + dev_info(&rphy->dev, |
|---|
| 732 | + "add: handle(0x%04x), sas_addr(0x%016llx)\n", handle, |
|---|
| 733 | + (unsigned long long)mpt3sas_port->remote_identify.sas_address); |
|---|
| 734 | + |
|---|
| 755 | 735 | mpt3sas_port->rphy = rphy; |
|---|
| 756 | 736 | spin_lock_irqsave(&ioc->sas_node_lock, flags); |
|---|
| 757 | 737 | list_add_tail(&mpt3sas_port->port_list, &sas_node->sas_port_list); |
|---|
| .. | .. |
|---|
| 767 | 747 | rphy_to_expander_device(rphy)); |
|---|
| 768 | 748 | return mpt3sas_port; |
|---|
| 769 | 749 | |
|---|
| 770 | | - out_fail: |
|---|
| 750 | +out_delete_port: |
|---|
| 751 | + sas_port_delete(port); |
|---|
| 752 | + |
|---|
| 753 | +out_fail: |
|---|
| 771 | 754 | list_for_each_entry_safe(mpt3sas_phy, next, &mpt3sas_port->phy_list, |
|---|
| 772 | 755 | port_siblings) |
|---|
| 773 | 756 | list_del(&mpt3sas_phy->port_siblings); |
|---|
| .. | .. |
|---|
| 841 | 824 | } |
|---|
| 842 | 825 | if (!ioc->remove_host) |
|---|
| 843 | 826 | sas_port_delete(mpt3sas_port->port); |
|---|
| 827 | + ioc_info(ioc, "%s: removed: sas_addr(0x%016llx)\n", |
|---|
| 828 | + __func__, (unsigned long long)sas_address); |
|---|
| 844 | 829 | kfree(mpt3sas_port); |
|---|
| 845 | 830 | } |
|---|
| 846 | 831 | |
|---|
| .. | .. |
|---|
| 864 | 849 | INIT_LIST_HEAD(&mpt3sas_phy->port_siblings); |
|---|
| 865 | 850 | phy = sas_phy_alloc(parent_dev, phy_index); |
|---|
| 866 | 851 | if (!phy) { |
|---|
| 867 | | - pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", |
|---|
| 868 | | - ioc->name, __FILE__, __LINE__, __func__); |
|---|
| 852 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", |
|---|
| 853 | + __FILE__, __LINE__, __func__); |
|---|
| 869 | 854 | return -1; |
|---|
| 870 | 855 | } |
|---|
| 871 | 856 | if ((_transport_set_identify(ioc, mpt3sas_phy->handle, |
|---|
| 872 | 857 | &mpt3sas_phy->identify))) { |
|---|
| 873 | | - pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", |
|---|
| 874 | | - ioc->name, __FILE__, __LINE__, __func__); |
|---|
| 858 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", |
|---|
| 859 | + __FILE__, __LINE__, __func__); |
|---|
| 875 | 860 | sas_phy_free(phy); |
|---|
| 876 | 861 | return -1; |
|---|
| 877 | 862 | } |
|---|
| .. | .. |
|---|
| 893 | 878 | phy_pg0.ProgrammedLinkRate >> 4); |
|---|
| 894 | 879 | |
|---|
| 895 | 880 | if ((sas_phy_add(phy))) { |
|---|
| 896 | | - pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", |
|---|
| 897 | | - ioc->name, __FILE__, __LINE__, __func__); |
|---|
| 881 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", |
|---|
| 882 | + __FILE__, __LINE__, __func__); |
|---|
| 898 | 883 | sas_phy_free(phy); |
|---|
| 899 | 884 | return -1; |
|---|
| 900 | 885 | } |
|---|
| .. | .. |
|---|
| 932 | 917 | INIT_LIST_HEAD(&mpt3sas_phy->port_siblings); |
|---|
| 933 | 918 | phy = sas_phy_alloc(parent_dev, phy_index); |
|---|
| 934 | 919 | if (!phy) { |
|---|
| 935 | | - pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", |
|---|
| 936 | | - ioc->name, __FILE__, __LINE__, __func__); |
|---|
| 920 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", |
|---|
| 921 | + __FILE__, __LINE__, __func__); |
|---|
| 937 | 922 | return -1; |
|---|
| 938 | 923 | } |
|---|
| 939 | 924 | if ((_transport_set_identify(ioc, mpt3sas_phy->handle, |
|---|
| 940 | 925 | &mpt3sas_phy->identify))) { |
|---|
| 941 | | - pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", |
|---|
| 942 | | - ioc->name, __FILE__, __LINE__, __func__); |
|---|
| 926 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", |
|---|
| 927 | + __FILE__, __LINE__, __func__); |
|---|
| 943 | 928 | sas_phy_free(phy); |
|---|
| 944 | 929 | return -1; |
|---|
| 945 | 930 | } |
|---|
| .. | .. |
|---|
| 963 | 948 | expander_pg1.ProgrammedLinkRate >> 4); |
|---|
| 964 | 949 | |
|---|
| 965 | 950 | if ((sas_phy_add(phy))) { |
|---|
| 966 | | - pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", |
|---|
| 967 | | - ioc->name, __FILE__, __LINE__, __func__); |
|---|
| 951 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", |
|---|
| 952 | + __FILE__, __LINE__, __func__); |
|---|
| 968 | 953 | sas_phy_free(phy); |
|---|
| 969 | 954 | return -1; |
|---|
| 970 | 955 | } |
|---|
| .. | .. |
|---|
| 1092 | 1077 | struct phy_error_log_reply *phy_error_log_reply; |
|---|
| 1093 | 1078 | int rc; |
|---|
| 1094 | 1079 | u16 smid; |
|---|
| 1095 | | - u32 ioc_state; |
|---|
| 1096 | 1080 | void *psge; |
|---|
| 1097 | 1081 | u8 issue_reset = 0; |
|---|
| 1098 | 1082 | void *data_out = NULL; |
|---|
| 1099 | 1083 | dma_addr_t data_out_dma; |
|---|
| 1100 | 1084 | u32 sz; |
|---|
| 1101 | | - u16 wait_state_count; |
|---|
| 1102 | 1085 | |
|---|
| 1103 | 1086 | if (ioc->shost_recovery || ioc->pci_error_recovery) { |
|---|
| 1104 | | - pr_info(MPT3SAS_FMT "%s: host reset in progress!\n", |
|---|
| 1105 | | - __func__, ioc->name); |
|---|
| 1087 | + ioc_info(ioc, "%s: host reset in progress!\n", __func__); |
|---|
| 1106 | 1088 | return -EFAULT; |
|---|
| 1107 | 1089 | } |
|---|
| 1108 | 1090 | |
|---|
| 1109 | 1091 | mutex_lock(&ioc->transport_cmds.mutex); |
|---|
| 1110 | 1092 | |
|---|
| 1111 | 1093 | if (ioc->transport_cmds.status != MPT3_CMD_NOT_USED) { |
|---|
| 1112 | | - pr_err(MPT3SAS_FMT "%s: transport_cmds in use\n", |
|---|
| 1113 | | - ioc->name, __func__); |
|---|
| 1094 | + ioc_err(ioc, "%s: transport_cmds in use\n", __func__); |
|---|
| 1114 | 1095 | rc = -EAGAIN; |
|---|
| 1115 | 1096 | goto out; |
|---|
| 1116 | 1097 | } |
|---|
| 1117 | 1098 | ioc->transport_cmds.status = MPT3_CMD_PENDING; |
|---|
| 1118 | 1099 | |
|---|
| 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__); |
|---|
| 1100 | + rc = mpt3sas_wait_for_ioc(ioc, IOC_OPERATIONAL_WAIT_COUNT); |
|---|
| 1101 | + if (rc) |
|---|
| 1102 | + goto out; |
|---|
| 1138 | 1103 | |
|---|
| 1139 | 1104 | smid = mpt3sas_base_get_smid(ioc, ioc->transport_cb_idx); |
|---|
| 1140 | 1105 | if (!smid) { |
|---|
| 1141 | | - pr_err(MPT3SAS_FMT "%s: failed obtaining a smid\n", |
|---|
| 1142 | | - ioc->name, __func__); |
|---|
| 1106 | + ioc_err(ioc, "%s: failed obtaining a smid\n", __func__); |
|---|
| 1143 | 1107 | rc = -EAGAIN; |
|---|
| 1144 | 1108 | goto out; |
|---|
| 1145 | 1109 | } |
|---|
| .. | .. |
|---|
| 1149 | 1113 | |
|---|
| 1150 | 1114 | sz = sizeof(struct phy_error_log_request) + |
|---|
| 1151 | 1115 | sizeof(struct phy_error_log_reply); |
|---|
| 1152 | | - data_out = pci_alloc_consistent(ioc->pdev, sz, &data_out_dma); |
|---|
| 1116 | + data_out = dma_alloc_coherent(&ioc->pdev->dev, sz, &data_out_dma, |
|---|
| 1117 | + GFP_KERNEL); |
|---|
| 1153 | 1118 | if (!data_out) { |
|---|
| 1154 | 1119 | pr_err("failure at %s:%d/%s()!\n", __FILE__, |
|---|
| 1155 | 1120 | __LINE__, __func__); |
|---|
| .. | .. |
|---|
| 1182 | 1147 | data_out_dma + sizeof(struct phy_error_log_request), |
|---|
| 1183 | 1148 | sizeof(struct phy_error_log_reply)); |
|---|
| 1184 | 1149 | |
|---|
| 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)); |
|---|
| 1150 | + dtransportprintk(ioc, |
|---|
| 1151 | + ioc_info(ioc, "phy_error_log - send to sas_addr(0x%016llx), phy(%d)\n", |
|---|
| 1152 | + (u64)phy->identify.sas_address, |
|---|
| 1153 | + phy->number)); |
|---|
| 1189 | 1154 | init_completion(&ioc->transport_cmds.done); |
|---|
| 1190 | | - mpt3sas_base_put_smid_default(ioc, smid); |
|---|
| 1155 | + ioc->put_smid_default(ioc, smid); |
|---|
| 1191 | 1156 | wait_for_completion_timeout(&ioc->transport_cmds.done, 10*HZ); |
|---|
| 1192 | 1157 | |
|---|
| 1193 | 1158 | if (!(ioc->transport_cmds.status & MPT3_CMD_COMPLETE)) { |
|---|
| 1194 | | - pr_err(MPT3SAS_FMT "%s: timeout\n", |
|---|
| 1195 | | - ioc->name, __func__); |
|---|
| 1159 | + ioc_err(ioc, "%s: timeout\n", __func__); |
|---|
| 1196 | 1160 | _debug_dump_mf(mpi_request, |
|---|
| 1197 | 1161 | sizeof(Mpi2SmpPassthroughRequest_t)/4); |
|---|
| 1198 | 1162 | if (!(ioc->transport_cmds.status & MPT3_CMD_RESET)) |
|---|
| .. | .. |
|---|
| 1200 | 1164 | goto issue_host_reset; |
|---|
| 1201 | 1165 | } |
|---|
| 1202 | 1166 | |
|---|
| 1203 | | - dtransportprintk(ioc, pr_info(MPT3SAS_FMT |
|---|
| 1204 | | - "phy_error_log - complete\n", ioc->name)); |
|---|
| 1167 | + dtransportprintk(ioc, ioc_info(ioc, "phy_error_log - complete\n")); |
|---|
| 1205 | 1168 | |
|---|
| 1206 | 1169 | if (ioc->transport_cmds.status & MPT3_CMD_REPLY_VALID) { |
|---|
| 1207 | 1170 | |
|---|
| 1208 | 1171 | mpi_reply = ioc->transport_cmds.reply; |
|---|
| 1209 | 1172 | |
|---|
| 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))); |
|---|
| 1173 | + dtransportprintk(ioc, |
|---|
| 1174 | + ioc_info(ioc, "phy_error_log - reply data transfer size(%d)\n", |
|---|
| 1175 | + le16_to_cpu(mpi_reply->ResponseDataLength))); |
|---|
| 1213 | 1176 | |
|---|
| 1214 | 1177 | if (le16_to_cpu(mpi_reply->ResponseDataLength) != |
|---|
| 1215 | 1178 | sizeof(struct phy_error_log_reply)) |
|---|
| .. | .. |
|---|
| 1218 | 1181 | phy_error_log_reply = data_out + |
|---|
| 1219 | 1182 | sizeof(struct phy_error_log_request); |
|---|
| 1220 | 1183 | |
|---|
| 1221 | | - dtransportprintk(ioc, pr_info(MPT3SAS_FMT |
|---|
| 1222 | | - "phy_error_log - function_result(%d)\n", |
|---|
| 1223 | | - ioc->name, phy_error_log_reply->function_result)); |
|---|
| 1184 | + dtransportprintk(ioc, |
|---|
| 1185 | + ioc_info(ioc, "phy_error_log - function_result(%d)\n", |
|---|
| 1186 | + phy_error_log_reply->function_result)); |
|---|
| 1224 | 1187 | |
|---|
| 1225 | 1188 | phy->invalid_dword_count = |
|---|
| 1226 | 1189 | be32_to_cpu(phy_error_log_reply->invalid_dword); |
|---|
| .. | .. |
|---|
| 1232 | 1195 | be32_to_cpu(phy_error_log_reply->phy_reset_problem); |
|---|
| 1233 | 1196 | rc = 0; |
|---|
| 1234 | 1197 | } else |
|---|
| 1235 | | - dtransportprintk(ioc, pr_info(MPT3SAS_FMT |
|---|
| 1236 | | - "phy_error_log - no reply\n", ioc->name)); |
|---|
| 1198 | + dtransportprintk(ioc, |
|---|
| 1199 | + ioc_info(ioc, "phy_error_log - no reply\n")); |
|---|
| 1237 | 1200 | |
|---|
| 1238 | 1201 | issue_host_reset: |
|---|
| 1239 | 1202 | if (issue_reset) |
|---|
| .. | .. |
|---|
| 1241 | 1204 | out: |
|---|
| 1242 | 1205 | ioc->transport_cmds.status = MPT3_CMD_NOT_USED; |
|---|
| 1243 | 1206 | if (data_out) |
|---|
| 1244 | | - pci_free_consistent(ioc->pdev, sz, data_out, data_out_dma); |
|---|
| 1207 | + dma_free_coherent(&ioc->pdev->dev, sz, data_out, data_out_dma); |
|---|
| 1245 | 1208 | |
|---|
| 1246 | 1209 | mutex_unlock(&ioc->transport_cmds.mutex); |
|---|
| 1247 | 1210 | return rc; |
|---|
| .. | .. |
|---|
| 1276 | 1239 | /* get hba phy error logs */ |
|---|
| 1277 | 1240 | if ((mpt3sas_config_get_phy_pg1(ioc, &mpi_reply, &phy_pg1, |
|---|
| 1278 | 1241 | phy->number))) { |
|---|
| 1279 | | - pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", |
|---|
| 1280 | | - ioc->name, __FILE__, __LINE__, __func__); |
|---|
| 1242 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", |
|---|
| 1243 | + __FILE__, __LINE__, __func__); |
|---|
| 1281 | 1244 | return -ENXIO; |
|---|
| 1282 | 1245 | } |
|---|
| 1283 | 1246 | |
|---|
| 1284 | 1247 | 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)); |
|---|
| 1248 | + ioc_info(ioc, "phy(%d), ioc_status (0x%04x), loginfo(0x%08x)\n", |
|---|
| 1249 | + phy->number, |
|---|
| 1250 | + le16_to_cpu(mpi_reply.IOCStatus), |
|---|
| 1251 | + le32_to_cpu(mpi_reply.IOCLogInfo)); |
|---|
| 1290 | 1252 | |
|---|
| 1291 | 1253 | phy->invalid_dword_count = le32_to_cpu(phy_pg1.InvalidDwordCount); |
|---|
| 1292 | 1254 | phy->running_disparity_error_count = |
|---|
| .. | .. |
|---|
| 1405 | 1367 | struct phy_control_reply *phy_control_reply; |
|---|
| 1406 | 1368 | int rc; |
|---|
| 1407 | 1369 | u16 smid; |
|---|
| 1408 | | - u32 ioc_state; |
|---|
| 1409 | 1370 | void *psge; |
|---|
| 1410 | 1371 | u8 issue_reset = 0; |
|---|
| 1411 | 1372 | void *data_out = NULL; |
|---|
| 1412 | 1373 | dma_addr_t data_out_dma; |
|---|
| 1413 | 1374 | u32 sz; |
|---|
| 1414 | | - u16 wait_state_count; |
|---|
| 1415 | 1375 | |
|---|
| 1416 | 1376 | if (ioc->shost_recovery || ioc->pci_error_recovery) { |
|---|
| 1417 | | - pr_info(MPT3SAS_FMT "%s: host reset in progress!\n", |
|---|
| 1418 | | - __func__, ioc->name); |
|---|
| 1377 | + ioc_info(ioc, "%s: host reset in progress!\n", __func__); |
|---|
| 1419 | 1378 | return -EFAULT; |
|---|
| 1420 | 1379 | } |
|---|
| 1421 | 1380 | |
|---|
| 1422 | 1381 | mutex_lock(&ioc->transport_cmds.mutex); |
|---|
| 1423 | 1382 | |
|---|
| 1424 | 1383 | if (ioc->transport_cmds.status != MPT3_CMD_NOT_USED) { |
|---|
| 1425 | | - pr_err(MPT3SAS_FMT "%s: transport_cmds in use\n", |
|---|
| 1426 | | - ioc->name, __func__); |
|---|
| 1384 | + ioc_err(ioc, "%s: transport_cmds in use\n", __func__); |
|---|
| 1427 | 1385 | rc = -EAGAIN; |
|---|
| 1428 | 1386 | goto out; |
|---|
| 1429 | 1387 | } |
|---|
| 1430 | 1388 | ioc->transport_cmds.status = MPT3_CMD_PENDING; |
|---|
| 1431 | 1389 | |
|---|
| 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__); |
|---|
| 1390 | + rc = mpt3sas_wait_for_ioc(ioc, IOC_OPERATIONAL_WAIT_COUNT); |
|---|
| 1391 | + if (rc) |
|---|
| 1392 | + goto out; |
|---|
| 1451 | 1393 | |
|---|
| 1452 | 1394 | smid = mpt3sas_base_get_smid(ioc, ioc->transport_cb_idx); |
|---|
| 1453 | 1395 | if (!smid) { |
|---|
| 1454 | | - pr_err(MPT3SAS_FMT "%s: failed obtaining a smid\n", |
|---|
| 1455 | | - ioc->name, __func__); |
|---|
| 1396 | + ioc_err(ioc, "%s: failed obtaining a smid\n", __func__); |
|---|
| 1456 | 1397 | rc = -EAGAIN; |
|---|
| 1457 | 1398 | goto out; |
|---|
| 1458 | 1399 | } |
|---|
| .. | .. |
|---|
| 1462 | 1403 | |
|---|
| 1463 | 1404 | sz = sizeof(struct phy_control_request) + |
|---|
| 1464 | 1405 | sizeof(struct phy_control_reply); |
|---|
| 1465 | | - data_out = pci_alloc_consistent(ioc->pdev, sz, &data_out_dma); |
|---|
| 1406 | + data_out = dma_alloc_coherent(&ioc->pdev->dev, sz, &data_out_dma, |
|---|
| 1407 | + GFP_KERNEL); |
|---|
| 1466 | 1408 | if (!data_out) { |
|---|
| 1467 | 1409 | pr_err("failure at %s:%d/%s()!\n", __FILE__, |
|---|
| 1468 | 1410 | __LINE__, __func__); |
|---|
| .. | .. |
|---|
| 1500 | 1442 | data_out_dma + sizeof(struct phy_control_request), |
|---|
| 1501 | 1443 | sizeof(struct phy_control_reply)); |
|---|
| 1502 | 1444 | |
|---|
| 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)); |
|---|
| 1445 | + dtransportprintk(ioc, |
|---|
| 1446 | + ioc_info(ioc, "phy_control - send to sas_addr(0x%016llx), phy(%d), opcode(%d)\n", |
|---|
| 1447 | + (u64)phy->identify.sas_address, |
|---|
| 1448 | + phy->number, phy_operation)); |
|---|
| 1507 | 1449 | init_completion(&ioc->transport_cmds.done); |
|---|
| 1508 | | - mpt3sas_base_put_smid_default(ioc, smid); |
|---|
| 1450 | + ioc->put_smid_default(ioc, smid); |
|---|
| 1509 | 1451 | wait_for_completion_timeout(&ioc->transport_cmds.done, 10*HZ); |
|---|
| 1510 | 1452 | |
|---|
| 1511 | 1453 | if (!(ioc->transport_cmds.status & MPT3_CMD_COMPLETE)) { |
|---|
| 1512 | | - pr_err(MPT3SAS_FMT "%s: timeout\n", |
|---|
| 1513 | | - ioc->name, __func__); |
|---|
| 1454 | + ioc_err(ioc, "%s: timeout\n", __func__); |
|---|
| 1514 | 1455 | _debug_dump_mf(mpi_request, |
|---|
| 1515 | 1456 | sizeof(Mpi2SmpPassthroughRequest_t)/4); |
|---|
| 1516 | 1457 | if (!(ioc->transport_cmds.status & MPT3_CMD_RESET)) |
|---|
| .. | .. |
|---|
| 1518 | 1459 | goto issue_host_reset; |
|---|
| 1519 | 1460 | } |
|---|
| 1520 | 1461 | |
|---|
| 1521 | | - dtransportprintk(ioc, pr_info(MPT3SAS_FMT |
|---|
| 1522 | | - "phy_control - complete\n", ioc->name)); |
|---|
| 1462 | + dtransportprintk(ioc, ioc_info(ioc, "phy_control - complete\n")); |
|---|
| 1523 | 1463 | |
|---|
| 1524 | 1464 | if (ioc->transport_cmds.status & MPT3_CMD_REPLY_VALID) { |
|---|
| 1525 | 1465 | |
|---|
| 1526 | 1466 | mpi_reply = ioc->transport_cmds.reply; |
|---|
| 1527 | 1467 | |
|---|
| 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))); |
|---|
| 1468 | + dtransportprintk(ioc, |
|---|
| 1469 | + ioc_info(ioc, "phy_control - reply data transfer size(%d)\n", |
|---|
| 1470 | + le16_to_cpu(mpi_reply->ResponseDataLength))); |
|---|
| 1531 | 1471 | |
|---|
| 1532 | 1472 | if (le16_to_cpu(mpi_reply->ResponseDataLength) != |
|---|
| 1533 | 1473 | sizeof(struct phy_control_reply)) |
|---|
| .. | .. |
|---|
| 1536 | 1476 | phy_control_reply = data_out + |
|---|
| 1537 | 1477 | sizeof(struct phy_control_request); |
|---|
| 1538 | 1478 | |
|---|
| 1539 | | - dtransportprintk(ioc, pr_info(MPT3SAS_FMT |
|---|
| 1540 | | - "phy_control - function_result(%d)\n", |
|---|
| 1541 | | - ioc->name, phy_control_reply->function_result)); |
|---|
| 1479 | + dtransportprintk(ioc, |
|---|
| 1480 | + ioc_info(ioc, "phy_control - function_result(%d)\n", |
|---|
| 1481 | + phy_control_reply->function_result)); |
|---|
| 1542 | 1482 | |
|---|
| 1543 | 1483 | rc = 0; |
|---|
| 1544 | 1484 | } else |
|---|
| 1545 | | - dtransportprintk(ioc, pr_info(MPT3SAS_FMT |
|---|
| 1546 | | - "phy_control - no reply\n", ioc->name)); |
|---|
| 1485 | + dtransportprintk(ioc, |
|---|
| 1486 | + ioc_info(ioc, "phy_control - no reply\n")); |
|---|
| 1547 | 1487 | |
|---|
| 1548 | 1488 | issue_host_reset: |
|---|
| 1549 | 1489 | if (issue_reset) |
|---|
| .. | .. |
|---|
| 1551 | 1491 | out: |
|---|
| 1552 | 1492 | ioc->transport_cmds.status = MPT3_CMD_NOT_USED; |
|---|
| 1553 | 1493 | if (data_out) |
|---|
| 1554 | | - pci_free_consistent(ioc->pdev, sz, data_out, data_out_dma); |
|---|
| 1494 | + dma_free_coherent(&ioc->pdev->dev, sz, data_out, |
|---|
| 1495 | + data_out_dma); |
|---|
| 1555 | 1496 | |
|---|
| 1556 | 1497 | mutex_unlock(&ioc->transport_cmds.mutex); |
|---|
| 1557 | 1498 | return rc; |
|---|
| .. | .. |
|---|
| 1594 | 1535 | mpi_request.PhyNum = phy->number; |
|---|
| 1595 | 1536 | |
|---|
| 1596 | 1537 | 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__); |
|---|
| 1538 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", |
|---|
| 1539 | + __FILE__, __LINE__, __func__); |
|---|
| 1599 | 1540 | return -ENXIO; |
|---|
| 1600 | 1541 | } |
|---|
| 1601 | 1542 | |
|---|
| 1602 | 1543 | 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)); |
|---|
| 1544 | + ioc_info(ioc, "phy(%d), ioc_status(0x%04x), loginfo(0x%08x)\n", |
|---|
| 1545 | + phy->number, le16_to_cpu(mpi_reply.IOCStatus), |
|---|
| 1546 | + le32_to_cpu(mpi_reply.IOCLogInfo)); |
|---|
| 1607 | 1547 | |
|---|
| 1608 | 1548 | return 0; |
|---|
| 1609 | 1549 | } |
|---|
| .. | .. |
|---|
| 1650 | 1590 | sizeof(Mpi2SasIOUnit0PhyData_t)); |
|---|
| 1651 | 1591 | sas_iounit_pg0 = kzalloc(sz, GFP_KERNEL); |
|---|
| 1652 | 1592 | if (!sas_iounit_pg0) { |
|---|
| 1653 | | - pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", |
|---|
| 1654 | | - ioc->name, __FILE__, __LINE__, __func__); |
|---|
| 1593 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", |
|---|
| 1594 | + __FILE__, __LINE__, __func__); |
|---|
| 1655 | 1595 | rc = -ENOMEM; |
|---|
| 1656 | 1596 | goto out; |
|---|
| 1657 | 1597 | } |
|---|
| 1658 | 1598 | if ((mpt3sas_config_get_sas_iounit_pg0(ioc, &mpi_reply, |
|---|
| 1659 | 1599 | sas_iounit_pg0, sz))) { |
|---|
| 1660 | | - pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", |
|---|
| 1661 | | - ioc->name, __FILE__, __LINE__, __func__); |
|---|
| 1600 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", |
|---|
| 1601 | + __FILE__, __LINE__, __func__); |
|---|
| 1662 | 1602 | rc = -ENXIO; |
|---|
| 1663 | 1603 | goto out; |
|---|
| 1664 | 1604 | } |
|---|
| 1665 | 1605 | ioc_status = le16_to_cpu(mpi_reply.IOCStatus) & |
|---|
| 1666 | 1606 | MPI2_IOCSTATUS_MASK; |
|---|
| 1667 | 1607 | if (ioc_status != MPI2_IOCSTATUS_SUCCESS) { |
|---|
| 1668 | | - pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", |
|---|
| 1669 | | - ioc->name, __FILE__, __LINE__, __func__); |
|---|
| 1608 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", |
|---|
| 1609 | + __FILE__, __LINE__, __func__); |
|---|
| 1670 | 1610 | rc = -EIO; |
|---|
| 1671 | 1611 | goto out; |
|---|
| 1672 | 1612 | } |
|---|
| .. | .. |
|---|
| 1675 | 1615 | for (i = 0, discovery_active = 0; i < ioc->sas_hba.num_phys ; i++) { |
|---|
| 1676 | 1616 | if (sas_iounit_pg0->PhyData[i].PortFlags & |
|---|
| 1677 | 1617 | 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); |
|---|
| 1618 | + ioc_err(ioc, "discovery is active on port = %d, phy = %d: unable to enable/disable phys, try again later!\n", |
|---|
| 1619 | + sas_iounit_pg0->PhyData[i].Port, i); |
|---|
| 1682 | 1620 | discovery_active = 1; |
|---|
| 1683 | 1621 | } |
|---|
| 1684 | 1622 | } |
|---|
| .. | .. |
|---|
| 1693 | 1631 | sizeof(Mpi2SasIOUnit1PhyData_t)); |
|---|
| 1694 | 1632 | sas_iounit_pg1 = kzalloc(sz, GFP_KERNEL); |
|---|
| 1695 | 1633 | if (!sas_iounit_pg1) { |
|---|
| 1696 | | - pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", |
|---|
| 1697 | | - ioc->name, __FILE__, __LINE__, __func__); |
|---|
| 1634 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", |
|---|
| 1635 | + __FILE__, __LINE__, __func__); |
|---|
| 1698 | 1636 | rc = -ENOMEM; |
|---|
| 1699 | 1637 | goto out; |
|---|
| 1700 | 1638 | } |
|---|
| 1701 | 1639 | if ((mpt3sas_config_get_sas_iounit_pg1(ioc, &mpi_reply, |
|---|
| 1702 | 1640 | sas_iounit_pg1, sz))) { |
|---|
| 1703 | | - pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", |
|---|
| 1704 | | - ioc->name, __FILE__, __LINE__, __func__); |
|---|
| 1641 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", |
|---|
| 1642 | + __FILE__, __LINE__, __func__); |
|---|
| 1705 | 1643 | rc = -ENXIO; |
|---|
| 1706 | 1644 | goto out; |
|---|
| 1707 | 1645 | } |
|---|
| 1708 | 1646 | ioc_status = le16_to_cpu(mpi_reply.IOCStatus) & |
|---|
| 1709 | 1647 | MPI2_IOCSTATUS_MASK; |
|---|
| 1710 | 1648 | if (ioc_status != MPI2_IOCSTATUS_SUCCESS) { |
|---|
| 1711 | | - pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", |
|---|
| 1712 | | - ioc->name, __FILE__, __LINE__, __func__); |
|---|
| 1649 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", |
|---|
| 1650 | + __FILE__, __LINE__, __func__); |
|---|
| 1713 | 1651 | rc = -EIO; |
|---|
| 1714 | 1652 | goto out; |
|---|
| 1715 | 1653 | } |
|---|
| .. | .. |
|---|
| 1801 | 1739 | sizeof(Mpi2SasIOUnit1PhyData_t)); |
|---|
| 1802 | 1740 | sas_iounit_pg1 = kzalloc(sz, GFP_KERNEL); |
|---|
| 1803 | 1741 | if (!sas_iounit_pg1) { |
|---|
| 1804 | | - pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", |
|---|
| 1805 | | - ioc->name, __FILE__, __LINE__, __func__); |
|---|
| 1742 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", |
|---|
| 1743 | + __FILE__, __LINE__, __func__); |
|---|
| 1806 | 1744 | rc = -ENOMEM; |
|---|
| 1807 | 1745 | goto out; |
|---|
| 1808 | 1746 | } |
|---|
| 1809 | 1747 | if ((mpt3sas_config_get_sas_iounit_pg1(ioc, &mpi_reply, |
|---|
| 1810 | 1748 | sas_iounit_pg1, sz))) { |
|---|
| 1811 | | - pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", |
|---|
| 1812 | | - ioc->name, __FILE__, __LINE__, __func__); |
|---|
| 1749 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", |
|---|
| 1750 | + __FILE__, __LINE__, __func__); |
|---|
| 1813 | 1751 | rc = -ENXIO; |
|---|
| 1814 | 1752 | goto out; |
|---|
| 1815 | 1753 | } |
|---|
| 1816 | 1754 | ioc_status = le16_to_cpu(mpi_reply.IOCStatus) & |
|---|
| 1817 | 1755 | MPI2_IOCSTATUS_MASK; |
|---|
| 1818 | 1756 | if (ioc_status != MPI2_IOCSTATUS_SUCCESS) { |
|---|
| 1819 | | - pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", |
|---|
| 1820 | | - ioc->name, __FILE__, __LINE__, __func__); |
|---|
| 1757 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", |
|---|
| 1758 | + __FILE__, __LINE__, __func__); |
|---|
| 1821 | 1759 | rc = -EIO; |
|---|
| 1822 | 1760 | goto out; |
|---|
| 1823 | 1761 | } |
|---|
| .. | .. |
|---|
| 1836 | 1774 | |
|---|
| 1837 | 1775 | if (mpt3sas_config_set_sas_iounit_pg1(ioc, &mpi_reply, sas_iounit_pg1, |
|---|
| 1838 | 1776 | sz)) { |
|---|
| 1839 | | - pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", |
|---|
| 1840 | | - ioc->name, __FILE__, __LINE__, __func__); |
|---|
| 1777 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", |
|---|
| 1778 | + __FILE__, __LINE__, __func__); |
|---|
| 1841 | 1779 | rc = -ENXIO; |
|---|
| 1842 | 1780 | goto out; |
|---|
| 1843 | 1781 | } |
|---|
| .. | .. |
|---|
| 1913 | 1851 | Mpi2SmpPassthroughReply_t *mpi_reply; |
|---|
| 1914 | 1852 | int rc; |
|---|
| 1915 | 1853 | u16 smid; |
|---|
| 1916 | | - u32 ioc_state; |
|---|
| 1917 | 1854 | void *psge; |
|---|
| 1918 | 1855 | dma_addr_t dma_addr_in; |
|---|
| 1919 | 1856 | dma_addr_t dma_addr_out; |
|---|
| .. | .. |
|---|
| 1921 | 1858 | void *addr_out = NULL; |
|---|
| 1922 | 1859 | size_t dma_len_in; |
|---|
| 1923 | 1860 | size_t dma_len_out; |
|---|
| 1924 | | - u16 wait_state_count; |
|---|
| 1925 | 1861 | unsigned int reslen = 0; |
|---|
| 1926 | 1862 | |
|---|
| 1927 | 1863 | if (ioc->shost_recovery || ioc->pci_error_recovery) { |
|---|
| 1928 | | - pr_info(MPT3SAS_FMT "%s: host reset in progress!\n", |
|---|
| 1929 | | - __func__, ioc->name); |
|---|
| 1864 | + ioc_info(ioc, "%s: host reset in progress!\n", __func__); |
|---|
| 1930 | 1865 | rc = -EFAULT; |
|---|
| 1931 | 1866 | goto job_done; |
|---|
| 1932 | 1867 | } |
|---|
| .. | .. |
|---|
| 1936 | 1871 | goto job_done; |
|---|
| 1937 | 1872 | |
|---|
| 1938 | 1873 | if (ioc->transport_cmds.status != MPT3_CMD_NOT_USED) { |
|---|
| 1939 | | - pr_err(MPT3SAS_FMT "%s: transport_cmds in use\n", ioc->name, |
|---|
| 1940 | | - __func__); |
|---|
| 1874 | + ioc_err(ioc, "%s: transport_cmds in use\n", |
|---|
| 1875 | + __func__); |
|---|
| 1941 | 1876 | rc = -EAGAIN; |
|---|
| 1942 | 1877 | goto out; |
|---|
| 1943 | 1878 | } |
|---|
| .. | .. |
|---|
| 1958 | 1893 | if (rc) |
|---|
| 1959 | 1894 | goto unmap_out; |
|---|
| 1960 | 1895 | |
|---|
| 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__); |
|---|
| 1896 | + rc = mpt3sas_wait_for_ioc(ioc, IOC_OPERATIONAL_WAIT_COUNT); |
|---|
| 1897 | + if (rc) |
|---|
| 1898 | + goto unmap_in; |
|---|
| 1980 | 1899 | |
|---|
| 1981 | 1900 | smid = mpt3sas_base_get_smid(ioc, ioc->transport_cb_idx); |
|---|
| 1982 | 1901 | if (!smid) { |
|---|
| 1983 | | - pr_err(MPT3SAS_FMT "%s: failed obtaining a smid\n", |
|---|
| 1984 | | - ioc->name, __func__); |
|---|
| 1902 | + ioc_err(ioc, "%s: failed obtaining a smid\n", __func__); |
|---|
| 1985 | 1903 | rc = -EAGAIN; |
|---|
| 1986 | 1904 | goto unmap_in; |
|---|
| 1987 | 1905 | } |
|---|
| .. | .. |
|---|
| 2002 | 1920 | ioc->build_sg(ioc, psge, dma_addr_out, dma_len_out - 4, dma_addr_in, |
|---|
| 2003 | 1921 | dma_len_in - 4); |
|---|
| 2004 | 1922 | |
|---|
| 2005 | | - dtransportprintk(ioc, pr_info(MPT3SAS_FMT |
|---|
| 2006 | | - "%s - sending smp request\n", ioc->name, __func__)); |
|---|
| 1923 | + dtransportprintk(ioc, |
|---|
| 1924 | + ioc_info(ioc, "%s: sending smp request\n", __func__)); |
|---|
| 2007 | 1925 | |
|---|
| 2008 | 1926 | init_completion(&ioc->transport_cmds.done); |
|---|
| 2009 | | - mpt3sas_base_put_smid_default(ioc, smid); |
|---|
| 1927 | + ioc->put_smid_default(ioc, smid); |
|---|
| 2010 | 1928 | wait_for_completion_timeout(&ioc->transport_cmds.done, 10*HZ); |
|---|
| 2011 | 1929 | |
|---|
| 2012 | 1930 | if (!(ioc->transport_cmds.status & MPT3_CMD_COMPLETE)) { |
|---|
| 2013 | | - pr_err(MPT3SAS_FMT "%s : timeout\n", |
|---|
| 2014 | | - __func__, ioc->name); |
|---|
| 1931 | + ioc_err(ioc, "%s: timeout\n", __func__); |
|---|
| 2015 | 1932 | _debug_dump_mf(mpi_request, |
|---|
| 2016 | 1933 | sizeof(Mpi2SmpPassthroughRequest_t)/4); |
|---|
| 2017 | 1934 | if (!(ioc->transport_cmds.status & MPT3_CMD_RESET)) { |
|---|
| .. | .. |
|---|
| 2021 | 1938 | } |
|---|
| 2022 | 1939 | } |
|---|
| 2023 | 1940 | |
|---|
| 2024 | | - dtransportprintk(ioc, pr_info(MPT3SAS_FMT |
|---|
| 2025 | | - "%s - complete\n", ioc->name, __func__)); |
|---|
| 1941 | + dtransportprintk(ioc, ioc_info(ioc, "%s - complete\n", __func__)); |
|---|
| 2026 | 1942 | |
|---|
| 2027 | 1943 | if (!(ioc->transport_cmds.status & MPT3_CMD_REPLY_VALID)) { |
|---|
| 2028 | | - dtransportprintk(ioc, pr_info(MPT3SAS_FMT |
|---|
| 2029 | | - "%s - no reply\n", ioc->name, __func__)); |
|---|
| 1944 | + dtransportprintk(ioc, |
|---|
| 1945 | + ioc_info(ioc, "%s: no reply\n", __func__)); |
|---|
| 2030 | 1946 | rc = -ENXIO; |
|---|
| 2031 | 1947 | goto unmap_in; |
|---|
| 2032 | 1948 | } |
|---|
| .. | .. |
|---|
| 2034 | 1950 | mpi_reply = ioc->transport_cmds.reply; |
|---|
| 2035 | 1951 | |
|---|
| 2036 | 1952 | 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))); |
|---|
| 1953 | + ioc_info(ioc, "%s: reply data transfer size(%d)\n", |
|---|
| 1954 | + __func__, |
|---|
| 1955 | + le16_to_cpu(mpi_reply->ResponseDataLength))); |
|---|
| 2040 | 1956 | |
|---|
| 2041 | 1957 | memcpy(job->reply, mpi_reply, sizeof(*mpi_reply)); |
|---|
| 2042 | 1958 | job->reply_len = sizeof(*mpi_reply); |
|---|