Pull SCSI updates from James Bottomley: "This is mostly updates of the usual drivers: UFS, esp_scsi, NCR5380, qla2xxx, lpfc, libsas, hisi_sas. In addition there's a set of mostly small updates to the target subsystem a set of conversions to the generic DMA API, which do have some potential for issues in the older drivers but we'll handle those as case by case fixes. A new myrs driver for the DAC960/mylex raid controllers to replace the block based DAC960 which is also being removed by Jens in this merge window. Plus the usual slew of trivial changes" [ "myrs" stands for "MYlex Raid Scsi". Obviously. Silly of me to even wonder. There's also a "myrb" driver, where the 'b' stands for 'block'. Truly, somebody has got mad naming skillz. - Linus ] * tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (237 commits) scsi: myrs: Fix the processor absent message in processor_show() scsi: myrs: Fix a logical vs bitwise bug scsi: hisi_sas: Fix NULL pointer dereference scsi: myrs: fix build failure on 32 bit scsi: fnic: replace gross legacy tag hack with blk-mq hack scsi: mesh: switch to generic DMA API scsi: ips: switch to generic DMA API scsi: smartpqi: fully convert to the generic DMA API scsi: vmw_pscsi: switch to generic DMA API scsi: snic: switch to generic DMA API scsi: qla4xxx: fully convert to the generic DMA API scsi: qla2xxx: fully convert to the generic DMA API scsi: qla1280: switch to generic DMA API scsi: qedi: fully convert to the generic DMA API scsi: qedf: fully convert to the generic DMA API scsi: pm8001: switch to generic DMA API scsi: nsp32: switch to generic DMA API scsi: mvsas: fully convert to the generic DMA API scsi: mvumi: switch to generic DMA API scsi: mpt3sas: switch to generic DMA API ...
Unified · Split
| @@ -128,6 +128,26 @@ The current UFSHCD implementation supports following functionality, · 127 unmodified lines | ||
| 128 | 128 | In this version of UFSHCD Query requests and power management |
| 129 | 129 | functionality are not implemented. |
| 130 | 130 | |
| 131 | +4. BSG Support | |
| 132 | +------------------ | |
| 133 | + | |
| 134 | +This transport driver supports exchanging UFS protocol information units | |
| 135 | +(UPIUs) with a UFS device. Typically, user space will allocate | |
| 136 | +struct ufs_bsg_request and struct ufs_bsg_reply (see ufs_bsg.h) as | |
| 137 | +request_upiu and reply_upiu respectively. Filling those UPIUs should | |
| 138 | +be done in accordance with JEDEC spec UFS2.1 paragraph 10.7. | |
| 139 | +*Caveat emptor*: The driver makes no further input validations and sends the | |
| 140 | +UPIU to the device as it is. Open the bsg device in /dev/ufs-bsg and | |
| 141 | +send SG_IO with the applicable sg_io_v4: | |
| 142 | + | |
| 143 | + io_hdr_v4.guard = 'Q'; | |
| 144 | + io_hdr_v4.protocol = BSG_PROTOCOL_SCSI; | |
| 145 | + io_hdr_v4.subprotocol = BSG_SUB_PROTOCOL_SCSI_TRANSPORT; | |
| 146 | + io_hdr_v4.response = (__u64)reply_upiu; | |
| 147 | + io_hdr_v4.max_response_len = reply_len; | |
| 148 | + io_hdr_v4.request_len = request_len; | |
| 149 | + io_hdr_v4.request = (__u64)request_upiu; | |
| 150 | + | |
| 131 | 151 | UFS Specifications can be found at, |
| 132 | 152 | UFS - http://www.jedec.org/sites/default/files/docs/JESD220.pdf |
| 133 | 153 | UFSHCI - http://www.jedec.org/sites/default/files/docs/JESD223.pdf |
| @@ -4055,7 +4055,7 @@ M: Uma Krishnan <ukrishn@linux.vnet.ibm.com> · 4054 unmodified lines | ||
| 4055 | 4055 | L: linux-scsi@vger.kernel.org |
| 4056 | 4056 | S: Supported |
| 4057 | 4057 | F: drivers/scsi/cxlflash/ |
| 4058 | −F: include/uapi/scsi/cxlflash_ioctls.h | |
| 4058 | +F: include/uapi/scsi/cxlflash_ioctl.h | |
| 4059 | 4059 | F: Documentation/powerpc/cxlflash.txt |
| 4060 | 4060 | |
| 4061 | 4061 | CYBERPRO FB DRIVER |
| @@ -10011,6 +10011,13 @@ S: Supported · 5949 unmodified lines | ||
| 10011 | 10011 | F: drivers/gpu/drm/mxsfb/ |
| 10012 | 10012 | F: Documentation/devicetree/bindings/display/mxsfb.txt |
| 10013 | 10013 | |
| 10014 | +MYLEX DAC960 PCI RAID Controller | |
| 10015 | +M: Hannes Reinecke <hare@kernel.org> | |
| 10016 | +L: linux-scsi@vger.kernel.org | |
| 10017 | +S: Supported | |
| 10018 | +F: drivers/scsi/myrb.* | |
| 10019 | +F: drivers/scsi/myrs.* | |
| 10020 | + | |
| 10014 | 10021 | MYRICOM MYRI-10G 10GbE DRIVER (MYRI10GE) |
| 10015 | 10022 | M: Chris Lee <christopher.lee@cspi.com> |
| 10016 | 10023 | L: netdev@vger.kernel.org |
| @@ -2004,7 +2004,7 @@ typedef struct _CONFIG_PAGE_FC_PORT_6 · 2003 unmodified lines | ||
| 2004 | 2004 | U64 LinkFailureCount; /* 50h */ |
| 2005 | 2005 | U64 LossOfSyncCount; /* 58h */ |
| 2006 | 2006 | U64 LossOfSignalCount; /* 60h */ |
| 2007 | − U64 PrimativeSeqErrCount; /* 68h */ | |
| 2007 | + U64 PrimitiveSeqErrCount; /* 68h */ | |
| 2008 | 2008 | U64 InvalidTxWordCount; /* 70h */ |
| 2009 | 2009 | U64 InvalidCrcCount; /* 78h */ |
| 2010 | 2010 | U64 FcpInitiatorIoCount; /* 80h */ |
| @@ -335,11 +335,11 @@ static int mpt_remove_dead_ioc_func(void *arg) · 334 unmodified lines | ||
| 335 | 335 | MPT_ADAPTER *ioc = (MPT_ADAPTER *)arg; |
| 336 | 336 | struct pci_dev *pdev; |
| 337 | 337 | |
| 338 | − if ((ioc == NULL)) | |
| 338 | + if (!ioc) | |
| 339 | 339 | return -1; |
| 340 | 340 | |
| 341 | 341 | pdev = ioc->pcidev; |
| 342 | − if ((pdev == NULL)) | |
| 342 | + if (!pdev) | |
| 343 | 343 | return -1; |
| 344 | 344 | |
| 345 | 345 | pci_stop_and_remove_bus_device_locked(pdev); |
| @@ -7570,11 +7570,11 @@ mpt_display_event_info(MPT_ADAPTER *ioc, EventNotificationReply_t *pEventReply) · 7224 unmodified lines | ||
| 7570 | 7570 | u8 phy_num = (u8)(evData0); |
| 7571 | 7571 | u8 port_num = (u8)(evData0 >> 8); |
| 7572 | 7572 | u8 port_width = (u8)(evData0 >> 16); |
| 7573 | − u8 primative = (u8)(evData0 >> 24); | |
| 7573 | + u8 primitive = (u8)(evData0 >> 24); | |
| 7574 | 7574 | snprintf(evStr, EVENT_DESCR_STR_SZ, |
| 7575 | − "SAS Broadcase Primative: phy=%d port=%d " | |
| 7576 | − "width=%d primative=0x%02x", | |
| 7577 | − phy_num, port_num, port_width, primative); | |
| 7575 | + "SAS Broadcast Primitive: phy=%d port=%d " | |
| 7576 | + "width=%d primitive=0x%02x", | |
| 7577 | + phy_num, port_num, port_width, primitive); | |
| 7578 | 7578 | break; |
| 7579 | 7579 | } |
| 7580 | 7580 | |
| @@ -129,7 +129,7 @@ static void mptsas_expander_delete(MPT_ADAPTER *ioc, · 128 unmodified lines | ||
| 129 | 129 | static void mptsas_send_expander_event(struct fw_event_work *fw_event); |
| 130 | 130 | static void mptsas_not_responding_devices(MPT_ADAPTER *ioc); |
| 131 | 131 | static void mptsas_scan_sas_topology(MPT_ADAPTER *ioc); |
| 132 | −static void mptsas_broadcast_primative_work(struct fw_event_work *fw_event); | |
| 132 | +static void mptsas_broadcast_primitive_work(struct fw_event_work *fw_event); | |
| 133 | 133 | static void mptsas_handle_queue_full_event(struct fw_event_work *fw_event); |
| 134 | 134 | static void mptsas_volume_delete(MPT_ADAPTER *ioc, u8 id); |
| 135 | 135 | void mptsas_schedule_target_reset(void *ioc); |
| @@ -1665,7 +1665,7 @@ mptsas_firmware_event_work(struct work_struct *work) · 1529 unmodified lines | ||
| 1665 | 1665 | mptsas_free_fw_event(ioc, fw_event); |
| 1666 | 1666 | break; |
| 1667 | 1667 | case MPI_EVENT_SAS_BROADCAST_PRIMITIVE: |
| 1668 | − mptsas_broadcast_primative_work(fw_event); | |
| 1668 | + mptsas_broadcast_primitive_work(fw_event); | |
| 1669 | 1669 | break; |
| 1670 | 1670 | case MPI_EVENT_SAS_EXPANDER_STATUS_CHANGE: |
| 1671 | 1671 | mptsas_send_expander_event(fw_event); |
| @@ -4826,13 +4826,13 @@ mptsas_issue_tm(MPT_ADAPTER *ioc, u8 type, u8 channel, u8 id, u64 lun, · 3154 unmodified lines | ||
| 4826 | 4826 | } |
| 4827 | 4827 | |
| 4828 | 4828 | /** |
| 4829 | − * mptsas_broadcast_primative_work - Handle broadcast primitives | |
| 4829 | + * mptsas_broadcast_primitive_work - Handle broadcast primitives | |
| 4830 | 4830 | * @work: work queue payload containing info describing the event |
| 4831 | 4831 | * |
| 4832 | 4832 | * this will be handled in workqueue context. |
| 4833 | 4833 | */ |
| 4834 | 4834 | static void |
| 4835 | −mptsas_broadcast_primative_work(struct fw_event_work *fw_event) | |
| 4835 | +mptsas_broadcast_primitive_work(struct fw_event_work *fw_event) | |
| 4836 | 4836 | { |
| 4837 | 4837 | MPT_ADAPTER *ioc = fw_event->ioc; |
| 4838 | 4838 | MPT_FRAME_HDR *mf; |
| @@ -518,7 +518,8 @@ static int twa_allocate_memory(TW_Device_Extension *tw_dev, int size, int which) · 517 unmodified lines | ||
| 518 | 518 | unsigned long *cpu_addr; |
| 519 | 519 | int retval = 1; |
| 520 | 520 | |
| 521 | − cpu_addr = pci_alloc_consistent(tw_dev->tw_pci_dev, size*TW_Q_LENGTH, &dma_handle); | |
| 521 | + cpu_addr = dma_alloc_coherent(&tw_dev->tw_pci_dev->dev, | |
| 522 | + size * TW_Q_LENGTH, &dma_handle, GFP_KERNEL); | |
| 522 | 523 | if (!cpu_addr) { |
| 523 | 524 | TW_PRINTK(tw_dev->host, TW_DRIVER, 0x5, "Memory allocation failed"); |
| 524 | 525 | goto out; |
| @@ -526,7 +527,8 @@ static int twa_allocate_memory(TW_Device_Extension *tw_dev, int size, int which) · 1 unmodified line | ||
| 526 | 527 | |
| 527 | 528 | if ((unsigned long)cpu_addr % (TW_ALIGNMENT_9000)) { |
| 528 | 529 | TW_PRINTK(tw_dev->host, TW_DRIVER, 0x6, "Failed to allocate correctly aligned memory"); |
| 529 | − pci_free_consistent(tw_dev->tw_pci_dev, size*TW_Q_LENGTH, cpu_addr, dma_handle); | |
| 530 | + dma_free_coherent(&tw_dev->tw_pci_dev->dev, size * TW_Q_LENGTH, | |
| 531 | + cpu_addr, dma_handle); | |
| 530 | 532 | goto out; |
| 531 | 533 | } |
| 532 | 534 | |
| @@ -1027,16 +1029,16 @@ out: · 494 unmodified lines | ||
| 1027 | 1029 | static void twa_free_device_extension(TW_Device_Extension *tw_dev) |
| 1028 | 1030 | { |
| 1029 | 1031 | if (tw_dev->command_packet_virt[0]) |
| 1030 | − pci_free_consistent(tw_dev->tw_pci_dev, | |
| 1031 | − sizeof(TW_Command_Full)*TW_Q_LENGTH, | |
| 1032 | − tw_dev->command_packet_virt[0], | |
| 1033 | − tw_dev->command_packet_phys[0]); | |
| 1032 | + dma_free_coherent(&tw_dev->tw_pci_dev->dev, | |
| 1033 | + sizeof(TW_Command_Full) * TW_Q_LENGTH, | |
| 1034 | + tw_dev->command_packet_virt[0], | |
| 1035 | + tw_dev->command_packet_phys[0]); | |
| 1034 | 1036 | |
| 1035 | 1037 | if (tw_dev->generic_buffer_virt[0]) |
| 1036 | − pci_free_consistent(tw_dev->tw_pci_dev, | |
| 1037 | − TW_SECTOR_SIZE*TW_Q_LENGTH, | |
| 1038 | − tw_dev->generic_buffer_virt[0], | |
| 1039 | − tw_dev->generic_buffer_phys[0]); | |
| 1038 | + dma_free_coherent(&tw_dev->tw_pci_dev->dev, | |
| 1039 | + TW_SECTOR_SIZE * TW_Q_LENGTH, | |
| 1040 | + tw_dev->generic_buffer_virt[0], | |
| 1041 | + tw_dev->generic_buffer_phys[0]); | |
| 1040 | 1042 | |
| 1041 | 1043 | kfree(tw_dev->event_queue[0]); |
| 1042 | 1044 | } /* End twa_free_device_extension() */ |
| @@ -2015,14 +2017,12 @@ static int twa_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id) · 972 unmodified lines | ||
| 2015 | 2017 | pci_set_master(pdev); |
| 2016 | 2018 | pci_try_set_mwi(pdev); |
| 2017 | 2019 | |
| 2018 | − if (pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) | |
| 2019 | − || pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64))) | |
| 2020 | − if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32)) | |
| 2021 | − || pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32))) { | |
| 2022 | − TW_PRINTK(host, TW_DRIVER, 0x23, "Failed to set dma mask"); | |
| 2023 | − retval = -ENODEV; | |
| 2024 | − goto out_disable_device; | |
| 2025 | − } | |
| 2020 | + if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) || | |
| 2021 | + dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) { | |
| 2022 | + TW_PRINTK(host, TW_DRIVER, 0x23, "Failed to set dma mask"); | |
| 2023 | + retval = -ENODEV; | |
| 2024 | + goto out_disable_device; | |
| 2025 | + } | |
| 2026 | 2026 | |
| 2027 | 2027 | host = scsi_host_alloc(&driver_template, sizeof(TW_Device_Extension)); |
| 2028 | 2028 | if (!host) { |
| @@ -2237,14 +2237,12 @@ static int twa_resume(struct pci_dev *pdev) · 208 unmodified lines | ||
| 2237 | 2237 | pci_set_master(pdev); |
| 2238 | 2238 | pci_try_set_mwi(pdev); |
| 2239 | 2239 | |
| 2240 | − if (pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) | |
| 2241 | − || pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64))) | |
| 2242 | − if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32)) | |
| 2243 | − || pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32))) { | |
| 2244 | − TW_PRINTK(host, TW_DRIVER, 0x40, "Failed to set dma mask during resume"); | |
| 2245 | − retval = -ENODEV; | |
| 2246 | − goto out_disable_device; | |
| 2247 | − } | |
| 2240 | + if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) || | |
| 2241 | + dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) { | |
| 2242 | + TW_PRINTK(host, TW_DRIVER, 0x40, "Failed to set dma mask during resume"); | |
| 2243 | + retval = -ENODEV; | |
| 2244 | + goto out_disable_device; | |
| 2245 | + } | |
| 2248 | 2246 | |
| 2249 | 2247 | /* Initialize the card */ |
| 2250 | 2248 | if (twa_reset_sequence(tw_dev, 0)) { |
| @@ -644,8 +644,8 @@ static int twl_allocate_memory(TW_Device_Extension *tw_dev, int size, int which) · 643 unmodified lines | ||
| 644 | 644 | unsigned long *cpu_addr; |
| 645 | 645 | int retval = 1; |
| 646 | 646 | |
| 647 | − cpu_addr = pci_zalloc_consistent(tw_dev->tw_pci_dev, size * TW_Q_LENGTH, | |
| 648 | − &dma_handle); | |
| 647 | + cpu_addr = dma_zalloc_coherent(&tw_dev->tw_pci_dev->dev, | |
| 648 | + size * TW_Q_LENGTH, &dma_handle, GFP_KERNEL); | |
| 649 | 649 | if (!cpu_addr) { |
| 650 | 650 | TW_PRINTK(tw_dev->host, TW_DRIVER, 0x5, "Memory allocation failed"); |
| 651 | 651 | goto out; |
| @@ -899,19 +899,19 @@ out: · 247 unmodified lines | ||
| 899 | 899 | static void twl_free_device_extension(TW_Device_Extension *tw_dev) |
| 900 | 900 | { |
| 901 | 901 | if (tw_dev->command_packet_virt[0]) |
| 902 | − pci_free_consistent(tw_dev->tw_pci_dev, | |
| 902 | + dma_free_coherent(&tw_dev->tw_pci_dev->dev, | |
| 903 | 903 | sizeof(TW_Command_Full)*TW_Q_LENGTH, |
| 904 | 904 | tw_dev->command_packet_virt[0], |
| 905 | 905 | tw_dev->command_packet_phys[0]); |
| 906 | 906 | |
| 907 | 907 | if (tw_dev->generic_buffer_virt[0]) |
| 908 | − pci_free_consistent(tw_dev->tw_pci_dev, | |
| 908 | + dma_free_coherent(&tw_dev->tw_pci_dev->dev, | |
| 909 | 909 | TW_SECTOR_SIZE*TW_Q_LENGTH, |
| 910 | 910 | tw_dev->generic_buffer_virt[0], |
| 911 | 911 | tw_dev->generic_buffer_phys[0]); |
| 912 | 912 | |
| 913 | 913 | if (tw_dev->sense_buffer_virt[0]) |
| 914 | − pci_free_consistent(tw_dev->tw_pci_dev, | |
| 914 | + dma_free_coherent(&tw_dev->tw_pci_dev->dev, | |
| 915 | 915 | sizeof(TW_Command_Apache_Header)* |
| 916 | 916 | TW_Q_LENGTH, |
| 917 | 917 | tw_dev->sense_buffer_virt[0], |
| @@ -1571,14 +1571,12 @@ static int twl_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id) · 653 unmodified lines | ||
| 1571 | 1571 | pci_set_master(pdev); |
| 1572 | 1572 | pci_try_set_mwi(pdev); |
| 1573 | 1573 | |
| 1574 | − if (pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) | |
| 1575 | − || pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64))) | |
| 1576 | − if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32)) | |
| 1577 | − || pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32))) { | |
| 1578 | − TW_PRINTK(host, TW_DRIVER, 0x18, "Failed to set dma mask"); | |
| 1579 | − retval = -ENODEV; | |
| 1580 | − goto out_disable_device; | |
| 1581 | − } | |
| 1574 | + if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) || | |
| 1575 | + dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) { | |
| 1576 | + TW_PRINTK(host, TW_DRIVER, 0x18, "Failed to set dma mask"); | |
| 1577 | + retval = -ENODEV; | |
| 1578 | + goto out_disable_device; | |
| 1579 | + } | |
| 1582 | 1580 | |
| 1583 | 1581 | host = scsi_host_alloc(&driver_template, sizeof(TW_Device_Extension)); |
| 1584 | 1582 | if (!host) { |
| @@ -1805,14 +1803,12 @@ static int twl_resume(struct pci_dev *pdev) · 220 unmodified lines | ||
| 1805 | 1803 | pci_set_master(pdev); |
| 1806 | 1804 | pci_try_set_mwi(pdev); |
| 1807 | 1805 | |
| 1808 | − if (pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) | |
| 1809 | − || pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64))) | |
| 1810 | − if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32)) | |
| 1811 | − || pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32))) { | |
| 1812 | − TW_PRINTK(host, TW_DRIVER, 0x25, "Failed to set dma mask during resume"); | |
| 1813 | − retval = -ENODEV; | |
| 1814 | − goto out_disable_device; | |
| 1815 | − } | |
| 1806 | + if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) || | |
| 1807 | + dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) { | |
| 1808 | + TW_PRINTK(host, TW_DRIVER, 0x25, "Failed to set dma mask during resume"); | |
| 1809 | + retval = -ENODEV; | |
| 1810 | + goto out_disable_device; | |
| 1811 | + } | |
| 1816 | 1812 | |
| 1817 | 1813 | /* Initialize the card */ |
| 1818 | 1814 | if (twl_reset_sequence(tw_dev, 0)) { |
| @@ -834,15 +834,17 @@ static int tw_allocate_memory(TW_Device_Extension *tw_dev, int size, int which) · 833 unmodified lines | ||
| 834 | 834 | |
| 835 | 835 | dprintk(KERN_NOTICE "3w-xxxx: tw_allocate_memory()\n"); |
| 836 | 836 | |
| 837 | − cpu_addr = pci_alloc_consistent(tw_dev->tw_pci_dev, size*TW_Q_LENGTH, &dma_handle); | |
| 837 | + cpu_addr = dma_alloc_coherent(&tw_dev->tw_pci_dev->dev, | |
| 838 | + size * TW_Q_LENGTH, &dma_handle, GFP_KERNEL); | |
| 838 | 839 | if (cpu_addr == NULL) { |
| 839 | − printk(KERN_WARNING "3w-xxxx: pci_alloc_consistent() failed.\n"); | |
| 840 | + printk(KERN_WARNING "3w-xxxx: dma_alloc_coherent() failed.\n"); | |
| 840 | 841 | return 1; |
| 841 | 842 | } |
| 842 | 843 | |
| 843 | 844 | if ((unsigned long)cpu_addr % (tw_dev->tw_pci_dev->device == TW_DEVICE_ID ? TW_ALIGNMENT_6000 : TW_ALIGNMENT_7000)) { |
| 844 | 845 | printk(KERN_WARNING "3w-xxxx: Couldn't allocate correctly aligned memory.\n"); |
| 845 | − pci_free_consistent(tw_dev->tw_pci_dev, size*TW_Q_LENGTH, cpu_addr, dma_handle); | |
| 846 | + dma_free_coherent(&tw_dev->tw_pci_dev->dev, size * TW_Q_LENGTH, | |
| 847 | + cpu_addr, dma_handle); | |
| 846 | 848 | return 1; |
| 847 | 849 | } |
| 848 | 850 | |
| @@ -1062,10 +1064,16 @@ static void tw_free_device_extension(TW_Device_Extension *tw_dev) · 213 unmodified lines | ||
| 1062 | 1064 | |
| 1063 | 1065 | /* Free command packet and generic buffer memory */ |
| 1064 | 1066 | if (tw_dev->command_packet_virtual_address[0]) |
| 1065 | − pci_free_consistent(tw_dev->tw_pci_dev, sizeof(TW_Command)*TW_Q_LENGTH, tw_dev->command_packet_virtual_address[0], tw_dev->command_packet_physical_address[0]); | |
| 1067 | + dma_free_coherent(&tw_dev->tw_pci_dev->dev, | |
| 1068 | + sizeof(TW_Command) * TW_Q_LENGTH, | |
| 1069 | + tw_dev->command_packet_virtual_address[0], | |
| 1070 | + tw_dev->command_packet_physical_address[0]); | |
| 1066 | 1071 | |
| 1067 | 1072 | if (tw_dev->alignment_virtual_address[0]) |
| 1068 | − pci_free_consistent(tw_dev->tw_pci_dev, sizeof(TW_Sector)*TW_Q_LENGTH, tw_dev->alignment_virtual_address[0], tw_dev->alignment_physical_address[0]); | |
| 1073 | + dma_free_coherent(&tw_dev->tw_pci_dev->dev, | |
| 1074 | + sizeof(TW_Sector) * TW_Q_LENGTH, | |
| 1075 | + tw_dev->alignment_virtual_address[0], | |
| 1076 | + tw_dev->alignment_physical_address[0]); | |
| 1069 | 1077 | } /* End tw_free_device_extension() */ |
| 1070 | 1078 | |
| 1071 | 1079 | /* This function will send an initconnection command to controller */ |
| @@ -2260,7 +2268,7 @@ static int tw_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id) · 1188 unmodified lines | ||
| 2260 | 2268 | |
| 2261 | 2269 | pci_set_master(pdev); |
| 2262 | 2270 | |
| 2263 | − retval = pci_set_dma_mask(pdev, TW_DMA_MASK); | |
| 2271 | + retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); | |
| 2264 | 2272 | if (retval) { |
| 2265 | 2273 | printk(KERN_WARNING "3w-xxxx: Failed to set dma mask."); |
| 2266 | 2274 | goto out_disable_device; |
| @@ -230,7 +230,6 @@ static unsigned char tw_sense_table[][4] = · 229 unmodified lines | ||
| 230 | 230 | #define TW_IOCTL_TIMEOUT 25 /* 25 seconds */ |
| 231 | 231 | #define TW_IOCTL_CHRDEV_TIMEOUT 60 /* 60 seconds */ |
| 232 | 232 | #define TW_IOCTL_CHRDEV_FREE -1 |
| 233 | −#define TW_DMA_MASK DMA_BIT_MASK(32) | |
| 234 | 233 | #define TW_MAX_CDB_LEN 16 |
| 235 | 234 | |
| 236 | 235 | /* Bitmask macros to eliminate bitfields */ |
| @@ -90,7 +90,7 @@ struct NCR_700_Device_Parameters { · 89 unmodified lines | ||
| 90 | 90 | /* The SYNC negotiation sequence looks like: |
| 91 | 91 | * |
| 92 | 92 | * If DEV_NEGOTIATED_SYNC not set, tack and SDTR message on to the |
| 93 | − * initial identify for the device and set DEV_BEGIN_SYNC_NEGOTATION | |
| 93 | + * initial identify for the device and set DEV_BEGIN_SYNC_NEGOTIATION | |
| 94 | 94 | * If we get an SDTR reply, work out the SXFER parameters, squirrel |
| 95 | 95 | * them away here, clear DEV_BEGIN_SYNC_NEGOTIATION and set |
| 96 | 96 | * DEV_NEGOTIATED_SYNC. If we get a REJECT msg, squirrel |
| @@ -201,8 +201,8 @@ static bool __init blogic_create_initccbs(struct blogic_adapter *adapter) · 200 unmodified lines | ||
| 201 | 201 | dma_addr_t blkp; |
| 202 | 202 | |
| 203 | 203 | while (adapter->alloc_ccbs < adapter->initccbs) { |
| 204 | − blk_pointer = pci_alloc_consistent(adapter->pci_device, | |
| 205 | − blk_size, &blkp); | |
| 204 | + blk_pointer = dma_alloc_coherent(&adapter->pci_device->dev, | |
| 205 | + blk_size, &blkp, GFP_KERNEL); | |
| 206 | 206 | if (blk_pointer == NULL) { |
| 207 | 207 | blogic_err("UNABLE TO ALLOCATE CCB GROUP - DETACHING\n", |
| 208 | 208 | adapter); |
| @@ -227,15 +227,16 @@ static void blogic_destroy_ccbs(struct blogic_adapter *adapter) · 18 unmodified lines | ||
| 227 | 227 | next_ccb = ccb->next_all; |
| 228 | 228 | if (ccb->allocgrp_head) { |
| 229 | 229 | if (lastccb) |
| 230 | − pci_free_consistent(adapter->pci_device, | |
| 230 | + dma_free_coherent(&adapter->pci_device->dev, | |
| 231 | 231 | lastccb->allocgrp_size, lastccb, |
| 232 | 232 | lastccb->allocgrp_head); |
| 233 | 233 | lastccb = ccb; |
| 234 | 234 | } |
| 235 | 235 | } |
| 236 | 236 | if (lastccb) |
| 237 | − pci_free_consistent(adapter->pci_device, lastccb->allocgrp_size, | |
| 238 | − lastccb, lastccb->allocgrp_head); | |
| 237 | + dma_free_coherent(&adapter->pci_device->dev, | |
| 238 | + lastccb->allocgrp_size, lastccb, | |
| 239 | + lastccb->allocgrp_head); | |
| 239 | 240 | } |
| 240 | 241 | |
| 241 | 242 | |
| @@ -256,8 +257,8 @@ static void blogic_create_addlccbs(struct blogic_adapter *adapter, · 14 unmodified lines | ||
| 256 | 257 | if (addl_ccbs <= 0) |
| 257 | 258 | return; |
| 258 | 259 | while (adapter->alloc_ccbs - prev_alloc < addl_ccbs) { |
| 259 | − blk_pointer = pci_alloc_consistent(adapter->pci_device, | |
| 260 | − blk_size, &blkp); | |
| 260 | + blk_pointer = dma_alloc_coherent(&adapter->pci_device->dev, | |
| 261 | + blk_size, &blkp, GFP_KERNEL); | |
| 261 | 262 | if (blk_pointer == NULL) |
| 262 | 263 | break; |
| 263 | 264 | blogic_init_ccbs(adapter, blk_pointer, blk_size, blkp); |
| @@ -318,8 +319,8 @@ static void blogic_dealloc_ccb(struct blogic_ccb *ccb, int dma_unmap) · 54 unmodified lines | ||
| 318 | 319 | if (ccb->command != NULL) |
| 319 | 320 | scsi_dma_unmap(ccb->command); |
| 320 | 321 | if (dma_unmap) |
| 321 | − pci_unmap_single(adapter->pci_device, ccb->sensedata, | |
| 322 | − ccb->sense_datalen, PCI_DMA_FROMDEVICE); | |
| 322 | + dma_unmap_single(&adapter->pci_device->dev, ccb->sensedata, | |
| 323 | + ccb->sense_datalen, DMA_FROM_DEVICE); | |
| 323 | 324 | |
| 324 | 325 | ccb->command = NULL; |
| 325 | 326 | ccb->status = BLOGIC_CCB_FREE; |
| @@ -712,7 +713,7 @@ static int __init blogic_init_mm_probeinfo(struct blogic_adapter *adapter) · 386 unmodified lines | ||
| 712 | 713 | if (pci_enable_device(pci_device)) |
| 713 | 714 | continue; |
| 714 | 715 | |
| 715 | − if (pci_set_dma_mask(pci_device, DMA_BIT_MASK(32))) | |
| 716 | + if (dma_set_mask(&pci_device->dev, DMA_BIT_MASK(32))) | |
| 716 | 717 | continue; |
| 717 | 718 | |
| 718 | 719 | bus = pci_device->bus->number; |
| @@ -895,7 +896,7 @@ static int __init blogic_init_mm_probeinfo(struct blogic_adapter *adapter) · 176 unmodified lines | ||
| 895 | 896 | if (pci_enable_device(pci_device)) |
| 896 | 897 | continue; |
| 897 | 898 | |
| 898 | − if (pci_set_dma_mask(pci_device, DMA_BIT_MASK(32))) | |
| 899 | + if (dma_set_mask(&pci_device->dev, DMA_BIT_MASK(32))) | |
| 899 | 900 | continue; |
| 900 | 901 | |
| 901 | 902 | bus = pci_device->bus->number; |
| @@ -952,7 +953,7 @@ static int __init blogic_init_fp_probeinfo(struct blogic_adapter *adapter) · 50 unmodified lines | ||
| 952 | 953 | if (pci_enable_device(pci_device)) |
| 953 | 954 | continue; |
| 954 | 955 | |
| 955 | − if (pci_set_dma_mask(pci_device, DMA_BIT_MASK(32))) | |
| 956 | + if (dma_set_mask(&pci_device->dev, DMA_BIT_MASK(32))) | |
| 956 | 957 | continue; |
| 957 | 958 | |
| 958 | 959 | bus = pci_device->bus->number; |
| @@ -2040,7 +2041,7 @@ static void blogic_relres(struct blogic_adapter *adapter) · 1081 unmodified lines | ||
| 2040 | 2041 | Release any allocated memory structs not released elsewhere |
| 2041 | 2042 | */ |
| 2042 | 2043 | if (adapter->mbox_space) |
| 2043 | − pci_free_consistent(adapter->pci_device, adapter->mbox_sz, | |
| 2044 | + dma_free_coherent(&adapter->pci_device->dev, adapter->mbox_sz, | |
| 2044 | 2045 | adapter->mbox_space, adapter->mbox_space_handle); |
| 2045 | 2046 | pci_dev_put(adapter->pci_device); |
| 2046 | 2047 | adapter->mbox_space = NULL; |
| @@ -2092,8 +2093,9 @@ static bool blogic_initadapter(struct blogic_adapter *adapter) · 45 unmodified lines | ||
| 2092 | 2093 | Initialize the Outgoing and Incoming Mailbox pointers. |
| 2093 | 2094 | */ |
| 2094 | 2095 | adapter->mbox_sz = adapter->mbox_count * (sizeof(struct blogic_outbox) + sizeof(struct blogic_inbox)); |
| 2095 | − adapter->mbox_space = pci_alloc_consistent(adapter->pci_device, | |
| 2096 | − adapter->mbox_sz, &adapter->mbox_space_handle); | |
| 2096 | + adapter->mbox_space = dma_alloc_coherent(&adapter->pci_device->dev, | |
| 2097 | + adapter->mbox_sz, &adapter->mbox_space_handle, | |
| 2098 | + GFP_KERNEL); | |
| 2097 | 2099 | if (adapter->mbox_space == NULL) |
| 2098 | 2100 | return blogic_failure(adapter, "MAILBOX ALLOCATION"); |
| 2099 | 2101 | adapter->first_outbox = (struct blogic_outbox *) adapter->mbox_space; |
| @@ -3183,9 +3185,9 @@ static int blogic_qcmd_lck(struct scsi_cmnd *command, · 1083 unmodified lines | ||
| 3183 | 3185 | memcpy(ccb->cdb, cdb, cdblen); |
| 3184 | 3186 | ccb->sense_datalen = SCSI_SENSE_BUFFERSIZE; |
| 3185 | 3187 | ccb->command = command; |
| 3186 | − sense_buf = pci_map_single(adapter->pci_device, | |
| 3188 | + sense_buf = dma_map_single(&adapter->pci_device->dev, | |
| 3187 | 3189 | command->sense_buffer, ccb->sense_datalen, |
| 3188 | − PCI_DMA_FROMDEVICE); | |
| 3190 | + DMA_FROM_DEVICE); | |
| 3189 | 3191 | if (dma_mapping_error(&adapter->pci_device->dev, sense_buf)) { |
| 3190 | 3192 | blogic_err("DMA mapping for sense data buffer failed\n", |
| 3191 | 3193 | adapter); |
| @@ -2944,7 +2944,7 @@ static void FPT_sdecm(unsigned char message, u32 port, unsigned char p_card) · 2943 unmodified lines | ||
| 2944 | 2944 | } |
| 2945 | 2945 | |
| 2946 | 2946 | if (currSCCB->Lun == 0x00) { |
| 2947 | − if ((currSCCB->Sccb_scsistat == SELECT_SN_ST)) { | |
| 2947 | + if (currSCCB->Sccb_scsistat == SELECT_SN_ST) { | |
| 2948 | 2948 | |
| 2949 | 2949 | currTar_Info->TarStatus |= |
| 2950 | 2950 | (unsigned char)SYNC_SUPPORTED; |
| @@ -2953,8 +2953,8 @@ static void FPT_sdecm(unsigned char message, u32 port, unsigned char p_card) · 2 unmodified lines | ||
| 2953 | 2953 | ~EE_SYNC_MASK; |
| 2954 | 2954 | } |
| 2955 | 2955 | |
| 2956 | − else if ((currSCCB->Sccb_scsistat == | |
| 2957 | − SELECT_WN_ST)) { | |
| 2956 | + else if (currSCCB->Sccb_scsistat == | |
| 2957 | + SELECT_WN_ST) { | |
| 2958 | 2958 | |
| 2959 | 2959 | currTar_Info->TarStatus = |
| 2960 | 2960 | (currTar_Info-> |
| @@ -42,6 +42,9 @@ config SCSI_DMA · 41 unmodified lines | ||
| 42 | 42 | bool |
| 43 | 43 | default n |
| 44 | 44 | |
| 45 | +config SCSI_ESP_PIO | |
| 46 | + bool | |
| 47 | + | |
| 45 | 48 | config SCSI_NETLINK |
| 46 | 49 | bool |
| 47 | 50 | default n |
| @@ -557,6 +560,36 @@ config SCSI_FLASHPOINT · 509 unmodified lines | ||
| 557 | 560 | substantial, so users of MultiMaster Host Adapters may not |
| 558 | 561 | wish to include it. |
| 559 | 562 | |
| 563 | +config SCSI_MYRB | |
| 564 | + tristate "Mylex DAC960/DAC1100 PCI RAID Controller (Block Interface)" | |
| 565 | + depends on PCI | |
| 566 | + select RAID_ATTRS | |
| 567 | + help | |
| 568 | + This driver adds support for the Mylex DAC960, AcceleRAID, and | |
| 569 | + eXtremeRAID PCI RAID controllers. This driver supports the | |
| 570 | + older, block based interface. | |
| 571 | + This driver is a reimplementation of the original DAC960 | |
| 572 | + driver. If you have used the DAC960 driver you should enable | |
| 573 | + this module. | |
| 574 | + | |
| 575 | + To compile this driver as a module, choose M here: the | |
| 576 | + module will be called myrb. | |
| 577 | + | |
| 578 | +config SCSI_MYRS | |
| 579 | + tristate "Mylex DAC960/DAC1100 PCI RAID Controller (SCSI Interface)" | |
| 580 | + depends on PCI | |
| 581 | + select RAID_ATTRS | |
| 582 | + help | |
| 583 | + This driver adds support for the Mylex DAC960, AcceleRAID, and | |
| 584 | + eXtremeRAID PCI RAID controllers. This driver supports the | |
| 585 | + newer, SCSI-based interface only. | |
| 586 | + This driver is a reimplementation of the original DAC960 | |
| 587 | + driver. If you have used the DAC960 driver you should enable | |
| 588 | + this module. | |
| 589 | + | |
| 590 | + To compile this driver as a module, choose M here: the | |
| 591 | + module will be called myrs. | |
| 592 | + | |
| 560 | 593 | config VMWARE_PVSCSI |
| 561 | 594 | tristate "VMware PVSCSI driver support" |
| 562 | 595 | depends on PCI && SCSI && X86 |
| @@ -1332,6 +1365,7 @@ config SCSI_ZORRO_ESP · 769 unmodified lines | ||
| 1332 | 1365 | tristate "Zorro ESP SCSI support" |
| 1333 | 1366 | depends on ZORRO && SCSI |
| 1334 | 1367 | select SCSI_SPI_ATTRS |
| 1368 | + select SCSI_ESP_PIO | |
| 1335 | 1369 | help |
| 1336 | 1370 | Support for various NCR53C9x (ESP) based SCSI controllers on Zorro |
| 1337 | 1371 | expansion boards for the Amiga. |
| @@ -1374,6 +1408,7 @@ config SCSI_MAC_ESP · 36 unmodified lines | ||
| 1374 | 1408 | tristate "Macintosh NCR53c9[46] SCSI" |
| 1375 | 1409 | depends on MAC && SCSI |
| 1376 | 1410 | select SCSI_SPI_ATTRS |
| 1411 | + select SCSI_ESP_PIO | |
| 1377 | 1412 | help |
| 1378 | 1413 | This is the NCR 53c9x SCSI controller found on most of the 68040 |
| 1379 | 1414 | based Macintoshes. |
| @@ -106,6 +106,8 @@ obj-$(CONFIG_SCSI_INIA100) += a100u2w.o · 105 unmodified lines | ||
| 106 | 106 | obj-$(CONFIG_SCSI_QLOGICPTI) += qlogicpti.o |
| 107 | 107 | obj-$(CONFIG_SCSI_MESH) += mesh.o |
| 108 | 108 | obj-$(CONFIG_SCSI_MAC53C94) += mac53c94.o |
| 109 | +obj-$(CONFIG_SCSI_MYRB) += myrb.o | |
| 110 | +obj-$(CONFIG_SCSI_MYRS) += myrs.o | |
| 109 | 111 | obj-$(CONFIG_BLK_DEV_3W_XXXX_RAID) += 3w-xxxx.o |
| 110 | 112 | obj-$(CONFIG_SCSI_3W_9XXX) += 3w-9xxx.o |
| 111 | 113 | obj-$(CONFIG_SCSI_3W_SAS) += 3w-sas.o |
| @@ -131,6 +131,7 @@ · 130 unmodified lines | ||
| 131 | 131 | |
| 132 | 132 | static int do_abort(struct Scsi_Host *); |
| 133 | 133 | static void do_reset(struct Scsi_Host *); |
| 134 | +static void bus_reset_cleanup(struct Scsi_Host *); | |
| 134 | 135 | |
| 135 | 136 | /** |
| 136 | 137 | * initialize_SCp - init the scsi pointer field |
| @@ -513,16 +514,15 @@ static void complete_cmd(struct Scsi_Host *instance, · 376 unmodified lines | ||
| 513 | 514 | |
| 514 | 515 | if (hostdata->sensing == cmd) { |
| 515 | 516 | /* Autosense processing ends here */ |
| 516 | − if ((cmd->result & 0xff) != SAM_STAT_GOOD) { | |
| 517 | + if (status_byte(cmd->result) != GOOD) { | |
| 517 | 518 | scsi_eh_restore_cmnd(cmd, &hostdata->ses); |
| 518 | − set_host_byte(cmd, DID_ERROR); | |
| 519 | − } else | |
| 519 | + } else { | |
| 520 | 520 | scsi_eh_restore_cmnd(cmd, &hostdata->ses); |
| 521 | + set_driver_byte(cmd, DRIVER_SENSE); | |
| 522 | + } | |
| 521 | 523 | hostdata->sensing = NULL; |
| 522 | 524 | } |
| 523 | 525 | |
| 524 | − hostdata->busy[scmd_id(cmd)] &= ~(1 << cmd->device->lun); | |
| 525 | − | |
| 526 | 526 | cmd->scsi_done(cmd); |
| 527 | 527 | } |
| 528 | 528 | |
| @@ -884,7 +884,14 @@ static irqreturn_t __maybe_unused NCR5380_intr(int irq, void *dev_id) · 355 unmodified lines | ||
| 884 | 884 | /* Probably Bus Reset */ |
| 885 | 885 | NCR5380_read(RESET_PARITY_INTERRUPT_REG); |
| 886 | 886 | |
| 887 | − dsprintk(NDEBUG_INTR, instance, "unknown interrupt\n"); | |
| 887 | + if (sr & SR_RST) { | |
| 888 | + /* Certainly Bus Reset */ | |
| 889 | + shost_printk(KERN_WARNING, instance, | |
| 890 | + "bus reset interrupt\n"); | |
| 891 | + bus_reset_cleanup(instance); | |
| 892 | + } else { | |
| 893 | + dsprintk(NDEBUG_INTR, instance, "unknown interrupt\n"); | |
| 894 | + } | |
| 888 | 895 | #ifdef SUN3_SCSI_VME |
| 889 | 896 | dregs->csr |= CSR_DMA_ENABLE; |
| 890 | 897 | #endif |
| @@ -902,20 +909,16 @@ static irqreturn_t __maybe_unused NCR5380_intr(int irq, void *dev_id) · 11 unmodified lines | ||
| 902 | 909 | return IRQ_RETVAL(handled); |
| 903 | 910 | } |
| 904 | 911 | |
| 905 | −/* | |
| 906 | − * Function : int NCR5380_select(struct Scsi_Host *instance, | |
| 907 | − * struct scsi_cmnd *cmd) | |
| 908 | − * | |
| 909 | − * Purpose : establishes I_T_L or I_T_L_Q nexus for new or existing command, | |
| 910 | − * including ARBITRATION, SELECTION, and initial message out for | |
| 911 | − * IDENTIFY and queue messages. | |
| 912 | +/** | |
| 913 | + * NCR5380_select - attempt arbitration and selection for a given command | |
| 914 | + * @instance: the Scsi_Host instance | |
| 915 | + * @cmd: the scsi_cmnd to execute | |
| 912 | 916 | * |
| 913 | − * Inputs : instance - instantiation of the 5380 driver on which this | |
| 914 | − * target lives, cmd - SCSI command to execute. | |
| 917 | + * This routine establishes an I_T_L nexus for a SCSI command. This involves | |
| 918 | + * ARBITRATION, SELECTION and MESSAGE OUT phases and an IDENTIFY message. | |
| 915 | 919 | * |
| 916 | − * Returns cmd if selection failed but should be retried, | |
| 917 | − * NULL if selection failed and should not be retried, or | |
| 918 | − * NULL if selection succeeded (hostdata->connected == cmd). | |
| 920 | + * Returns true if the operation should be retried. | |
| 921 | + * Returns false if it should not be retried. | |
| 919 | 922 | * |
| 920 | 923 | * Side effects : |
| 921 | 924 | * If bus busy, arbitration failed, etc, NCR5380_select() will exit |
| @@ -923,16 +926,15 @@ static irqreturn_t __maybe_unused NCR5380_intr(int irq, void *dev_id) · 1 unmodified line | ||
| 923 | 926 | * SELECT_ENABLE will be set appropriately, the NCR5380 |
| 924 | 927 | * will cease to drive any SCSI bus signals. |
| 925 | 928 | * |
| 926 | − * If successful : I_T_L or I_T_L_Q nexus will be established, | |
| 927 | − * instance->connected will be set to cmd. | |
| 929 | + * If successful : the I_T_L nexus will be established, and | |
| 930 | + * hostdata->connected will be set to cmd. | |
| 928 | 931 | * SELECT interrupt will be disabled. |
| 929 | 932 | * |
| 930 | 933 | * If failed (no target) : cmd->scsi_done() will be called, and the |
| 931 | 934 | * cmd->result host byte set to DID_BAD_TARGET. |
| 932 | 935 | */ |
| 933 | 936 | |
| 934 | −static struct scsi_cmnd *NCR5380_select(struct Scsi_Host *instance, | |
| 935 | − struct scsi_cmnd *cmd) | |
| 937 | +static bool NCR5380_select(struct Scsi_Host *instance, struct scsi_cmnd *cmd) | |
| 936 | 938 | __releases(&hostdata->lock) __acquires(&hostdata->lock) |
| 937 | 939 | { |
| 938 | 940 | struct NCR5380_hostdata *hostdata = shost_priv(instance); |
| @@ -940,6 +942,9 @@ static struct scsi_cmnd *NCR5380_select(struct Scsi_Host *instance, · 1 unmodified line | ||
| 940 | 942 | unsigned char *data; |
| 941 | 943 | int len; |
| 942 | 944 | int err; |
| 945 | + bool ret = true; | |
| 946 | + bool can_disconnect = instance->irq != NO_IRQ && | |
| 947 | + cmd->cmnd[0] != REQUEST_SENSE; | |
| 943 | 948 | |
| 944 | 949 | NCR5380_dprint(NDEBUG_ARBITRATION, instance); |
| 945 | 950 | dsprintk(NDEBUG_ARBITRATION, instance, "starting arbitration, id = %d\n", |
| @@ -948,7 +953,7 @@ static struct scsi_cmnd *NCR5380_select(struct Scsi_Host *instance, · 2 unmodified lines | ||
| 948 | 953 | /* |
| 949 | 954 | * Arbitration and selection phases are slow and involve dropping the |
| 950 | 955 | * lock, so we have to watch out for EH. An exception handler may |
| 951 | − * change 'selecting' to NULL. This function will then return NULL | |
| 956 | + * change 'selecting' to NULL. This function will then return false | |
| 952 | 957 | * so that the caller will forget about 'cmd'. (During information |
| 953 | 958 | * transfer phases, EH may change 'connected' to NULL.) |
| 954 | 959 | */ |
| @@ -984,7 +989,7 @@ static struct scsi_cmnd *NCR5380_select(struct Scsi_Host *instance, · 29 unmodified lines | ||
| 984 | 989 | if (!hostdata->selecting) { |
| 985 | 990 | /* Command was aborted */ |
| 986 | 991 | NCR5380_write(MODE_REG, MR_BASE); |
| 987 | − goto out; | |
| 992 | + return false; | |
| 988 | 993 | } |
| 989 | 994 | if (err < 0) { |
| 990 | 995 | NCR5380_write(MODE_REG, MR_BASE); |
| @@ -1033,7 +1038,7 @@ static struct scsi_cmnd *NCR5380_select(struct Scsi_Host *instance, · 42 unmodified lines | ||
| 1033 | 1038 | if (!hostdata->selecting) { |
| 1034 | 1039 | NCR5380_write(MODE_REG, MR_BASE); |
| 1035 | 1040 | NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE); |
| 1036 | − goto out; | |
| 1041 | + return false; | |
| 1037 | 1042 | } |
| 1038 | 1043 | |
| 1039 | 1044 | dsprintk(NDEBUG_ARBITRATION, instance, "won arbitration\n"); |
| @@ -1116,13 +1121,16 @@ static struct scsi_cmnd *NCR5380_select(struct Scsi_Host *instance, · 76 unmodified lines | ||
| 1116 | 1121 | spin_lock_irq(&hostdata->lock); |
| 1117 | 1122 | NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE); |
| 1118 | 1123 | NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask); |
| 1124 | + | |
| 1119 | 1125 | /* Can't touch cmd if it has been reclaimed by the scsi ML */ |
| 1120 | − if (hostdata->selecting) { | |
| 1121 | − cmd->result = DID_BAD_TARGET << 16; | |
| 1122 | − complete_cmd(instance, cmd); | |
| 1123 | − dsprintk(NDEBUG_SELECTION, instance, "target did not respond within 250ms\n"); | |
| 1124 | − cmd = NULL; | |
| 1125 | − } | |
| 1126 | + if (!hostdata->selecting) | |
| 1127 | + return false; | |
| 1128 | + | |
| 1129 | + cmd->result = DID_BAD_TARGET << 16; | |
| 1130 | + complete_cmd(instance, cmd); | |
| 1131 | + dsprintk(NDEBUG_SELECTION, instance, | |
| 1132 | + "target did not respond within 250ms\n"); | |
| 1133 | + ret = false; | |
| 1126 | 1134 | goto out; |
| 1127 | 1135 | } |
| 1128 | 1136 | |
| @@ -1155,12 +1163,12 @@ static struct scsi_cmnd *NCR5380_select(struct Scsi_Host *instance, · 26 unmodified lines | ||
| 1155 | 1163 | } |
| 1156 | 1164 | if (!hostdata->selecting) { |
| 1157 | 1165 | do_abort(instance); |
| 1158 | − goto out; | |
| 1166 | + return false; | |
| 1159 | 1167 | } |
| 1160 | 1168 | |
| 1161 | 1169 | dsprintk(NDEBUG_SELECTION, instance, "target %d selected, going into MESSAGE OUT phase.\n", |
| 1162 | 1170 | scmd_id(cmd)); |
| 1163 | − tmp[0] = IDENTIFY(((instance->irq == NO_IRQ) ? 0 : 1), cmd->device->lun); | |
| 1171 | + tmp[0] = IDENTIFY(can_disconnect, cmd->device->lun); | |
| 1164 | 1172 | |
| 1165 | 1173 | len = 1; |
| 1166 | 1174 | data = tmp; |
| @@ -1171,7 +1179,7 @@ static struct scsi_cmnd *NCR5380_select(struct Scsi_Host *instance, · 4 unmodified lines | ||
| 1171 | 1179 | cmd->result = DID_ERROR << 16; |
| 1172 | 1180 | complete_cmd(instance, cmd); |
| 1173 | 1181 | dsprintk(NDEBUG_SELECTION, instance, "IDENTIFY message transfer failed\n"); |
| 1174 | − cmd = NULL; | |
| 1182 | + ret = false; | |
| 1175 | 1183 | goto out; |
| 1176 | 1184 | } |
| 1177 | 1185 | |
| @@ -1186,13 +1194,13 @@ static struct scsi_cmnd *NCR5380_select(struct Scsi_Host *instance, · 8 unmodified lines | ||
| 1186 | 1194 | |
| 1187 | 1195 | initialize_SCp(cmd); |
| 1188 | 1196 | |
| 1189 | − cmd = NULL; | |
| 1197 | + ret = false; | |
| 1190 | 1198 | |
| 1191 | 1199 | out: |
| 1192 | 1200 | if (!hostdata->selecting) |
| 1193 | 1201 | return NULL; |
| 1194 | 1202 | hostdata->selecting = NULL; |
| 1195 | − return cmd; | |
| 1203 | + return ret; | |
| 1196 | 1204 | } |
| 1197 | 1205 | |
| 1198 | 1206 | /* |
| @@ -1711,6 +1719,7 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) · 512 unmodified lines | ||
| 1711 | 1719 | cmd->result = DID_ERROR << 16; |
| 1712 | 1720 | complete_cmd(instance, cmd); |
| 1713 | 1721 | hostdata->connected = NULL; |
| 1722 | + hostdata->busy[scmd_id(cmd)] &= ~(1 << cmd->device->lun); | |
| 1714 | 1723 | return; |
| 1715 | 1724 | #endif |
| 1716 | 1725 | case PHASE_DATAIN: |
| @@ -1793,6 +1802,7 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) · 76 unmodified lines | ||
| 1793 | 1802 | cmd, scmd_id(cmd), cmd->device->lun); |
| 1794 | 1803 | |
| 1795 | 1804 | hostdata->connected = NULL; |
| 1805 | + hostdata->busy[scmd_id(cmd)] &= ~(1 << cmd->device->lun); | |
| 1796 | 1806 | |
| 1797 | 1807 | cmd->result &= ~0xffff; |
| 1798 | 1808 | cmd->result |= cmd->SCp.Status; |
| @@ -1951,6 +1961,7 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) · 152 unmodified lines | ||
| 1951 | 1961 | NCR5380_transfer_pio(instance, &phase, &len, &data); |
| 1952 | 1962 | if (msgout == ABORT) { |
| 1953 | 1963 | hostdata->connected = NULL; |
| 1964 | + hostdata->busy[scmd_id(cmd)] &= ~(1 << cmd->device->lun); | |
| 1954 | 1965 | cmd->result = DID_ERROR << 16; |
| 1955 | 1966 | complete_cmd(instance, cmd); |
| 1956 | 1967 | maybe_release_dma_irq(instance); |
| @@ -2014,8 +2025,11 @@ static void NCR5380_reselect(struct Scsi_Host *instance) · 57 unmodified lines | ||
| 2014 | 2025 | NCR5380_write(MODE_REG, MR_BASE); |
| 2015 | 2026 | |
| 2016 | 2027 | target_mask = NCR5380_read(CURRENT_SCSI_DATA_REG) & ~(hostdata->id_mask); |
| 2017 | − | |
| 2018 | − dsprintk(NDEBUG_RESELECTION, instance, "reselect\n"); | |
| 2028 | + if (!target_mask || target_mask & (target_mask - 1)) { | |
| 2029 | + shost_printk(KERN_WARNING, instance, | |
| 2030 | + "reselect: bad target_mask 0x%02x\n", target_mask); | |
| 2031 | + return; | |
| 2032 | + } | |
| 2019 | 2033 | |
| 2020 | 2034 | /* |
| 2021 | 2035 | * At this point, we have detected that our SCSI ID is on the bus, |
| @@ -2029,6 +2043,7 @@ static void NCR5380_reselect(struct Scsi_Host *instance) · 7 unmodified lines | ||
| 2029 | 2043 | NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_BSY); |
| 2030 | 2044 | if (NCR5380_poll_politely(hostdata, |
| 2031 | 2045 | STATUS_REG, SR_SEL, 0, 2 * HZ) < 0) { |
| 2046 | + shost_printk(KERN_ERR, instance, "reselect: !SEL timeout\n"); | |
| 2032 | 2047 | NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE); |
| 2033 | 2048 | return; |
| 2034 | 2049 | } |
| @@ -2040,6 +2055,10 @@ static void NCR5380_reselect(struct Scsi_Host *instance) · 5 unmodified lines | ||
| 2040 | 2055 | |
| 2041 | 2056 | if (NCR5380_poll_politely(hostdata, |
| 2042 | 2057 | STATUS_REG, SR_REQ, SR_REQ, 2 * HZ) < 0) { |
| 2058 | + if ((NCR5380_read(STATUS_REG) & (SR_BSY | SR_SEL)) == 0) | |
| 2059 | + /* BUS FREE phase */ | |
| 2060 | + return; | |
| 2061 | + shost_printk(KERN_ERR, instance, "reselect: REQ timeout\n"); | |
| 2043 | 2062 | do_abort(instance); |
| 2044 | 2063 | return; |
| 2045 | 2064 | } |
| @@ -2101,13 +2120,16 @@ static void NCR5380_reselect(struct Scsi_Host *instance) · 55 unmodified lines | ||
| 2101 | 2120 | dsprintk(NDEBUG_RESELECTION | NDEBUG_QUEUES, instance, |
| 2102 | 2121 | "reselect: removed %p from disconnected queue\n", tmp); |
| 2103 | 2122 | } else { |
| 2123 | + int target = ffs(target_mask) - 1; | |
| 2124 | + | |
| 2104 | 2125 | shost_printk(KERN_ERR, instance, "target bitmask 0x%02x lun %d not in disconnected queue.\n", |
| 2105 | 2126 | target_mask, lun); |
| 2106 | 2127 | /* |
| 2107 | 2128 | * Since we have an established nexus that we can't do anything |
| 2108 | 2129 | * with, we must abort it. |
| 2109 | 2130 | */ |
| 2110 | − do_abort(instance); | |
| 2131 | + if (do_abort(instance) == 0) | |
| 2132 | + hostdata->busy[target] &= ~(1 << lun); | |
| 2111 | 2133 | return; |
| 2112 | 2134 | } |
| 2113 | 2135 | |
| @@ -2272,15 +2294,16 @@ static int NCR5380_abort(struct scsi_cmnd *cmd) · 158 unmodified lines | ||
| 2272 | 2294 | if (list_del_cmd(&hostdata->autosense, cmd)) { |
| 2273 | 2295 | dsprintk(NDEBUG_ABORT, instance, |
| 2274 | 2296 | "abort: removed %p from sense queue\n", cmd); |
| 2275 | − set_host_byte(cmd, DID_ERROR); | |
| 2276 | 2297 | complete_cmd(instance, cmd); |
| 2277 | 2298 | } |
| 2278 | 2299 | |
| 2279 | 2300 | out: |
| 2280 | 2301 | if (result == FAILED) |
| 2281 | 2302 | dsprintk(NDEBUG_ABORT, instance, "abort: failed to abort %p\n", cmd); |
| 2282 | − else | |
| 2303 | + else { | |
| 2304 | + hostdata->busy[scmd_id(cmd)] &= ~(1 << cmd->device->lun); | |
| 2283 | 2305 | dsprintk(NDEBUG_ABORT, instance, "abort: successfully aborted %p\n", cmd); |
| 2306 | + } | |
| 2284 | 2307 | |
| 2285 | 2308 | queue_work(hostdata->work_q, &hostdata->main_task); |
| 2286 | 2309 | maybe_release_dma_irq(instance); |
| @@ -2290,31 +2313,12 @@ out: · 3 unmodified lines | ||
| 2290 | 2313 | } |
| 2291 | 2314 | |
| 2292 | 2315 | |
| 2293 | −/** | |
| 2294 | − * NCR5380_host_reset - reset the SCSI host | |
| 2295 | − * @cmd: SCSI command undergoing EH | |
| 2296 | − * | |
| 2297 | − * Returns SUCCESS | |
| 2298 | − */ | |
| 2299 | − | |
| 2300 | −static int NCR5380_host_reset(struct scsi_cmnd *cmd) | |
| 2316 | +static void bus_reset_cleanup(struct Scsi_Host *instance) | |
| 2301 | 2317 | { |
| 2302 | − struct Scsi_Host *instance = cmd->device->host; | |
| 2303 | 2318 | struct NCR5380_hostdata *hostdata = shost_priv(instance); |
| 2304 | 2319 | int i; |
| 2305 | − unsigned long flags; | |
| 2306 | 2320 | struct NCR5380_cmd *ncmd; |
| 2307 | 2321 | |
| 2308 | − spin_lock_irqsave(&hostdata->lock, flags); | |
| 2309 | − | |
| 2310 | −#if (NDEBUG & NDEBUG_ANY) | |
| 2311 | − scmd_printk(KERN_INFO, cmd, __func__); | |
| 2312 | −#endif | |
| 2313 | − NCR5380_dprint(NDEBUG_ANY, instance); | |
| 2314 | − NCR5380_dprint_phase(NDEBUG_ANY, instance); | |
| 2315 | − | |
| 2316 | − do_reset(instance); | |
| 2317 | − | |
| 2318 | 2322 | /* reset NCR registers */ |
| 2319 | 2323 | NCR5380_write(MODE_REG, MR_BASE); |
| 2320 | 2324 | NCR5380_write(TARGET_COMMAND_REG, 0); |
| @@ -2326,11 +2330,6 @@ static int NCR5380_host_reset(struct scsi_cmnd *cmd) · 5 unmodified lines | ||
| 2326 | 2330 | * commands! |
| 2327 | 2331 | */ |
| 2328 | 2332 | |
| 2329 | − if (list_del_cmd(&hostdata->unissued, cmd)) { | |
| 2330 | − cmd->result = DID_RESET << 16; | |
| 2331 | − cmd->scsi_done(cmd); | |
| 2332 | − } | |
| 2333 | − | |
| 2334 | 2333 | if (hostdata->selecting) { |
| 2335 | 2334 | hostdata->selecting->result = DID_RESET << 16; |
| 2336 | 2335 | complete_cmd(instance, hostdata->selecting); |
| @@ -2348,7 +2347,6 @@ static int NCR5380_host_reset(struct scsi_cmnd *cmd) · 11 unmodified lines | ||
| 2348 | 2347 | list_for_each_entry(ncmd, &hostdata->autosense, list) { |
| 2349 | 2348 | struct scsi_cmnd *cmd = NCR5380_to_scmd(ncmd); |
| 2350 | 2349 | |
| 2351 | − set_host_byte(cmd, DID_RESET); | |
| 2352 | 2350 | cmd->scsi_done(cmd); |
| 2353 | 2351 | } |
| 2354 | 2352 | INIT_LIST_HEAD(&hostdata->autosense); |
| @@ -2365,6 +2363,41 @@ static int NCR5380_host_reset(struct scsi_cmnd *cmd) · 10 unmodified lines | ||
| 2365 | 2363 | |
| 2366 | 2364 | queue_work(hostdata->work_q, &hostdata->main_task); |
| 2367 | 2365 | maybe_release_dma_irq(instance); |
| 2366 | +} | |
| 2367 | + | |
| 2368 | +/** | |
| 2369 | + * NCR5380_host_reset - reset the SCSI host | |
| 2370 | + * @cmd: SCSI command undergoing EH | |
| 2371 | + * | |
| 2372 | + * Returns SUCCESS | |
| 2373 | + */ | |
| 2374 | + | |
| 2375 | +static int NCR5380_host_reset(struct scsi_cmnd *cmd) | |
| 2376 | +{ | |
| 2377 | + struct Scsi_Host *instance = cmd->device->host; | |
| 2378 | + struct NCR5380_hostdata *hostdata = shost_priv(instance); | |
| 2379 | + unsigned long flags; | |
| 2380 | + struct NCR5380_cmd *ncmd; | |
| 2381 | + | |
| 2382 | + spin_lock_irqsave(&hostdata->lock, flags); | |
| 2383 | + | |
| 2384 | +#if (NDEBUG & NDEBUG_ANY) | |
| 2385 | + shost_printk(KERN_INFO, instance, __func__); | |
| 2386 | +#endif | |
| 2387 | + NCR5380_dprint(NDEBUG_ANY, instance); | |
| 2388 | + NCR5380_dprint_phase(NDEBUG_ANY, instance); | |
| 2389 | + | |
| 2390 | + list_for_each_entry(ncmd, &hostdata->unissued, list) { | |
| 2391 | + struct scsi_cmnd *scmd = NCR5380_to_scmd(ncmd); | |
| 2392 | + | |
| 2393 | + scmd->result = DID_RESET << 16; | |
| 2394 | + scmd->scsi_done(scmd); | |
| 2395 | + } | |
| 2396 | + INIT_LIST_HEAD(&hostdata->unissued); | |
| 2397 | + | |
| 2398 | + do_reset(instance); | |
| 2399 | + bus_reset_cleanup(instance); | |
| 2400 | + | |
| 2368 | 2401 | spin_unlock_irqrestore(&hostdata->lock, flags); |
| 2369 | 2402 | |
| 2370 | 2403 | return SUCCESS; |
| @@ -275,7 +275,7 @@ static irqreturn_t NCR5380_intr(int irq, void *dev_id); · 274 unmodified lines | ||
| 275 | 275 | static void NCR5380_main(struct work_struct *work); |
| 276 | 276 | static const char *NCR5380_info(struct Scsi_Host *instance); |
| 277 | 277 | static void NCR5380_reselect(struct Scsi_Host *instance); |
| 278 | −static struct scsi_cmnd *NCR5380_select(struct Scsi_Host *, struct scsi_cmnd *); | |
| 278 | +static bool NCR5380_select(struct Scsi_Host *, struct scsi_cmnd *); | |
| 279 | 279 | static int NCR5380_transfer_dma(struct Scsi_Host *instance, unsigned char *phase, int *count, unsigned char **data); |
| 280 | 280 | static int NCR5380_transfer_pio(struct Scsi_Host *instance, unsigned char *phase, int *count, unsigned char **data); |
| 281 | 281 | static int NCR5380_poll_politely2(struct NCR5380_hostdata *, |
| @@ -1094,7 +1094,7 @@ static int inia100_probe_one(struct pci_dev *pdev, · 1093 unmodified lines | ||
| 1094 | 1094 | |
| 1095 | 1095 | if (pci_enable_device(pdev)) |
| 1096 | 1096 | goto out; |
| 1097 | − if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) { | |
| 1097 | + if (dma_set_mask(&pdev->dev, DMA_BIT_MASK(32))) { | |
| 1098 | 1098 | printk(KERN_WARNING "Unable to set 32bit DMA " |
| 1099 | 1099 | "on inia100 adapter, ignoring.\n"); |
| 1100 | 1100 | goto out_disable_device; |
| @@ -1124,7 +1124,8 @@ static int inia100_probe_one(struct pci_dev *pdev, · 23 unmodified lines | ||
| 1124 | 1124 | |
| 1125 | 1125 | /* Get total memory needed for SCB */ |
| 1126 | 1126 | sz = ORC_MAXQUEUE * sizeof(struct orc_scb); |
| 1127 | − host->scb_virt = pci_zalloc_consistent(pdev, sz, &host->scb_phys); | |
| 1127 | + host->scb_virt = dma_zalloc_coherent(&pdev->dev, sz, &host->scb_phys, | |
| 1128 | + GFP_KERNEL); | |
| 1128 | 1129 | if (!host->scb_virt) { |
| 1129 | 1130 | printk("inia100: SCB memory allocation error\n"); |
| 1130 | 1131 | goto out_host_put; |
| @@ -1132,7 +1133,8 @@ static int inia100_probe_one(struct pci_dev *pdev, · 1 unmodified line | ||
| 1132 | 1133 | |
| 1133 | 1134 | /* Get total memory needed for ESCB */ |
| 1134 | 1135 | sz = ORC_MAXQUEUE * sizeof(struct orc_extended_scb); |
| 1135 | − host->escb_virt = pci_zalloc_consistent(pdev, sz, &host->escb_phys); | |
| 1136 | + host->escb_virt = dma_zalloc_coherent(&pdev->dev, sz, &host->escb_phys, | |
| 1137 | + GFP_KERNEL); | |
| 1136 | 1138 | if (!host->escb_virt) { |
| 1137 | 1139 | printk("inia100: ESCB memory allocation error\n"); |
| 1138 | 1140 | goto out_free_scb_array; |
| @@ -1177,10 +1179,12 @@ static int inia100_probe_one(struct pci_dev *pdev, · 38 unmodified lines | ||
| 1177 | 1179 | out_free_irq: |
| 1178 | 1180 | free_irq(shost->irq, shost); |
| 1179 | 1181 | out_free_escb_array: |
| 1180 | − pci_free_consistent(pdev, ORC_MAXQUEUE * sizeof(struct orc_extended_scb), | |
| 1182 | + dma_free_coherent(&pdev->dev, | |
| 1183 | + ORC_MAXQUEUE * sizeof(struct orc_extended_scb), | |
| 1181 | 1184 | host->escb_virt, host->escb_phys); |
| 1182 | 1185 | out_free_scb_array: |
| 1183 | − pci_free_consistent(pdev, ORC_MAXQUEUE * sizeof(struct orc_scb), | |
| 1186 | + dma_free_coherent(&pdev->dev, | |
| 1187 | + ORC_MAXQUEUE * sizeof(struct orc_scb), | |
| 1184 | 1188 | host->scb_virt, host->scb_phys); |
| 1185 | 1189 | out_host_put: |
| 1186 | 1190 | scsi_host_put(shost); |
| @@ -1200,9 +1204,11 @@ static void inia100_remove_one(struct pci_dev *pdev) · 13 unmodified lines | ||
| 1200 | 1204 | scsi_remove_host(shost); |
| 1201 | 1205 | |
| 1202 | 1206 | free_irq(shost->irq, shost); |
| 1203 | − pci_free_consistent(pdev, ORC_MAXQUEUE * sizeof(struct orc_extended_scb), | |
| 1207 | + dma_free_coherent(&pdev->dev, | |
| 1208 | + ORC_MAXQUEUE * sizeof(struct orc_extended_scb), | |
| 1204 | 1209 | host->escb_virt, host->escb_phys); |
| 1205 | − pci_free_consistent(pdev, ORC_MAXQUEUE * sizeof(struct orc_scb), | |
| 1210 | + dma_free_coherent(&pdev->dev, | |
| 1211 | + ORC_MAXQUEUE * sizeof(struct orc_scb), | |
| 1206 | 1212 | host->scb_virt, host->scb_phys); |
| 1207 | 1213 | release_region(shost->io_port, 256); |
| 1208 | 1214 | |
| @@ -3480,7 +3480,6 @@ int aac_dev_ioctl(struct aac_dev *dev, int cmd, void __user *arg) · 3479 unmodified lines | ||
| 3480 | 3480 | |
| 3481 | 3481 | static void aac_srb_callback(void *context, struct fib * fibptr) |
| 3482 | 3482 | { |
| 3483 | − struct aac_dev *dev; | |
| 3484 | 3483 | struct aac_srb_reply *srbreply; |
| 3485 | 3484 | struct scsi_cmnd *scsicmd; |
| 3486 | 3485 | |
| @@ -3491,8 +3490,6 @@ static void aac_srb_callback(void *context, struct fib * fibptr) · 4 unmodified lines | ||
| 3491 | 3490 | |
| 3492 | 3491 | BUG_ON(fibptr == NULL); |
| 3493 | 3492 | |
| 3494 | − dev = fibptr->dev; | |
| 3495 | − | |
| 3496 | 3493 | srbreply = (struct aac_srb_reply *) fib_data(fibptr); |
| 3497 | 3494 | |
| 3498 | 3495 | scsicmd->sense_buffer[0] = '\0'; /* Initialize sense valid flag to false */ |
| @@ -3921,13 +3918,11 @@ static int aac_send_hba_fib(struct scsi_cmnd *scsicmd) · 422 unmodified lines | ||
| 3921 | 3918 | |
| 3922 | 3919 | static long aac_build_sg(struct scsi_cmnd *scsicmd, struct sgmap *psg) |
| 3923 | 3920 | { |
| 3924 | − struct aac_dev *dev; | |
| 3925 | 3921 | unsigned long byte_count = 0; |
| 3926 | 3922 | int nseg; |
| 3927 | 3923 | struct scatterlist *sg; |
| 3928 | 3924 | int i; |
| 3929 | 3925 | |
| 3930 | − dev = (struct aac_dev *)scsicmd->device->host->hostdata; | |
| 3931 | 3926 | // Get rid of old data |
| 3932 | 3927 | psg->count = 0; |
| 3933 | 3928 | psg->sg[0].addr = 0; |
| @@ -3963,14 +3958,12 @@ static long aac_build_sg(struct scsi_cmnd *scsicmd, struct sgmap *psg) · 29 unmodified lines | ||
| 3963 | 3958 | |
| 3964 | 3959 | static long aac_build_sg64(struct scsi_cmnd *scsicmd, struct sgmap64 *psg) |
| 3965 | 3960 | { |
| 3966 | − struct aac_dev *dev; | |
| 3967 | 3961 | unsigned long byte_count = 0; |
| 3968 | 3962 | u64 addr; |
| 3969 | 3963 | int nseg; |
| 3970 | 3964 | struct scatterlist *sg; |
| 3971 | 3965 | int i; |
| 3972 | 3966 | |
| 3973 | − dev = (struct aac_dev *)scsicmd->device->host->hostdata; | |
| 3974 | 3967 | // Get rid of old data |
| 3975 | 3968 | psg->count = 0; |
| 3976 | 3969 | psg->sg[0].addr[0] = 0; |
| @@ -2586,9 +2586,7 @@ int aac_acquire_irq(struct aac_dev *dev) · 2585 unmodified lines | ||
| 2586 | 2586 | void aac_free_irq(struct aac_dev *dev) |
| 2587 | 2587 | { |
| 2588 | 2588 | int i; |
| 2589 | − int cpu; | |
| 2590 | 2589 | |
| 2591 | − cpu = cpumask_first(cpu_online_mask); | |
| 2592 | 2590 | if (aac_is_src(dev)) { |
| 2593 | 2591 | if (dev->max_msix > 1) { |
| 2594 | 2592 | for (i = 0; i < dev->max_msix; i++) |
| @@ -5949,7 +5949,6 @@ static void adv_async_callback(ADV_DVC_VAR *adv_dvc_varp, uchar code) · 5948 unmodified lines | ||
| 5949 | 5949 | static void adv_isr_callback(ADV_DVC_VAR *adv_dvc_varp, ADV_SCSI_REQ_Q *scsiqp) |
| 5950 | 5950 | { |
| 5951 | 5951 | struct asc_board *boardp = adv_dvc_varp->drv_ptr; |
| 5952 | − u32 srb_tag; | |
| 5953 | 5952 | adv_req_t *reqp; |
| 5954 | 5953 | adv_sgblk_t *sgblkp; |
| 5955 | 5954 | struct scsi_cmnd *scp; |
| @@ -5965,7 +5964,6 @@ static void adv_isr_callback(ADV_DVC_VAR *adv_dvc_varp, ADV_SCSI_REQ_Q *scsiqp) · 9 unmodified lines | ||
| 5965 | 5964 | * completed. The adv_req_t structure actually contains the |
| 5966 | 5965 | * completed ADV_SCSI_REQ_Q structure. |
| 5967 | 5966 | */ |
| 5968 | − srb_tag = le32_to_cpu(scsiqp->srb_tag); | |
| 5969 | 5967 | scp = scsi_host_find_tag(boardp->shost, scsiqp->srb_tag); |
| 5970 | 5968 | |
| 5971 | 5969 | ASC_DBG(1, "scp 0x%p\n", scp); |
| @@ -6448,7 +6446,7 @@ static void AscIsrChipHalted(ASC_DVC_VAR *asc_dvc) · 476 unmodified lines | ||
| 6448 | 6446 | sdtr_data = |
| 6449 | 6447 | AscCalSDTRData(asc_dvc, ext_msg.xfer_period, |
| 6450 | 6448 | ext_msg.req_ack_offset); |
| 6451 | − if ((sdtr_data == 0xFF)) { | |
| 6449 | + if (sdtr_data == 0xFF) { | |
| 6452 | 6450 | |
| 6453 | 6451 | q_cntl |= QC_MSG_OUT; |
| 6454 | 6452 | asc_dvc->init_sdtr &= ~target_id; |
| @@ -42,15 +42,9 @@ · 41 unmodified lines | ||
| 42 | 42 | * $FreeBSD$ |
| 43 | 43 | */ |
| 44 | 44 | |
| 45 | −#ifdef __linux__ | |
| 46 | 45 | #include "aic7xxx_osm.h" |
| 47 | 46 | #include "aic7xxx_inline.h" |
| 48 | 47 | #include "aic7xxx_93cx6.h" |
| 49 | −#else | |
| 50 | −#include <dev/aic7xxx/aic7xxx_osm.h> | |
| 51 | −#include <dev/aic7xxx/aic7xxx_inline.h> | |
| 52 | −#include <dev/aic7xxx/aic7xxx_93cx6.h> | |
| 53 | −#endif | |
| 54 | 48 | |
| 55 | 49 | #define ID_AIC7770 0x04907770 |
| 56 | 50 | #define ID_AHA_274x 0x04907771 |
| @@ -607,9 +607,6 @@ struct scb { · 606 unmodified lines | ||
| 607 | 607 | ahd_io_ctx_t io_ctx; |
| 608 | 608 | struct ahd_softc *ahd_softc; |
| 609 | 609 | scb_flag flags; |
| 610 | −#ifndef __linux__ | |
| 611 | − bus_dmamap_t dmamap; | |
| 612 | −#endif | |
| 613 | 610 | struct scb_platform_data *platform_data; |
| 614 | 611 | struct map_node *hscb_map; |
| 615 | 612 | struct map_node *sg_map; |
| @@ -1056,9 +1053,6 @@ struct ahd_completion · 440 unmodified lines | ||
| 1056 | 1053 | struct ahd_softc { |
| 1057 | 1054 | bus_space_tag_t tags[2]; |
| 1058 | 1055 | bus_space_handle_t bshs[2]; |
| 1059 | −#ifndef __linux__ | |
| 1060 | − bus_dma_tag_t buffer_dmat; /* dmat for buffer I/O */ | |
| 1061 | −#endif | |
| 1062 | 1056 | struct scb_data scb_data; |
| 1063 | 1057 | |
| 1064 | 1058 | struct hardware_scb *next_queued_hscb; |
| @@ -40,16 +40,9 @@ · 39 unmodified lines | ||
| 40 | 40 | * $Id: //depot/aic7xxx/aic7xxx/aic79xx.c#250 $ |
| 41 | 41 | */ |
| 42 | 42 | |
| 43 | −#ifdef __linux__ | |
| 44 | 43 | #include "aic79xx_osm.h" |
| 45 | 44 | #include "aic79xx_inline.h" |
| 46 | 45 | #include "aicasm/aicasm_insformat.h" |
| 47 | −#else | |
| 48 | −#include <dev/aic7xxx/aic79xx_osm.h> | |
| 49 | −#include <dev/aic7xxx/aic79xx_inline.h> | |
| 50 | −#include <dev/aic7xxx/aicasm/aicasm_insformat.h> | |
| 51 | −#endif | |
| 52 | − | |
| 53 | 46 | |
| 54 | 47 | /***************************** Lookup Tables **********************************/ |
| 55 | 48 | static const char *const ahd_chip_names[] = |
| @@ -59,7 +52,6 @@ static const char *const ahd_chip_names[] = · 3 unmodified lines | ||
| 59 | 52 | "aic7902", |
| 60 | 53 | "aic7901A" |
| 61 | 54 | }; |
| 62 | −static const u_int num_chip_names = ARRAY_SIZE(ahd_chip_names); | |
| 63 | 55 | |
| 64 | 56 | /* |
| 65 | 57 | * Hardware error codes. |
| @@ -6172,17 +6164,11 @@ ahd_free(struct ahd_softc *ahd) · 6106 unmodified lines | ||
| 6172 | 6164 | case 2: |
| 6173 | 6165 | ahd_dma_tag_destroy(ahd, ahd->shared_data_dmat); |
| 6174 | 6166 | case 1: |
| 6175 | −#ifndef __linux__ | |
| 6176 | − ahd_dma_tag_destroy(ahd, ahd->buffer_dmat); | |
| 6177 | −#endif | |
| 6178 | 6167 | break; |
| 6179 | 6168 | case 0: |
| 6180 | 6169 | break; |
| 6181 | 6170 | } |
| 6182 | 6171 | |
| 6183 | −#ifndef __linux__ | |
| 6184 | − ahd_dma_tag_destroy(ahd, ahd->parent_dmat); | |
| 6185 | −#endif | |
| 6186 | 6172 | ahd_platform_free(ahd); |
| 6187 | 6173 | ahd_fini_scbdata(ahd); |
| 6188 | 6174 | for (i = 0; i < AHD_NUM_TARGETS; i++) { |
| @@ -6934,9 +6920,6 @@ ahd_alloc_scbs(struct ahd_softc *ahd) · 745 unmodified lines | ||
| 6934 | 6920 | for (i = 0; i < newcount; i++) { |
| 6935 | 6921 | struct scb_platform_data *pdata; |
| 6936 | 6922 | u_int col_tag; |
| 6937 | −#ifndef __linux__ | |
| 6938 | − int error; | |
| 6939 | −#endif | |
| 6940 | 6923 | |
| 6941 | 6924 | next_scb = kmalloc(sizeof(*next_scb), GFP_ATOMIC); |
| 6942 | 6925 | if (next_scb == NULL) |
| @@ -6970,15 +6953,6 @@ ahd_alloc_scbs(struct ahd_softc *ahd) · 27 unmodified lines | ||
| 6970 | 6953 | next_scb->sg_list_busaddr += sizeof(struct ahd_dma_seg); |
| 6971 | 6954 | next_scb->ahd_softc = ahd; |
| 6972 | 6955 | next_scb->flags = SCB_FLAG_NONE; |
| 6973 | −#ifndef __linux__ | |
| 6974 | − error = ahd_dmamap_create(ahd, ahd->buffer_dmat, /*flags*/0, | |
| 6975 | − &next_scb->dmamap); | |
| 6976 | − if (error != 0) { | |
| 6977 | − kfree(next_scb); | |
| 6978 | − kfree(pdata); | |
| 6979 | − break; | |
| 6980 | − } | |
| 6981 | −#endif | |
| 6982 | 6956 | next_scb->hscb->tag = ahd_htole16(scb_data->numscbs); |
| 6983 | 6957 | col_tag = scb_data->numscbs ^ 0x100; |
| 6984 | 6958 | next_scb->col_scb = ahd_find_scb_by_tag(ahd, col_tag); |
| @@ -7091,24 +7065,6 @@ ahd_init(struct ahd_softc *ahd) · 106 unmodified lines | ||
| 7091 | 7065 | if ((AHD_TMODE_ENABLE & (0x1 << ahd->unit)) == 0) |
| 7092 | 7066 | ahd->features &= ~AHD_TARGETMODE; |
| 7093 | 7067 | |
| 7094 | −#ifndef __linux__ | |
| 7095 | − /* DMA tag for mapping buffers into device visible space. */ | |
| 7096 | − if (ahd_dma_tag_create(ahd, ahd->parent_dmat, /*alignment*/1, | |
| 7097 | − /*boundary*/BUS_SPACE_MAXADDR_32BIT + 1, | |
| 7098 | − /*lowaddr*/ahd->flags & AHD_39BIT_ADDRESSING | |
| 7099 | − ? (dma_addr_t)0x7FFFFFFFFFULL | |
| 7100 | − : BUS_SPACE_MAXADDR_32BIT, | |
| 7101 | − /*highaddr*/BUS_SPACE_MAXADDR, | |
| 7102 | − /*filter*/NULL, /*filterarg*/NULL, | |
| 7103 | − /*maxsize*/(AHD_NSEG - 1) * PAGE_SIZE, | |
| 7104 | − /*nsegments*/AHD_NSEG, | |
| 7105 | − /*maxsegsz*/AHD_MAXTRANSFER_SIZE, | |
| 7106 | − /*flags*/BUS_DMA_ALLOCNOW, | |
| 7107 | − &ahd->buffer_dmat) != 0) { | |
| 7108 | − return (ENOMEM); | |
| 7109 | − } | |
| 7110 | −#endif | |
| 7111 | − | |
| 7112 | 7068 | ahd->init_level++; |
| 7113 | 7069 | |
| 7114 | 7070 | /* |
| @@ -41,14 +41,8 @@ · 40 unmodified lines | ||
| 41 | 41 | * $Id: //depot/aic7xxx/aic7xxx/aic79xx_pci.c#92 $ |
| 42 | 42 | */ |
| 43 | 43 | |
| 44 | −#ifdef __linux__ | |
| 45 | 44 | #include "aic79xx_osm.h" |
| 46 | 45 | #include "aic79xx_inline.h" |
| 47 | −#else | |
| 48 | −#include <dev/aic7xxx/aic79xx_osm.h> | |
| 49 | −#include <dev/aic7xxx/aic79xx_inline.h> | |
| 50 | −#endif | |
| 51 | − | |
| 52 | 46 | #include "aic79xx_pci.h" |
| 53 | 47 | |
| 54 | 48 | static inline uint64_t |
| @@ -294,13 +288,11 @@ ahd_find_pci_device(ahd_dev_softc_t pci) · 239 unmodified lines | ||
| 294 | 288 | int |
| 295 | 289 | ahd_pci_config(struct ahd_softc *ahd, const struct ahd_pci_identity *entry) |
| 296 | 290 | { |
| 297 | − struct scb_data *shared_scb_data; | |
| 298 | 291 | u_int command; |
| 299 | 292 | uint32_t devconfig; |
| 300 | 293 | uint16_t subvendor; |
| 301 | 294 | int error; |
| 302 | 295 | |
| 303 | − shared_scb_data = NULL; | |
| 304 | 296 | ahd->description = entry->name; |
| 305 | 297 | /* |
| 306 | 298 | * Record if this is an HP board. |
| @@ -568,9 +568,6 @@ struct scb { · 567 unmodified lines | ||
| 568 | 568 | ahc_io_ctx_t io_ctx; |
| 569 | 569 | struct ahc_softc *ahc_softc; |
| 570 | 570 | scb_flag flags; |
| 571 | −#ifndef __linux__ | |
| 572 | − bus_dmamap_t dmamap; | |
| 573 | −#endif | |
| 574 | 571 | struct scb_platform_data *platform_data; |
| 575 | 572 | struct sg_map_node *sg_map; |
| 576 | 573 | struct ahc_dma_seg *sg_list; |
| @@ -906,9 +903,6 @@ typedef void ahc_callback_t (void *); · 329 unmodified lines | ||
| 906 | 903 | struct ahc_softc { |
| 907 | 904 | bus_space_tag_t tag; |
| 908 | 905 | bus_space_handle_t bsh; |
| 909 | −#ifndef __linux__ | |
| 910 | − bus_dma_tag_t buffer_dmat; /* dmat for buffer I/O */ | |
| 911 | −#endif | |
| 912 | 906 | struct scb_data *scb_data; |
| 913 | 907 | |
| 914 | 908 | struct scb *next_queued_scb; |
| @@ -64,15 +64,9 @@ · 63 unmodified lines | ||
| 64 | 64 | * bit to be sent from the chip. |
| 65 | 65 | */ |
| 66 | 66 | |
| 67 | −#ifdef __linux__ | |
| 68 | 67 | #include "aic7xxx_osm.h" |
| 69 | 68 | #include "aic7xxx_inline.h" |
| 70 | 69 | #include "aic7xxx_93cx6.h" |
| 71 | −#else | |
| 72 | −#include <dev/aic7xxx/aic7xxx_osm.h> | |
| 73 | −#include <dev/aic7xxx/aic7xxx_inline.h> | |
| 74 | −#include <dev/aic7xxx/aic7xxx_93cx6.h> | |
| 75 | −#endif | |
| 76 | 70 | |
| 77 | 71 | /* |
| 78 | 72 | * Right now, we only have to read the SEEPROM. But we make it easier to |
| @@ -40,15 +40,9 @@ · 39 unmodified lines | ||
| 40 | 40 | * $Id: //depot/aic7xxx/aic7xxx/aic7xxx.c#155 $ |
| 41 | 41 | */ |
| 42 | 42 | |
| 43 | −#ifdef __linux__ | |
| 44 | 43 | #include "aic7xxx_osm.h" |
| 45 | 44 | #include "aic7xxx_inline.h" |
| 46 | 45 | #include "aicasm/aicasm_insformat.h" |
| 47 | −#else | |
| 48 | −#include <dev/aic7xxx/aic7xxx_osm.h> | |
| 49 | −#include <dev/aic7xxx/aic7xxx_inline.h> | |
| 50 | −#include <dev/aic7xxx/aicasm/aicasm_insformat.h> | |
| 51 | −#endif | |
| 52 | 46 | |
| 53 | 47 | /***************************** Lookup Tables **********************************/ |
| 54 | 48 | static const char *const ahc_chip_names[] = { |
| @@ -67,7 +61,6 @@ static const char *const ahc_chip_names[] = { · 12 unmodified lines | ||
| 67 | 61 | "aic7892", |
| 68 | 62 | "aic7899" |
| 69 | 63 | }; |
| 70 | −static const u_int num_chip_names = ARRAY_SIZE(ahc_chip_names); | |
| 71 | 64 | |
| 72 | 65 | /* |
| 73 | 66 | * Hardware error codes. |
| @@ -4509,17 +4502,11 @@ ahc_free(struct ahc_softc *ahc) · 4435 unmodified lines | ||
| 4509 | 4502 | case 2: |
| 4510 | 4503 | ahc_dma_tag_destroy(ahc, ahc->shared_data_dmat); |
| 4511 | 4504 | case 1: |
| 4512 | −#ifndef __linux__ | |
| 4513 | − ahc_dma_tag_destroy(ahc, ahc->buffer_dmat); | |
| 4514 | −#endif | |
| 4515 | 4505 | break; |
| 4516 | 4506 | case 0: |
| 4517 | 4507 | break; |
| 4518 | 4508 | } |
| 4519 | 4509 | |
| 4520 | −#ifndef __linux__ | |
| 4521 | − ahc_dma_tag_destroy(ahc, ahc->parent_dmat); | |
| 4522 | −#endif | |
| 4523 | 4510 | ahc_platform_free(ahc); |
| 4524 | 4511 | ahc_fini_scbdata(ahc); |
| 4525 | 4512 | for (i = 0; i < AHC_NUM_TARGETS; i++) { |
| @@ -5005,9 +4992,7 @@ ahc_alloc_scbs(struct ahc_softc *ahc) · 479 unmodified lines | ||
| 5005 | 4992 | newcount = min(newcount, (AHC_SCB_MAX_ALLOC - scb_data->numscbs)); |
| 5006 | 4993 | for (i = 0; i < newcount; i++) { |
| 5007 | 4994 | struct scb_platform_data *pdata; |
| 5008 | −#ifndef __linux__ | |
| 5009 | − int error; | |
| 5010 | −#endif | |
| 4995 | + | |
| 5011 | 4996 | pdata = kmalloc(sizeof(*pdata), GFP_ATOMIC); |
| 5012 | 4997 | if (pdata == NULL) |
| 5013 | 4998 | break; |
| @@ -5021,12 +5006,6 @@ ahc_alloc_scbs(struct ahc_softc *ahc) · 7 unmodified lines | ||
| 5021 | 5006 | next_scb->sg_list_phys = physaddr + sizeof(struct ahc_dma_seg); |
| 5022 | 5007 | next_scb->ahc_softc = ahc; |
| 5023 | 5008 | next_scb->flags = SCB_FREE; |
| 5024 | −#ifndef __linux__ | |
| 5025 | − error = ahc_dmamap_create(ahc, ahc->buffer_dmat, /*flags*/0, | |
| 5026 | − &next_scb->dmamap); | |
| 5027 | − if (error != 0) | |
| 5028 | − break; | |
| 5029 | −#endif | |
| 5030 | 5009 | next_scb->hscb = &scb_data->hscbs[scb_data->numscbs]; |
| 5031 | 5010 | next_scb->hscb->tag = ahc->scb_data->numscbs; |
| 5032 | 5011 | SLIST_INSERT_HEAD(&ahc->scb_data->free_scbs, |
| @@ -5325,24 +5304,6 @@ ahc_init(struct ahc_softc *ahc) · 292 unmodified lines | ||
| 5325 | 5304 | if ((AHC_TMODE_ENABLE & (0x1 << ahc->unit)) == 0) |
| 5326 | 5305 | ahc->features &= ~AHC_TARGETMODE; |
| 5327 | 5306 | |
| 5328 | −#ifndef __linux__ | |
| 5329 | − /* DMA tag for mapping buffers into device visible space. */ | |
| 5330 | − if (ahc_dma_tag_create(ahc, ahc->parent_dmat, /*alignment*/1, | |
| 5331 | − /*boundary*/BUS_SPACE_MAXADDR_32BIT + 1, | |
| 5332 | − /*lowaddr*/ahc->flags & AHC_39BIT_ADDRESSING | |
| 5333 | − ? (dma_addr_t)0x7FFFFFFFFFULL | |
| 5334 | − : BUS_SPACE_MAXADDR_32BIT, | |
| 5335 | − /*highaddr*/BUS_SPACE_MAXADDR, | |
| 5336 | − /*filter*/NULL, /*filterarg*/NULL, | |
| 5337 | − /*maxsize*/(AHC_NSEG - 1) * PAGE_SIZE, | |
| 5338 | − /*nsegments*/AHC_NSEG, | |
| 5339 | − /*maxsegsz*/AHC_MAXTRANSFER_SIZE, | |
| 5340 | − /*flags*/BUS_DMA_ALLOCNOW, | |
| 5341 | − &ahc->buffer_dmat) != 0) { | |
| 5342 | − return (ENOMEM); | |
| 5343 | − } | |
| 5344 | −#endif | |
| 5345 | − | |
| 5346 | 5307 | ahc->init_level++; |
| 5347 | 5308 | |
| 5348 | 5309 | /* |
| @@ -42,16 +42,9 @@ · 41 unmodified lines | ||
| 42 | 42 | * $Id: //depot/aic7xxx/aic7xxx/aic7xxx_pci.c#79 $ |
| 43 | 43 | */ |
| 44 | 44 | |
| 45 | −#ifdef __linux__ | |
| 46 | 45 | #include "aic7xxx_osm.h" |
| 47 | 46 | #include "aic7xxx_inline.h" |
| 48 | 47 | #include "aic7xxx_93cx6.h" |
| 49 | −#else | |
| 50 | −#include <dev/aic7xxx/aic7xxx_osm.h> | |
| 51 | −#include <dev/aic7xxx/aic7xxx_inline.h> | |
| 52 | −#include <dev/aic7xxx/aic7xxx_93cx6.h> | |
| 53 | −#endif | |
| 54 | − | |
| 55 | 48 | #include "aic7xxx_pci.h" |
| 56 | 49 | |
| 57 | 50 | static inline uint64_t |
| @@ -42,11 +42,7 @@ · 41 unmodified lines | ||
| 42 | 42 | * $FreeBSD$ |
| 43 | 43 | */ |
| 44 | 44 | |
| 45 | −#ifdef __linux__ | |
| 46 | 45 | #include "../queue.h" |
| 47 | −#else | |
| 48 | −#include <sys/queue.h> | |
| 49 | −#endif | |
| 50 | 46 | |
| 51 | 47 | #ifndef TRUE |
| 52 | 48 | #define TRUE 1 |
| @@ -52,11 +52,7 @@ · 51 unmodified lines | ||
| 52 | 52 | #include <string.h> |
| 53 | 53 | #include <sysexits.h> |
| 54 | 54 | |
| 55 | −#ifdef __linux__ | |
| 56 | 55 | #include "../queue.h" |
| 57 | −#else | |
| 58 | −#include <sys/queue.h> | |
| 59 | −#endif | |
| 60 | 56 | |
| 61 | 57 | #include "aicasm.h" |
| 62 | 58 | #include "aicasm_symbol.h" |
| @@ -52,11 +52,7 @@ · 51 unmodified lines | ||
| 52 | 52 | #include <string.h> |
| 53 | 53 | #include <sysexits.h> |
| 54 | 54 | |
| 55 | −#ifdef __linux__ | |
| 56 | 55 | #include "../queue.h" |
| 57 | −#else | |
| 58 | −#include <sys/queue.h> | |
| 59 | −#endif | |
| 60 | 56 | |
| 61 | 57 | #include "aicasm.h" |
| 62 | 58 | #include "aicasm_symbol.h" |
| @@ -51,11 +51,7 @@ · 50 unmodified lines | ||
| 51 | 51 | #include <stdio.h> |
| 52 | 52 | #include <string.h> |
| 53 | 53 | #include <sysexits.h> |
| 54 | −#ifdef __linux__ | |
| 55 | 54 | #include "../queue.h" |
| 56 | −#else | |
| 57 | −#include <sys/queue.h> | |
| 58 | −#endif | |
| 59 | 55 | |
| 60 | 56 | #include "aicasm.h" |
| 61 | 57 | #include "aicasm_symbol.h" |
| @@ -51,11 +51,7 @@ · 50 unmodified lines | ||
| 51 | 51 | #include <stdio.h> |
| 52 | 52 | #include <string.h> |
| 53 | 53 | #include <sysexits.h> |
| 54 | −#ifdef __linux__ | |
| 55 | 54 | #include "../queue.h" |
| 56 | −#else | |
| 57 | −#include <sys/queue.h> | |
| 58 | −#endif | |
| 59 | 55 | |
| 60 | 56 | #include "aicasm.h" |
| 61 | 57 | #include "aicasm_symbol.h" |
| @@ -44,11 +44,7 @@ · 43 unmodified lines | ||
| 44 | 44 | |
| 45 | 45 | #include <sys/types.h> |
| 46 | 46 | |
| 47 | −#ifdef __linux__ | |
| 48 | 47 | #include "aicdb.h" |
| 49 | −#else | |
| 50 | −#include <db.h> | |
| 51 | −#endif | |
| 52 | 48 | #include <fcntl.h> |
| 53 | 49 | #include <inttypes.h> |
| 54 | 50 | #include <regex.h> |
| @@ -42,11 +42,7 @@ · 41 unmodified lines | ||
| 42 | 42 | * $FreeBSD$ |
| 43 | 43 | */ |
| 44 | 44 | |
| 45 | −#ifdef __linux__ | |
| 46 | 45 | #include "../queue.h" |
| 47 | −#else | |
| 48 | −#include <sys/queue.h> | |
| 49 | −#endif | |
| 50 | 46 | |
| 51 | 47 | typedef enum { |
| 52 | 48 | UNINITIALIZED, |
| @@ -771,13 +771,8 @@ static int asd_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) · 770 unmodified lines | ||
| 771 | 771 | goto Err_remove; |
| 772 | 772 | |
| 773 | 773 | err = -ENODEV; |
| 774 | − if (!pci_set_dma_mask(dev, DMA_BIT_MASK(64)) | |
| 775 | − && !pci_set_consistent_dma_mask(dev, DMA_BIT_MASK(64))) | |
| 776 | − ; | |
| 777 | − else if (!pci_set_dma_mask(dev, DMA_BIT_MASK(32)) | |
| 778 | − && !pci_set_consistent_dma_mask(dev, DMA_BIT_MASK(32))) | |
| 779 | − ; | |
| 780 | − else { | |
| 774 | + if (dma_set_mask_and_coherent(&dev->dev, DMA_BIT_MASK(64)) || | |
| 775 | + dma_set_mask_and_coherent(&dev->dev, DMA_BIT_MASK(32))) { | |
| 781 | 776 | asd_printk("no suitable DMA mask for %s\n", pci_name(dev)); |
| 782 | 777 | goto Err_remove; |
| 783 | 778 | } |
| @@ -724,9 +724,11 @@ static void set_speed_mask(u8 *speed_mask, struct asd_phy_desc *pd) · 723 unmodified lines | ||
| 724 | 724 | switch (pd->max_sas_lrate) { |
| 725 | 725 | case SAS_LINK_RATE_6_0_GBPS: |
| 726 | 726 | *speed_mask &= ~SAS_SPEED_60_DIS; |
| 727 | + /* fall through*/ | |
| 727 | 728 | default: |
| 728 | 729 | case SAS_LINK_RATE_3_0_GBPS: |
| 729 | 730 | *speed_mask &= ~SAS_SPEED_30_DIS; |
| 731 | + /* fall through*/ | |
| 730 | 732 | case SAS_LINK_RATE_1_5_GBPS: |
| 731 | 733 | *speed_mask &= ~SAS_SPEED_15_DIS; |
| 732 | 734 | } |
| @@ -734,6 +736,7 @@ static void set_speed_mask(u8 *speed_mask, struct asd_phy_desc *pd) · 1 unmodified line | ||
| 734 | 736 | switch (pd->min_sas_lrate) { |
| 735 | 737 | case SAS_LINK_RATE_6_0_GBPS: |
| 736 | 738 | *speed_mask |= SAS_SPEED_30_DIS; |
| 739 | + /* fall through*/ | |
| 737 | 740 | case SAS_LINK_RATE_3_0_GBPS: |
| 738 | 741 | *speed_mask |= SAS_SPEED_15_DIS; |
| 739 | 742 | default: |
| @@ -745,6 +748,7 @@ static void set_speed_mask(u8 *speed_mask, struct asd_phy_desc *pd) · 5 unmodified lines | ||
| 745 | 748 | switch (pd->max_sata_lrate) { |
| 746 | 749 | case SAS_LINK_RATE_3_0_GBPS: |
| 747 | 750 | *speed_mask &= ~SATA_SPEED_30_DIS; |
| 751 | + /* fall through*/ | |
| 748 | 752 | default: |
| 749 | 753 | case SAS_LINK_RATE_1_5_GBPS: |
| 750 | 754 | *speed_mask &= ~SATA_SPEED_15_DIS; |
| @@ -803,6 +807,7 @@ void asd_build_control_phy(struct asd_ascb *ascb, int phy_id, u8 subfunc) · 52 unmodified lines | ||
| 803 | 807 | |
| 804 | 808 | /* link reset retries, this should be nominal */ |
| 805 | 809 | control_phy->link_reset_retries = 10; |
| 810 | + /* fall through */ | |
| 806 | 811 | |
| 807 | 812 | case RELEASE_SPINUP_HOLD: /* 0x02 */ |
| 808 | 813 | /* decide the func_mask */ |
| @@ -42,13 +42,13 @@ static void asd_can_dequeue(struct asd_ha_struct *asd_ha, int num) · 41 unmodified lines | ||
| 42 | 42 | spin_unlock_irqrestore(&asd_ha->seq.pend_q_lock, flags); |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | −/* PCI_DMA_... to our direction translation. | |
| 45 | +/* DMA_... to our direction translation. | |
| 46 | 46 | */ |
| 47 | 47 | static const u8 data_dir_flags[] = { |
| 48 | − [PCI_DMA_BIDIRECTIONAL] = DATA_DIR_BYRECIPIENT, /* UNSPECIFIED */ | |
| 49 | − [PCI_DMA_TODEVICE] = DATA_DIR_OUT, /* OUTBOUND */ | |
| 50 | − [PCI_DMA_FROMDEVICE] = DATA_DIR_IN, /* INBOUND */ | |
| 51 | − [PCI_DMA_NONE] = DATA_DIR_NONE, /* NO TRANSFER */ | |
| 48 | + [DMA_BIDIRECTIONAL] = DATA_DIR_BYRECIPIENT, /* UNSPECIFIED */ | |
| 49 | + [DMA_TO_DEVICE] = DATA_DIR_OUT, /* OUTBOUND */ | |
| 50 | + [DMA_FROM_DEVICE] = DATA_DIR_IN, /* INBOUND */ | |
| 51 | + [DMA_NONE] = DATA_DIR_NONE, /* NO TRANSFER */ | |
| 52 | 52 | }; |
| 53 | 53 | |
| 54 | 54 | static int asd_map_scatterlist(struct sas_task *task, |
| @@ -60,12 +60,12 @@ static int asd_map_scatterlist(struct sas_task *task, · 5 unmodified lines | ||
| 60 | 60 | struct scatterlist *sc; |
| 61 | 61 | int num_sg, res; |
| 62 | 62 | |
| 63 | − if (task->data_dir == PCI_DMA_NONE) | |
| 63 | + if (task->data_dir == DMA_NONE) | |
| 64 | 64 | return 0; |
| 65 | 65 | |
| 66 | 66 | if (task->num_scatter == 0) { |
| 67 | 67 | void *p = task->scatter; |
| 68 | − dma_addr_t dma = pci_map_single(asd_ha->pcidev, p, | |
| 68 | + dma_addr_t dma = dma_map_single(&asd_ha->pcidev->dev, p, | |
| 69 | 69 | task->total_xfer_len, |
| 70 | 70 | task->data_dir); |
| 71 | 71 | sg_arr[0].bus_addr = cpu_to_le64((u64)dma); |
| @@ -79,7 +79,7 @@ static int asd_map_scatterlist(struct sas_task *task, · 7 unmodified lines | ||
| 79 | 79 | if (sas_protocol_ata(task->task_proto)) |
| 80 | 80 | num_sg = task->num_scatter; |
| 81 | 81 | else |
| 82 | − num_sg = pci_map_sg(asd_ha->pcidev, task->scatter, | |
| 82 | + num_sg = dma_map_sg(&asd_ha->pcidev->dev, task->scatter, | |
| 83 | 83 | task->num_scatter, task->data_dir); |
| 84 | 84 | if (num_sg == 0) |
| 85 | 85 | return -ENOMEM; |
| @@ -126,8 +126,8 @@ static int asd_map_scatterlist(struct sas_task *task, · 40 unmodified lines | ||
| 126 | 126 | return 0; |
| 127 | 127 | err_unmap: |
| 128 | 128 | if (sas_protocol_ata(task->task_proto)) |
| 129 | − pci_unmap_sg(asd_ha->pcidev, task->scatter, task->num_scatter, | |
| 130 | − task->data_dir); | |
| 129 | + dma_unmap_sg(&asd_ha->pcidev->dev, task->scatter, | |
| 130 | + task->num_scatter, task->data_dir); | |
| 131 | 131 | return res; |
| 132 | 132 | } |
| 133 | 133 | |
| @@ -136,21 +136,21 @@ static void asd_unmap_scatterlist(struct asd_ascb *ascb) · 2 unmodified lines | ||
| 136 | 136 | struct asd_ha_struct *asd_ha = ascb->ha; |
| 137 | 137 | struct sas_task *task = ascb->uldd_task; |
| 138 | 138 | |
| 139 | − if (task->data_dir == PCI_DMA_NONE) | |
| 139 | + if (task->data_dir == DMA_NONE) | |
| 140 | 140 | return; |
| 141 | 141 | |
| 142 | 142 | if (task->num_scatter == 0) { |
| 143 | 143 | dma_addr_t dma = (dma_addr_t) |
| 144 | 144 | le64_to_cpu(ascb->scb->ssp_task.sg_element[0].bus_addr); |
| 145 | − pci_unmap_single(ascb->ha->pcidev, dma, task->total_xfer_len, | |
| 146 | − task->data_dir); | |
| 145 | + dma_unmap_single(&ascb->ha->pcidev->dev, dma, | |
| 146 | + task->total_xfer_len, task->data_dir); | |
| 147 | 147 | return; |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | asd_free_coherent(asd_ha, ascb->sg_arr); |
| 151 | 151 | if (task->task_proto != SAS_PROTOCOL_STP) |
| 152 | − pci_unmap_sg(asd_ha->pcidev, task->scatter, task->num_scatter, | |
| 153 | − task->data_dir); | |
| 152 | + dma_unmap_sg(&asd_ha->pcidev->dev, task->scatter, | |
| 153 | + task->num_scatter, task->data_dir); | |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | /* ---------- Task complete tasklet ---------- */ |
| @@ -436,10 +436,10 @@ static int asd_build_smp_ascb(struct asd_ascb *ascb, struct sas_task *task, · 279 unmodified lines | ||
| 436 | 436 | struct domain_device *dev = task->dev; |
| 437 | 437 | struct scb *scb; |
| 438 | 438 | |
| 439 | − pci_map_sg(asd_ha->pcidev, &task->smp_task.smp_req, 1, | |
| 440 | − PCI_DMA_TODEVICE); | |
| 441 | − pci_map_sg(asd_ha->pcidev, &task->smp_task.smp_resp, 1, | |
| 442 | − PCI_DMA_FROMDEVICE); | |
| 439 | + dma_map_sg(&asd_ha->pcidev->dev, &task->smp_task.smp_req, 1, | |
| 440 | + DMA_TO_DEVICE); | |
| 441 | + dma_map_sg(&asd_ha->pcidev->dev, &task->smp_task.smp_resp, 1, | |
| 442 | + DMA_FROM_DEVICE); | |
| 443 | 443 | |
| 444 | 444 | scb = ascb->scb; |
| 445 | 445 | |
| @@ -471,10 +471,10 @@ static void asd_unbuild_smp_ascb(struct asd_ascb *a) · 25 unmodified lines | ||
| 471 | 471 | struct sas_task *task = a->uldd_task; |
| 472 | 472 | |
| 473 | 473 | BUG_ON(!task); |
| 474 | − pci_unmap_sg(a->ha->pcidev, &task->smp_task.smp_req, 1, | |
| 475 | − PCI_DMA_TODEVICE); | |
| 476 | − pci_unmap_sg(a->ha->pcidev, &task->smp_task.smp_resp, 1, | |
| 477 | − PCI_DMA_FROMDEVICE); | |
| 474 | + dma_unmap_sg(&a->ha->pcidev->dev, &task->smp_task.smp_req, 1, | |
| 475 | + DMA_TO_DEVICE); | |
| 476 | + dma_unmap_sg(&a->ha->pcidev->dev, &task->smp_task.smp_resp, 1, | |
| 477 | + DMA_FROM_DEVICE); | |
| 478 | 478 | } |
| 479 | 479 | |
| 480 | 480 | /* ---------- SSP ---------- */ |
| @@ -96,9 +96,7 @@ static void pci_esp_dma_drain(struct esp *esp); · 95 unmodified lines | ||
| 96 | 96 | |
| 97 | 97 | static inline struct pci_esp_priv *pci_esp_get_priv(struct esp *esp) |
| 98 | 98 | { |
| 99 | − struct pci_dev *pdev = esp->dev; | |
| 100 | − | |
| 101 | − return pci_get_drvdata(pdev); | |
| 99 | + return dev_get_drvdata(esp->dev); | |
| 102 | 100 | } |
| 103 | 101 | |
| 104 | 102 | static void pci_esp_write8(struct esp *esp, u8 val, unsigned long reg) |
| @@ -116,30 +114,6 @@ static void pci_esp_write32(struct esp *esp, u32 val, unsigned long reg) · 11 unmodified lines | ||
| 116 | 114 | return iowrite32(val, esp->regs + (reg * 4UL)); |
| 117 | 115 | } |
| 118 | 116 | |
| 119 | −static dma_addr_t pci_esp_map_single(struct esp *esp, void *buf, | |
| 120 | − size_t sz, int dir) | |
| 121 | −{ | |
| 122 | − return pci_map_single(esp->dev, buf, sz, dir); | |
| 123 | −} | |
| 124 | − | |
| 125 | −static int pci_esp_map_sg(struct esp *esp, struct scatterlist *sg, | |
| 126 | − int num_sg, int dir) | |
| 127 | −{ | |
| 128 | − return pci_map_sg(esp->dev, sg, num_sg, dir); | |
| 129 | −} | |
| 130 | − | |
| 131 | −static void pci_esp_unmap_single(struct esp *esp, dma_addr_t addr, | |
| 132 | − size_t sz, int dir) | |
| 133 | −{ | |
| 134 | − pci_unmap_single(esp->dev, addr, sz, dir); | |
| 135 | −} | |
| 136 | − | |
| 137 | −static void pci_esp_unmap_sg(struct esp *esp, struct scatterlist *sg, | |
| 138 | − int num_sg, int dir) | |
| 139 | −{ | |
| 140 | − pci_unmap_sg(esp->dev, sg, num_sg, dir); | |
| 141 | −} | |
| 142 | − | |
| 143 | 117 | static int pci_esp_irq_pending(struct esp *esp) |
| 144 | 118 | { |
| 145 | 119 | struct pci_esp_priv *pep = pci_esp_get_priv(esp); |
| @@ -295,10 +269,6 @@ static u32 pci_esp_dma_length_limit(struct esp *esp, u32 dma_addr, u32 dma_len) · 149 unmodified lines | ||
| 295 | 269 | static const struct esp_driver_ops pci_esp_ops = { |
| 296 | 270 | .esp_write8 = pci_esp_write8, |
| 297 | 271 | .esp_read8 = pci_esp_read8, |
| 298 | − .map_single = pci_esp_map_single, | |
| 299 | − .map_sg = pci_esp_map_sg, | |
| 300 | − .unmap_single = pci_esp_unmap_single, | |
| 301 | − .unmap_sg = pci_esp_unmap_sg, | |
| 302 | 272 | .irq_pending = pci_esp_irq_pending, |
| 303 | 273 | .reset_dma = pci_esp_reset_dma, |
| 304 | 274 | .dma_drain = pci_esp_dma_drain, |
| @@ -375,18 +345,18 @@ static void dc390_read_eeprom(struct pci_dev *pdev, u16 *ptr) · 70 unmodified lines | ||
| 375 | 345 | |
| 376 | 346 | static void dc390_check_eeprom(struct esp *esp) |
| 377 | 347 | { |
| 348 | + struct pci_dev *pdev = to_pci_dev(esp->dev); | |
| 378 | 349 | u8 EEbuf[128]; |
| 379 | 350 | u16 *ptr = (u16 *)EEbuf, wval = 0; |
| 380 | 351 | int i; |
| 381 | 352 | |
| 382 | − dc390_read_eeprom((struct pci_dev *)esp->dev, ptr); | |
| 353 | + dc390_read_eeprom(pdev, ptr); | |
| 383 | 354 | |
| 384 | 355 | for (i = 0; i < DC390_EEPROM_LEN; i++, ptr++) |
| 385 | 356 | wval += *ptr; |
| 386 | 357 | |
| 387 | 358 | /* no Tekram EEprom found */ |
| 388 | 359 | if (wval != 0x1234) { |
| 389 | − struct pci_dev *pdev = esp->dev; | |
| 390 | 360 | dev_printk(KERN_INFO, &pdev->dev, |
| 391 | 361 | "No valid Tekram EEprom found\n"); |
| 392 | 362 | return; |
| @@ -411,7 +381,7 @@ static int pci_esp_probe_one(struct pci_dev *pdev, · 18 unmodified lines | ||
| 411 | 381 | return -ENODEV; |
| 412 | 382 | } |
| 413 | 383 | |
| 414 | − if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) { | |
| 384 | + if (dma_set_mask(&pdev->dev, DMA_BIT_MASK(32))) { | |
| 415 | 385 | dev_printk(KERN_INFO, &pdev->dev, |
| 416 | 386 | "failed to set 32bit DMA mask\n"); |
| 417 | 387 | goto fail_disable_device; |
| @@ -435,7 +405,7 @@ static int pci_esp_probe_one(struct pci_dev *pdev, · 17 unmodified lines | ||
| 435 | 405 | |
| 436 | 406 | esp = shost_priv(shost); |
| 437 | 407 | esp->host = shost; |
| 438 | − esp->dev = pdev; | |
| 408 | + esp->dev = &pdev->dev; | |
| 439 | 409 | esp->ops = &pci_esp_ops; |
| 440 | 410 | /* |
| 441 | 411 | * The am53c974 HBA has a design flaw of generating |
| @@ -467,8 +437,8 @@ static int pci_esp_probe_one(struct pci_dev *pdev, · 25 unmodified lines | ||
| 467 | 437 | |
| 468 | 438 | pci_set_master(pdev); |
| 469 | 439 | |
| 470 | − esp->command_block = pci_alloc_consistent(pdev, 16, | |
| 471 | − &esp->command_block_dma); | |
| 440 | + esp->command_block = dma_alloc_coherent(&pdev->dev, 16, | |
| 441 | + &esp->command_block_dma, GFP_KERNEL); | |
| 472 | 442 | if (!esp->command_block) { |
| 473 | 443 | dev_printk(KERN_ERR, &pdev->dev, |
| 474 | 444 | "failed to allocate command block\n"); |
| @@ -498,7 +468,7 @@ static int pci_esp_probe_one(struct pci_dev *pdev, · 23 unmodified lines | ||
| 498 | 468 | /* Assume 40MHz clock */ |
| 499 | 469 | esp->cfreq = 40000000; |
| 500 | 470 | |
| 501 | − err = scsi_esp_register(esp, &pdev->dev); | |
| 471 | + err = scsi_esp_register(esp); | |
| 502 | 472 | if (err) |
| 503 | 473 | goto fail_free_irq; |
| 504 | 474 | |
| @@ -508,8 +478,8 @@ fail_free_irq: · 3 unmodified lines | ||
| 508 | 478 | free_irq(pdev->irq, esp); |
| 509 | 479 | fail_unmap_command_block: |
| 510 | 480 | pci_set_drvdata(pdev, NULL); |
| 511 | − pci_free_consistent(pdev, 16, esp->command_block, | |
| 512 | − esp->command_block_dma); | |
| 481 | + dma_free_coherent(&pdev->dev, 16, esp->command_block, | |
| 482 | + esp->command_block_dma); | |
| 513 | 483 | fail_unmap_regs: |
| 514 | 484 | pci_iounmap(pdev, esp->regs); |
| 515 | 485 | fail_release_regions: |
| @@ -532,8 +502,8 @@ static void pci_esp_remove_one(struct pci_dev *pdev) · 16 unmodified lines | ||
| 532 | 502 | scsi_esp_unregister(esp); |
| 533 | 503 | free_irq(pdev->irq, esp); |
| 534 | 504 | pci_set_drvdata(pdev, NULL); |
| 535 | − pci_free_consistent(pdev, 16, esp->command_block, | |
| 536 | − esp->command_block_dma); | |
| 505 | + dma_free_coherent(&pdev->dev, 16, esp->command_block, | |
| 506 | + esp->command_block_dma); | |
| 537 | 507 | pci_iounmap(pdev, esp->regs); |
| 538 | 508 | pci_release_regions(pdev); |
| 539 | 509 | pci_disable_device(pdev); |
| @@ -1317,13 +1317,10 @@ static void arcmsr_report_ccb_state(struct AdapterControlBlock *acb, · 1316 unmodified lines | ||
| 1317 | 1317 | |
| 1318 | 1318 | static void arcmsr_drain_donequeue(struct AdapterControlBlock *acb, struct CommandControlBlock *pCCB, bool error) |
| 1319 | 1319 | { |
| 1320 | − int id, lun; | |
| 1321 | 1320 | if ((pCCB->acb != acb) || (pCCB->startdone != ARCMSR_CCB_START)) { |
| 1322 | 1321 | if (pCCB->startdone == ARCMSR_CCB_ABORTED) { |
| 1323 | 1322 | struct scsi_cmnd *abortcmd = pCCB->pcmd; |
| 1324 | 1323 | if (abortcmd) { |
| 1325 | − id = abortcmd->device->id; | |
| 1326 | − lun = abortcmd->device->lun; | |
| 1327 | 1324 | abortcmd->result |= DID_ABORT << 16; |
| 1328 | 1325 | arcmsr_ccb_complete(pCCB); |
| 1329 | 1326 | printk(KERN_NOTICE "arcmsr%d: pCCB ='0x%p' isr got aborted command \n", |
| @@ -1798,7 +1795,7 @@ static void arcmsr_hbaA_stop_bgrb(struct AdapterControlBlock *acb) · 468 unmodified lines | ||
| 1798 | 1795 | writel(ARCMSR_INBOUND_MESG0_STOP_BGRB, ®->inbound_msgaddr0); |
| 1799 | 1796 | if (!arcmsr_hbaA_wait_msgint_ready(acb)) { |
| 1800 | 1797 | printk(KERN_NOTICE |
| 1801 | − "arcmsr%d: wait 'stop adapter background rebulid' timeout\n" | |
| 1798 | + "arcmsr%d: wait 'stop adapter background rebuild' timeout\n" | |
| 1802 | 1799 | , acb->host->host_no); |
| 1803 | 1800 | } |
| 1804 | 1801 | } |
| @@ -1811,7 +1808,7 @@ static void arcmsr_hbaB_stop_bgrb(struct AdapterControlBlock *acb) · 6 unmodified lines | ||
| 1811 | 1808 | |
| 1812 | 1809 | if (!arcmsr_hbaB_wait_msgint_ready(acb)) { |
| 1813 | 1810 | printk(KERN_NOTICE |
| 1814 | − "arcmsr%d: wait 'stop adapter background rebulid' timeout\n" | |
| 1811 | + "arcmsr%d: wait 'stop adapter background rebuild' timeout\n" | |
| 1815 | 1812 | , acb->host->host_no); |
| 1816 | 1813 | } |
| 1817 | 1814 | } |
| @@ -1824,7 +1821,7 @@ static void arcmsr_hbaC_stop_bgrb(struct AdapterControlBlock *pACB) · 6 unmodified lines | ||
| 1824 | 1821 | writel(ARCMSR_HBCMU_DRV2IOP_MESSAGE_CMD_DONE, ®->inbound_doorbell); |
| 1825 | 1822 | if (!arcmsr_hbaC_wait_msgint_ready(pACB)) { |
| 1826 | 1823 | printk(KERN_NOTICE |
| 1827 | − "arcmsr%d: wait 'stop adapter background rebulid' timeout\n" | |
| 1824 | + "arcmsr%d: wait 'stop adapter background rebuild' timeout\n" | |
| 1828 | 1825 | , pACB->host->host_no); |
| 1829 | 1826 | } |
| 1830 | 1827 | return; |
| @@ -1837,7 +1834,7 @@ static void arcmsr_hbaD_stop_bgrb(struct AdapterControlBlock *pACB) · 6 unmodified lines | ||
| 1837 | 1834 | pACB->acb_flags &= ~ACB_F_MSG_START_BGRB; |
| 1838 | 1835 | writel(ARCMSR_INBOUND_MESG0_STOP_BGRB, reg->inbound_msgaddr0); |
| 1839 | 1836 | if (!arcmsr_hbaD_wait_msgint_ready(pACB)) |
| 1840 | − pr_notice("arcmsr%d: wait 'stop adapter background rebulid' " | |
| 1837 | + pr_notice("arcmsr%d: wait 'stop adapter background rebuild' " | |
| 1841 | 1838 | "timeout\n", pACB->host->host_no); |
| 1842 | 1839 | } |
| 1843 | 1840 | |
| @@ -1850,7 +1847,7 @@ static void arcmsr_hbaE_stop_bgrb(struct AdapterControlBlock *pACB) · 6 unmodified lines | ||
| 1850 | 1847 | pACB->out_doorbell ^= ARCMSR_HBEMU_DRV2IOP_MESSAGE_CMD_DONE; |
| 1851 | 1848 | writel(pACB->out_doorbell, ®->iobound_doorbell); |
| 1852 | 1849 | if (!arcmsr_hbaE_wait_msgint_ready(pACB)) { |
| 1853 | − pr_notice("arcmsr%d: wait 'stop adapter background rebulid' " | |
| 1850 | + pr_notice("arcmsr%d: wait 'stop adapter background rebuild' " | |
| 1854 | 1851 | "timeout\n", pACB->host->host_no); |
| 1855 | 1852 | } |
| 1856 | 1853 | } |
| @@ -3927,7 +3924,7 @@ static void arcmsr_hbaA_start_bgrb(struct AdapterControlBlock *acb) · 2070 unmodified lines | ||
| 3927 | 3924 | writel(ARCMSR_INBOUND_MESG0_START_BGRB, ®->inbound_msgaddr0); |
| 3928 | 3925 | if (!arcmsr_hbaA_wait_msgint_ready(acb)) { |
| 3929 | 3926 | printk(KERN_NOTICE "arcmsr%d: wait 'start adapter background \ |
| 3930 | − rebulid' timeout \n", acb->host->host_no); | |
| 3927 | + rebuild' timeout \n", acb->host->host_no); | |
| 3931 | 3928 | } |
| 3932 | 3929 | } |
| 3933 | 3930 | |
| @@ -3938,7 +3935,7 @@ static void arcmsr_hbaB_start_bgrb(struct AdapterControlBlock *acb) · 4 unmodified lines | ||
| 3938 | 3935 | writel(ARCMSR_MESSAGE_START_BGRB, reg->drv2iop_doorbell); |
| 3939 | 3936 | if (!arcmsr_hbaB_wait_msgint_ready(acb)) { |
| 3940 | 3937 | printk(KERN_NOTICE "arcmsr%d: wait 'start adapter background \ |
| 3941 | − rebulid' timeout \n",acb->host->host_no); | |
| 3938 | + rebuild' timeout \n",acb->host->host_no); | |
| 3942 | 3939 | } |
| 3943 | 3940 | } |
| 3944 | 3941 | |
| @@ -3950,7 +3947,7 @@ static void arcmsr_hbaC_start_bgrb(struct AdapterControlBlock *pACB) · 5 unmodified lines | ||
| 3950 | 3947 | writel(ARCMSR_HBCMU_DRV2IOP_MESSAGE_CMD_DONE, &phbcmu->inbound_doorbell); |
| 3951 | 3948 | if (!arcmsr_hbaC_wait_msgint_ready(pACB)) { |
| 3952 | 3949 | printk(KERN_NOTICE "arcmsr%d: wait 'start adapter background \ |
| 3953 | − rebulid' timeout \n", pACB->host->host_no); | |
| 3950 | + rebuild' timeout \n", pACB->host->host_no); | |
| 3954 | 3951 | } |
| 3955 | 3952 | return; |
| 3956 | 3953 | } |
| @@ -3963,7 +3960,7 @@ static void arcmsr_hbaD_start_bgrb(struct AdapterControlBlock *pACB) · 6 unmodified lines | ||
| 3963 | 3960 | writel(ARCMSR_INBOUND_MESG0_START_BGRB, pmu->inbound_msgaddr0); |
| 3964 | 3961 | if (!arcmsr_hbaD_wait_msgint_ready(pACB)) { |
| 3965 | 3962 | pr_notice("arcmsr%d: wait 'start adapter " |
| 3966 | − "background rebulid' timeout\n", pACB->host->host_no); | |
| 3963 | + "background rebuild' timeout\n", pACB->host->host_no); | |
| 3967 | 3964 | } |
| 3968 | 3965 | } |
| 3969 | 3966 | |
| @@ -3977,7 +3974,7 @@ static void arcmsr_hbaE_start_bgrb(struct AdapterControlBlock *pACB) · 7 unmodified lines | ||
| 3977 | 3974 | writel(pACB->out_doorbell, &pmu->iobound_doorbell); |
| 3978 | 3975 | if (!arcmsr_hbaE_wait_msgint_ready(pACB)) { |
| 3979 | 3976 | pr_notice("arcmsr%d: wait 'start adapter " |
| 3980 | − "background rebulid' timeout \n", pACB->host->host_no); | |
| 3977 | + "background rebuild' timeout \n", pACB->host->host_no); | |
| 3981 | 3978 | } |
| 3982 | 3979 | } |
| 3983 | 3980 | |
| @@ -4135,9 +4132,9 @@ static void arcmsr_hardware_reset(struct AdapterControlBlock *acb) · 151 unmodified lines | ||
| 4135 | 4132 | pci_read_config_byte(acb->pdev, i, &value[i]); |
| 4136 | 4133 | } |
| 4137 | 4134 | /* hardware reset signal */ |
| 4138 | − if ((acb->dev_id == 0x1680)) { | |
| 4135 | + if (acb->dev_id == 0x1680) { | |
| 4139 | 4136 | writel(ARCMSR_ARC1680_BUS_RESET, &pmuA->reserved1[0]); |
| 4140 | − } else if ((acb->dev_id == 0x1880)) { | |
| 4137 | + } else if (acb->dev_id == 0x1880) { | |
| 4141 | 4138 | do { |
| 4142 | 4139 | count++; |
| 4143 | 4140 | writel(0xF, &pmuC->write_sequence); |
| @@ -4161,7 +4158,7 @@ static void arcmsr_hardware_reset(struct AdapterControlBlock *acb) · 17 unmodified lines | ||
| 4161 | 4158 | } while (((readl(&pmuE->host_diagnostic_3xxx) & |
| 4162 | 4159 | ARCMSR_ARC1884_DiagWrite_ENABLE) == 0) && (count < 5)); |
| 4163 | 4160 | writel(ARCMSR_ARC188X_RESET_ADAPTER, &pmuE->host_diagnostic_3xxx); |
| 4164 | − } else if ((acb->dev_id == 0x1214)) { | |
| 4161 | + } else if (acb->dev_id == 0x1214) { | |
| 4165 | 4162 | writel(0x20, pmuD->reset_request); |
| 4166 | 4163 | } else { |
| 4167 | 4164 | pci_write_config_byte(acb->pdev, 0x84, 0x20); |
| @@ -1193,7 +1193,7 @@ static void atp870u_free_tables(struct Scsi_Host *host) · 1192 unmodified lines | ||
| 1193 | 1193 | for (k = 0; k < 16; k++) { |
| 1194 | 1194 | if (!atp_dev->id[j][k].prd_table) |
| 1195 | 1195 | continue; |
| 1196 | − pci_free_consistent(atp_dev->pdev, 1024, atp_dev->id[j][k].prd_table, atp_dev->id[j][k].prd_bus); | |
| 1196 | + dma_free_coherent(&atp_dev->pdev->dev, 1024, atp_dev->id[j][k].prd_table, atp_dev->id[j][k].prd_bus); | |
| 1197 | 1197 | atp_dev->id[j][k].prd_table = NULL; |
| 1198 | 1198 | } |
| 1199 | 1199 | } |
| @@ -1205,7 +1205,7 @@ static int atp870u_init_tables(struct Scsi_Host *host) · 5 unmodified lines | ||
| 1205 | 1205 | int c,k; |
| 1206 | 1206 | for(c=0;c < 2;c++) { |
| 1207 | 1207 | for(k=0;k<16;k++) { |
| 1208 | − atp_dev->id[c][k].prd_table = pci_alloc_consistent(atp_dev->pdev, 1024, &(atp_dev->id[c][k].prd_bus)); | |
| 1208 | + atp_dev->id[c][k].prd_table = dma_alloc_coherent(&atp_dev->pdev->dev, 1024, &(atp_dev->id[c][k].prd_bus), GFP_KERNEL); | |
| 1209 | 1209 | if (!atp_dev->id[c][k].prd_table) { |
| 1210 | 1210 | printk("atp870u_init_tables fail\n"); |
| 1211 | 1211 | atp870u_free_tables(host); |
| @@ -1509,7 +1509,7 @@ static int atp870u_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · 297 unmodified lines | ||
| 1509 | 1509 | if (err) |
| 1510 | 1510 | goto fail; |
| 1511 | 1511 | |
| 1512 | − if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) { | |
| 1512 | + if (dma_set_mask(&pdev->dev, DMA_BIT_MASK(32))) { | |
| 1513 | 1513 | printk(KERN_ERR "atp870u: DMA mask required but not available.\n"); |
| 1514 | 1514 | err = -EIO; |
| 1515 | 1515 | goto disable_device; |
| @@ -520,7 +520,7 @@ int beiscsi_process_mcc_compl(struct be_ctrl_info *ctrl, · 519 unmodified lines | ||
| 520 | 520 | **/ |
| 521 | 521 | tag_mem = &ctrl->ptag_state[tag].tag_mem_state; |
| 522 | 522 | if (tag_mem->size) { |
| 523 | − pci_free_consistent(ctrl->pdev, tag_mem->size, | |
| 523 | + dma_free_coherent(&ctrl->pdev->dev, tag_mem->size, | |
| 524 | 524 | tag_mem->va, tag_mem->dma); |
| 525 | 525 | tag_mem->size = 0; |
| 526 | 526 | } |
| @@ -1269,12 +1269,12 @@ int beiscsi_check_supported_fw(struct be_ctrl_info *ctrl, · 742 unmodified lines | ||
| 1269 | 1269 | struct be_sge *sge = nonembedded_sgl(wrb); |
| 1270 | 1270 | int status = 0; |
| 1271 | 1271 | |
| 1272 | − nonemb_cmd.va = pci_alloc_consistent(ctrl->pdev, | |
| 1272 | + nonemb_cmd.va = dma_alloc_coherent(&ctrl->pdev->dev, | |
| 1273 | 1273 | sizeof(struct be_mgmt_controller_attributes), |
| 1274 | − &nonemb_cmd.dma); | |
| 1274 | + &nonemb_cmd.dma, GFP_KERNEL); | |
| 1275 | 1275 | if (nonemb_cmd.va == NULL) { |
| 1276 | 1276 | beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT, |
| 1277 | − "BG_%d : pci_alloc_consistent failed in %s\n", | |
| 1277 | + "BG_%d : dma_alloc_coherent failed in %s\n", | |
| 1278 | 1278 | __func__); |
| 1279 | 1279 | return -ENOMEM; |
| 1280 | 1280 | } |
| @@ -1314,7 +1314,7 @@ int beiscsi_check_supported_fw(struct be_ctrl_info *ctrl, · 33 unmodified lines | ||
| 1314 | 1314 | "BG_%d : Failed in beiscsi_check_supported_fw\n"); |
| 1315 | 1315 | mutex_unlock(&ctrl->mbox_lock); |
| 1316 | 1316 | if (nonemb_cmd.va) |
| 1317 | − pci_free_consistent(ctrl->pdev, nonemb_cmd.size, | |
| 1317 | + dma_free_coherent(&ctrl->pdev->dev, nonemb_cmd.size, | |
| 1318 | 1318 | nonemb_cmd.va, nonemb_cmd.dma); |
| 1319 | 1319 | |
| 1320 | 1320 | return status; |
| @@ -771,7 +771,7 @@ int beiscsi_get_host_param(struct Scsi_Host *shost, · 770 unmodified lines | ||
| 771 | 771 | status = beiscsi_get_initiator_name(phba, buf, false); |
| 772 | 772 | if (status < 0) { |
| 773 | 773 | beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG, |
| 774 | − "BS_%d : Retreiving Initiator Name Failed\n"); | |
| 774 | + "BS_%d : Retrieving Initiator Name Failed\n"); | |
| 775 | 775 | status = 0; |
| 776 | 776 | } |
| 777 | 777 | } |
| @@ -1071,9 +1071,9 @@ static int beiscsi_open_conn(struct iscsi_endpoint *ep, · 293 unmodified lines | ||
| 1071 | 1071 | else |
| 1072 | 1072 | req_memsize = sizeof(struct tcp_connect_and_offload_in_v1); |
| 1073 | 1073 | |
| 1074 | − nonemb_cmd.va = pci_alloc_consistent(phba->ctrl.pdev, | |
| 1074 | + nonemb_cmd.va = dma_alloc_coherent(&phba->ctrl.pdev->dev, | |
| 1075 | 1075 | req_memsize, |
| 1076 | − &nonemb_cmd.dma); | |
| 1076 | + &nonemb_cmd.dma, GFP_KERNEL); | |
| 1077 | 1077 | if (nonemb_cmd.va == NULL) { |
| 1078 | 1078 | |
| 1079 | 1079 | beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG, |
| @@ -1091,7 +1091,7 @@ static int beiscsi_open_conn(struct iscsi_endpoint *ep, · 11 unmodified lines | ||
| 1091 | 1091 | "BS_%d : mgmt_open_connection Failed for cid=%d\n", |
| 1092 | 1092 | beiscsi_ep->ep_cid); |
| 1093 | 1093 | |
| 1094 | − pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size, | |
| 1094 | + dma_free_coherent(&phba->ctrl.pdev->dev, nonemb_cmd.size, | |
| 1095 | 1095 | nonemb_cmd.va, nonemb_cmd.dma); |
| 1096 | 1096 | beiscsi_free_ep(beiscsi_ep); |
| 1097 | 1097 | return -EAGAIN; |
| @@ -1104,8 +1104,9 @@ static int beiscsi_open_conn(struct iscsi_endpoint *ep, · 6 unmodified lines | ||
| 1104 | 1104 | "BS_%d : mgmt_open_connection Failed"); |
| 1105 | 1105 | |
| 1106 | 1106 | if (ret != -EBUSY) |
| 1107 | − pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size, | |
| 1108 | − nonemb_cmd.va, nonemb_cmd.dma); | |
| 1107 | + dma_free_coherent(&phba->ctrl.pdev->dev, | |
| 1108 | + nonemb_cmd.size, nonemb_cmd.va, | |
| 1109 | + nonemb_cmd.dma); | |
| 1109 | 1110 | |
| 1110 | 1111 | beiscsi_free_ep(beiscsi_ep); |
| 1111 | 1112 | return ret; |
| @@ -1118,7 +1119,7 @@ static int beiscsi_open_conn(struct iscsi_endpoint *ep, · 6 unmodified lines | ||
| 1118 | 1119 | beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG, |
| 1119 | 1120 | "BS_%d : mgmt_open_connection Success\n"); |
| 1120 | 1121 | |
| 1121 | − pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size, | |
| 1122 | + dma_free_coherent(&phba->ctrl.pdev->dev, nonemb_cmd.size, | |
| 1122 | 1123 | nonemb_cmd.va, nonemb_cmd.dma); |
| 1123 | 1124 | return 0; |
| 1124 | 1125 | } |
| @@ -511,18 +511,9 @@ static int beiscsi_enable_pci(struct pci_dev *pcidev) · 510 unmodified lines | ||
| 511 | 511 | } |
| 512 | 512 | |
| 513 | 513 | pci_set_master(pcidev); |
| 514 | − ret = pci_set_dma_mask(pcidev, DMA_BIT_MASK(64)); | |
| 514 | + ret = dma_set_mask_and_coherent(&pcidev->dev, DMA_BIT_MASK(64)); | |
| 515 | 515 | if (ret) { |
| 516 | − ret = pci_set_dma_mask(pcidev, DMA_BIT_MASK(32)); | |
| 517 | − if (ret) { | |
| 518 | − dev_err(&pcidev->dev, "Could not set PCI DMA Mask\n"); | |
| 519 | − goto pci_region_release; | |
| 520 | − } else { | |
| 521 | − ret = pci_set_consistent_dma_mask(pcidev, | |
| 522 | − DMA_BIT_MASK(32)); | |
| 523 | − } | |
| 524 | − } else { | |
| 525 | − ret = pci_set_consistent_dma_mask(pcidev, DMA_BIT_MASK(64)); | |
| 516 | + ret = dma_set_mask_and_coherent(&pcidev->dev, DMA_BIT_MASK(32)); | |
| 526 | 517 | if (ret) { |
| 527 | 518 | dev_err(&pcidev->dev, "Could not set PCI DMA Mask\n"); |
| 528 | 519 | goto pci_region_release; |
| @@ -550,9 +541,8 @@ static int be_ctrl_init(struct beiscsi_hba *phba, struct pci_dev *pdev) · 21 unmodified lines | ||
| 550 | 541 | if (status) |
| 551 | 542 | return status; |
| 552 | 543 | mbox_mem_alloc->size = sizeof(struct be_mcc_mailbox) + 16; |
| 553 | − mbox_mem_alloc->va = pci_alloc_consistent(pdev, | |
| 554 | − mbox_mem_alloc->size, | |
| 555 | − &mbox_mem_alloc->dma); | |
| 544 | + mbox_mem_alloc->va = dma_alloc_coherent(&pdev->dev, | |
| 545 | + mbox_mem_alloc->size, &mbox_mem_alloc->dma, GFP_KERNEL); | |
| 556 | 546 | if (!mbox_mem_alloc->va) { |
| 557 | 547 | beiscsi_unmap_pci_function(phba); |
| 558 | 548 | return -ENOMEM; |
| @@ -1866,7 +1856,6 @@ unsigned int beiscsi_process_cq(struct be_eq_obj *pbe_eq, int budget) · 1307 unmodified lines | ||
| 1866 | 1856 | { |
| 1867 | 1857 | struct be_queue_info *cq; |
| 1868 | 1858 | struct sol_cqe *sol; |
| 1869 | − struct dmsg_cqe *dmsg; | |
| 1870 | 1859 | unsigned int total = 0; |
| 1871 | 1860 | unsigned int num_processed = 0; |
| 1872 | 1861 | unsigned short code = 0, cid = 0; |
| @@ -1939,7 +1928,6 @@ unsigned int beiscsi_process_cq(struct be_eq_obj *pbe_eq, int budget) · 66 unmodified lines | ||
| 1939 | 1928 | "BM_%d : Received %s[%d] on CID : %d\n", |
| 1940 | 1929 | cqe_desc[code], code, cid); |
| 1941 | 1930 | |
| 1942 | − dmsg = (struct dmsg_cqe *)sol; | |
| 1943 | 1931 | hwi_complete_drvr_msgs(beiscsi_conn, phba, sol); |
| 1944 | 1932 | break; |
| 1945 | 1933 | case UNSOL_HDR_NOTIFY: |
| @@ -2304,11 +2292,11 @@ static int hwi_write_buffer(struct iscsi_wrb *pwrb, struct iscsi_task *task) · 358 unmodified lines | ||
| 2304 | 2292 | |
| 2305 | 2293 | /* Map addr only if there is data_count */ |
| 2306 | 2294 | if (dsp_value) { |
| 2307 | − io_task->mtask_addr = pci_map_single(phba->pcidev, | |
| 2295 | + io_task->mtask_addr = dma_map_single(&phba->pcidev->dev, | |
| 2308 | 2296 | task->data, |
| 2309 | 2297 | task->data_count, |
| 2310 | − PCI_DMA_TODEVICE); | |
| 2311 | − if (pci_dma_mapping_error(phba->pcidev, | |
| 2298 | + DMA_TO_DEVICE); | |
| 2299 | + if (dma_mapping_error(&phba->pcidev->dev, | |
| 2312 | 2300 | io_task->mtask_addr)) |
| 2313 | 2301 | return -ENOMEM; |
| 2314 | 2302 | io_task->mtask_data_count = task->data_count; |
| @@ -2519,10 +2507,9 @@ static int beiscsi_alloc_mem(struct beiscsi_hba *phba) · 204 unmodified lines | ||
| 2519 | 2507 | BEISCSI_MAX_FRAGS_INIT); |
| 2520 | 2508 | curr_alloc_size = min(be_max_phys_size * 1024, alloc_size); |
| 2521 | 2509 | do { |
| 2522 | − mem_arr->virtual_address = pci_alloc_consistent( | |
| 2523 | − phba->pcidev, | |
| 2524 | − curr_alloc_size, | |
| 2525 | − &bus_add); | |
| 2510 | + mem_arr->virtual_address = | |
| 2511 | + dma_alloc_coherent(&phba->pcidev->dev, | |
| 2512 | + curr_alloc_size, &bus_add, GFP_KERNEL); | |
| 2526 | 2513 | if (!mem_arr->virtual_address) { |
| 2527 | 2514 | if (curr_alloc_size <= BE_MIN_MEM_SIZE) |
| 2528 | 2515 | goto free_mem; |
| @@ -2560,7 +2547,7 @@ free_mem: · 31 unmodified lines | ||
| 2560 | 2547 | mem_descr->num_elements = j; |
| 2561 | 2548 | while ((i) || (j)) { |
| 2562 | 2549 | for (j = mem_descr->num_elements; j > 0; j--) { |
| 2563 | − pci_free_consistent(phba->pcidev, | |
| 2550 | + dma_free_coherent(&phba->pcidev->dev, | |
| 2564 | 2551 | mem_descr->mem_array[j - 1].size, |
| 2565 | 2552 | mem_descr->mem_array[j - 1]. |
| 2566 | 2553 | virtual_address, |
| @@ -3031,9 +3018,9 @@ static int beiscsi_create_eqs(struct beiscsi_hba *phba, · 464 unmodified lines | ||
| 3031 | 3018 | eq = &phwi_context->be_eq[i].q; |
| 3032 | 3019 | mem = &eq->dma_mem; |
| 3033 | 3020 | phwi_context->be_eq[i].phba = phba; |
| 3034 | − eq_vaddress = pci_alloc_consistent(phba->pcidev, | |
| 3021 | + eq_vaddress = dma_alloc_coherent(&phba->pcidev->dev, | |
| 3035 | 3022 | num_eq_pages * PAGE_SIZE, |
| 3036 | − &paddr); | |
| 3023 | + &paddr, GFP_KERNEL); | |
| 3037 | 3024 | if (!eq_vaddress) { |
| 3038 | 3025 | ret = -ENOMEM; |
| 3039 | 3026 | goto create_eq_error; |
| @@ -3069,7 +3056,7 @@ create_eq_error: · 29 unmodified lines | ||
| 3069 | 3056 | eq = &phwi_context->be_eq[i].q; |
| 3070 | 3057 | mem = &eq->dma_mem; |
| 3071 | 3058 | if (mem->va) |
| 3072 | − pci_free_consistent(phba->pcidev, num_eq_pages | |
| 3059 | + dma_free_coherent(&phba->pcidev->dev, num_eq_pages | |
| 3073 | 3060 | * PAGE_SIZE, |
| 3074 | 3061 | mem->va, mem->dma); |
| 3075 | 3062 | } |
| @@ -3097,9 +3084,9 @@ static int beiscsi_create_cqs(struct beiscsi_hba *phba, · 21 unmodified lines | ||
| 3097 | 3084 | pbe_eq->cq = cq; |
| 3098 | 3085 | pbe_eq->phba = phba; |
| 3099 | 3086 | mem = &cq->dma_mem; |
| 3100 | − cq_vaddress = pci_alloc_consistent(phba->pcidev, | |
| 3087 | + cq_vaddress = dma_alloc_coherent(&phba->pcidev->dev, | |
| 3101 | 3088 | num_cq_pages * PAGE_SIZE, |
| 3102 | − &paddr); | |
| 3089 | + &paddr, GFP_KERNEL); | |
| 3103 | 3090 | if (!cq_vaddress) { |
| 3104 | 3091 | ret = -ENOMEM; |
| 3105 | 3092 | goto create_cq_error; |
| @@ -3134,7 +3121,7 @@ create_cq_error: · 28 unmodified lines | ||
| 3134 | 3121 | cq = &phwi_context->be_cq[i]; |
| 3135 | 3122 | mem = &cq->dma_mem; |
| 3136 | 3123 | if (mem->va) |
| 3137 | − pci_free_consistent(phba->pcidev, num_cq_pages | |
| 3124 | + dma_free_coherent(&phba->pcidev->dev, num_cq_pages | |
| 3138 | 3125 | * PAGE_SIZE, |
| 3139 | 3126 | mem->va, mem->dma); |
| 3140 | 3127 | } |
| @@ -3326,7 +3313,7 @@ static void be_queue_free(struct beiscsi_hba *phba, struct be_queue_info *q) · 185 unmodified lines | ||
| 3326 | 3313 | { |
| 3327 | 3314 | struct be_dma_mem *mem = &q->dma_mem; |
| 3328 | 3315 | if (mem->va) { |
| 3329 | − pci_free_consistent(phba->pcidev, mem->size, | |
| 3316 | + dma_free_coherent(&phba->pcidev->dev, mem->size, | |
| 3330 | 3317 | mem->va, mem->dma); |
| 3331 | 3318 | mem->va = NULL; |
| 3332 | 3319 | } |
| @@ -3341,7 +3328,8 @@ static int be_queue_alloc(struct beiscsi_hba *phba, struct be_queue_info *q, · 8 unmodified lines | ||
| 3341 | 3328 | q->len = len; |
| 3342 | 3329 | q->entry_size = entry_size; |
| 3343 | 3330 | mem->size = len * entry_size; |
| 3344 | − mem->va = pci_zalloc_consistent(phba->pcidev, mem->size, &mem->dma); | |
| 3331 | + mem->va = dma_zalloc_coherent(&phba->pcidev->dev, mem->size, &mem->dma, | |
| 3332 | + GFP_KERNEL); | |
| 3345 | 3333 | if (!mem->va) |
| 3346 | 3334 | return -ENOMEM; |
| 3347 | 3335 | return 0; |
| @@ -3479,7 +3467,7 @@ static void be_mcc_queues_destroy(struct beiscsi_hba *phba) · 131 unmodified lines | ||
| 3479 | 3467 | &ctrl->ptag_state[tag].tag_state)) { |
| 3480 | 3468 | ptag_mem = &ctrl->ptag_state[tag].tag_mem_state; |
| 3481 | 3469 | if (ptag_mem->size) { |
| 3482 | − pci_free_consistent(ctrl->pdev, | |
| 3470 | + dma_free_coherent(&ctrl->pdev->dev, | |
| 3483 | 3471 | ptag_mem->size, |
| 3484 | 3472 | ptag_mem->va, |
| 3485 | 3473 | ptag_mem->dma); |
| @@ -3880,7 +3868,7 @@ static void beiscsi_free_mem(struct beiscsi_hba *phba) · 394 unmodified lines | ||
| 3880 | 3868 | j = 0; |
| 3881 | 3869 | for (i = 0; i < SE_MEM_MAX; i++) { |
| 3882 | 3870 | for (j = mem_descr->num_elements; j > 0; j--) { |
| 3883 | − pci_free_consistent(phba->pcidev, | |
| 3871 | + dma_free_coherent(&phba->pcidev->dev, | |
| 3884 | 3872 | mem_descr->mem_array[j - 1].size, |
| 3885 | 3873 | mem_descr->mem_array[j - 1].virtual_address, |
| 3886 | 3874 | (unsigned long)mem_descr->mem_array[j - 1]. |
| @@ -4255,10 +4243,10 @@ beiscsi_free_mgmt_task_handles(struct beiscsi_conn *beiscsi_conn, · 368 unmodified lines | ||
| 4255 | 4243 | } |
| 4256 | 4244 | |
| 4257 | 4245 | if (io_task->mtask_addr) { |
| 4258 | − pci_unmap_single(phba->pcidev, | |
| 4246 | + dma_unmap_single(&phba->pcidev->dev, | |
| 4259 | 4247 | io_task->mtask_addr, |
| 4260 | 4248 | io_task->mtask_data_count, |
| 4261 | − PCI_DMA_TODEVICE); | |
| 4249 | + DMA_TO_DEVICE); | |
| 4262 | 4250 | io_task->mtask_addr = 0; |
| 4263 | 4251 | } |
| 4264 | 4252 | } |
| @@ -4852,9 +4840,9 @@ static int beiscsi_bsg_request(struct bsg_job *job) · 587 unmodified lines | ||
| 4852 | 4840 | |
| 4853 | 4841 | switch (bsg_req->msgcode) { |
| 4854 | 4842 | case ISCSI_BSG_HST_VENDOR: |
| 4855 | − nonemb_cmd.va = pci_alloc_consistent(phba->ctrl.pdev, | |
| 4843 | + nonemb_cmd.va = dma_alloc_coherent(&phba->ctrl.pdev->dev, | |
| 4856 | 4844 | job->request_payload.payload_len, |
| 4857 | − &nonemb_cmd.dma); | |
| 4845 | + &nonemb_cmd.dma, GFP_KERNEL); | |
| 4858 | 4846 | if (nonemb_cmd.va == NULL) { |
| 4859 | 4847 | beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG, |
| 4860 | 4848 | "BM_%d : Failed to allocate memory for " |
| @@ -4867,7 +4855,7 @@ static int beiscsi_bsg_request(struct bsg_job *job) · 6 unmodified lines | ||
| 4867 | 4855 | beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG, |
| 4868 | 4856 | "BM_%d : MBX Tag Allocation Failed\n"); |
| 4869 | 4857 | |
| 4870 | − pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size, | |
| 4858 | + dma_free_coherent(&phba->ctrl.pdev->dev, nonemb_cmd.size, | |
| 4871 | 4859 | nonemb_cmd.va, nonemb_cmd.dma); |
| 4872 | 4860 | return -EAGAIN; |
| 4873 | 4861 | } |
| @@ -4881,7 +4869,7 @@ static int beiscsi_bsg_request(struct bsg_job *job) · 7 unmodified lines | ||
| 4881 | 4869 | if (!test_bit(BEISCSI_HBA_ONLINE, &phba->state)) { |
| 4882 | 4870 | clear_bit(MCC_TAG_STATE_RUNNING, |
| 4883 | 4871 | &phba->ctrl.ptag_state[tag].tag_state); |
| 4884 | − pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size, | |
| 4872 | + dma_free_coherent(&phba->ctrl.pdev->dev, nonemb_cmd.size, | |
| 4885 | 4873 | nonemb_cmd.va, nonemb_cmd.dma); |
| 4886 | 4874 | return -EIO; |
| 4887 | 4875 | } |
| @@ -4898,7 +4886,7 @@ static int beiscsi_bsg_request(struct bsg_job *job) · 10 unmodified lines | ||
| 4898 | 4886 | bsg_reply->result = status; |
| 4899 | 4887 | bsg_job_done(job, bsg_reply->result, |
| 4900 | 4888 | bsg_reply->reply_payload_rcv_len); |
| 4901 | − pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size, | |
| 4889 | + dma_free_coherent(&phba->ctrl.pdev->dev, nonemb_cmd.size, | |
| 4902 | 4890 | nonemb_cmd.va, nonemb_cmd.dma); |
| 4903 | 4891 | if (status || extd_status) { |
| 4904 | 4892 | beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG, |
| @@ -5754,7 +5742,7 @@ free_twq: · 849 unmodified lines | ||
| 5754 | 5742 | beiscsi_cleanup_port(phba); |
| 5755 | 5743 | beiscsi_free_mem(phba); |
| 5756 | 5744 | free_port: |
| 5757 | − pci_free_consistent(phba->pcidev, | |
| 5745 | + dma_free_coherent(&phba->pcidev->dev, | |
| 5758 | 5746 | phba->ctrl.mbox_mem_alloced.size, |
| 5759 | 5747 | phba->ctrl.mbox_mem_alloced.va, |
| 5760 | 5748 | phba->ctrl.mbox_mem_alloced.dma); |
| @@ -5798,7 +5786,7 @@ static void beiscsi_remove(struct pci_dev *pcidev) · 37 unmodified lines | ||
| 5798 | 5786 | |
| 5799 | 5787 | /* ctrl uninit */ |
| 5800 | 5788 | beiscsi_unmap_pci_function(phba); |
| 5801 | − pci_free_consistent(phba->pcidev, | |
| 5789 | + dma_free_coherent(&phba->pcidev->dev, | |
| 5802 | 5790 | phba->ctrl.mbox_mem_alloced.size, |
| 5803 | 5791 | phba->ctrl.mbox_mem_alloced.va, |
| 5804 | 5792 | phba->ctrl.mbox_mem_alloced.dma); |
| @@ -284,7 +284,7 @@ static int beiscsi_exec_nemb_cmd(struct beiscsi_hba *phba, · 283 unmodified lines | ||
| 284 | 284 | return rc; |
| 285 | 285 | |
| 286 | 286 | free_cmd: |
| 287 | − pci_free_consistent(ctrl->pdev, nonemb_cmd->size, | |
| 287 | + dma_free_coherent(&ctrl->pdev->dev, nonemb_cmd->size, | |
| 288 | 288 | nonemb_cmd->va, nonemb_cmd->dma); |
| 289 | 289 | return rc; |
| 290 | 290 | } |
| @@ -293,7 +293,8 @@ static int beiscsi_prep_nemb_cmd(struct beiscsi_hba *phba, · 2 unmodified lines | ||
| 293 | 293 | struct be_dma_mem *cmd, |
| 294 | 294 | u8 subsystem, u8 opcode, u32 size) |
| 295 | 295 | { |
| 296 | − cmd->va = pci_zalloc_consistent(phba->ctrl.pdev, size, &cmd->dma); | |
| 296 | + cmd->va = dma_zalloc_coherent(&phba->ctrl.pdev->dev, size, &cmd->dma, | |
| 297 | + GFP_KERNEL); | |
| 297 | 298 | if (!cmd->va) { |
| 298 | 299 | beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG, |
| 299 | 300 | "BG_%d : Failed to allocate memory for if info\n"); |
| @@ -315,7 +316,7 @@ static void __beiscsi_eq_delay_compl(struct beiscsi_hba *phba, unsigned int tag) · 15 unmodified lines | ||
| 315 | 316 | __beiscsi_mcc_compl_status(phba, tag, NULL, NULL); |
| 316 | 317 | tag_mem = &phba->ctrl.ptag_state[tag].tag_mem_state; |
| 317 | 318 | if (tag_mem->size) { |
| 318 | − pci_free_consistent(phba->pcidev, tag_mem->size, | |
| 319 | + dma_free_coherent(&phba->pcidev->dev, tag_mem->size, | |
| 319 | 320 | tag_mem->va, tag_mem->dma); |
| 320 | 321 | tag_mem->size = 0; |
| 321 | 322 | } |
| @@ -761,7 +762,7 @@ int beiscsi_if_get_info(struct beiscsi_hba *phba, int ip_type, · 439 unmodified lines | ||
| 761 | 762 | "BG_%d : Memory Allocation Failure\n"); |
| 762 | 763 | |
| 763 | 764 | /* Free the DMA memory for the IOCTL issuing */ |
| 764 | − pci_free_consistent(phba->ctrl.pdev, | |
| 765 | + dma_free_coherent(&phba->ctrl.pdev->dev, | |
| 765 | 766 | nonemb_cmd.size, |
| 766 | 767 | nonemb_cmd.va, |
| 767 | 768 | nonemb_cmd.dma); |
| @@ -780,7 +781,7 @@ int beiscsi_if_get_info(struct beiscsi_hba *phba, int ip_type, · 12 unmodified lines | ||
| 780 | 781 | ioctl_size += sizeof(struct be_cmd_req_hdr); |
| 781 | 782 | |
| 782 | 783 | /* Free the previous allocated DMA memory */ |
| 783 | − pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size, | |
| 784 | + dma_free_coherent(&phba->ctrl.pdev->dev, nonemb_cmd.size, | |
| 784 | 785 | nonemb_cmd.va, |
| 785 | 786 | nonemb_cmd.dma); |
| 786 | 787 | |
| @@ -869,7 +870,7 @@ static void beiscsi_boot_process_compl(struct beiscsi_hba *phba, · 82 unmodified lines | ||
| 869 | 870 | status); |
| 870 | 871 | boot_work = 0; |
| 871 | 872 | } |
| 872 | − pci_free_consistent(phba->ctrl.pdev, bs->nonemb_cmd.size, | |
| 873 | + dma_free_coherent(&phba->ctrl.pdev->dev, bs->nonemb_cmd.size, | |
| 873 | 874 | bs->nonemb_cmd.va, bs->nonemb_cmd.dma); |
| 874 | 875 | bs->nonemb_cmd.va = NULL; |
| 875 | 876 | break; |
| @@ -1012,9 +1013,10 @@ unsigned int beiscsi_boot_get_sinfo(struct beiscsi_hba *phba) · 136 unmodified lines | ||
| 1012 | 1013 | |
| 1013 | 1014 | nonemb_cmd = &phba->boot_struct.nonemb_cmd; |
| 1014 | 1015 | nonemb_cmd->size = sizeof(struct be_cmd_get_session_resp); |
| 1015 | − nonemb_cmd->va = pci_alloc_consistent(phba->ctrl.pdev, | |
| 1016 | + nonemb_cmd->va = dma_alloc_coherent(&phba->ctrl.pdev->dev, | |
| 1016 | 1017 | nonemb_cmd->size, |
| 1017 | − &nonemb_cmd->dma); | |
| 1018 | + &nonemb_cmd->dma, | |
| 1019 | + GFP_KERNEL); | |
| 1018 | 1020 | if (!nonemb_cmd->va) { |
| 1019 | 1021 | mutex_unlock(&ctrl->mbox_lock); |
| 1020 | 1022 | return 0; |
| @@ -1508,9 +1510,10 @@ int beiscsi_mgmt_invalidate_icds(struct beiscsi_hba *phba, · 487 unmodified lines | ||
| 1508 | 1510 | return -EINVAL; |
| 1509 | 1511 | |
| 1510 | 1512 | nonemb_cmd.size = sizeof(union be_invldt_cmds_params); |
| 1511 | − nonemb_cmd.va = pci_zalloc_consistent(phba->ctrl.pdev, | |
| 1513 | + nonemb_cmd.va = dma_zalloc_coherent(&phba->ctrl.pdev->dev, | |
| 1512 | 1514 | nonemb_cmd.size, |
| 1513 | − &nonemb_cmd.dma); | |
| 1515 | + &nonemb_cmd.dma, | |
| 1516 | + GFP_KERNEL); | |
| 1514 | 1517 | if (!nonemb_cmd.va) { |
| 1515 | 1518 | beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_EH, |
| 1516 | 1519 | "BM_%d : invldt_cmds_params alloc failed\n"); |
| @@ -1521,7 +1524,7 @@ int beiscsi_mgmt_invalidate_icds(struct beiscsi_hba *phba, · 4 unmodified lines | ||
| 1521 | 1524 | wrb = alloc_mcc_wrb(phba, &tag); |
| 1522 | 1525 | if (!wrb) { |
| 1523 | 1526 | mutex_unlock(&ctrl->mbox_lock); |
| 1524 | − pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size, | |
| 1527 | + dma_free_coherent(&phba->ctrl.pdev->dev, nonemb_cmd.size, | |
| 1525 | 1528 | nonemb_cmd.va, nonemb_cmd.dma); |
| 1526 | 1529 | return -ENOMEM; |
| 1527 | 1530 | } |
| @@ -1548,7 +1551,7 @@ int beiscsi_mgmt_invalidate_icds(struct beiscsi_hba *phba, · 20 unmodified lines | ||
| 1548 | 1551 | |
| 1549 | 1552 | rc = beiscsi_mccq_compl_wait(phba, tag, NULL, &nonemb_cmd); |
| 1550 | 1553 | if (rc != -EBUSY) |
| 1551 | − pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size, | |
| 1554 | + dma_free_coherent(&phba->ctrl.pdev->dev, nonemb_cmd.size, | |
| 1552 | 1555 | nonemb_cmd.va, nonemb_cmd.dma); |
| 1553 | 1556 | return rc; |
| 1554 | 1557 | } |
| @@ -1453,7 +1453,7 @@ union bfa_aen_data_u { · 1452 unmodified lines | ||
| 1453 | 1453 | struct bfa_aen_entry_s { |
| 1454 | 1454 | struct list_head qe; |
| 1455 | 1455 | enum bfa_aen_category aen_category; |
| 1456 | − u32 aen_type; | |
| 1456 | + int aen_type; | |
| 1457 | 1457 | union bfa_aen_data_u aen_data; |
| 1458 | 1458 | u64 aen_tv_sec; |
| 1459 | 1459 | u64 aen_tv_usec; |
| @@ -190,27 +190,6 @@ fc_els_rsp_build(struct fchs_s *fchs, u32 d_id, u32 s_id, __be16 ox_id) · 189 unmodified lines | ||
| 190 | 190 | fchs->ox_id = ox_id; |
| 191 | 191 | } |
| 192 | 192 | |
| 193 | −enum fc_parse_status | |
| 194 | −fc_els_rsp_parse(struct fchs_s *fchs, int len) | |
| 195 | −{ | |
| 196 | − struct fc_els_cmd_s *els_cmd = (struct fc_els_cmd_s *) (fchs + 1); | |
| 197 | − struct fc_ls_rjt_s *ls_rjt = (struct fc_ls_rjt_s *) els_cmd; | |
| 198 | − | |
| 199 | − len = len; | |
| 200 | − | |
| 201 | − switch (els_cmd->els_code) { | |
| 202 | − case FC_ELS_LS_RJT: | |
| 203 | − if (ls_rjt->reason_code == FC_LS_RJT_RSN_LOGICAL_BUSY) | |
| 204 | − return FC_PARSE_BUSY; | |
| 205 | − else | |
| 206 | − return FC_PARSE_FAILURE; | |
| 207 | − | |
| 208 | − case FC_ELS_ACC: | |
| 209 | − return FC_PARSE_OK; | |
| 210 | − } | |
| 211 | − return FC_PARSE_OK; | |
| 212 | −} | |
| 213 | − | |
| 214 | 193 | static void |
| 215 | 194 | fc_bls_rsp_build(struct fchs_s *fchs, u32 d_id, u32 s_id, __be16 ox_id) |
| 216 | 195 | { |
| @@ -830,18 +809,6 @@ fc_rpsc_acc_build(struct fchs_s *fchs, struct fc_rpsc_acc_s *rpsc_acc, · 613 unmodified lines | ||
| 830 | 809 | return sizeof(struct fc_rpsc_acc_s); |
| 831 | 810 | } |
| 832 | 811 | |
| 833 | −u16 | |
| 834 | −fc_logo_rsp_parse(struct fchs_s *fchs, int len) | |
| 835 | −{ | |
| 836 | − struct fc_els_cmd_s *els_cmd = (struct fc_els_cmd_s *) (fchs + 1); | |
| 837 | − | |
| 838 | − len = len; | |
| 839 | − if (els_cmd->els_code != FC_ELS_ACC) | |
| 840 | − return FC_PARSE_FAILURE; | |
| 841 | − | |
| 842 | − return FC_PARSE_OK; | |
| 843 | −} | |
| 844 | − | |
| 845 | 812 | u16 |
| 846 | 813 | fc_pdisc_build(struct fchs_s *fchs, u32 d_id, u32 s_id, u16 ox_id, |
| 847 | 814 | wwn_t port_name, wwn_t node_name, u16 pdu_size) |
| @@ -907,40 +874,6 @@ fc_prlo_build(struct fchs_s *fchs, u32 d_id, u32 s_id, u16 ox_id, · 59 unmodified lines | ||
| 907 | 874 | return be16_to_cpu(prlo->payload_len); |
| 908 | 875 | } |
| 909 | 876 | |
| 910 | −u16 | |
| 911 | −fc_prlo_rsp_parse(struct fchs_s *fchs, int len) | |
| 912 | −{ | |
| 913 | − struct fc_prlo_acc_s *prlo = (struct fc_prlo_acc_s *) (fchs + 1); | |
| 914 | − int num_pages = 0; | |
| 915 | − int page = 0; | |
| 916 | − | |
| 917 | − len = len; | |
| 918 | − | |
| 919 | − if (prlo->command != FC_ELS_ACC) | |
| 920 | − return FC_PARSE_FAILURE; | |
| 921 | − | |
| 922 | − num_pages = ((be16_to_cpu(prlo->payload_len)) - 4) / 16; | |
| 923 | − | |
| 924 | − for (page = 0; page < num_pages; page++) { | |
| 925 | − if (prlo->prlo_acc_params[page].type != FC_TYPE_FCP) | |
| 926 | − return FC_PARSE_FAILURE; | |
| 927 | − | |
| 928 | − if (prlo->prlo_acc_params[page].opa_valid != 0) | |
| 929 | − return FC_PARSE_FAILURE; | |
| 930 | − | |
| 931 | − if (prlo->prlo_acc_params[page].rpa_valid != 0) | |
| 932 | − return FC_PARSE_FAILURE; | |
| 933 | − | |
| 934 | − if (prlo->prlo_acc_params[page].orig_process_assc != 0) | |
| 935 | − return FC_PARSE_FAILURE; | |
| 936 | − | |
| 937 | − if (prlo->prlo_acc_params[page].resp_process_assc != 0) | |
| 938 | − return FC_PARSE_FAILURE; | |
| 939 | − } | |
| 940 | − return FC_PARSE_OK; | |
| 941 | − | |
| 942 | −} | |
| 943 | − | |
| 944 | 877 | u16 |
| 945 | 878 | fc_tprlo_build(struct fchs_s *fchs, u32 d_id, u32 s_id, u16 ox_id, |
| 946 | 879 | int num_pages, enum fc_tprlo_type tprlo_type, u32 tpr_id) |
| @@ -971,47 +904,6 @@ fc_tprlo_build(struct fchs_s *fchs, u32 d_id, u32 s_id, u16 ox_id, · 24 unmodified lines | ||
| 971 | 904 | return be16_to_cpu(tprlo->payload_len); |
| 972 | 905 | } |
| 973 | 906 | |
| 974 | −u16 | |
| 975 | −fc_tprlo_rsp_parse(struct fchs_s *fchs, int len) | |
| 976 | −{ | |
| 977 | − struct fc_tprlo_acc_s *tprlo = (struct fc_tprlo_acc_s *) (fchs + 1); | |
| 978 | − int num_pages = 0; | |
| 979 | − int page = 0; | |
| 980 | − | |
| 981 | − len = len; | |
| 982 | − | |
| 983 | − if (tprlo->command != FC_ELS_ACC) | |
| 984 | − return FC_PARSE_ACC_INVAL; | |
| 985 | − | |
| 986 | − num_pages = (be16_to_cpu(tprlo->payload_len) - 4) / 16; | |
| 987 | − | |
| 988 | − for (page = 0; page < num_pages; page++) { | |
| 989 | − if (tprlo->tprlo_acc_params[page].type != FC_TYPE_FCP) | |
| 990 | − return FC_PARSE_NOT_FCP; | |
| 991 | − if (tprlo->tprlo_acc_params[page].opa_valid != 0) | |
| 992 | − return FC_PARSE_OPAFLAG_INVAL; | |
| 993 | − if (tprlo->tprlo_acc_params[page].rpa_valid != 0) | |
| 994 | − return FC_PARSE_RPAFLAG_INVAL; | |
| 995 | − if (tprlo->tprlo_acc_params[page].orig_process_assc != 0) | |
| 996 | − return FC_PARSE_OPA_INVAL; | |
| 997 | − if (tprlo->tprlo_acc_params[page].resp_process_assc != 0) | |
| 998 | − return FC_PARSE_RPA_INVAL; | |
| 999 | − } | |
| 1000 | − return FC_PARSE_OK; | |
| 1001 | −} | |
| 1002 | − | |
| 1003 | −enum fc_parse_status | |
| 1004 | −fc_rrq_rsp_parse(struct fchs_s *fchs, int len) | |
| 1005 | −{ | |
| 1006 | − struct fc_els_cmd_s *els_cmd = (struct fc_els_cmd_s *) (fchs + 1); | |
| 1007 | − | |
| 1008 | − len = len; | |
| 1009 | − if (els_cmd->els_code != FC_ELS_ACC) | |
| 1010 | − return FC_PARSE_FAILURE; | |
| 1011 | − | |
| 1012 | − return FC_PARSE_OK; | |
| 1013 | −} | |
| 1014 | − | |
| 1015 | 907 | u16 |
| 1016 | 908 | fc_ba_rjt_build(struct fchs_s *fchs, u32 d_id, u32 s_id, __be16 ox_id, |
| 1017 | 909 | u32 reason_code, u32 reason_expl) |
| @@ -163,7 +163,6 @@ enum fc_parse_status fc_abts_rsp_parse(struct fchs_s *buf, int len); · 162 unmodified lines | ||
| 163 | 163 | |
| 164 | 164 | u16 fc_rrq_build(struct fchs_s *buf, struct fc_rrq_s *rrq, u32 d_id, |
| 165 | 165 | u32 s_id, u16 ox_id, u16 rrq_oxid); |
| 166 | −enum fc_parse_status fc_rrq_rsp_parse(struct fchs_s *buf, int len); | |
| 167 | 166 | |
| 168 | 167 | u16 fc_rspnid_build(struct fchs_s *fchs, void *pld, u32 s_id, |
| 169 | 168 | u16 ox_id, u8 *name); |
| @@ -276,8 +275,6 @@ void fc_get_fc4type_bitmask(u8 fc4_type, u8 *bit_mask); · 106 unmodified lines | ||
| 276 | 275 | void fc_els_req_build(struct fchs_s *fchs, u32 d_id, u32 s_id, |
| 277 | 276 | __be16 ox_id); |
| 278 | 277 | |
| 279 | −enum fc_parse_status fc_els_rsp_parse(struct fchs_s *fchs, int len); | |
| 280 | − | |
| 281 | 278 | enum fc_parse_status fc_plogi_rsp_parse(struct fchs_s *fchs, int len, |
| 282 | 279 | wwn_t port_name); |
| 283 | 280 | |
| @@ -297,8 +294,6 @@ u16 fc_tprlo_acc_build(struct fchs_s *fchs, struct fc_tprlo_acc_s *tprlo_acc, · 13 unmodified lines | ||
| 297 | 294 | u16 fc_prlo_acc_build(struct fchs_s *fchs, struct fc_prlo_acc_s *prlo_acc, |
| 298 | 295 | u32 d_id, u32 s_id, __be16 ox_id, int num_pages); |
| 299 | 296 | |
| 300 | −u16 fc_logo_rsp_parse(struct fchs_s *fchs, int len); | |
| 301 | − | |
| 302 | 297 | u16 fc_pdisc_build(struct fchs_s *fchs, u32 d_id, u32 s_id, |
| 303 | 298 | u16 ox_id, wwn_t port_name, wwn_t node_name, |
| 304 | 299 | u16 pdu_size); |
| @@ -308,14 +303,10 @@ u16 fc_pdisc_rsp_parse(struct fchs_s *fchs, int len, wwn_t port_name); · 3 unmodified lines | ||
| 308 | 303 | u16 fc_prlo_build(struct fchs_s *fchs, u32 d_id, u32 s_id, |
| 309 | 304 | u16 ox_id, int num_pages); |
| 310 | 305 | |
| 311 | −u16 fc_prlo_rsp_parse(struct fchs_s *fchs, int len); | |
| 312 | − | |
| 313 | 306 | u16 fc_tprlo_build(struct fchs_s *fchs, u32 d_id, u32 s_id, |
| 314 | 307 | u16 ox_id, int num_pages, enum fc_tprlo_type tprlo_type, |
| 315 | 308 | u32 tpr_id); |
| 316 | 309 | |
| 317 | −u16 fc_tprlo_rsp_parse(struct fchs_s *fchs, int len); | |
| 318 | − | |
| 319 | 310 | u16 fc_ba_rjt_build(struct fchs_s *fchs, u32 d_id, u32 s_id, |
| 320 | 311 | __be16 ox_id, u32 reason_code, u32 reason_expl); |
| 321 | 312 | |
| @@ -143,7 +143,7 @@ struct bfad_im_s { · 142 unmodified lines | ||
| 143 | 143 | static inline void bfad_im_post_vendor_event(struct bfa_aen_entry_s *entry, |
| 144 | 144 | struct bfad_s *drv, int cnt, |
| 145 | 145 | enum bfa_aen_category cat, |
| 146 | − enum bfa_ioc_aen_event evt) | |
| 146 | + int evt) | |
| 147 | 147 | { |
| 148 | 148 | struct timespec64 ts; |
| 149 | 149 | |
| @@ -432,7 +432,6 @@ static int bnx2fc_rcv(struct sk_buff *skb, struct net_device *dev, · 431 unmodified lines | ||
| 432 | 432 | struct fcoe_rcv_info *fr; |
| 433 | 433 | struct fcoe_percpu_s *bg; |
| 434 | 434 | struct sk_buff *tmp_skb; |
| 435 | − unsigned short oxid; | |
| 436 | 435 | |
| 437 | 436 | interface = container_of(ptype, struct bnx2fc_interface, |
| 438 | 437 | fcoe_packet_type); |
| @@ -466,8 +465,6 @@ static int bnx2fc_rcv(struct sk_buff *skb, struct net_device *dev, · 27 unmodified lines | ||
| 466 | 465 | skb_set_transport_header(skb, sizeof(struct fcoe_hdr)); |
| 467 | 466 | fh = (struct fc_frame_header *) skb_transport_header(skb); |
| 468 | 467 | |
| 469 | − oxid = ntohs(fh->fh_ox_id); | |
| 470 | − | |
| 471 | 468 | fr = fcoe_dev_from_skb(skb); |
| 472 | 469 | fr->fr_dev = lport; |
| 473 | 470 | |
| @@ -210,11 +210,8 @@ csio_pci_init(struct pci_dev *pdev, int *bars) · 209 unmodified lines | ||
| 210 | 210 | pci_set_master(pdev); |
| 211 | 211 | pci_try_set_mwi(pdev); |
| 212 | 212 | |
| 213 | − if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) { | |
| 214 | − pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64)); | |
| 215 | − } else if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) { | |
| 216 | − pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); | |
| 217 | − } else { | |
| 213 | + if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) || | |
| 214 | + dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) { | |
| 218 | 215 | dev_err(&pdev->dev, "No suitable DMA available.\n"); |
| 219 | 216 | goto err_release_regions; |
| 220 | 217 | } |
| @@ -1845,8 +1845,8 @@ csio_ln_fdmi_init(struct csio_lnode *ln) · 1844 unmodified lines | ||
| 1845 | 1845 | /* Allocate Dma buffers for FDMI response Payload */ |
| 1846 | 1846 | dma_buf = &ln->mgmt_req->dma_buf; |
| 1847 | 1847 | dma_buf->len = 2048; |
| 1848 | − dma_buf->vaddr = pci_alloc_consistent(hw->pdev, dma_buf->len, | |
| 1849 | − &dma_buf->paddr); | |
| 1848 | + dma_buf->vaddr = dma_alloc_coherent(&hw->pdev->dev, dma_buf->len, | |
| 1849 | + &dma_buf->paddr, GFP_KERNEL); | |
| 1850 | 1850 | if (!dma_buf->vaddr) { |
| 1851 | 1851 | csio_err(hw, "Failed to alloc DMA buffer for FDMI!\n"); |
| 1852 | 1852 | kfree(ln->mgmt_req); |
| @@ -1873,7 +1873,7 @@ csio_ln_fdmi_exit(struct csio_lnode *ln) · 20 unmodified lines | ||
| 1873 | 1873 | |
| 1874 | 1874 | dma_buf = &ln->mgmt_req->dma_buf; |
| 1875 | 1875 | if (dma_buf->vaddr) |
| 1876 | − pci_free_consistent(hw->pdev, dma_buf->len, dma_buf->vaddr, | |
| 1876 | + dma_free_coherent(&hw->pdev->dev, dma_buf->len, dma_buf->vaddr, | |
| 1877 | 1877 | dma_buf->paddr); |
| 1878 | 1878 | |
| 1879 | 1879 | kfree(ln->mgmt_req); |
| @@ -2349,8 +2349,8 @@ csio_scsi_alloc_ddp_bufs(struct csio_scsim *scm, struct csio_hw *hw, · 2348 unmodified lines | ||
| 2349 | 2349 | } |
| 2350 | 2350 | |
| 2351 | 2351 | /* Allocate Dma buffers for DDP */ |
| 2352 | − ddp_desc->vaddr = pci_alloc_consistent(hw->pdev, unit_size, | |
| 2353 | − &ddp_desc->paddr); | |
| 2352 | + ddp_desc->vaddr = dma_alloc_coherent(&hw->pdev->dev, unit_size, | |
| 2353 | + &ddp_desc->paddr, GFP_KERNEL); | |
| 2354 | 2354 | if (!ddp_desc->vaddr) { |
| 2355 | 2355 | csio_err(hw, |
| 2356 | 2356 | "SCSI response DMA buffer (ddp) allocation" |
| @@ -2372,8 +2372,8 @@ no_mem: · 15 unmodified lines | ||
| 2372 | 2372 | list_for_each(tmp, &scm->ddp_freelist) { |
| 2373 | 2373 | ddp_desc = (struct csio_dma_buf *) tmp; |
| 2374 | 2374 | tmp = csio_list_prev(tmp); |
| 2375 | − pci_free_consistent(hw->pdev, ddp_desc->len, ddp_desc->vaddr, | |
| 2376 | − ddp_desc->paddr); | |
| 2375 | + dma_free_coherent(&hw->pdev->dev, ddp_desc->len, | |
| 2376 | + ddp_desc->vaddr, ddp_desc->paddr); | |
| 2377 | 2377 | list_del_init(&ddp_desc->list); |
| 2378 | 2378 | kfree(ddp_desc); |
| 2379 | 2379 | } |
| @@ -2399,8 +2399,8 @@ csio_scsi_free_ddp_bufs(struct csio_scsim *scm, struct csio_hw *hw) · 19 unmodified lines | ||
| 2399 | 2399 | list_for_each(tmp, &scm->ddp_freelist) { |
| 2400 | 2400 | ddp_desc = (struct csio_dma_buf *) tmp; |
| 2401 | 2401 | tmp = csio_list_prev(tmp); |
| 2402 | − pci_free_consistent(hw->pdev, ddp_desc->len, ddp_desc->vaddr, | |
| 2403 | − ddp_desc->paddr); | |
| 2402 | + dma_free_coherent(&hw->pdev->dev, ddp_desc->len, | |
| 2403 | + ddp_desc->vaddr, ddp_desc->paddr); | |
| 2404 | 2404 | list_del_init(&ddp_desc->list); |
| 2405 | 2405 | kfree(ddp_desc); |
| 2406 | 2406 | } |
| @@ -124,8 +124,8 @@ csio_wr_fill_fl(struct csio_hw *hw, struct csio_q *flq) · 123 unmodified lines | ||
| 124 | 124 | |
| 125 | 125 | while (n--) { |
| 126 | 126 | buf->len = sge->sge_fl_buf_size[sreg]; |
| 127 | − buf->vaddr = pci_alloc_consistent(hw->pdev, buf->len, | |
| 128 | − &buf->paddr); | |
| 127 | + buf->vaddr = dma_alloc_coherent(&hw->pdev->dev, buf->len, | |
| 128 | + &buf->paddr, GFP_KERNEL); | |
| 129 | 129 | if (!buf->vaddr) { |
| 130 | 130 | csio_err(hw, "Could only fill %d buffers!\n", n + 1); |
| 131 | 131 | return -ENOMEM; |
| @@ -233,7 +233,8 @@ csio_wr_alloc_q(struct csio_hw *hw, uint32_t qsize, uint32_t wrsize, · 101 unmodified lines | ||
| 233 | 233 | |
| 234 | 234 | q = wrm->q_arr[free_idx]; |
| 235 | 235 | |
| 236 | − q->vstart = pci_zalloc_consistent(hw->pdev, qsz, &q->pstart); | |
| 236 | + q->vstart = dma_zalloc_coherent(&hw->pdev->dev, qsz, &q->pstart, | |
| 237 | + GFP_KERNEL); | |
| 237 | 238 | if (!q->vstart) { |
| 238 | 239 | csio_err(hw, |
| 239 | 240 | "Failed to allocate DMA memory for " |
| @@ -1703,14 +1704,14 @@ csio_wrm_exit(struct csio_wrm *wrm, struct csio_hw *hw) · 1463 unmodified lines | ||
| 1703 | 1704 | buf = &q->un.fl.bufs[j]; |
| 1704 | 1705 | if (!buf->vaddr) |
| 1705 | 1706 | continue; |
| 1706 | − pci_free_consistent(hw->pdev, buf->len, | |
| 1707 | − buf->vaddr, | |
| 1708 | − buf->paddr); | |
| 1707 | + dma_free_coherent(&hw->pdev->dev, | |
| 1708 | + buf->len, buf->vaddr, | |
| 1709 | + buf->paddr); | |
| 1709 | 1710 | } |
| 1710 | 1711 | kfree(q->un.fl.bufs); |
| 1711 | 1712 | } |
| 1712 | − pci_free_consistent(hw->pdev, q->size, | |
| 1713 | − q->vstart, q->pstart); | |
| 1713 | + dma_free_coherent(&hw->pdev->dev, q->size, | |
| 1714 | + q->vstart, q->pstart); | |
| 1714 | 1715 | } |
| 1715 | 1716 | kfree(q); |
| 1716 | 1717 | } |
| @@ -35,6 +35,11 @@ static unsigned int dbg_level; · 34 unmodified lines | ||
| 35 | 35 | |
| 36 | 36 | #include "../libcxgbi.h" |
| 37 | 37 | |
| 38 | +#ifdef CONFIG_CHELSIO_T4_DCB | |
| 39 | +#include <net/dcbevent.h> | |
| 40 | +#include "cxgb4_dcb.h" | |
| 41 | +#endif | |
| 42 | + | |
| 38 | 43 | #define DRV_MODULE_NAME "cxgb4i" |
| 39 | 44 | #define DRV_MODULE_DESC "Chelsio T4-T6 iSCSI Driver" |
| 40 | 45 | #define DRV_MODULE_VERSION "0.9.5-ko" |
| @@ -155,6 +160,15 @@ static struct iscsi_transport cxgb4i_iscsi_transport = { · 114 unmodified lines | ||
| 155 | 160 | .session_recovery_timedout = iscsi_session_recovery_timedout, |
| 156 | 161 | }; |
| 157 | 162 | |
| 163 | +#ifdef CONFIG_CHELSIO_T4_DCB | |
| 164 | +static int | |
| 165 | +cxgb4_dcb_change_notify(struct notifier_block *, unsigned long, void *); | |
| 166 | + | |
| 167 | +static struct notifier_block cxgb4_dcb_change = { | |
| 168 | + .notifier_call = cxgb4_dcb_change_notify, | |
| 169 | +}; | |
| 170 | +#endif | |
| 171 | + | |
| 158 | 172 | static struct scsi_transport_template *cxgb4i_stt; |
| 159 | 173 | |
| 160 | 174 | /* |
| @@ -574,6 +588,9 @@ static inline int tx_flowc_wr_credits(int *nparamsp, int *flowclenp) · 413 unmodified lines | ||
| 574 | 588 | int nparams, flowclen16, flowclen; |
| 575 | 589 | |
| 576 | 590 | nparams = FLOWC_WR_NPARAMS_MIN; |
| 591 | +#ifdef CONFIG_CHELSIO_T4_DCB | |
| 592 | + nparams++; | |
| 593 | +#endif | |
| 577 | 594 | flowclen = offsetof(struct fw_flowc_wr, mnemval[nparams]); |
| 578 | 595 | flowclen16 = DIV_ROUND_UP(flowclen, 16); |
| 579 | 596 | flowclen = flowclen16 * 16; |
| @@ -595,6 +612,9 @@ static inline int send_tx_flowc_wr(struct cxgbi_sock *csk) · 15 unmodified lines | ||
| 595 | 612 | struct fw_flowc_wr *flowc; |
| 596 | 613 | int nparams, flowclen16, flowclen; |
| 597 | 614 | |
| 615 | +#ifdef CONFIG_CHELSIO_T4_DCB | |
| 616 | + u16 vlan = ((struct l2t_entry *)csk->l2t)->vlan; | |
| 617 | +#endif | |
| 598 | 618 | flowclen16 = tx_flowc_wr_credits(&nparams, &flowclen); |
| 599 | 619 | skb = alloc_wr(flowclen, 0, GFP_ATOMIC); |
| 600 | 620 | flowc = (struct fw_flowc_wr *)skb->head; |
| @@ -622,6 +642,17 @@ static inline int send_tx_flowc_wr(struct cxgbi_sock *csk) · 21 unmodified lines | ||
| 622 | 642 | flowc->mnemval[8].val = 0; |
| 623 | 643 | flowc->mnemval[8].mnemonic = FW_FLOWC_MNEM_TXDATAPLEN_MAX; |
| 624 | 644 | flowc->mnemval[8].val = 16384; |
| 645 | +#ifdef CONFIG_CHELSIO_T4_DCB | |
| 646 | + flowc->mnemval[9].mnemonic = FW_FLOWC_MNEM_DCBPRIO; | |
| 647 | + if (vlan == CPL_L2T_VLAN_NONE) { | |
| 648 | + pr_warn_ratelimited("csk %u without VLAN Tag on DCB Link\n", | |
| 649 | + csk->tid); | |
| 650 | + flowc->mnemval[9].val = cpu_to_be32(0); | |
| 651 | + } else { | |
| 652 | + flowc->mnemval[9].val = cpu_to_be32((vlan & VLAN_PRIO_MASK) >> | |
| 653 | + VLAN_PRIO_SHIFT); | |
| 654 | + } | |
| 655 | +#endif | |
| 625 | 656 | |
| 626 | 657 | set_wr_txq(skb, CPL_PRIORITY_DATA, csk->port_id); |
| 627 | 658 | |
| @@ -1600,6 +1631,46 @@ static void release_offload_resources(struct cxgbi_sock *csk) · 972 unmodified lines | ||
| 1600 | 1631 | csk->dst = NULL; |
| 1601 | 1632 | } |
| 1602 | 1633 | |
| 1634 | +#ifdef CONFIG_CHELSIO_T4_DCB | |
| 1635 | +static inline u8 get_iscsi_dcb_state(struct net_device *ndev) | |
| 1636 | +{ | |
| 1637 | + return ndev->dcbnl_ops->getstate(ndev); | |
| 1638 | +} | |
| 1639 | + | |
| 1640 | +static int select_priority(int pri_mask) | |
| 1641 | +{ | |
| 1642 | + if (!pri_mask) | |
| 1643 | + return 0; | |
| 1644 | + return (ffs(pri_mask) - 1); | |
| 1645 | +} | |
| 1646 | + | |
| 1647 | +static u8 get_iscsi_dcb_priority(struct net_device *ndev) | |
| 1648 | +{ | |
| 1649 | + int rv; | |
| 1650 | + u8 caps; | |
| 1651 | + | |
| 1652 | + struct dcb_app iscsi_dcb_app = { | |
| 1653 | + .protocol = 3260 | |
| 1654 | + }; | |
| 1655 | + | |
| 1656 | + rv = (int)ndev->dcbnl_ops->getcap(ndev, DCB_CAP_ATTR_DCBX, &caps); | |
| 1657 | + if (rv) | |
| 1658 | + return 0; | |
| 1659 | + | |
| 1660 | + if (caps & DCB_CAP_DCBX_VER_IEEE) { | |
| 1661 | + iscsi_dcb_app.selector = IEEE_8021QAZ_APP_SEL_ANY; | |
| 1662 | + rv = dcb_ieee_getapp_mask(ndev, &iscsi_dcb_app); | |
| 1663 | + } else if (caps & DCB_CAP_DCBX_VER_CEE) { | |
| 1664 | + iscsi_dcb_app.selector = DCB_APP_IDTYPE_PORTNUM; | |
| 1665 | + rv = dcb_getapp(ndev, &iscsi_dcb_app); | |
| 1666 | + } | |
| 1667 | + | |
| 1668 | + log_debug(1 << CXGBI_DBG_ISCSI, | |
| 1669 | + "iSCSI priority is set to %u\n", select_priority(rv)); | |
| 1670 | + return select_priority(rv); | |
| 1671 | +} | |
| 1672 | +#endif | |
| 1673 | + | |
| 1603 | 1674 | static int init_act_open(struct cxgbi_sock *csk) |
| 1604 | 1675 | { |
| 1605 | 1676 | struct cxgbi_device *cdev = csk->cdev; |
| @@ -1613,7 +1684,9 @@ static int init_act_open(struct cxgbi_sock *csk) · 7 unmodified lines | ||
| 1613 | 1684 | unsigned int size, size6; |
| 1614 | 1685 | unsigned int linkspeed; |
| 1615 | 1686 | unsigned int rcv_winf, snd_winf; |
| 1616 | − | |
| 1687 | +#ifdef CONFIG_CHELSIO_T4_DCB | |
| 1688 | + u8 priority = 0; | |
| 1689 | +#endif | |
| 1617 | 1690 | log_debug(1 << CXGBI_DBG_TOE | 1 << CXGBI_DBG_SOCK, |
| 1618 | 1691 | "csk 0x%p,%u,0x%lx,%u.\n", |
| 1619 | 1692 | csk, csk->state, csk->flags, csk->tid); |
| @@ -1647,7 +1720,15 @@ static int init_act_open(struct cxgbi_sock *csk) · 27 unmodified lines | ||
| 1647 | 1720 | cxgbi_sock_set_flag(csk, CTPF_HAS_ATID); |
| 1648 | 1721 | cxgbi_sock_get(csk); |
| 1649 | 1722 | |
| 1723 | +#ifdef CONFIG_CHELSIO_T4_DCB | |
| 1724 | + if (get_iscsi_dcb_state(ndev)) | |
| 1725 | + priority = get_iscsi_dcb_priority(ndev); | |
| 1726 | + | |
| 1727 | + csk->dcb_priority = priority; | |
| 1728 | + csk->l2t = cxgb4_l2t_get(lldi->l2t, n, ndev, priority); | |
| 1729 | +#else | |
| 1650 | 1730 | csk->l2t = cxgb4_l2t_get(lldi->l2t, n, ndev, 0); |
| 1731 | +#endif | |
| 1651 | 1732 | if (!csk->l2t) { |
| 1652 | 1733 | pr_err("%s, cannot alloc l2t.\n", ndev->name); |
| 1653 | 1734 | goto rel_resource_without_clip; |
| @@ -2146,6 +2227,70 @@ static int t4_uld_state_change(void *handle, enum cxgb4_state state) · 492 unmodified lines | ||
| 2146 | 2227 | return 0; |
| 2147 | 2228 | } |
| 2148 | 2229 | |
| 2230 | +#ifdef CONFIG_CHELSIO_T4_DCB | |
| 2231 | +static int | |
| 2232 | +cxgb4_dcb_change_notify(struct notifier_block *self, unsigned long val, | |
| 2233 | + void *data) | |
| 2234 | +{ | |
| 2235 | + int i, port = 0xFF; | |
| 2236 | + struct net_device *ndev; | |
| 2237 | + struct cxgbi_device *cdev = NULL; | |
| 2238 | + struct dcb_app_type *iscsi_app = data; | |
| 2239 | + struct cxgbi_ports_map *pmap; | |
| 2240 | + u8 priority; | |
| 2241 | + | |
| 2242 | + if (iscsi_app->dcbx & DCB_CAP_DCBX_VER_IEEE) { | |
| 2243 | + if (iscsi_app->app.selector != IEEE_8021QAZ_APP_SEL_ANY) | |
| 2244 | + return NOTIFY_DONE; | |
| 2245 | + | |
| 2246 | + priority = iscsi_app->app.priority; | |
| 2247 | + } else if (iscsi_app->dcbx & DCB_CAP_DCBX_VER_CEE) { | |
| 2248 | + if (iscsi_app->app.selector != DCB_APP_IDTYPE_PORTNUM) | |
| 2249 | + return NOTIFY_DONE; | |
| 2250 | + | |
| 2251 | + if (!iscsi_app->app.priority) | |
| 2252 | + return NOTIFY_DONE; | |
| 2253 | + | |
| 2254 | + priority = ffs(iscsi_app->app.priority) - 1; | |
| 2255 | + } else { | |
| 2256 | + return NOTIFY_DONE; | |
| 2257 | + } | |
| 2258 | + | |
| 2259 | + if (iscsi_app->app.protocol != 3260) | |
| 2260 | + return NOTIFY_DONE; | |
| 2261 | + | |
| 2262 | + log_debug(1 << CXGBI_DBG_ISCSI, "iSCSI priority for ifid %d is %u\n", | |
| 2263 | + iscsi_app->ifindex, priority); | |
| 2264 | + | |
| 2265 | + ndev = dev_get_by_index(&init_net, iscsi_app->ifindex); | |
| 2266 | + if (!ndev) | |
| 2267 | + return NOTIFY_DONE; | |
| 2268 | + | |
| 2269 | + cdev = cxgbi_device_find_by_netdev_rcu(ndev, &port); | |
| 2270 | + | |
| 2271 | + dev_put(ndev); | |
| 2272 | + if (!cdev) | |
| 2273 | + return NOTIFY_DONE; | |
| 2274 | + | |
| 2275 | + pmap = &cdev->pmap; | |
| 2276 | + | |
| 2277 | + for (i = 0; i < pmap->used; i++) { | |
| 2278 | + if (pmap->port_csk[i]) { | |
| 2279 | + struct cxgbi_sock *csk = pmap->port_csk[i]; | |
| 2280 | + | |
| 2281 | + if (csk->dcb_priority != priority) { | |
| 2282 | + iscsi_conn_failure(csk->user_data, | |
| 2283 | + ISCSI_ERR_CONN_FAILED); | |
| 2284 | + pr_info("Restarting iSCSI connection %p with " | |
| 2285 | + "priority %u->%u.\n", csk, | |
| 2286 | + csk->dcb_priority, priority); | |
| 2287 | + } | |
| 2288 | + } | |
| 2289 | + } | |
| 2290 | + return NOTIFY_OK; | |
| 2291 | +} | |
| 2292 | +#endif | |
| 2293 | + | |
| 2149 | 2294 | static int __init cxgb4i_init_module(void) |
| 2150 | 2295 | { |
| 2151 | 2296 | int rc; |
| @@ -2157,11 +2302,18 @@ static int __init cxgb4i_init_module(void) · 5 unmodified lines | ||
| 2157 | 2302 | return rc; |
| 2158 | 2303 | cxgb4_register_uld(CXGB4_ULD_ISCSI, &cxgb4i_uld_info); |
| 2159 | 2304 | |
| 2305 | +#ifdef CONFIG_CHELSIO_T4_DCB | |
| 2306 | + pr_info("%s dcb enabled.\n", DRV_MODULE_NAME); | |
| 2307 | + register_dcbevent_notifier(&cxgb4_dcb_change); | |
| 2308 | +#endif | |
| 2160 | 2309 | return 0; |
| 2161 | 2310 | } |
| 2162 | 2311 | |
| 2163 | 2312 | static void __exit cxgb4i_exit_module(void) |
| 2164 | 2313 | { |
| 2314 | +#ifdef CONFIG_CHELSIO_T4_DCB | |
| 2315 | + unregister_dcbevent_notifier(&cxgb4_dcb_change); | |
| 2316 | +#endif | |
| 2165 | 2317 | cxgb4_unregister_uld(CXGB4_ULD_ISCSI); |
| 2166 | 2318 | cxgbi_device_unregister_all(CXGBI_FLAG_DEV_T4); |
| 2167 | 2319 | cxgbi_iscsi_cleanup(&cxgb4i_iscsi_transport, &cxgb4i_stt); |
| @@ -120,6 +120,9 @@ struct cxgbi_sock { · 119 unmodified lines | ||
| 120 | 120 | int wr_max_cred; |
| 121 | 121 | int wr_cred; |
| 122 | 122 | int wr_una_cred; |
| 123 | +#ifdef CONFIG_CHELSIO_T4_DCB | |
| 124 | + u8 dcb_priority; | |
| 125 | +#endif | |
| 123 | 126 | unsigned char hcrc_len; |
| 124 | 127 | unsigned char dcrc_len; |
| 125 | 128 | |
| @@ -753,105 +753,6 @@ static inline struct ScsiReqBlk *find_cmd(struct scsi_cmnd *cmd, · 752 unmodified lines | ||
| 753 | 753 | return NULL; |
| 754 | 754 | } |
| 755 | 755 | |
| 756 | − | |
| 757 | −static struct ScsiReqBlk *srb_get_free(struct AdapterCtlBlk *acb) | |
| 758 | −{ | |
| 759 | − struct list_head *head = &acb->srb_free_list; | |
| 760 | − struct ScsiReqBlk *srb = NULL; | |
| 761 | − | |
| 762 | − if (!list_empty(head)) { | |
| 763 | − srb = list_entry(head->next, struct ScsiReqBlk, list); | |
| 764 | − list_del(head->next); | |
| 765 | − dprintkdbg(DBG_0, "srb_get_free: srb=%p\n", srb); | |
| 766 | − } | |
| 767 | − return srb; | |
| 768 | −} | |
| 769 | − | |
| 770 | − | |
| 771 | −static void srb_free_insert(struct AdapterCtlBlk *acb, struct ScsiReqBlk *srb) | |
| 772 | −{ | |
| 773 | − dprintkdbg(DBG_0, "srb_free_insert: srb=%p\n", srb); | |
| 774 | − list_add_tail(&srb->list, &acb->srb_free_list); | |
| 775 | −} | |
| 776 | − | |
| 777 | − | |
| 778 | −static void srb_waiting_insert(struct DeviceCtlBlk *dcb, | |
| 779 | − struct ScsiReqBlk *srb) | |
| 780 | −{ | |
| 781 | − dprintkdbg(DBG_0, "srb_waiting_insert: (0x%p) <%02i-%i> srb=%p\n", | |
| 782 | − srb->cmd, dcb->target_id, dcb->target_lun, srb); | |
| 783 | − list_add(&srb->list, &dcb->srb_waiting_list); | |
| 784 | −} | |
| 785 | − | |
| 786 | − | |
| 787 | −static void srb_waiting_append(struct DeviceCtlBlk *dcb, | |
| 788 | − struct ScsiReqBlk *srb) | |
| 789 | −{ | |
| 790 | − dprintkdbg(DBG_0, "srb_waiting_append: (0x%p) <%02i-%i> srb=%p\n", | |
| 791 | − srb->cmd, dcb->target_id, dcb->target_lun, srb); | |
| 792 | − list_add_tail(&srb->list, &dcb->srb_waiting_list); | |
| 793 | −} | |
| 794 | − | |
| 795 | − | |
| 796 | −static void srb_going_append(struct DeviceCtlBlk *dcb, struct ScsiReqBlk *srb) | |
| 797 | −{ | |
| 798 | − dprintkdbg(DBG_0, "srb_going_append: (0x%p) <%02i-%i> srb=%p\n", | |
| 799 | − srb->cmd, dcb->target_id, dcb->target_lun, srb); | |
| 800 | − list_add_tail(&srb->list, &dcb->srb_going_list); | |
| 801 | −} | |
| 802 | − | |
| 803 | − | |
| 804 | −static void srb_going_remove(struct DeviceCtlBlk *dcb, struct ScsiReqBlk *srb) | |
| 805 | −{ | |
| 806 | − struct ScsiReqBlk *i; | |
| 807 | − struct ScsiReqBlk *tmp; | |
| 808 | − dprintkdbg(DBG_0, "srb_going_remove: (0x%p) <%02i-%i> srb=%p\n", | |
| 809 | − srb->cmd, dcb->target_id, dcb->target_lun, srb); | |
| 810 | − | |
| 811 | − list_for_each_entry_safe(i, tmp, &dcb->srb_going_list, list) | |
| 812 | − if (i == srb) { | |
| 813 | − list_del(&srb->list); | |
| 814 | − break; | |
| 815 | − } | |
| 816 | −} | |
| 817 | − | |
| 818 | − | |
| 819 | −static void srb_waiting_remove(struct DeviceCtlBlk *dcb, | |
| 820 | − struct ScsiReqBlk *srb) | |
| 821 | −{ | |
| 822 | − struct ScsiReqBlk *i; | |
| 823 | − struct ScsiReqBlk *tmp; | |
| 824 | − dprintkdbg(DBG_0, "srb_waiting_remove: (0x%p) <%02i-%i> srb=%p\n", | |
| 825 | − srb->cmd, dcb->target_id, dcb->target_lun, srb); | |
| 826 | − | |
| 827 | − list_for_each_entry_safe(i, tmp, &dcb->srb_waiting_list, list) | |
| 828 | − if (i == srb) { | |
| 829 | − list_del(&srb->list); | |
| 830 | − break; | |
| 831 | − } | |
| 832 | −} | |
| 833 | − | |
| 834 | − | |
| 835 | −static void srb_going_to_waiting_move(struct DeviceCtlBlk *dcb, | |
| 836 | − struct ScsiReqBlk *srb) | |
| 837 | −{ | |
| 838 | − dprintkdbg(DBG_0, | |
| 839 | − "srb_going_to_waiting_move: (0x%p) <%02i-%i> srb=%p\n", | |
| 840 | − srb->cmd, dcb->target_id, dcb->target_lun, srb); | |
| 841 | − list_move(&srb->list, &dcb->srb_waiting_list); | |
| 842 | −} | |
| 843 | − | |
| 844 | − | |
| 845 | −static void srb_waiting_to_going_move(struct DeviceCtlBlk *dcb, | |
| 846 | − struct ScsiReqBlk *srb) | |
| 847 | −{ | |
| 848 | − dprintkdbg(DBG_0, | |
| 849 | − "srb_waiting_to_going_move: (0x%p) <%02i-%i> srb=%p\n", | |
| 850 | − srb->cmd, dcb->target_id, dcb->target_lun, srb); | |
| 851 | − list_move(&srb->list, &dcb->srb_going_list); | |
| 852 | −} | |
| 853 | − | |
| 854 | − | |
| 855 | 756 | /* Sets the timer to wake us up */ |
| 856 | 757 | static void waiting_set_timer(struct AdapterCtlBlk *acb, unsigned long to) |
| 857 | 758 | { |
| @@ -923,7 +824,7 @@ static void waiting_process_next(struct AdapterCtlBlk *acb) · 65 unmodified lines | ||
| 923 | 824 | |
| 924 | 825 | /* Try to send to the bus */ |
| 925 | 826 | if (!start_scsi(acb, pos, srb)) |
| 926 | − srb_waiting_to_going_move(pos, srb); | |
| 827 | + list_move(&srb->list, &pos->srb_going_list); | |
| 927 | 828 | else |
| 928 | 829 | waiting_set_timer(acb, HZ/50); |
| 929 | 830 | break; |
| @@ -960,15 +861,15 @@ static void send_srb(struct AdapterCtlBlk *acb, struct ScsiReqBlk *srb) · 30 unmodified lines | ||
| 960 | 861 | if (dcb->max_command <= list_size(&dcb->srb_going_list) || |
| 961 | 862 | acb->active_dcb || |
| 962 | 863 | (acb->acb_flag & (RESET_DETECT + RESET_DONE + RESET_DEV))) { |
| 963 | − srb_waiting_append(dcb, srb); | |
| 864 | + list_add_tail(&srb->list, &dcb->srb_waiting_list); | |
| 964 | 865 | waiting_process_next(acb); |
| 965 | 866 | return; |
| 966 | 867 | } |
| 967 | 868 | |
| 968 | − if (!start_scsi(acb, dcb, srb)) | |
| 969 | − srb_going_append(dcb, srb); | |
| 970 | − else { | |
| 971 | − srb_waiting_insert(dcb, srb); | |
| 869 | + if (!start_scsi(acb, dcb, srb)) { | |
| 870 | + list_add_tail(&srb->list, &dcb->srb_going_list); | |
| 871 | + } else { | |
| 872 | + list_add(&srb->list, &dcb->srb_waiting_list); | |
| 972 | 873 | waiting_set_timer(acb, HZ / 50); |
| 973 | 874 | } |
| 974 | 875 | } |
| @@ -1045,10 +946,8 @@ static void build_srb(struct scsi_cmnd *cmd, struct DeviceCtlBlk *dcb, · 70 unmodified lines | ||
| 1045 | 946 | sgp->length++; |
| 1046 | 947 | } |
| 1047 | 948 | |
| 1048 | − srb->sg_bus_addr = pci_map_single(dcb->acb->dev, | |
| 1049 | − srb->segment_x, | |
| 1050 | − SEGMENTX_LEN, | |
| 1051 | − PCI_DMA_TODEVICE); | |
| 949 | + srb->sg_bus_addr = dma_map_single(&dcb->acb->dev->dev, | |
| 950 | + srb->segment_x, SEGMENTX_LEN, DMA_TO_DEVICE); | |
| 1052 | 951 | |
| 1053 | 952 | dprintkdbg(DBG_SG, "build_srb: [n] map sg %p->%08x(%05x)\n", |
| 1054 | 953 | srb->segment_x, srb->sg_bus_addr, SEGMENTX_LEN); |
| @@ -1116,9 +1015,9 @@ static int dc395x_queue_command_lck(struct scsi_cmnd *cmd, void (*done)(struct s · 61 unmodified lines | ||
| 1116 | 1015 | cmd->scsi_done = done; |
| 1117 | 1016 | cmd->result = 0; |
| 1118 | 1017 | |
| 1119 | − srb = srb_get_free(acb); | |
| 1120 | − if (!srb) | |
| 1121 | − { | |
| 1018 | + srb = list_first_entry_or_null(&acb->srb_free_list, | |
| 1019 | + struct ScsiReqBlk, list); | |
| 1020 | + if (!srb) { | |
| 1122 | 1021 | /* |
| 1123 | 1022 | * Return 1 since we are unable to queue this command at this |
| 1124 | 1023 | * point in time. |
| @@ -1126,12 +1025,13 @@ static int dc395x_queue_command_lck(struct scsi_cmnd *cmd, void (*done)(struct s · 1 unmodified line | ||
| 1126 | 1025 | dprintkdbg(DBG_0, "queue_command: No free srb's\n"); |
| 1127 | 1026 | return 1; |
| 1128 | 1027 | } |
| 1028 | + list_del(&srb->list); | |
| 1129 | 1029 | |
| 1130 | 1030 | build_srb(cmd, dcb, srb); |
| 1131 | 1031 | |
| 1132 | 1032 | if (!list_empty(&dcb->srb_waiting_list)) { |
| 1133 | 1033 | /* append to waiting queue */ |
| 1134 | − srb_waiting_append(dcb, srb); | |
| 1034 | + list_add_tail(&srb->list, &dcb->srb_waiting_list); | |
| 1135 | 1035 | waiting_process_next(acb); |
| 1136 | 1036 | } else { |
| 1137 | 1037 | /* process immediately */ |
| @@ -1376,11 +1276,11 @@ static int dc395x_eh_abort(struct scsi_cmnd *cmd) · 238 unmodified lines | ||
| 1376 | 1276 | |
| 1377 | 1277 | srb = find_cmd(cmd, &dcb->srb_waiting_list); |
| 1378 | 1278 | if (srb) { |
| 1379 | − srb_waiting_remove(dcb, srb); | |
| 1279 | + list_del(&srb->list); | |
| 1380 | 1280 | pci_unmap_srb_sense(acb, srb); |
| 1381 | 1281 | pci_unmap_srb(acb, srb); |
| 1382 | 1282 | free_tag(dcb, srb); |
| 1383 | − srb_free_insert(acb, srb); | |
| 1283 | + list_add_tail(&srb->list, &acb->srb_free_list); | |
| 1384 | 1284 | dprintkl(KERN_DEBUG, "eh_abort: Command was waiting\n"); |
| 1385 | 1285 | cmd->result = DID_ABORT << 16; |
| 1386 | 1286 | return SUCCESS; |
| @@ -1969,14 +1869,15 @@ static void sg_update_list(struct ScsiReqBlk *srb, u32 left) · 582 unmodified lines | ||
| 1969 | 1869 | xferred -= psge->length; |
| 1970 | 1870 | } else { |
| 1971 | 1871 | /* Partial SG entry done */ |
| 1872 | + dma_sync_single_for_cpu(&srb->dcb->acb->dev->dev, | |
| 1873 | + srb->sg_bus_addr, SEGMENTX_LEN, | |
| 1874 | + DMA_TO_DEVICE); | |
| 1972 | 1875 | psge->length -= xferred; |
| 1973 | 1876 | psge->address += xferred; |
| 1974 | 1877 | srb->sg_index = idx; |
| 1975 | − pci_dma_sync_single_for_device(srb->dcb-> | |
| 1976 | − acb->dev, | |
| 1977 | − srb->sg_bus_addr, | |
| 1978 | − SEGMENTX_LEN, | |
| 1979 | − PCI_DMA_TODEVICE); | |
| 1878 | + dma_sync_single_for_device(&srb->dcb->acb->dev->dev, | |
| 1879 | + srb->sg_bus_addr, SEGMENTX_LEN, | |
| 1880 | + DMA_TO_DEVICE); | |
| 1980 | 1881 | break; |
| 1981 | 1882 | } |
| 1982 | 1883 | psge++; |
| @@ -3083,7 +2984,7 @@ static void disconnect(struct AdapterCtlBlk *acb) · 1100 unmodified lines | ||
| 3083 | 2984 | goto disc1; |
| 3084 | 2985 | } |
| 3085 | 2986 | free_tag(dcb, srb); |
| 3086 | − srb_going_to_waiting_move(dcb, srb); | |
| 2987 | + list_move(&srb->list, &dcb->srb_waiting_list); | |
| 3087 | 2988 | dprintkdbg(DBG_KG, |
| 3088 | 2989 | "disconnect: (0x%p) Retry\n", |
| 3089 | 2990 | srb->cmd); |
| @@ -3148,7 +3049,7 @@ static void reselect(struct AdapterCtlBlk *acb) · 58 unmodified lines | ||
| 3148 | 3049 | |
| 3149 | 3050 | srb->state = SRB_READY; |
| 3150 | 3051 | free_tag(dcb, srb); |
| 3151 | − srb_going_to_waiting_move(dcb, srb); | |
| 3052 | + list_move(&srb->list, &dcb->srb_waiting_list); | |
| 3152 | 3053 | waiting_set_timer(acb, HZ / 20); |
| 3153 | 3054 | |
| 3154 | 3055 | /* return; */ |
| @@ -3271,9 +3172,8 @@ static void pci_unmap_srb(struct AdapterCtlBlk *acb, struct ScsiReqBlk *srb) · 116 unmodified lines | ||
| 3271 | 3172 | /* unmap DC395x SG list */ |
| 3272 | 3173 | dprintkdbg(DBG_SG, "pci_unmap_srb: list=%08x(%05x)\n", |
| 3273 | 3174 | srb->sg_bus_addr, SEGMENTX_LEN); |
| 3274 | − pci_unmap_single(acb->dev, srb->sg_bus_addr, | |
| 3275 | − SEGMENTX_LEN, | |
| 3276 | − PCI_DMA_TODEVICE); | |
| 3175 | + dma_unmap_single(&acb->dev->dev, srb->sg_bus_addr, SEGMENTX_LEN, | |
| 3176 | + DMA_TO_DEVICE); | |
| 3277 | 3177 | dprintkdbg(DBG_SG, "pci_unmap_srb: segs=%i buffer=%p\n", |
| 3278 | 3178 | scsi_sg_count(cmd), scsi_bufflen(cmd)); |
| 3279 | 3179 | /* unmap the sg segments */ |
| @@ -3291,8 +3191,8 @@ static void pci_unmap_srb_sense(struct AdapterCtlBlk *acb, · 11 unmodified lines | ||
| 3291 | 3191 | /* Unmap sense buffer */ |
| 3292 | 3192 | dprintkdbg(DBG_SG, "pci_unmap_srb_sense: buffer=%08x\n", |
| 3293 | 3193 | srb->segment_x[0].address); |
| 3294 | − pci_unmap_single(acb->dev, srb->segment_x[0].address, | |
| 3295 | − srb->segment_x[0].length, PCI_DMA_FROMDEVICE); | |
| 3194 | + dma_unmap_single(&acb->dev->dev, srb->segment_x[0].address, | |
| 3195 | + srb->segment_x[0].length, DMA_FROM_DEVICE); | |
| 3296 | 3196 | /* Restore SG stuff */ |
| 3297 | 3197 | srb->total_xfer_length = srb->xferred; |
| 3298 | 3198 | srb->segment_x[0].address = |
| @@ -3411,7 +3311,7 @@ static void srb_done(struct AdapterCtlBlk *acb, struct DeviceCtlBlk *dcb, · 112 unmodified lines | ||
| 3411 | 3311 | tempcnt--; |
| 3412 | 3312 | dcb->max_command = tempcnt; |
| 3413 | 3313 | free_tag(dcb, srb); |
| 3414 | − srb_going_to_waiting_move(dcb, srb); | |
| 3314 | + list_move(&srb->list, &dcb->srb_waiting_list); | |
| 3415 | 3315 | waiting_set_timer(acb, HZ / 20); |
| 3416 | 3316 | srb->adapter_status = 0; |
| 3417 | 3317 | srb->target_status = 0; |
| @@ -3447,14 +3347,12 @@ static void srb_done(struct AdapterCtlBlk *acb, struct DeviceCtlBlk *dcb, · 29 unmodified lines | ||
| 3447 | 3347 | } |
| 3448 | 3348 | } |
| 3449 | 3349 | |
| 3450 | − if (dir != PCI_DMA_NONE && scsi_sg_count(cmd)) | |
| 3451 | − pci_dma_sync_sg_for_cpu(acb->dev, scsi_sglist(cmd), | |
| 3452 | − scsi_sg_count(cmd), dir); | |
| 3453 | − | |
| 3454 | 3350 | ckc_only = 0; |
| 3455 | 3351 | /* Check Error Conditions */ |
| 3456 | 3352 | ckc_e: |
| 3457 | 3353 | |
| 3354 | + pci_unmap_srb(acb, srb); | |
| 3355 | + | |
| 3458 | 3356 | if (cmd->cmnd[0] == INQUIRY) { |
| 3459 | 3357 | unsigned char *base = NULL; |
| 3460 | 3358 | struct ScsiInqData *ptr; |
| @@ -3498,16 +3396,14 @@ static void srb_done(struct AdapterCtlBlk *acb, struct DeviceCtlBlk *dcb, · 37 unmodified lines | ||
| 3498 | 3396 | cmd->cmnd[0], srb->total_xfer_length); |
| 3499 | 3397 | } |
| 3500 | 3398 | |
| 3501 | − srb_going_remove(dcb, srb); | |
| 3502 | − /* Add to free list */ | |
| 3503 | − if (srb == acb->tmp_srb) | |
| 3504 | − dprintkl(KERN_ERR, "srb_done: ERROR! Completed cmd with tmp_srb\n"); | |
| 3505 | − else { | |
| 3399 | + if (srb != acb->tmp_srb) { | |
| 3400 | + /* Add to free list */ | |
| 3506 | 3401 | dprintkdbg(DBG_0, "srb_done: (0x%p) done result=0x%08x\n", |
| 3507 | 3402 | cmd, cmd->result); |
| 3508 | − srb_free_insert(acb, srb); | |
| 3403 | + list_move_tail(&srb->list, &acb->srb_free_list); | |
| 3404 | + } else { | |
| 3405 | + dprintkl(KERN_ERR, "srb_done: ERROR! Completed cmd with tmp_srb\n"); | |
| 3509 | 3406 | } |
| 3510 | − pci_unmap_srb(acb, srb); | |
| 3511 | 3407 | |
| 3512 | 3408 | cmd->scsi_done(cmd); |
| 3513 | 3409 | waiting_process_next(acb); |
| @@ -3535,9 +3431,9 @@ static void doing_srb_done(struct AdapterCtlBlk *acb, u8 did_flag, · 21 unmodified lines | ||
| 3535 | 3431 | result = MK_RES(0, did_flag, 0, 0); |
| 3536 | 3432 | printk("G:%p(%02i-%i) ", p, |
| 3537 | 3433 | p->device->id, (u8)p->device->lun); |
| 3538 | − srb_going_remove(dcb, srb); | |
| 3434 | + list_del(&srb->list); | |
| 3539 | 3435 | free_tag(dcb, srb); |
| 3540 | − srb_free_insert(acb, srb); | |
| 3436 | + list_add_tail(&srb->list, &acb->srb_free_list); | |
| 3541 | 3437 | p->result = result; |
| 3542 | 3438 | pci_unmap_srb_sense(acb, srb); |
| 3543 | 3439 | pci_unmap_srb(acb, srb); |
| @@ -3565,8 +3461,7 @@ static void doing_srb_done(struct AdapterCtlBlk *acb, u8 did_flag, · 21 unmodified lines | ||
| 3565 | 3461 | result = MK_RES(0, did_flag, 0, 0); |
| 3566 | 3462 | printk("W:%p<%02i-%i>", p, p->device->id, |
| 3567 | 3463 | (u8)p->device->lun); |
| 3568 | − srb_waiting_remove(dcb, srb); | |
| 3569 | − srb_free_insert(acb, srb); | |
| 3464 | + list_move_tail(&srb->list, &acb->srb_free_list); | |
| 3570 | 3465 | p->result = result; |
| 3571 | 3466 | pci_unmap_srb_sense(acb, srb); |
| 3572 | 3467 | pci_unmap_srb(acb, srb); |
| @@ -3692,9 +3587,9 @@ static void request_sense(struct AdapterCtlBlk *acb, struct DeviceCtlBlk *dcb, · 119 unmodified lines | ||
| 3692 | 3587 | srb->total_xfer_length = SCSI_SENSE_BUFFERSIZE; |
| 3693 | 3588 | srb->segment_x[0].length = SCSI_SENSE_BUFFERSIZE; |
| 3694 | 3589 | /* Map sense buffer */ |
| 3695 | − srb->segment_x[0].address = | |
| 3696 | − pci_map_single(acb->dev, cmd->sense_buffer, | |
| 3697 | − SCSI_SENSE_BUFFERSIZE, PCI_DMA_FROMDEVICE); | |
| 3590 | + srb->segment_x[0].address = dma_map_single(&acb->dev->dev, | |
| 3591 | + cmd->sense_buffer, SCSI_SENSE_BUFFERSIZE, | |
| 3592 | + DMA_FROM_DEVICE); | |
| 3698 | 3593 | dprintkdbg(DBG_SG, "request_sense: map buffer %p->%08x(%05x)\n", |
| 3699 | 3594 | cmd->sense_buffer, srb->segment_x[0].address, |
| 3700 | 3595 | SCSI_SENSE_BUFFERSIZE); |
| @@ -3705,7 +3600,7 @@ static void request_sense(struct AdapterCtlBlk *acb, struct DeviceCtlBlk *dcb, · 4 unmodified lines | ||
| 3705 | 3600 | dprintkl(KERN_DEBUG, |
| 3706 | 3601 | "request_sense: (0x%p) failed <%02i-%i>\n", |
| 3707 | 3602 | srb->cmd, dcb->target_id, dcb->target_lun); |
| 3708 | − srb_going_to_waiting_move(dcb, srb); | |
| 3603 | + list_move(&srb->list, &dcb->srb_waiting_list); | |
| 3709 | 3604 | waiting_set_timer(acb, HZ / 100); |
| 3710 | 3605 | } |
| 3711 | 3606 | } |
| @@ -4392,7 +4287,7 @@ static void adapter_init_params(struct AdapterCtlBlk *acb) · 680 unmodified lines | ||
| 4392 | 4287 | |
| 4393 | 4288 | /* link static array of srbs into the srb free list */ |
| 4394 | 4289 | for (i = 0; i < acb->srb_count - 1; i++) |
| 4395 | − srb_free_insert(acb, &acb->srb_array[i]); | |
| 4290 | + list_add_tail(&acb->srb_array[i].list, &acb->srb_free_list); | |
| 4396 | 4291 | } |
| 4397 | 4292 | |
| 4398 | 4293 | |
| @@ -369,19 +369,28 @@ static void esp_map_dma(struct esp *esp, struct scsi_cmnd *cmd) · 368 unmodified lines | ||
| 369 | 369 | { |
| 370 | 370 | struct esp_cmd_priv *spriv = ESP_CMD_PRIV(cmd); |
| 371 | 371 | struct scatterlist *sg = scsi_sglist(cmd); |
| 372 | − int dir = cmd->sc_data_direction; | |
| 373 | − int total, i; | |
| 372 | + int total = 0, i; | |
| 374 | 373 | |
| 375 | − if (dir == DMA_NONE) | |
| 374 | + if (cmd->sc_data_direction == DMA_NONE) | |
| 376 | 375 | return; |
| 377 | 376 | |
| 378 | − spriv->u.num_sg = esp->ops->map_sg(esp, sg, scsi_sg_count(cmd), dir); | |
| 377 | + if (esp->flags & ESP_FLAG_NO_DMA_MAP) { | |
| 378 | + /* | |
| 379 | + * For pseudo DMA and PIO we need the virtual address instead of | |
| 380 | + * a dma address, so perform an identity mapping. | |
| 381 | + */ | |
| 382 | + spriv->num_sg = scsi_sg_count(cmd); | |
| 383 | + for (i = 0; i < spriv->num_sg; i++) { | |
| 384 | + sg[i].dma_address = (uintptr_t)sg_virt(&sg[i]); | |
| 385 | + total += sg_dma_len(&sg[i]); | |
| 386 | + } | |
| 387 | + } else { | |
| 388 | + spriv->num_sg = scsi_dma_map(cmd); | |
| 389 | + for (i = 0; i < spriv->num_sg; i++) | |
| 390 | + total += sg_dma_len(&sg[i]); | |
| 391 | + } | |
| 379 | 392 | spriv->cur_residue = sg_dma_len(sg); |
| 380 | 393 | spriv->cur_sg = sg; |
| 381 | − | |
| 382 | − total = 0; | |
| 383 | − for (i = 0; i < spriv->u.num_sg; i++) | |
| 384 | − total += sg_dma_len(&sg[i]); | |
| 385 | 394 | spriv->tot_residue = total; |
| 386 | 395 | } |
| 387 | 396 | |
| @@ -441,13 +450,8 @@ static void esp_advance_dma(struct esp *esp, struct esp_cmd_entry *ent, · 53 unmodified lines | ||
| 441 | 450 | |
| 442 | 451 | static void esp_unmap_dma(struct esp *esp, struct scsi_cmnd *cmd) |
| 443 | 452 | { |
| 444 | − struct esp_cmd_priv *spriv = ESP_CMD_PRIV(cmd); | |
| 445 | − int dir = cmd->sc_data_direction; | |
| 446 | − | |
| 447 | − if (dir == DMA_NONE) | |
| 448 | − return; | |
| 449 | − | |
| 450 | − esp->ops->unmap_sg(esp, scsi_sglist(cmd), spriv->u.num_sg, dir); | |
| 453 | + if (!(esp->flags & ESP_FLAG_NO_DMA_MAP)) | |
| 454 | + scsi_dma_unmap(cmd); | |
| 451 | 455 | } |
| 452 | 456 | |
| 453 | 457 | static void esp_save_pointers(struct esp *esp, struct esp_cmd_entry *ent) |
| @@ -478,17 +482,6 @@ static void esp_restore_pointers(struct esp *esp, struct esp_cmd_entry *ent) · 24 unmodified lines | ||
| 478 | 482 | spriv->tot_residue = ent->saved_tot_residue; |
| 479 | 483 | } |
| 480 | 484 | |
| 481 | −static void esp_check_command_len(struct esp *esp, struct scsi_cmnd *cmd) | |
| 482 | −{ | |
| 483 | − if (cmd->cmd_len == 6 || | |
| 484 | − cmd->cmd_len == 10 || | |
| 485 | − cmd->cmd_len == 12) { | |
| 486 | − esp->flags &= ~ESP_FLAG_DOING_SLOWCMD; | |
| 487 | − } else { | |
| 488 | − esp->flags |= ESP_FLAG_DOING_SLOWCMD; | |
| 489 | − } | |
| 490 | −} | |
| 491 | − | |
| 492 | 485 | static void esp_write_tgt_config3(struct esp *esp, int tgt) |
| 493 | 486 | { |
| 494 | 487 | if (esp->rev > ESP100A) { |
| @@ -624,6 +617,26 @@ static void esp_free_lun_tag(struct esp_cmd_entry *ent, · 129 unmodified lines | ||
| 624 | 617 | } |
| 625 | 618 | } |
| 626 | 619 | |
| 620 | +static void esp_map_sense(struct esp *esp, struct esp_cmd_entry *ent) | |
| 621 | +{ | |
| 622 | + ent->sense_ptr = ent->cmd->sense_buffer; | |
| 623 | + if (esp->flags & ESP_FLAG_NO_DMA_MAP) { | |
| 624 | + ent->sense_dma = (uintptr_t)ent->sense_ptr; | |
| 625 | + return; | |
| 626 | + } | |
| 627 | + | |
| 628 | + ent->sense_dma = dma_map_single(esp->dev, ent->sense_ptr, | |
| 629 | + SCSI_SENSE_BUFFERSIZE, DMA_FROM_DEVICE); | |
| 630 | +} | |
| 631 | + | |
| 632 | +static void esp_unmap_sense(struct esp *esp, struct esp_cmd_entry *ent) | |
| 633 | +{ | |
| 634 | + if (!(esp->flags & ESP_FLAG_NO_DMA_MAP)) | |
| 635 | + dma_unmap_single(esp->dev, ent->sense_dma, | |
| 636 | + SCSI_SENSE_BUFFERSIZE, DMA_FROM_DEVICE); | |
| 637 | + ent->sense_ptr = NULL; | |
| 638 | +} | |
| 639 | + | |
| 627 | 640 | /* When a contingent allegiance conditon is created, we force feed a |
| 628 | 641 | * REQUEST_SENSE command to the device to fetch the sense data. I |
| 629 | 642 | * tried many other schemes, relying on the scsi error handling layer |
| @@ -645,12 +658,7 @@ static void esp_autosense(struct esp *esp, struct esp_cmd_entry *ent) · 15 unmodified lines | ||
| 645 | 658 | if (!ent->sense_ptr) { |
| 646 | 659 | esp_log_autosense("Doing auto-sense for tgt[%d] lun[%d]\n", |
| 647 | 660 | tgt, lun); |
| 648 | − | |
| 649 | − ent->sense_ptr = cmd->sense_buffer; | |
| 650 | − ent->sense_dma = esp->ops->map_single(esp, | |
| 651 | − ent->sense_ptr, | |
| 652 | − SCSI_SENSE_BUFFERSIZE, | |
| 653 | − DMA_FROM_DEVICE); | |
| 661 | + esp_map_sense(esp, ent); | |
| 654 | 662 | } |
| 655 | 663 | ent->saved_sense_ptr = ent->sense_ptr; |
| 656 | 664 | |
| @@ -717,10 +725,10 @@ static struct esp_cmd_entry *find_and_prep_issuable_command(struct esp *esp) · 60 unmodified lines | ||
| 717 | 725 | static void esp_maybe_execute_command(struct esp *esp) |
| 718 | 726 | { |
| 719 | 727 | struct esp_target_data *tp; |
| 720 | − struct esp_lun_data *lp; | |
| 721 | 728 | struct scsi_device *dev; |
| 722 | 729 | struct scsi_cmnd *cmd; |
| 723 | 730 | struct esp_cmd_entry *ent; |
| 731 | + bool select_and_stop = false; | |
| 724 | 732 | int tgt, lun, i; |
| 725 | 733 | u32 val, start_cmd; |
| 726 | 734 | u8 *p; |
| @@ -743,7 +751,6 @@ static void esp_maybe_execute_command(struct esp *esp) · 16 unmodified lines | ||
| 743 | 751 | tgt = dev->id; |
| 744 | 752 | lun = dev->lun; |
| 745 | 753 | tp = &esp->target[tgt]; |
| 746 | − lp = dev->hostdata; | |
| 747 | 754 | |
| 748 | 755 | list_move(&ent->list, &esp->active_cmds); |
| 749 | 756 | |
| @@ -752,7 +759,8 @@ static void esp_maybe_execute_command(struct esp *esp) · 2 unmodified lines | ||
| 752 | 759 | esp_map_dma(esp, cmd); |
| 753 | 760 | esp_save_pointers(esp, ent); |
| 754 | 761 | |
| 755 | − esp_check_command_len(esp, cmd); | |
| 762 | + if (!(cmd->cmd_len == 6 || cmd->cmd_len == 10 || cmd->cmd_len == 12)) | |
| 763 | + select_and_stop = true; | |
| 756 | 764 | |
| 757 | 765 | p = esp->command_block; |
| 758 | 766 | |
| @@ -793,42 +801,22 @@ static void esp_maybe_execute_command(struct esp *esp) · 34 unmodified lines | ||
| 793 | 801 | tp->flags &= ~ESP_TGT_CHECK_NEGO; |
| 794 | 802 | } |
| 795 | 803 | |
| 796 | − /* Process it like a slow command. */ | |
| 797 | − if (tp->flags & (ESP_TGT_NEGO_WIDE | ESP_TGT_NEGO_SYNC)) | |
| 798 | − esp->flags |= ESP_FLAG_DOING_SLOWCMD; | |
| 804 | + /* If there are multiple message bytes, use Select and Stop */ | |
| 805 | + if (esp->msg_out_len) | |
| 806 | + select_and_stop = true; | |
| 799 | 807 | } |
| 800 | 808 | |
| 801 | 809 | build_identify: |
| 802 | − /* If we don't have a lun-data struct yet, we're probing | |
| 803 | − * so do not disconnect. Also, do not disconnect unless | |
| 804 | − * we have a tag on this command. | |
| 805 | − */ | |
| 806 | − if (lp && (tp->flags & ESP_TGT_DISCONNECT) && ent->tag[0]) | |
| 807 | − *p++ = IDENTIFY(1, lun); | |
| 808 | − else | |
| 809 | − *p++ = IDENTIFY(0, lun); | |
| 810 | + *p++ = IDENTIFY(tp->flags & ESP_TGT_DISCONNECT, lun); | |
| 810 | 811 | |
| 811 | 812 | if (ent->tag[0] && esp->rev == ESP100) { |
| 812 | 813 | /* ESP100 lacks select w/atn3 command, use select |
| 813 | 814 | * and stop instead. |
| 814 | 815 | */ |
| 815 | − esp->flags |= ESP_FLAG_DOING_SLOWCMD; | |
| 816 | + select_and_stop = true; | |
| 816 | 817 | } |
| 817 | 818 | |
| 818 | − if (!(esp->flags & ESP_FLAG_DOING_SLOWCMD)) { | |
| 819 | − start_cmd = ESP_CMD_SELA; | |
| 820 | − if (ent->tag[0]) { | |
| 821 | − *p++ = ent->tag[0]; | |
| 822 | − *p++ = ent->tag[1]; | |
| 823 | − | |
| 824 | − start_cmd = ESP_CMD_SA3; | |
| 825 | − } | |
| 826 | − | |
| 827 | − for (i = 0; i < cmd->cmd_len; i++) | |
| 828 | − *p++ = cmd->cmnd[i]; | |
| 829 | − | |
| 830 | − esp->select_state = ESP_SELECT_BASIC; | |
| 831 | − } else { | |
| 819 | + if (select_and_stop) { | |
| 832 | 820 | esp->cmd_bytes_left = cmd->cmd_len; |
| 833 | 821 | esp->cmd_bytes_ptr = &cmd->cmnd[0]; |
| 834 | 822 | |
| @@ -843,6 +831,19 @@ build_identify: · 8 unmodified lines | ||
| 843 | 831 | |
| 844 | 832 | start_cmd = ESP_CMD_SELAS; |
| 845 | 833 | esp->select_state = ESP_SELECT_MSGOUT; |
| 834 | + } else { | |
| 835 | + start_cmd = ESP_CMD_SELA; | |
| 836 | + if (ent->tag[0]) { | |
| 837 | + *p++ = ent->tag[0]; | |
| 838 | + *p++ = ent->tag[1]; | |
| 839 | + | |
| 840 | + start_cmd = ESP_CMD_SA3; | |
| 841 | + } | |
| 842 | + | |
| 843 | + for (i = 0; i < cmd->cmd_len; i++) | |
| 844 | + *p++ = cmd->cmnd[i]; | |
| 845 | + | |
| 846 | + esp->select_state = ESP_SELECT_BASIC; | |
| 846 | 847 | } |
| 847 | 848 | val = tgt; |
| 848 | 849 | if (esp->rev == FASHME) |
| @@ -902,9 +903,7 @@ static void esp_cmd_is_done(struct esp *esp, struct esp_cmd_entry *ent, · 53 unmodified lines | ||
| 902 | 903 | } |
| 903 | 904 | |
| 904 | 905 | if (ent->flags & ESP_CMD_FLAG_AUTOSENSE) { |
| 905 | − esp->ops->unmap_single(esp, ent->sense_dma, | |
| 906 | − SCSI_SENSE_BUFFERSIZE, DMA_FROM_DEVICE); | |
| 907 | − ent->sense_ptr = NULL; | |
| 906 | + esp_unmap_sense(esp, ent); | |
| 908 | 907 | |
| 909 | 908 | /* Restore the message/status bytes to what we actually |
| 910 | 909 | * saw originally. Also, report that we are providing |
| @@ -965,7 +964,7 @@ static int esp_queuecommand_lck(struct scsi_cmnd *cmd, void (*done)(struct scsi_ · 54 unmodified lines | ||
| 965 | 964 | cmd->scsi_done = done; |
| 966 | 965 | |
| 967 | 966 | spriv = ESP_CMD_PRIV(cmd); |
| 968 | − spriv->u.dma_addr = ~(dma_addr_t)0x0; | |
| 967 | + spriv->num_sg = 0; | |
| 969 | 968 | |
| 970 | 969 | list_add_tail(&ent->list, &esp->queued_cmds); |
| 971 | 970 | |
| @@ -1252,14 +1251,10 @@ static int esp_finish_select(struct esp *esp) · 280 unmodified lines | ||
| 1252 | 1251 | esp_unmap_dma(esp, cmd); |
| 1253 | 1252 | esp_free_lun_tag(ent, cmd->device->hostdata); |
| 1254 | 1253 | tp->flags &= ~(ESP_TGT_NEGO_SYNC | ESP_TGT_NEGO_WIDE); |
| 1255 | − esp->flags &= ~ESP_FLAG_DOING_SLOWCMD; | |
| 1256 | 1254 | esp->cmd_bytes_ptr = NULL; |
| 1257 | 1255 | esp->cmd_bytes_left = 0; |
| 1258 | 1256 | } else { |
| 1259 | − esp->ops->unmap_single(esp, ent->sense_dma, | |
| 1260 | − SCSI_SENSE_BUFFERSIZE, | |
| 1261 | − DMA_FROM_DEVICE); | |
| 1262 | − ent->sense_ptr = NULL; | |
| 1257 | + esp_unmap_sense(esp, ent); | |
| 1263 | 1258 | } |
| 1264 | 1259 | |
| 1265 | 1260 | /* Now that the state is unwound properly, put back onto |
| @@ -1303,9 +1298,8 @@ static int esp_finish_select(struct esp *esp) · 37 unmodified lines | ||
| 1303 | 1298 | esp_flush_fifo(esp); |
| 1304 | 1299 | } |
| 1305 | 1300 | |
| 1306 | − /* If we are doing a slow command, negotiation, etc. | |
| 1307 | − * we'll do the right thing as we transition to the | |
| 1308 | − * next phase. | |
| 1301 | + /* If we are doing a Select And Stop command, negotiation, etc. | |
| 1302 | + * we'll do the right thing as we transition to the next phase. | |
| 1309 | 1303 | */ |
| 1310 | 1304 | esp_event(esp, ESP_EVENT_CHECK_PHASE); |
| 1311 | 1305 | return 0; |
| @@ -1338,6 +1332,7 @@ static int esp_data_bytes_sent(struct esp *esp, struct esp_cmd_entry *ent, · 26 unmodified lines | ||
| 1338 | 1332 | |
| 1339 | 1333 | bytes_sent = esp->data_dma_len; |
| 1340 | 1334 | bytes_sent -= ecount; |
| 1335 | + bytes_sent -= esp->send_cmd_residual; | |
| 1341 | 1336 | |
| 1342 | 1337 | /* |
| 1343 | 1338 | * The am53c974 has a DMA 'pecularity'. The doc states: |
| @@ -1358,7 +1353,7 @@ static int esp_data_bytes_sent(struct esp *esp, struct esp_cmd_entry *ent, · 14 unmodified lines | ||
| 1358 | 1353 | struct esp_cmd_priv *p = ESP_CMD_PRIV(cmd); |
| 1359 | 1354 | u8 *ptr; |
| 1360 | 1355 | |
| 1361 | − ptr = scsi_kmap_atomic_sg(p->cur_sg, p->u.num_sg, | |
| 1356 | + ptr = scsi_kmap_atomic_sg(p->cur_sg, p->num_sg, | |
| 1362 | 1357 | &offset, &count); |
| 1363 | 1358 | if (likely(ptr)) { |
| 1364 | 1359 | *(ptr + offset) = bval; |
| @@ -2039,11 +2034,8 @@ static void esp_reset_cleanup_one(struct esp *esp, struct esp_cmd_entry *ent) · 674 unmodified lines | ||
| 2039 | 2034 | esp_free_lun_tag(ent, cmd->device->hostdata); |
| 2040 | 2035 | cmd->result = DID_RESET << 16; |
| 2041 | 2036 | |
| 2042 | − if (ent->flags & ESP_CMD_FLAG_AUTOSENSE) { | |
| 2043 | − esp->ops->unmap_single(esp, ent->sense_dma, | |
| 2044 | − SCSI_SENSE_BUFFERSIZE, DMA_FROM_DEVICE); | |
| 2045 | − ent->sense_ptr = NULL; | |
| 2046 | − } | |
| 2037 | + if (ent->flags & ESP_CMD_FLAG_AUTOSENSE) | |
| 2038 | + esp_unmap_sense(esp, ent); | |
| 2047 | 2039 | |
| 2048 | 2040 | cmd->scsi_done(cmd); |
| 2049 | 2041 | list_del(&ent->list); |
| @@ -2382,7 +2374,7 @@ static const char *esp_chip_names[] = { · 332 unmodified lines | ||
| 2382 | 2374 | |
| 2383 | 2375 | static struct scsi_transport_template *esp_transport_template; |
| 2384 | 2376 | |
| 2385 | −int scsi_esp_register(struct esp *esp, struct device *dev) | |
| 2377 | +int scsi_esp_register(struct esp *esp) | |
| 2386 | 2378 | { |
| 2387 | 2379 | static int instance; |
| 2388 | 2380 | int err; |
| @@ -2402,10 +2394,10 @@ int scsi_esp_register(struct esp *esp, struct device *dev) · 13 unmodified lines | ||
| 2402 | 2394 | |
| 2403 | 2395 | esp_bootup_reset(esp); |
| 2404 | 2396 | |
| 2405 | − dev_printk(KERN_INFO, dev, "esp%u: regs[%1p:%1p] irq[%u]\n", | |
| 2397 | + dev_printk(KERN_INFO, esp->dev, "esp%u: regs[%1p:%1p] irq[%u]\n", | |
| 2406 | 2398 | esp->host->unique_id, esp->regs, esp->dma_regs, |
| 2407 | 2399 | esp->host->irq); |
| 2408 | − dev_printk(KERN_INFO, dev, | |
| 2400 | + dev_printk(KERN_INFO, esp->dev, | |
| 2409 | 2401 | "esp%u: is a %s, %u MHz (ccf=%u), SCSI ID %u\n", |
| 2410 | 2402 | esp->host->unique_id, esp_chip_names[esp->rev], |
| 2411 | 2403 | esp->cfreq / 1000000, esp->cfact, esp->scsi_id); |
| @@ -2413,7 +2405,7 @@ int scsi_esp_register(struct esp *esp, struct device *dev) · 1 unmodified line | ||
| 2413 | 2405 | /* Let the SCSI bus reset settle. */ |
| 2414 | 2406 | ssleep(esp_bus_reset_settle); |
| 2415 | 2407 | |
| 2416 | − err = scsi_add_host(esp->host, dev); | |
| 2408 | + err = scsi_add_host(esp->host, esp->dev); | |
| 2417 | 2409 | if (err) |
| 2418 | 2410 | return err; |
| 2419 | 2411 | |
| @@ -2790,3 +2782,131 @@ MODULE_PARM_DESC(esp_debug, · 370 unmodified lines | ||
| 2790 | 2782 | |
| 2791 | 2783 | module_init(esp_init); |
| 2792 | 2784 | module_exit(esp_exit); |
| 2785 | + | |
| 2786 | +#ifdef CONFIG_SCSI_ESP_PIO | |
| 2787 | +static inline unsigned int esp_wait_for_fifo(struct esp *esp) | |
| 2788 | +{ | |
| 2789 | + int i = 500000; | |
| 2790 | + | |
| 2791 | + do { | |
| 2792 | + unsigned int fbytes = esp_read8(ESP_FFLAGS) & ESP_FF_FBYTES; | |
| 2793 | + | |
| 2794 | + if (fbytes) | |
| 2795 | + return fbytes; | |
| 2796 | + | |
| 2797 | + udelay(1); | |
| 2798 | + } while (--i); | |
| 2799 | + | |
| 2800 | + shost_printk(KERN_ERR, esp->host, "FIFO is empty. sreg [%02x]\n", | |
| 2801 | + esp_read8(ESP_STATUS)); | |
| 2802 | + return 0; | |
| 2803 | +} | |
| 2804 | + | |
| 2805 | +static inline int esp_wait_for_intr(struct esp *esp) | |
| 2806 | +{ | |
| 2807 | + int i = 500000; | |
| 2808 | + | |
| 2809 | + do { | |
| 2810 | + esp->sreg = esp_read8(ESP_STATUS); | |
| 2811 | + if (esp->sreg & ESP_STAT_INTR) | |
| 2812 | + return 0; | |
| 2813 | + | |
| 2814 | + udelay(1); | |
| 2815 | + } while (--i); | |
| 2816 | + | |
| 2817 | + shost_printk(KERN_ERR, esp->host, "IRQ timeout. sreg [%02x]\n", | |
| 2818 | + esp->sreg); | |
| 2819 | + return 1; | |
| 2820 | +} | |
| 2821 | + | |
| 2822 | +#define ESP_FIFO_SIZE 16 | |
| 2823 | + | |
| 2824 | +void esp_send_pio_cmd(struct esp *esp, u32 addr, u32 esp_count, | |
| 2825 | + u32 dma_count, int write, u8 cmd) | |
| 2826 | +{ | |
| 2827 | + u8 phase = esp->sreg & ESP_STAT_PMASK; | |
| 2828 | + | |
| 2829 | + cmd &= ~ESP_CMD_DMA; | |
| 2830 | + esp->send_cmd_error = 0; | |
| 2831 | + | |
| 2832 | + if (write) { | |
| 2833 | + u8 *dst = (u8 *)addr; | |
| 2834 | + u8 mask = ~(phase == ESP_MIP ? ESP_INTR_FDONE : ESP_INTR_BSERV); | |
| 2835 | + | |
| 2836 | + scsi_esp_cmd(esp, cmd); | |
| 2837 | + | |
| 2838 | + while (1) { | |
| 2839 | + if (!esp_wait_for_fifo(esp)) | |
| 2840 | + break; | |
| 2841 | + | |
| 2842 | + *dst++ = readb(esp->fifo_reg); | |
| 2843 | + --esp_count; | |
| 2844 | + | |
| 2845 | + if (!esp_count) | |
| 2846 | + break; | |
| 2847 | + | |
| 2848 | + if (esp_wait_for_intr(esp)) { | |
| 2849 | + esp->send_cmd_error = 1; | |
| 2850 | + break; | |
| 2851 | + } | |
| 2852 | + | |
| 2853 | + if ((esp->sreg & ESP_STAT_PMASK) != phase) | |
| 2854 | + break; | |
| 2855 | + | |
| 2856 | + esp->ireg = esp_read8(ESP_INTRPT); | |
| 2857 | + if (esp->ireg & mask) { | |
| 2858 | + esp->send_cmd_error = 1; | |
| 2859 | + break; | |
| 2860 | + } | |
| 2861 | + | |
| 2862 | + if (phase == ESP_MIP) | |
| 2863 | + esp_write8(ESP_CMD_MOK, ESP_CMD); | |
| 2864 | + | |
| 2865 | + esp_write8(ESP_CMD_TI, ESP_CMD); | |
| 2866 | + } | |
| 2867 | + } else { | |
| 2868 | + unsigned int n = ESP_FIFO_SIZE; | |
| 2869 | + u8 *src = (u8 *)addr; | |
| 2870 | + | |
| 2871 | + scsi_esp_cmd(esp, ESP_CMD_FLUSH); | |
| 2872 | + | |
| 2873 | + if (n > esp_count) | |
| 2874 | + n = esp_count; | |
| 2875 | + writesb(esp->fifo_reg, src, n); | |
| 2876 | + src += n; | |
| 2877 | + esp_count -= n; | |
| 2878 | + | |
| 2879 | + scsi_esp_cmd(esp, cmd); | |
| 2880 | + | |
| 2881 | + while (esp_count) { | |
| 2882 | + if (esp_wait_for_intr(esp)) { | |
| 2883 | + esp->send_cmd_error = 1; | |
| 2884 | + break; | |
| 2885 | + } | |
| 2886 | + | |
| 2887 | + if ((esp->sreg & ESP_STAT_PMASK) != phase) | |
| 2888 | + break; | |
| 2889 | + | |
| 2890 | + esp->ireg = esp_read8(ESP_INTRPT); | |
| 2891 | + if (esp->ireg & ~ESP_INTR_BSERV) { | |
| 2892 | + esp->send_cmd_error = 1; | |
| 2893 | + break; | |
| 2894 | + } | |
| 2895 | + | |
| 2896 | + n = ESP_FIFO_SIZE - | |
| 2897 | + (esp_read8(ESP_FFLAGS) & ESP_FF_FBYTES); | |
| 2898 | + | |
| 2899 | + if (n > esp_count) | |
| 2900 | + n = esp_count; | |
| 2901 | + writesb(esp->fifo_reg, src, n); | |
| 2902 | + src += n; | |
| 2903 | + esp_count -= n; | |
| 2904 | + | |
| 2905 | + esp_write8(ESP_CMD_TI, ESP_CMD); | |
| 2906 | + } | |
| 2907 | + } | |
| 2908 | + | |
| 2909 | + esp->send_cmd_residual = esp_count; | |
| 2910 | +} | |
| 2911 | +EXPORT_SYMBOL(esp_send_pio_cmd); | |
| 2912 | +#endif | |
| @@ -249,11 +249,7 @@ · 248 unmodified lines | ||
| 249 | 249 | #define SYNC_DEFP_FAST 0x19 /* 10mb/s */ |
| 250 | 250 | |
| 251 | 251 | struct esp_cmd_priv { |
| 252 | − union { | |
| 253 | − dma_addr_t dma_addr; | |
| 254 | − int num_sg; | |
| 255 | − } u; | |
| 256 | − | |
| 252 | + int num_sg; | |
| 257 | 253 | int cur_residue; |
| 258 | 254 | struct scatterlist *cur_sg; |
| 259 | 255 | int tot_residue; |
| @@ -363,19 +359,6 @@ struct esp_driver_ops { · 103 unmodified lines | ||
| 363 | 359 | void (*esp_write8)(struct esp *esp, u8 val, unsigned long reg); |
| 364 | 360 | u8 (*esp_read8)(struct esp *esp, unsigned long reg); |
| 365 | 361 | |
| 366 | − /* Map and unmap DMA memory. Eventually the driver will be | |
| 367 | − * converted to the generic DMA API as soon as SBUS is able to | |
| 368 | − * cope with that. At such time we can remove this. | |
| 369 | − */ | |
| 370 | − dma_addr_t (*map_single)(struct esp *esp, void *buf, | |
| 371 | − size_t sz, int dir); | |
| 372 | − int (*map_sg)(struct esp *esp, struct scatterlist *sg, | |
| 373 | − int num_sg, int dir); | |
| 374 | − void (*unmap_single)(struct esp *esp, dma_addr_t addr, | |
| 375 | − size_t sz, int dir); | |
| 376 | − void (*unmap_sg)(struct esp *esp, struct scatterlist *sg, | |
| 377 | − int num_sg, int dir); | |
| 378 | − | |
| 379 | 362 | /* Return non-zero if there is an IRQ pending. Usually this |
| 380 | 363 | * status bit lives in the DMA controller sitting in front of |
| 381 | 364 | * the ESP. This has to be accurate or else the ESP interrupt |
| @@ -435,7 +418,7 @@ struct esp { · 53 unmodified lines | ||
| 435 | 418 | const struct esp_driver_ops *ops; |
| 436 | 419 | |
| 437 | 420 | struct Scsi_Host *host; |
| 438 | − void *dev; | |
| 421 | + struct device *dev; | |
| 439 | 422 | |
| 440 | 423 | struct esp_cmd_entry *active_cmd; |
| 441 | 424 | |
| @@ -490,11 +473,11 @@ struct esp { · 48 unmodified lines | ||
| 490 | 473 | u32 flags; |
| 491 | 474 | #define ESP_FLAG_DIFFERENTIAL 0x00000001 |
| 492 | 475 | #define ESP_FLAG_RESETTING 0x00000002 |
| 493 | −#define ESP_FLAG_DOING_SLOWCMD 0x00000004 | |
| 494 | 476 | #define ESP_FLAG_WIDE_CAPABLE 0x00000008 |
| 495 | 477 | #define ESP_FLAG_QUICKIRQ_CHECK 0x00000010 |
| 496 | 478 | #define ESP_FLAG_DISABLE_SYNC 0x00000020 |
| 497 | 479 | #define ESP_FLAG_USE_FIFO 0x00000040 |
| 480 | +#define ESP_FLAG_NO_DMA_MAP 0x00000080 | |
| 498 | 481 | |
| 499 | 482 | u8 select_state; |
| 500 | 483 | #define ESP_SELECT_NONE 0x00 /* Not selecting */ |
| @@ -532,7 +515,7 @@ struct esp { · 31 unmodified lines | ||
| 532 | 515 | u32 min_period; |
| 533 | 516 | u32 radelay; |
| 534 | 517 | |
| 535 | − /* Slow command state. */ | |
| 518 | + /* ESP_CMD_SELAS command state */ | |
| 536 | 519 | u8 *cmd_bytes_ptr; |
| 537 | 520 | int cmd_bytes_left; |
| 538 | 521 | |
| @@ -540,6 +523,11 @@ struct esp { · 1 unmodified line | ||
| 540 | 523 | |
| 541 | 524 | void *dma; |
| 542 | 525 | int dmarev; |
| 526 | + | |
| 527 | + /* These are used by esp_send_pio_cmd() */ | |
| 528 | + u8 __iomem *fifo_reg; | |
| 529 | + int send_cmd_error; | |
| 530 | + u32 send_cmd_residual; | |
| 543 | 531 | }; |
| 544 | 532 | |
| 545 | 533 | /* A front-end driver for the ESP chip should do the following in |
| @@ -568,16 +556,18 @@ struct esp { · 22 unmodified lines | ||
| 568 | 556 | * example, the DMA engine has to be reset before ESP can |
| 569 | 557 | * be programmed. |
| 570 | 558 | * 11) If necessary, call dev_set_drvdata() as needed. |
| 571 | − * 12) Call scsi_esp_register() with prepared 'esp' structure | |
| 572 | − * and a device pointer if possible. | |
| 559 | + * 12) Call scsi_esp_register() with prepared 'esp' structure. | |
| 573 | 560 | * 13) Check scsi_esp_register() return value, release all resources |
| 574 | 561 | * if an error was returned. |
| 575 | 562 | */ |
| 576 | 563 | extern struct scsi_host_template scsi_esp_template; |
| 577 | −extern int scsi_esp_register(struct esp *, struct device *); | |
| 564 | +extern int scsi_esp_register(struct esp *); | |
| 578 | 565 | |
| 579 | 566 | extern void scsi_esp_unregister(struct esp *); |
| 580 | 567 | extern irqreturn_t scsi_esp_intr(int, void *); |
| 581 | 568 | extern void scsi_esp_cmd(struct esp *, u8); |
| 582 | 569 | |
| 570 | +extern void esp_send_pio_cmd(struct esp *esp, u32 dma_addr, u32 esp_count, | |
| 571 | + u32 dma_count, int write, u8 cmd); | |
| 572 | + | |
| 583 | 573 | #endif /* !(_ESP_SCSI_H) */ |
| @@ -836,8 +836,8 @@ static void fnic_rq_cmpl_frame_recv(struct vnic_rq *rq, struct cq_desc · 835 unmodified lines | ||
| 836 | 836 | u32 fcp_bytes_written = 0; |
| 837 | 837 | unsigned long flags; |
| 838 | 838 | |
| 839 | − pci_unmap_single(fnic->pdev, buf->dma_addr, buf->len, | |
| 840 | − PCI_DMA_FROMDEVICE); | |
| 839 | + dma_unmap_single(&fnic->pdev->dev, buf->dma_addr, buf->len, | |
| 840 | + DMA_FROM_DEVICE); | |
| 841 | 841 | skb = buf->os_buf; |
| 842 | 842 | fp = (struct fc_frame *)skb; |
| 843 | 843 | buf->os_buf = NULL; |
| @@ -977,9 +977,8 @@ int fnic_alloc_rq_frame(struct vnic_rq *rq) · 133 unmodified lines | ||
| 977 | 977 | skb_reset_transport_header(skb); |
| 978 | 978 | skb_reset_network_header(skb); |
| 979 | 979 | skb_put(skb, len); |
| 980 | − pa = pci_map_single(fnic->pdev, skb->data, len, PCI_DMA_FROMDEVICE); | |
| 981 | − | |
| 982 | − if (pci_dma_mapping_error(fnic->pdev, pa)) { | |
| 980 | + pa = dma_map_single(&fnic->pdev->dev, skb->data, len, DMA_FROM_DEVICE); | |
| 981 | + if (dma_mapping_error(&fnic->pdev->dev, pa)) { | |
| 983 | 982 | r = -ENOMEM; |
| 984 | 983 | printk(KERN_ERR "PCI mapping failed with error %d\n", r); |
| 985 | 984 | goto free_skb; |
| @@ -998,8 +997,8 @@ void fnic_free_rq_buf(struct vnic_rq *rq, struct vnic_rq_buf *buf) · 12 unmodified lines | ||
| 998 | 997 | struct fc_frame *fp = buf->os_buf; |
| 999 | 998 | struct fnic *fnic = vnic_dev_priv(rq->vdev); |
| 1000 | 999 | |
| 1001 | − pci_unmap_single(fnic->pdev, buf->dma_addr, buf->len, | |
| 1002 | − PCI_DMA_FROMDEVICE); | |
| 1000 | + dma_unmap_single(&fnic->pdev->dev, buf->dma_addr, buf->len, | |
| 1001 | + DMA_FROM_DEVICE); | |
| 1003 | 1002 | |
| 1004 | 1003 | dev_kfree_skb(fp_skb(fp)); |
| 1005 | 1004 | buf->os_buf = NULL; |
| @@ -1018,7 +1017,6 @@ void fnic_eth_send(struct fcoe_ctlr *fip, struct sk_buff *skb) · 12 unmodified lines | ||
| 1018 | 1017 | struct ethhdr *eth_hdr; |
| 1019 | 1018 | struct vlan_ethhdr *vlan_hdr; |
| 1020 | 1019 | unsigned long flags; |
| 1021 | − int r; | |
| 1022 | 1020 | |
| 1023 | 1021 | if (!fnic->vlan_hw_insert) { |
| 1024 | 1022 | eth_hdr = (struct ethhdr *)skb_mac_header(skb); |
| @@ -1038,11 +1036,10 @@ void fnic_eth_send(struct fcoe_ctlr *fip, struct sk_buff *skb) · 13 unmodified lines | ||
| 1038 | 1036 | } |
| 1039 | 1037 | } |
| 1040 | 1038 | |
| 1041 | − pa = pci_map_single(fnic->pdev, skb->data, skb->len, PCI_DMA_TODEVICE); | |
| 1042 | − | |
| 1043 | − r = pci_dma_mapping_error(fnic->pdev, pa); | |
| 1044 | − if (r) { | |
| 1045 | − printk(KERN_ERR "PCI mapping failed with error %d\n", r); | |
| 1039 | + pa = dma_map_single(&fnic->pdev->dev, skb->data, skb->len, | |
| 1040 | + DMA_TO_DEVICE); | |
| 1041 | + if (dma_mapping_error(&fnic->pdev->dev, pa)) { | |
| 1042 | + printk(KERN_ERR "DMA mapping failed\n"); | |
| 1046 | 1043 | goto free_skb; |
| 1047 | 1044 | } |
| 1048 | 1045 | |
| @@ -1058,7 +1055,7 @@ void fnic_eth_send(struct fcoe_ctlr *fip, struct sk_buff *skb) · 9 unmodified lines | ||
| 1058 | 1055 | |
| 1059 | 1056 | irq_restore: |
| 1060 | 1057 | spin_unlock_irqrestore(&fnic->wq_lock[0], flags); |
| 1061 | − pci_unmap_single(fnic->pdev, pa, skb->len, PCI_DMA_TODEVICE); | |
| 1058 | + dma_unmap_single(&fnic->pdev->dev, pa, skb->len, DMA_TO_DEVICE); | |
| 1062 | 1059 | free_skb: |
| 1063 | 1060 | kfree_skb(skb); |
| 1064 | 1061 | } |
| @@ -1115,9 +1112,8 @@ static int fnic_send_frame(struct fnic *fnic, struct fc_frame *fp) · 50 unmodified lines | ||
| 1115 | 1112 | if (FC_FCOE_VER) |
| 1116 | 1113 | FC_FCOE_ENCAPS_VER(fcoe_hdr, FC_FCOE_VER); |
| 1117 | 1114 | |
| 1118 | − pa = pci_map_single(fnic->pdev, eth_hdr, tot_len, PCI_DMA_TODEVICE); | |
| 1119 | − | |
| 1120 | − if (pci_dma_mapping_error(fnic->pdev, pa)) { | |
| 1115 | + pa = dma_map_single(&fnic->pdev->dev, eth_hdr, tot_len, DMA_TO_DEVICE); | |
| 1116 | + if (dma_mapping_error(&fnic->pdev->dev, pa)) { | |
| 1121 | 1117 | ret = -ENOMEM; |
| 1122 | 1118 | printk(KERN_ERR "DMA map failed with error %d\n", ret); |
| 1123 | 1119 | goto free_skb_on_err; |
| @@ -1131,8 +1127,7 @@ static int fnic_send_frame(struct fnic *fnic, struct fc_frame *fp) · 7 unmodified lines | ||
| 1131 | 1127 | spin_lock_irqsave(&fnic->wq_lock[0], flags); |
| 1132 | 1128 | |
| 1133 | 1129 | if (!vnic_wq_desc_avail(wq)) { |
| 1134 | − pci_unmap_single(fnic->pdev, pa, | |
| 1135 | − tot_len, PCI_DMA_TODEVICE); | |
| 1130 | + dma_unmap_single(&fnic->pdev->dev, pa, tot_len, DMA_TO_DEVICE); | |
| 1136 | 1131 | ret = -1; |
| 1137 | 1132 | goto irq_restore; |
| 1138 | 1133 | } |
| @@ -1247,8 +1242,8 @@ static void fnic_wq_complete_frame_send(struct vnic_wq *wq, · 108 unmodified lines | ||
| 1247 | 1242 | struct fc_frame *fp = (struct fc_frame *)skb; |
| 1248 | 1243 | struct fnic *fnic = vnic_dev_priv(wq->vdev); |
| 1249 | 1244 | |
| 1250 | − pci_unmap_single(fnic->pdev, buf->dma_addr, | |
| 1251 | − buf->len, PCI_DMA_TODEVICE); | |
| 1245 | + dma_unmap_single(&fnic->pdev->dev, buf->dma_addr, buf->len, | |
| 1246 | + DMA_TO_DEVICE); | |
| 1252 | 1247 | dev_kfree_skb_irq(fp_skb(fp)); |
| 1253 | 1248 | buf->os_buf = NULL; |
| 1254 | 1249 | } |
| @@ -1290,8 +1285,8 @@ void fnic_free_wq_buf(struct vnic_wq *wq, struct vnic_wq_buf *buf) · 35 unmodified lines | ||
| 1290 | 1285 | struct fc_frame *fp = buf->os_buf; |
| 1291 | 1286 | struct fnic *fnic = vnic_dev_priv(wq->vdev); |
| 1292 | 1287 | |
| 1293 | − pci_unmap_single(fnic->pdev, buf->dma_addr, | |
| 1294 | − buf->len, PCI_DMA_TODEVICE); | |
| 1288 | + dma_unmap_single(&fnic->pdev->dev, buf->dma_addr, buf->len, | |
| 1289 | + DMA_TO_DEVICE); | |
| 1295 | 1290 | |
| 1296 | 1291 | dev_kfree_skb(fp_skb(fp)); |
| 1297 | 1292 | buf->os_buf = NULL; |
| @@ -611,30 +611,15 @@ static int fnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · 610 unmodified lines | ||
| 611 | 611 | * limitation for the device. Try 64-bit first, and |
| 612 | 612 | * fail to 32-bit. |
| 613 | 613 | */ |
| 614 | − err = pci_set_dma_mask(pdev, DMA_BIT_MASK(64)); | |
| 614 | + err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)); | |
| 615 | 615 | if (err) { |
| 616 | − err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); | |
| 616 | + err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); | |
| 617 | 617 | if (err) { |
| 618 | 618 | shost_printk(KERN_ERR, fnic->lport->host, |
| 619 | 619 | "No usable DMA configuration " |
| 620 | 620 | "aborting\n"); |
| 621 | 621 | goto err_out_release_regions; |
| 622 | 622 | } |
| 623 | − err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); | |
| 624 | − if (err) { | |
| 625 | − shost_printk(KERN_ERR, fnic->lport->host, | |
| 626 | − "Unable to obtain 32-bit DMA " | |
| 627 | − "for consistent allocations, aborting.\n"); | |
| 628 | − goto err_out_release_regions; | |
| 629 | − } | |
| 630 | − } else { | |
| 631 | − err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64)); | |
| 632 | − if (err) { | |
| 633 | − shost_printk(KERN_ERR, fnic->lport->host, | |
| 634 | − "Unable to obtain 64-bit DMA " | |
| 635 | − "for consistent allocations, aborting.\n"); | |
| 636 | − goto err_out_release_regions; | |
| 637 | − } | |
| 638 | 623 | } |
| 639 | 624 | |
| 640 | 625 | /* Map vNIC resources from BAR0 */ |
| @@ -126,17 +126,17 @@ static void fnic_release_ioreq_buf(struct fnic *fnic, · 125 unmodified lines | ||
| 126 | 126 | struct scsi_cmnd *sc) |
| 127 | 127 | { |
| 128 | 128 | if (io_req->sgl_list_pa) |
| 129 | − pci_unmap_single(fnic->pdev, io_req->sgl_list_pa, | |
| 129 | + dma_unmap_single(&fnic->pdev->dev, io_req->sgl_list_pa, | |
| 130 | 130 | sizeof(io_req->sgl_list[0]) * io_req->sgl_cnt, |
| 131 | − PCI_DMA_TODEVICE); | |
| 131 | + DMA_TO_DEVICE); | |
| 132 | 132 | scsi_dma_unmap(sc); |
| 133 | 133 | |
| 134 | 134 | if (io_req->sgl_cnt) |
| 135 | 135 | mempool_free(io_req->sgl_list_alloc, |
| 136 | 136 | fnic->io_sgl_pool[io_req->sgl_type]); |
| 137 | 137 | if (io_req->sense_buf_pa) |
| 138 | − pci_unmap_single(fnic->pdev, io_req->sense_buf_pa, | |
| 139 | − SCSI_SENSE_BUFFERSIZE, PCI_DMA_FROMDEVICE); | |
| 138 | + dma_unmap_single(&fnic->pdev->dev, io_req->sense_buf_pa, | |
| 139 | + SCSI_SENSE_BUFFERSIZE, DMA_FROM_DEVICE); | |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | /* Free up Copy Wq descriptors. Called with copy_wq lock held */ |
| @@ -330,7 +330,6 @@ static inline int fnic_queue_wq_copy_desc(struct fnic *fnic, · 187 unmodified lines | ||
| 330 | 330 | int flags; |
| 331 | 331 | u8 exch_flags; |
| 332 | 332 | struct scsi_lun fc_lun; |
| 333 | − int r; | |
| 334 | 333 | |
| 335 | 334 | if (sg_count) { |
| 336 | 335 | /* For each SGE, create a device desc entry */ |
| @@ -342,30 +341,25 @@ static inline int fnic_queue_wq_copy_desc(struct fnic *fnic, · 5 unmodified lines | ||
| 342 | 341 | desc++; |
| 343 | 342 | } |
| 344 | 343 | |
| 345 | − io_req->sgl_list_pa = pci_map_single | |
| 346 | − (fnic->pdev, | |
| 347 | − io_req->sgl_list, | |
| 348 | − sizeof(io_req->sgl_list[0]) * sg_count, | |
| 349 | − PCI_DMA_TODEVICE); | |
| 350 | − | |
| 351 | − r = pci_dma_mapping_error(fnic->pdev, io_req->sgl_list_pa); | |
| 352 | − if (r) { | |
| 353 | − printk(KERN_ERR "PCI mapping failed with error %d\n", r); | |
| 344 | + io_req->sgl_list_pa = dma_map_single(&fnic->pdev->dev, | |
| 345 | + io_req->sgl_list, | |
| 346 | + sizeof(io_req->sgl_list[0]) * sg_count, | |
| 347 | + DMA_TO_DEVICE); | |
| 348 | + if (dma_mapping_error(&fnic->pdev->dev, io_req->sgl_list_pa)) { | |
| 349 | + printk(KERN_ERR "DMA mapping failed\n"); | |
| 354 | 350 | return SCSI_MLQUEUE_HOST_BUSY; |
| 355 | 351 | } |
| 356 | 352 | } |
| 357 | 353 | |
| 358 | − io_req->sense_buf_pa = pci_map_single(fnic->pdev, | |
| 354 | + io_req->sense_buf_pa = dma_map_single(&fnic->pdev->dev, | |
| 359 | 355 | sc->sense_buffer, |
| 360 | 356 | SCSI_SENSE_BUFFERSIZE, |
| 361 | − PCI_DMA_FROMDEVICE); | |
| 362 | − | |
| 363 | − r = pci_dma_mapping_error(fnic->pdev, io_req->sense_buf_pa); | |
| 364 | − if (r) { | |
| 365 | − pci_unmap_single(fnic->pdev, io_req->sgl_list_pa, | |
| 357 | + DMA_FROM_DEVICE); | |
| 358 | + if (dma_mapping_error(&fnic->pdev->dev, io_req->sense_buf_pa)) { | |
| 359 | + dma_unmap_single(&fnic->pdev->dev, io_req->sgl_list_pa, | |
| 366 | 360 | sizeof(io_req->sgl_list[0]) * sg_count, |
| 367 | − PCI_DMA_TODEVICE); | |
| 368 | − printk(KERN_ERR "PCI mapping failed with error %d\n", r); | |
| 361 | + DMA_TO_DEVICE); | |
| 362 | + printk(KERN_ERR "DMA mapping failed\n"); | |
| 369 | 363 | return SCSI_MLQUEUE_HOST_BUSY; |
| 370 | 364 | } |
| 371 | 365 | |
| @@ -2272,33 +2266,17 @@ clean_pending_aborts_end: · 1900 unmodified lines | ||
| 2272 | 2266 | static inline int |
| 2273 | 2267 | fnic_scsi_host_start_tag(struct fnic *fnic, struct scsi_cmnd *sc) |
| 2274 | 2268 | { |
| 2275 | − struct blk_queue_tag *bqt = fnic->lport->host->bqt; | |
| 2276 | − int tag, ret = SCSI_NO_TAG; | |
| 2277 | − | |
| 2278 | − BUG_ON(!bqt); | |
| 2279 | − if (!bqt) { | |
| 2280 | − pr_err("Tags are not supported\n"); | |
| 2281 | − goto end; | |
| 2282 | − } | |
| 2283 | − | |
| 2284 | − do { | |
| 2285 | − tag = find_next_zero_bit(bqt->tag_map, bqt->max_depth, 1); | |
| 2286 | − if (tag >= bqt->max_depth) { | |
| 2287 | − pr_err("Tag allocation failure\n"); | |
| 2288 | − goto end; | |
| 2289 | − } | |
| 2290 | − } while (test_and_set_bit(tag, bqt->tag_map)); | |
| 2269 | + struct request_queue *q = sc->request->q; | |
| 2270 | + struct request *dummy; | |
| 2291 | 2271 | |
| 2292 | − bqt->tag_index[tag] = sc->request; | |
| 2293 | − sc->request->tag = tag; | |
| 2294 | − sc->tag = tag; | |
| 2295 | − if (!sc->request->special) | |
| 2296 | − sc->request->special = sc; | |
| 2272 | + dummy = blk_mq_alloc_request(q, REQ_OP_WRITE, BLK_MQ_REQ_NOWAIT); | |
| 2273 | + if (IS_ERR(dummy)) | |
| 2274 | + return SCSI_NO_TAG; | |
| 2297 | 2275 | |
| 2298 | − ret = tag; | |
| 2276 | + sc->tag = sc->request->tag = dummy->tag; | |
| 2277 | + sc->request->special = sc; | |
| 2299 | 2278 | |
| 2300 | −end: | |
| 2301 | − return ret; | |
| 2279 | + return dummy->tag; | |
| 2302 | 2280 | } |
| 2303 | 2281 | |
| 2304 | 2282 | /** |
| @@ -2308,20 +2286,9 @@ end: · 3 unmodified lines | ||
| 2308 | 2286 | static inline void |
| 2309 | 2287 | fnic_scsi_host_end_tag(struct fnic *fnic, struct scsi_cmnd *sc) |
| 2310 | 2288 | { |
| 2311 | − struct blk_queue_tag *bqt = fnic->lport->host->bqt; | |
| 2312 | − int tag = sc->request->tag; | |
| 2289 | + struct request *dummy = sc->request->special; | |
| 2313 | 2290 | |
| 2314 | − if (tag == SCSI_NO_TAG) | |
| 2315 | − return; | |
| 2316 | − | |
| 2317 | − BUG_ON(!bqt || !bqt->tag_index[tag]); | |
| 2318 | − if (!bqt) | |
| 2319 | − return; | |
| 2320 | − | |
| 2321 | − bqt->tag_index[tag] = NULL; | |
| 2322 | − clear_bit(tag, bqt->tag_map); | |
| 2323 | − | |
| 2324 | − return; | |
| 2291 | + blk_mq_free_request(dummy); | |
| 2325 | 2292 | } |
| 2326 | 2293 | |
| 2327 | 2294 | /* |
| @@ -2380,19 +2347,9 @@ int fnic_device_reset(struct scsi_cmnd *sc) · 52 unmodified lines | ||
| 2380 | 2347 | tag = sc->request->tag; |
| 2381 | 2348 | if (unlikely(tag < 0)) { |
| 2382 | 2349 | /* |
| 2383 | − * XXX(hch): current the midlayer fakes up a struct | |
| 2384 | − * request for the explicit reset ioctls, and those | |
| 2385 | − * don't have a tag allocated to them. The below | |
| 2386 | − * code pokes into midlayer structures to paper over | |
| 2387 | − * this design issue, but that won't work for blk-mq. | |
| 2388 | − * | |
| 2389 | − * Either someone who can actually test the hardware | |
| 2390 | − * will have to come up with a similar hack for the | |
| 2391 | − * blk-mq case, or we'll have to bite the bullet and | |
| 2392 | − * fix the way the EH ioctls work for real, but until | |
| 2393 | − * that happens we fail these explicit requests here. | |
| 2350 | + * Really should fix the midlayer to pass in a proper | |
| 2351 | + * request for ioctls... | |
| 2394 | 2352 | */ |
| 2395 | − | |
| 2396 | 2353 | tag = fnic_scsi_host_start_tag(fnic, sc); |
| 2397 | 2354 | if (unlikely(tag == SCSI_NO_TAG)) |
| 2398 | 2355 | goto fnic_device_reset_end; |
| @@ -195,9 +195,9 @@ int vnic_dev_alloc_desc_ring(struct vnic_dev *vdev, struct vnic_dev_ring *ring, · 194 unmodified lines | ||
| 195 | 195 | { |
| 196 | 196 | vnic_dev_desc_ring_size(ring, desc_count, desc_size); |
| 197 | 197 | |
| 198 | − ring->descs_unaligned = pci_alloc_consistent(vdev->pdev, | |
| 198 | + ring->descs_unaligned = dma_alloc_coherent(&vdev->pdev->dev, | |
| 199 | 199 | ring->size_unaligned, |
| 200 | − &ring->base_addr_unaligned); | |
| 200 | + &ring->base_addr_unaligned, GFP_KERNEL); | |
| 201 | 201 | |
| 202 | 202 | if (!ring->descs_unaligned) { |
| 203 | 203 | printk(KERN_ERR |
| @@ -221,7 +221,7 @@ int vnic_dev_alloc_desc_ring(struct vnic_dev *vdev, struct vnic_dev_ring *ring, · 17 unmodified lines | ||
| 221 | 221 | void vnic_dev_free_desc_ring(struct vnic_dev *vdev, struct vnic_dev_ring *ring) |
| 222 | 222 | { |
| 223 | 223 | if (ring->descs) { |
| 224 | − pci_free_consistent(vdev->pdev, | |
| 224 | + dma_free_coherent(&vdev->pdev->dev, | |
| 225 | 225 | ring->size_unaligned, |
| 226 | 226 | ring->descs_unaligned, |
| 227 | 227 | ring->base_addr_unaligned); |
| @@ -298,9 +298,9 @@ int vnic_dev_fw_info(struct vnic_dev *vdev, · 70 unmodified lines | ||
| 298 | 298 | int err = 0; |
| 299 | 299 | |
| 300 | 300 | if (!vdev->fw_info) { |
| 301 | − vdev->fw_info = pci_alloc_consistent(vdev->pdev, | |
| 301 | + vdev->fw_info = dma_alloc_coherent(&vdev->pdev->dev, | |
| 302 | 302 | sizeof(struct vnic_devcmd_fw_info), |
| 303 | − &vdev->fw_info_pa); | |
| 303 | + &vdev->fw_info_pa, GFP_KERNEL); | |
| 304 | 304 | if (!vdev->fw_info) |
| 305 | 305 | return -ENOMEM; |
| 306 | 306 | |
| @@ -361,8 +361,8 @@ int vnic_dev_stats_dump(struct vnic_dev *vdev, struct vnic_stats **stats) · 54 unmodified lines | ||
| 361 | 361 | int wait = 1000; |
| 362 | 362 | |
| 363 | 363 | if (!vdev->stats) { |
| 364 | − vdev->stats = pci_alloc_consistent(vdev->pdev, | |
| 365 | − sizeof(struct vnic_stats), &vdev->stats_pa); | |
| 364 | + vdev->stats = dma_alloc_coherent(&vdev->pdev->dev, | |
| 365 | + sizeof(struct vnic_stats), &vdev->stats_pa, GFP_KERNEL); | |
| 366 | 366 | if (!vdev->stats) |
| 367 | 367 | return -ENOMEM; |
| 368 | 368 | } |
| @@ -523,9 +523,9 @@ int vnic_dev_notify_set(struct vnic_dev *vdev, u16 intr) · 154 unmodified lines | ||
| 523 | 523 | int wait = 1000; |
| 524 | 524 | |
| 525 | 525 | if (!vdev->notify) { |
| 526 | − vdev->notify = pci_alloc_consistent(vdev->pdev, | |
| 526 | + vdev->notify = dma_alloc_coherent(&vdev->pdev->dev, | |
| 527 | 527 | sizeof(struct vnic_devcmd_notify), |
| 528 | − &vdev->notify_pa); | |
| 528 | + &vdev->notify_pa, GFP_KERNEL); | |
| 529 | 529 | if (!vdev->notify) |
| 530 | 530 | return -ENOMEM; |
| 531 | 531 | } |
| @@ -647,21 +647,21 @@ void vnic_dev_unregister(struct vnic_dev *vdev) · 115 unmodified lines | ||
| 647 | 647 | { |
| 648 | 648 | if (vdev) { |
| 649 | 649 | if (vdev->notify) |
| 650 | − pci_free_consistent(vdev->pdev, | |
| 650 | + dma_free_coherent(&vdev->pdev->dev, | |
| 651 | 651 | sizeof(struct vnic_devcmd_notify), |
| 652 | 652 | vdev->notify, |
| 653 | 653 | vdev->notify_pa); |
| 654 | 654 | if (vdev->linkstatus) |
| 655 | − pci_free_consistent(vdev->pdev, | |
| 655 | + dma_free_coherent(&vdev->pdev->dev, | |
| 656 | 656 | sizeof(u32), |
| 657 | 657 | vdev->linkstatus, |
| 658 | 658 | vdev->linkstatus_pa); |
| 659 | 659 | if (vdev->stats) |
| 660 | − pci_free_consistent(vdev->pdev, | |
| 660 | + dma_free_coherent(&vdev->pdev->dev, | |
| 661 | 661 | sizeof(struct vnic_stats), |
| 662 | 662 | vdev->stats, vdev->stats_pa); |
| 663 | 663 | if (vdev->fw_info) |
| 664 | − pci_free_consistent(vdev->pdev, | |
| 664 | + dma_free_coherent(&vdev->pdev->dev, | |
| 665 | 665 | sizeof(struct vnic_devcmd_fw_info), |
| 666 | 666 | vdev->fw_info, vdev->fw_info_pa); |
| 667 | 667 | kfree(vdev); |
| @@ -34,6 +34,7 @@ · 33 unmodified lines | ||
| 34 | 34 | #define HISI_SAS_MAX_DEVICES HISI_SAS_MAX_ITCT_ENTRIES |
| 35 | 35 | #define HISI_SAS_RESET_BIT 0 |
| 36 | 36 | #define HISI_SAS_REJECT_CMD_BIT 1 |
| 37 | +#define HISI_SAS_RESERVED_IPTT_CNT 96 | |
| 37 | 38 | |
| 38 | 39 | #define HISI_SAS_STATUS_BUF_SZ (sizeof(struct hisi_sas_status_buffer)) |
| 39 | 40 | #define HISI_SAS_COMMAND_TABLE_SZ (sizeof(union hisi_sas_command_table)) |
| @@ -217,7 +218,7 @@ struct hisi_sas_hw { · 177 unmodified lines | ||
| 217 | 218 | int (*hw_init)(struct hisi_hba *hisi_hba); |
| 218 | 219 | void (*setup_itct)(struct hisi_hba *hisi_hba, |
| 219 | 220 | struct hisi_sas_device *device); |
| 220 | − int (*slot_index_alloc)(struct hisi_hba *hisi_hba, int *slot_idx, | |
| 221 | + int (*slot_index_alloc)(struct hisi_hba *hisi_hba, | |
| 221 | 222 | struct domain_device *device); |
| 222 | 223 | struct hisi_sas_device *(*alloc_dev)(struct domain_device *device); |
| 223 | 224 | void (*sl_notify)(struct hisi_hba *hisi_hba, int phy_no); |
| @@ -183,7 +183,14 @@ static void hisi_sas_slot_index_clear(struct hisi_hba *hisi_hba, int slot_idx) · 182 unmodified lines | ||
| 183 | 183 | |
| 184 | 184 | static void hisi_sas_slot_index_free(struct hisi_hba *hisi_hba, int slot_idx) |
| 185 | 185 | { |
| 186 | − hisi_sas_slot_index_clear(hisi_hba, slot_idx); | |
| 186 | + unsigned long flags; | |
| 187 | + | |
| 188 | + if (hisi_hba->hw->slot_index_alloc || (slot_idx >= | |
| 189 | + hisi_hba->hw->max_command_entries - HISI_SAS_RESERVED_IPTT_CNT)) { | |
| 190 | + spin_lock_irqsave(&hisi_hba->lock, flags); | |
| 191 | + hisi_sas_slot_index_clear(hisi_hba, slot_idx); | |
| 192 | + spin_unlock_irqrestore(&hisi_hba->lock, flags); | |
| 193 | + } | |
| 187 | 194 | } |
| 188 | 195 | |
| 189 | 196 | static void hisi_sas_slot_index_set(struct hisi_hba *hisi_hba, int slot_idx) |
| @@ -193,24 +200,34 @@ static void hisi_sas_slot_index_set(struct hisi_hba *hisi_hba, int slot_idx) · 3 unmodified lines | ||
| 193 | 200 | set_bit(slot_idx, bitmap); |
| 194 | 201 | } |
| 195 | 202 | |
| 196 | −static int hisi_sas_slot_index_alloc(struct hisi_hba *hisi_hba, int *slot_idx) | |
| 203 | +static int hisi_sas_slot_index_alloc(struct hisi_hba *hisi_hba, | |
| 204 | + struct scsi_cmnd *scsi_cmnd) | |
| 197 | 205 | { |
| 198 | − unsigned int index; | |
| 206 | + int index; | |
| 199 | 207 | void *bitmap = hisi_hba->slot_index_tags; |
| 208 | + unsigned long flags; | |
| 209 | + | |
| 210 | + if (scsi_cmnd) | |
| 211 | + return scsi_cmnd->request->tag; | |
| 200 | 212 | |
| 213 | + spin_lock_irqsave(&hisi_hba->lock, flags); | |
| 201 | 214 | index = find_next_zero_bit(bitmap, hisi_hba->slot_index_count, |
| 202 | − hisi_hba->last_slot_index + 1); | |
| 215 | + hisi_hba->last_slot_index + 1); | |
| 203 | 216 | if (index >= hisi_hba->slot_index_count) { |
| 204 | − index = find_next_zero_bit(bitmap, hisi_hba->slot_index_count, | |
| 205 | − 0); | |
| 206 | − if (index >= hisi_hba->slot_index_count) | |
| 217 | + index = find_next_zero_bit(bitmap, | |
| 218 | + hisi_hba->slot_index_count, | |
| 219 | + hisi_hba->hw->max_command_entries - | |
| 220 | + HISI_SAS_RESERVED_IPTT_CNT); | |
| 221 | + if (index >= hisi_hba->slot_index_count) { | |
| 222 | + spin_unlock_irqrestore(&hisi_hba->lock, flags); | |
| 207 | 223 | return -SAS_QUEUE_FULL; |
| 224 | + } | |
| 208 | 225 | } |
| 209 | 226 | hisi_sas_slot_index_set(hisi_hba, index); |
| 210 | − *slot_idx = index; | |
| 211 | 227 | hisi_hba->last_slot_index = index; |
| 228 | + spin_unlock_irqrestore(&hisi_hba->lock, flags); | |
| 212 | 229 | |
| 213 | − return 0; | |
| 230 | + return index; | |
| 214 | 231 | } |
| 215 | 232 | |
| 216 | 233 | static void hisi_sas_slot_index_init(struct hisi_hba *hisi_hba) |
| @@ -249,9 +266,7 @@ void hisi_sas_slot_task_free(struct hisi_hba *hisi_hba, struct sas_task *task, · 32 unmodified lines | ||
| 249 | 266 | |
| 250 | 267 | memset(slot, 0, offsetof(struct hisi_sas_slot, buf)); |
| 251 | 268 | |
| 252 | − spin_lock_irqsave(&hisi_hba->lock, flags); | |
| 253 | 269 | hisi_sas_slot_index_free(hisi_hba, slot->idx); |
| 254 | − spin_unlock_irqrestore(&hisi_hba->lock, flags); | |
| 255 | 270 | } |
| 256 | 271 | EXPORT_SYMBOL_GPL(hisi_sas_slot_task_free); |
| 257 | 272 | |
| @@ -287,13 +302,13 @@ static int hisi_sas_task_prep(struct sas_task *task, · 29 unmodified lines | ||
| 287 | 302 | int *pass) |
| 288 | 303 | { |
| 289 | 304 | struct domain_device *device = task->dev; |
| 290 | − struct hisi_hba *hisi_hba = dev_to_hisi_hba(device); | |
| 305 | + struct hisi_hba *hisi_hba; | |
| 291 | 306 | struct hisi_sas_device *sas_dev = device->lldd_dev; |
| 292 | 307 | struct hisi_sas_port *port; |
| 293 | 308 | struct hisi_sas_slot *slot; |
| 294 | 309 | struct hisi_sas_cmd_hdr *cmd_hdr_base; |
| 295 | 310 | struct asd_sas_port *sas_port = device->port; |
| 296 | − struct device *dev = hisi_hba->dev; | |
| 311 | + struct device *dev; | |
| 297 | 312 | int dlvry_queue_slot, dlvry_queue, rc, slot_idx; |
| 298 | 313 | int n_elem = 0, n_elem_req = 0, n_elem_resp = 0; |
| 299 | 314 | struct hisi_sas_dq *dq; |
| @@ -314,6 +329,9 @@ static int hisi_sas_task_prep(struct sas_task *task, · 14 unmodified lines | ||
| 314 | 329 | return -ECOMM; |
| 315 | 330 | } |
| 316 | 331 | |
| 332 | + hisi_hba = dev_to_hisi_hba(device); | |
| 333 | + dev = hisi_hba->dev; | |
| 334 | + | |
| 317 | 335 | if (DEV_IS_GONE(sas_dev)) { |
| 318 | 336 | if (sas_dev) |
| 319 | 337 | dev_info(dev, "task prep: device %d not ready\n", |
| @@ -381,16 +399,27 @@ static int hisi_sas_task_prep(struct sas_task *task, · 61 unmodified lines | ||
| 381 | 399 | goto err_out_dma_unmap; |
| 382 | 400 | } |
| 383 | 401 | |
| 384 | − spin_lock_irqsave(&hisi_hba->lock, flags); | |
| 385 | 402 | if (hisi_hba->hw->slot_index_alloc) |
| 386 | − rc = hisi_hba->hw->slot_index_alloc(hisi_hba, &slot_idx, | |
| 387 | − device); | |
| 388 | − else | |
| 389 | − rc = hisi_sas_slot_index_alloc(hisi_hba, &slot_idx); | |
| 390 | − spin_unlock_irqrestore(&hisi_hba->lock, flags); | |
| 391 | − if (rc) | |
| 403 | + rc = hisi_hba->hw->slot_index_alloc(hisi_hba, device); | |
| 404 | + else { | |
| 405 | + struct scsi_cmnd *scsi_cmnd = NULL; | |
| 406 | + | |
| 407 | + if (task->uldd_task) { | |
| 408 | + struct ata_queued_cmd *qc; | |
| 409 | + | |
| 410 | + if (dev_is_sata(device)) { | |
| 411 | + qc = task->uldd_task; | |
| 412 | + scsi_cmnd = qc->scsicmd; | |
| 413 | + } else { | |
| 414 | + scsi_cmnd = task->uldd_task; | |
| 415 | + } | |
| 416 | + } | |
| 417 | + rc = hisi_sas_slot_index_alloc(hisi_hba, scsi_cmnd); | |
| 418 | + } | |
| 419 | + if (rc < 0) | |
| 392 | 420 | goto err_out_dma_unmap; |
| 393 | 421 | |
| 422 | + slot_idx = rc; | |
| 394 | 423 | slot = &hisi_hba->slot_info[slot_idx]; |
| 395 | 424 | |
| 396 | 425 | spin_lock_irqsave(&dq->lock, flags); |
| @@ -451,9 +480,7 @@ static int hisi_sas_task_prep(struct sas_task *task, · 54 unmodified lines | ||
| 451 | 480 | return 0; |
| 452 | 481 | |
| 453 | 482 | err_out_tag: |
| 454 | − spin_lock_irqsave(&hisi_hba->lock, flags); | |
| 455 | 483 | hisi_sas_slot_index_free(hisi_hba, slot_idx); |
| 456 | − spin_unlock_irqrestore(&hisi_hba->lock, flags); | |
| 457 | 484 | err_out_dma_unmap: |
| 458 | 485 | if (!sas_protocol_ata(task->task_proto)) { |
| 459 | 486 | if (task->num_scatter) { |
| @@ -904,6 +931,9 @@ static void hisi_sas_phy_set_linkrate(struct hisi_hba *hisi_hba, int phy_no, · 444 unmodified lines | ||
| 904 | 931 | _r.maximum_linkrate = max; |
| 905 | 932 | _r.minimum_linkrate = min; |
| 906 | 933 | |
| 934 | + sas_phy->phy->maximum_linkrate = max; | |
| 935 | + sas_phy->phy->minimum_linkrate = min; | |
| 936 | + | |
| 907 | 937 | hisi_hba->hw->phy_disable(hisi_hba, phy_no); |
| 908 | 938 | msleep(100); |
| 909 | 939 | hisi_hba->hw->phy_set_linkrate(hisi_hba, phy_no, &_r); |
| @@ -950,8 +980,7 @@ static int hisi_sas_control_phy(struct asd_sas_phy *sas_phy, enum phy_func func, · 40 unmodified lines | ||
| 950 | 980 | |
| 951 | 981 | static void hisi_sas_task_done(struct sas_task *task) |
| 952 | 982 | { |
| 953 | − if (!del_timer(&task->slow_task->timer)) | |
| 954 | − return; | |
| 983 | + del_timer(&task->slow_task->timer); | |
| 955 | 984 | complete(&task->slow_task->completion); |
| 956 | 985 | } |
| 957 | 986 | |
| @@ -960,13 +989,17 @@ static void hisi_sas_tmf_timedout(struct timer_list *t) · 2 unmodified lines | ||
| 960 | 989 | struct sas_task_slow *slow = from_timer(slow, t, timer); |
| 961 | 990 | struct sas_task *task = slow->task; |
| 962 | 991 | unsigned long flags; |
| 992 | + bool is_completed = true; | |
| 963 | 993 | |
| 964 | 994 | spin_lock_irqsave(&task->task_state_lock, flags); |
| 965 | − if (!(task->task_state_flags & SAS_TASK_STATE_DONE)) | |
| 995 | + if (!(task->task_state_flags & SAS_TASK_STATE_DONE)) { | |
| 966 | 996 | task->task_state_flags |= SAS_TASK_STATE_ABORTED; |
| 997 | + is_completed = false; | |
| 998 | + } | |
| 967 | 999 | spin_unlock_irqrestore(&task->task_state_lock, flags); |
| 968 | 1000 | |
| 969 | − complete(&task->slow_task->completion); | |
| 1001 | + if (!is_completed) | |
| 1002 | + complete(&task->slow_task->completion); | |
| 970 | 1003 | } |
| 971 | 1004 | |
| 972 | 1005 | #define TASK_TIMEOUT 20 |
| @@ -1019,8 +1052,16 @@ static int hisi_sas_exec_internal_tmf_task(struct domain_device *device, · 46 unmodified lines | ||
| 1019 | 1052 | struct hisi_sas_slot *slot = task->lldd_task; |
| 1020 | 1053 | |
| 1021 | 1054 | dev_err(dev, "abort tmf: TMF task timeout and not done\n"); |
| 1022 | − if (slot) | |
| 1055 | + if (slot) { | |
| 1056 | + struct hisi_sas_cq *cq = | |
| 1057 | + &hisi_hba->cq[slot->dlvry_queue]; | |
| 1058 | + /* | |
| 1059 | + * flush tasklet to avoid free'ing task | |
| 1060 | + * before using task in IO completion | |
| 1061 | + */ | |
| 1062 | + tasklet_kill(&cq->tasklet); | |
| 1023 | 1063 | slot->task = NULL; |
| 1064 | + } | |
| 1024 | 1065 | |
| 1025 | 1066 | goto ex_err; |
| 1026 | 1067 | } else |
| @@ -1396,6 +1437,17 @@ static int hisi_sas_abort_task(struct sas_task *task) · 369 unmodified lines | ||
| 1396 | 1437 | |
| 1397 | 1438 | spin_lock_irqsave(&task->task_state_lock, flags); |
| 1398 | 1439 | if (task->task_state_flags & SAS_TASK_STATE_DONE) { |
| 1440 | + struct hisi_sas_slot *slot = task->lldd_task; | |
| 1441 | + struct hisi_sas_cq *cq; | |
| 1442 | + | |
| 1443 | + if (slot) { | |
| 1444 | + /* | |
| 1445 | + * flush tasklet to avoid free'ing task | |
| 1446 | + * before using task in IO completion | |
| 1447 | + */ | |
| 1448 | + cq = &hisi_hba->cq[slot->dlvry_queue]; | |
| 1449 | + tasklet_kill(&cq->tasklet); | |
| 1450 | + } | |
| 1399 | 1451 | spin_unlock_irqrestore(&task->task_state_lock, flags); |
| 1400 | 1452 | rc = TMF_RESP_FUNC_COMPLETE; |
| 1401 | 1453 | goto out; |
| @@ -1451,12 +1503,19 @@ static int hisi_sas_abort_task(struct sas_task *task) · 49 unmodified lines | ||
| 1451 | 1503 | /* SMP */ |
| 1452 | 1504 | struct hisi_sas_slot *slot = task->lldd_task; |
| 1453 | 1505 | u32 tag = slot->idx; |
| 1506 | + struct hisi_sas_cq *cq = &hisi_hba->cq[slot->dlvry_queue]; | |
| 1454 | 1507 | |
| 1455 | 1508 | rc = hisi_sas_internal_task_abort(hisi_hba, device, |
| 1456 | 1509 | HISI_SAS_INT_ABT_CMD, tag); |
| 1457 | 1510 | if (((rc < 0) || (rc == TMF_RESP_FUNC_FAILED)) && |
| 1458 | − task->lldd_task) | |
| 1459 | − hisi_sas_do_release_task(hisi_hba, task, slot); | |
| 1511 | + task->lldd_task) { | |
| 1512 | + /* | |
| 1513 | + * flush tasklet to avoid free'ing task | |
| 1514 | + * before using task in IO completion | |
| 1515 | + */ | |
| 1516 | + tasklet_kill(&cq->tasklet); | |
| 1517 | + slot->task = NULL; | |
| 1518 | + } | |
| 1460 | 1519 | } |
| 1461 | 1520 | |
| 1462 | 1521 | out: |
| @@ -1705,14 +1764,11 @@ hisi_sas_internal_abort_task_exec(struct hisi_hba *hisi_hba, int device_id, · 242 unmodified lines | ||
| 1705 | 1764 | port = to_hisi_sas_port(sas_port); |
| 1706 | 1765 | |
| 1707 | 1766 | /* simply get a slot and send abort command */ |
| 1708 | − spin_lock_irqsave(&hisi_hba->lock, flags); | |
| 1709 | − rc = hisi_sas_slot_index_alloc(hisi_hba, &slot_idx); | |
| 1710 | − if (rc) { | |
| 1711 | − spin_unlock_irqrestore(&hisi_hba->lock, flags); | |
| 1767 | + rc = hisi_sas_slot_index_alloc(hisi_hba, NULL); | |
| 1768 | + if (rc < 0) | |
| 1712 | 1769 | goto err_out; |
| 1713 | − } | |
| 1714 | − spin_unlock_irqrestore(&hisi_hba->lock, flags); | |
| 1715 | 1770 | |
| 1771 | + slot_idx = rc; | |
| 1716 | 1772 | slot = &hisi_hba->slot_info[slot_idx]; |
| 1717 | 1773 | |
| 1718 | 1774 | spin_lock_irqsave(&dq->lock, flags_dq); |
| @@ -1748,7 +1804,6 @@ hisi_sas_internal_abort_task_exec(struct hisi_hba *hisi_hba, int device_id, · 29 unmodified lines | ||
| 1748 | 1804 | spin_lock_irqsave(&task->task_state_lock, flags); |
| 1749 | 1805 | task->task_state_flags |= SAS_TASK_AT_INITIATOR; |
| 1750 | 1806 | spin_unlock_irqrestore(&task->task_state_lock, flags); |
| 1751 | − | |
| 1752 | 1807 | WRITE_ONCE(slot->ready, 1); |
| 1753 | 1808 | /* send abort command to the chip */ |
| 1754 | 1809 | spin_lock_irqsave(&dq->lock, flags); |
| @@ -1759,9 +1814,7 @@ hisi_sas_internal_abort_task_exec(struct hisi_hba *hisi_hba, int device_id, · 4 unmodified lines | ||
| 1759 | 1814 | return 0; |
| 1760 | 1815 | |
| 1761 | 1816 | err_out_tag: |
| 1762 | − spin_lock_irqsave(&hisi_hba->lock, flags); | |
| 1763 | 1817 | hisi_sas_slot_index_free(hisi_hba, slot_idx); |
| 1764 | − spin_unlock_irqrestore(&hisi_hba->lock, flags); | |
| 1765 | 1818 | err_out: |
| 1766 | 1819 | dev_err(dev, "internal abort task prep: failed[%d]!\n", rc); |
| 1767 | 1820 | |
| @@ -1823,8 +1876,16 @@ hisi_sas_internal_task_abort(struct hisi_hba *hisi_hba, · 55 unmodified lines | ||
| 1823 | 1876 | if (!(task->task_state_flags & SAS_TASK_STATE_DONE)) { |
| 1824 | 1877 | struct hisi_sas_slot *slot = task->lldd_task; |
| 1825 | 1878 | |
| 1826 | − if (slot) | |
| 1879 | + if (slot) { | |
| 1880 | + struct hisi_sas_cq *cq = | |
| 1881 | + &hisi_hba->cq[slot->dlvry_queue]; | |
| 1882 | + /* | |
| 1883 | + * flush tasklet to avoid free'ing task | |
| 1884 | + * before using task in IO completion | |
| 1885 | + */ | |
| 1886 | + tasklet_kill(&cq->tasklet); | |
| 1827 | 1887 | slot->task = NULL; |
| 1888 | + } | |
| 1828 | 1889 | dev_err(dev, "internal task abort: timeout and not done.\n"); |
| 1829 | 1890 | res = -EIO; |
| 1830 | 1891 | goto exit; |
| @@ -1861,10 +1922,6 @@ static void hisi_sas_port_formed(struct asd_sas_phy *sas_phy) · 30 unmodified lines | ||
| 1861 | 1922 | hisi_sas_port_notify_formed(sas_phy); |
| 1862 | 1923 | } |
| 1863 | 1924 | |
| 1864 | −static void hisi_sas_port_deformed(struct asd_sas_phy *sas_phy) | |
| 1865 | −{ | |
| 1866 | −} | |
| 1867 | − | |
| 1868 | 1925 | static int hisi_sas_write_gpio(struct sas_ha_struct *sha, u8 reg_type, |
| 1869 | 1926 | u8 reg_index, u8 reg_count, u8 *write_data) |
| 1870 | 1927 | { |
| @@ -1954,10 +2011,9 @@ static struct sas_domain_function_template hisi_sas_transport_ops = { · 83 unmodified lines | ||
| 1954 | 2011 | .lldd_I_T_nexus_reset = hisi_sas_I_T_nexus_reset, |
| 1955 | 2012 | .lldd_lu_reset = hisi_sas_lu_reset, |
| 1956 | 2013 | .lldd_query_task = hisi_sas_query_task, |
| 1957 | − .lldd_clear_nexus_ha = hisi_sas_clear_nexus_ha, | |
| 2014 | + .lldd_clear_nexus_ha = hisi_sas_clear_nexus_ha, | |
| 1958 | 2015 | .lldd_port_formed = hisi_sas_port_formed, |
| 1959 | − .lldd_port_deformed = hisi_sas_port_deformed, | |
| 1960 | − .lldd_write_gpio = hisi_sas_write_gpio, | |
| 2016 | + .lldd_write_gpio = hisi_sas_write_gpio, | |
| 1961 | 2017 | }; |
| 1962 | 2018 | |
| 1963 | 2019 | void hisi_sas_init_mem(struct hisi_hba *hisi_hba) |
| @@ -2120,6 +2176,8 @@ int hisi_sas_alloc(struct hisi_hba *hisi_hba, struct Scsi_Host *shost) · 156 unmodified lines | ||
| 2120 | 2176 | hisi_sas_init_mem(hisi_hba); |
| 2121 | 2177 | |
| 2122 | 2178 | hisi_sas_slot_index_init(hisi_hba); |
| 2179 | + hisi_hba->last_slot_index = hisi_hba->hw->max_command_entries - | |
| 2180 | + HISI_SAS_RESERVED_IPTT_CNT; | |
| 2123 | 2181 | |
| 2124 | 2182 | hisi_hba->wq = create_singlethread_workqueue(dev_name(dev)); |
| 2125 | 2183 | if (!hisi_hba->wq) { |
| @@ -2323,8 +2381,15 @@ int hisi_sas_probe(struct platform_device *pdev, · 197 unmodified lines | ||
| 2323 | 2381 | shost->max_channel = 1; |
| 2324 | 2382 | shost->max_cmd_len = 16; |
| 2325 | 2383 | shost->sg_tablesize = min_t(u16, SG_ALL, HISI_SAS_SGE_PAGE_CNT); |
| 2326 | − shost->can_queue = hisi_hba->hw->max_command_entries; | |
| 2327 | − shost->cmd_per_lun = hisi_hba->hw->max_command_entries; | |
| 2384 | + if (hisi_hba->hw->slot_index_alloc) { | |
| 2385 | + shost->can_queue = hisi_hba->hw->max_command_entries; | |
| 2386 | + shost->cmd_per_lun = hisi_hba->hw->max_command_entries; | |
| 2387 | + } else { | |
| 2388 | + shost->can_queue = hisi_hba->hw->max_command_entries - | |
| 2389 | + HISI_SAS_RESERVED_IPTT_CNT; | |
| 2390 | + shost->cmd_per_lun = hisi_hba->hw->max_command_entries - | |
| 2391 | + HISI_SAS_RESERVED_IPTT_CNT; | |
| 2392 | + } | |
| 2328 | 2393 | |
| 2329 | 2394 | sha->sas_ha_name = DRV_NAME; |
| 2330 | 2395 | sha->dev = hisi_hba->dev; |
| @@ -1809,7 +1809,6 @@ static struct scsi_host_template sht_v1_hw = { · 1808 unmodified lines | ||
| 1809 | 1809 | .scan_start = hisi_sas_scan_start, |
| 1810 | 1810 | .change_queue_depth = sas_change_queue_depth, |
| 1811 | 1811 | .bios_param = sas_bios_param, |
| 1812 | − .can_queue = 1, | |
| 1813 | 1812 | .this_id = -1, |
| 1814 | 1813 | .sg_tablesize = SG_ALL, |
| 1815 | 1814 | .max_sectors = SCSI_DEFAULT_MAX_SECTORS, |
| @@ -770,7 +770,7 @@ static u32 hisi_sas_phy_read32(struct hisi_hba *hisi_hba, · 769 unmodified lines | ||
| 770 | 770 | |
| 771 | 771 | /* This function needs to be protected from pre-emption. */ |
| 772 | 772 | static int |
| 773 | −slot_index_alloc_quirk_v2_hw(struct hisi_hba *hisi_hba, int *slot_idx, | |
| 773 | +slot_index_alloc_quirk_v2_hw(struct hisi_hba *hisi_hba, | |
| 774 | 774 | struct domain_device *device) |
| 775 | 775 | { |
| 776 | 776 | int sata_dev = dev_is_sata(device); |
| @@ -778,6 +778,7 @@ slot_index_alloc_quirk_v2_hw(struct hisi_hba *hisi_hba, int *slot_idx, · 1 unmodified line | ||
| 778 | 778 | struct hisi_sas_device *sas_dev = device->lldd_dev; |
| 779 | 779 | int sata_idx = sas_dev->sata_idx; |
| 780 | 780 | int start, end; |
| 781 | + unsigned long flags; | |
| 781 | 782 | |
| 782 | 783 | if (!sata_dev) { |
| 783 | 784 | /* |
| @@ -801,11 +802,14 @@ slot_index_alloc_quirk_v2_hw(struct hisi_hba *hisi_hba, int *slot_idx, · 17 unmodified lines | ||
| 801 | 802 | end = 64 * (sata_idx + 2); |
| 802 | 803 | } |
| 803 | 804 | |
| 805 | + spin_lock_irqsave(&hisi_hba->lock, flags); | |
| 804 | 806 | while (1) { |
| 805 | 807 | start = find_next_zero_bit(bitmap, |
| 806 | 808 | hisi_hba->slot_index_count, start); |
| 807 | − if (start >= end) | |
| 809 | + if (start >= end) { | |
| 810 | + spin_unlock_irqrestore(&hisi_hba->lock, flags); | |
| 808 | 811 | return -SAS_QUEUE_FULL; |
| 812 | + } | |
| 809 | 813 | /* |
| 810 | 814 | * SAS IPTT bit0 should be 1, and SATA IPTT bit0 should be 0. |
| 811 | 815 | */ |
| @@ -815,8 +819,8 @@ slot_index_alloc_quirk_v2_hw(struct hisi_hba *hisi_hba, int *slot_idx, · 3 unmodified lines | ||
| 815 | 819 | } |
| 816 | 820 | |
| 817 | 821 | set_bit(start, bitmap); |
| 818 | − *slot_idx = start; | |
| 819 | − return 0; | |
| 822 | + spin_unlock_irqrestore(&hisi_hba->lock, flags); | |
| 823 | + return start; | |
| 820 | 824 | } |
| 821 | 825 | |
| 822 | 826 | static bool sata_index_alloc_v2_hw(struct hisi_hba *hisi_hba, int *idx) |
| @@ -2483,7 +2487,6 @@ slot_complete_v2_hw(struct hisi_hba *hisi_hba, struct hisi_sas_slot *slot) · 1660 unmodified lines | ||
| 2483 | 2487 | } |
| 2484 | 2488 | |
| 2485 | 2489 | out: |
| 2486 | − hisi_sas_slot_task_free(hisi_hba, task, slot); | |
| 2487 | 2490 | sts = ts->stat; |
| 2488 | 2491 | spin_lock_irqsave(&task->task_state_lock, flags); |
| 2489 | 2492 | if (task->task_state_flags & SAS_TASK_STATE_ABORTED) { |
| @@ -2493,6 +2496,7 @@ out: · 3 unmodified lines | ||
| 2493 | 2496 | } |
| 2494 | 2497 | task->task_state_flags |= SAS_TASK_STATE_DONE; |
| 2495 | 2498 | spin_unlock_irqrestore(&task->task_state_lock, flags); |
| 2499 | + hisi_sas_slot_task_free(hisi_hba, task, slot); | |
| 2496 | 2500 | |
| 2497 | 2501 | if (!is_internal && (task->task_proto != SAS_PROTOCOL_SMP)) { |
| 2498 | 2502 | spin_lock_irqsave(&device->done_lock, flags); |
| @@ -3560,7 +3564,6 @@ static struct scsi_host_template sht_v2_hw = { · 1061 unmodified lines | ||
| 3560 | 3564 | .scan_start = hisi_sas_scan_start, |
| 3561 | 3565 | .change_queue_depth = sas_change_queue_depth, |
| 3562 | 3566 | .bios_param = sas_bios_param, |
| 3563 | − .can_queue = 1, | |
| 3564 | 3567 | .this_id = -1, |
| 3565 | 3568 | .sg_tablesize = SG_ALL, |
| 3566 | 3569 | .max_sectors = SCSI_DEFAULT_MAX_SECTORS, |
| @@ -127,6 +127,7 @@ · 126 unmodified lines | ||
| 127 | 127 | #define PHY_CTRL_RESET_OFF 0 |
| 128 | 128 | #define PHY_CTRL_RESET_MSK (0x1 << PHY_CTRL_RESET_OFF) |
| 129 | 129 | #define SL_CFG (PORT_BASE + 0x84) |
| 130 | +#define AIP_LIMIT (PORT_BASE + 0x90) | |
| 130 | 131 | #define SL_CONTROL (PORT_BASE + 0x94) |
| 131 | 132 | #define SL_CONTROL_NOTIFY_EN_OFF 0 |
| 132 | 133 | #define SL_CONTROL_NOTIFY_EN_MSK (0x1 << SL_CONTROL_NOTIFY_EN_OFF) |
| @@ -431,6 +432,7 @@ static void init_reg_v3_hw(struct hisi_hba *hisi_hba) · 298 unmodified lines | ||
| 431 | 432 | (u32)((1ULL << hisi_hba->queue_count) - 1)); |
| 432 | 433 | hisi_sas_write32(hisi_hba, CFG_MAX_TAG, 0xfff0400); |
| 433 | 434 | hisi_sas_write32(hisi_hba, HGC_SAS_TXFAIL_RETRY_CTRL, 0x108); |
| 435 | + hisi_sas_write32(hisi_hba, CFG_AGING_TIME, 0x1); | |
| 434 | 436 | hisi_sas_write32(hisi_hba, INT_COAL_EN, 0x1); |
| 435 | 437 | hisi_sas_write32(hisi_hba, OQ_INT_COAL_TIME, 0x1); |
| 436 | 438 | hisi_sas_write32(hisi_hba, OQ_INT_COAL_CNT, 0x1); |
| @@ -441,7 +443,7 @@ static void init_reg_v3_hw(struct hisi_hba *hisi_hba) · 4 unmodified lines | ||
| 441 | 443 | hisi_sas_write32(hisi_hba, ENT_INT_SRC_MSK1, 0xfefefefe); |
| 442 | 444 | hisi_sas_write32(hisi_hba, ENT_INT_SRC_MSK2, 0xfefefefe); |
| 443 | 445 | if (pdev->revision >= 0x21) |
| 444 | − hisi_sas_write32(hisi_hba, ENT_INT_SRC_MSK3, 0xffff7fff); | |
| 446 | + hisi_sas_write32(hisi_hba, ENT_INT_SRC_MSK3, 0xffff7aff); | |
| 445 | 447 | else |
| 446 | 448 | hisi_sas_write32(hisi_hba, ENT_INT_SRC_MSK3, 0xfffe20ff); |
| 447 | 449 | hisi_sas_write32(hisi_hba, CHNL_PHYUPDOWN_INT_MSK, 0x0); |
| @@ -495,6 +497,7 @@ static void init_reg_v3_hw(struct hisi_hba *hisi_hba) · 47 unmodified lines | ||
| 495 | 497 | |
| 496 | 498 | /* used for 12G negotiate */ |
| 497 | 499 | hisi_sas_phy_write32(hisi_hba, i, COARSETUNE_TIME, 0x1e); |
| 500 | + hisi_sas_phy_write32(hisi_hba, i, AIP_LIMIT, 0x2ffff); | |
| 498 | 501 | } |
| 499 | 502 | |
| 500 | 503 | for (i = 0; i < hisi_hba->queue_count; i++) { |
| @@ -1751,7 +1754,6 @@ slot_complete_v3_hw(struct hisi_hba *hisi_hba, struct hisi_sas_slot *slot) · 1250 unmodified lines | ||
| 1751 | 1754 | } |
| 1752 | 1755 | |
| 1753 | 1756 | out: |
| 1754 | − hisi_sas_slot_task_free(hisi_hba, task, slot); | |
| 1755 | 1757 | sts = ts->stat; |
| 1756 | 1758 | spin_lock_irqsave(&task->task_state_lock, flags); |
| 1757 | 1759 | if (task->task_state_flags & SAS_TASK_STATE_ABORTED) { |
| @@ -1761,6 +1763,7 @@ out: · 3 unmodified lines | ||
| 1761 | 1763 | } |
| 1762 | 1764 | task->task_state_flags |= SAS_TASK_STATE_DONE; |
| 1763 | 1765 | spin_unlock_irqrestore(&task->task_state_lock, flags); |
| 1766 | + hisi_sas_slot_task_free(hisi_hba, task, slot); | |
| 1764 | 1767 | |
| 1765 | 1768 | if (!is_internal && (task->task_proto != SAS_PROTOCOL_SMP)) { |
| 1766 | 1769 | spin_lock_irqsave(&device->done_lock, flags); |
| @@ -2098,7 +2101,6 @@ static struct scsi_host_template sht_v3_hw = { · 331 unmodified lines | ||
| 2098 | 2101 | .scan_start = hisi_sas_scan_start, |
| 2099 | 2102 | .change_queue_depth = sas_change_queue_depth, |
| 2100 | 2103 | .bios_param = sas_bios_param, |
| 2101 | − .can_queue = 1, | |
| 2102 | 2104 | .this_id = -1, |
| 2103 | 2105 | .sg_tablesize = SG_ALL, |
| 2104 | 2106 | .max_sectors = SCSI_DEFAULT_MAX_SECTORS, |
| @@ -2108,6 +2110,7 @@ static struct scsi_host_template sht_v3_hw = { · 3 unmodified lines | ||
| 2108 | 2110 | .target_destroy = sas_target_destroy, |
| 2109 | 2111 | .ioctl = sas_ioctl, |
| 2110 | 2112 | .shost_attrs = host_attrs, |
| 2113 | + .tag_alloc_policy = BLK_TAG_ALLOC_RR, | |
| 2111 | 2114 | }; |
| 2112 | 2115 | |
| 2113 | 2116 | static const struct hisi_sas_hw hisi_sas_v3_hw = { |
| @@ -2245,8 +2248,10 @@ hisi_sas_v3_probe(struct pci_dev *pdev, const struct pci_device_id *id) · 131 unmodified lines | ||
| 2245 | 2248 | shost->max_channel = 1; |
| 2246 | 2249 | shost->max_cmd_len = 16; |
| 2247 | 2250 | shost->sg_tablesize = min_t(u16, SG_ALL, HISI_SAS_SGE_PAGE_CNT); |
| 2248 | − shost->can_queue = hisi_hba->hw->max_command_entries; | |
| 2249 | − shost->cmd_per_lun = hisi_hba->hw->max_command_entries; | |
| 2251 | + shost->can_queue = hisi_hba->hw->max_command_entries - | |
| 2252 | + HISI_SAS_RESERVED_IPTT_CNT; | |
| 2253 | + shost->cmd_per_lun = hisi_hba->hw->max_command_entries - | |
| 2254 | + HISI_SAS_RESERVED_IPTT_CNT; | |
| 2250 | 2255 | |
| 2251 | 2256 | sha->sas_ha_name = DRV_NAME; |
| 2252 | 2257 | sha->dev = dev; |
| @@ -2240,8 +2240,8 @@ static int hpsa_map_ioaccel2_sg_chain_block(struct ctlr_info *h, · 2239 unmodified lines | ||
| 2240 | 2240 | |
| 2241 | 2241 | chain_block = h->ioaccel2_cmd_sg_list[c->cmdindex]; |
| 2242 | 2242 | chain_size = le32_to_cpu(cp->sg[0].length); |
| 2243 | − temp64 = pci_map_single(h->pdev, chain_block, chain_size, | |
| 2244 | − PCI_DMA_TODEVICE); | |
| 2243 | + temp64 = dma_map_single(&h->pdev->dev, chain_block, chain_size, | |
| 2244 | + DMA_TO_DEVICE); | |
| 2245 | 2245 | if (dma_mapping_error(&h->pdev->dev, temp64)) { |
| 2246 | 2246 | /* prevent subsequent unmapping */ |
| 2247 | 2247 | cp->sg->address = 0; |
| @@ -2261,7 +2261,7 @@ static void hpsa_unmap_ioaccel2_sg_chain_block(struct ctlr_info *h, · 13 unmodified lines | ||
| 2261 | 2261 | chain_sg = cp->sg; |
| 2262 | 2262 | temp64 = le64_to_cpu(chain_sg->address); |
| 2263 | 2263 | chain_size = le32_to_cpu(cp->sg[0].length); |
| 2264 | − pci_unmap_single(h->pdev, temp64, chain_size, PCI_DMA_TODEVICE); | |
| 2264 | + dma_unmap_single(&h->pdev->dev, temp64, chain_size, DMA_TO_DEVICE); | |
| 2265 | 2265 | } |
| 2266 | 2266 | |
| 2267 | 2267 | static int hpsa_map_sg_chain_block(struct ctlr_info *h, |
| @@ -2277,8 +2277,8 @@ static int hpsa_map_sg_chain_block(struct ctlr_info *h, · 9 unmodified lines | ||
| 2277 | 2277 | chain_len = sizeof(*chain_sg) * |
| 2278 | 2278 | (le16_to_cpu(c->Header.SGTotal) - h->max_cmd_sg_entries); |
| 2279 | 2279 | chain_sg->Len = cpu_to_le32(chain_len); |
| 2280 | − temp64 = pci_map_single(h->pdev, chain_block, chain_len, | |
| 2281 | − PCI_DMA_TODEVICE); | |
| 2280 | + temp64 = dma_map_single(&h->pdev->dev, chain_block, chain_len, | |
| 2281 | + DMA_TO_DEVICE); | |
| 2282 | 2282 | if (dma_mapping_error(&h->pdev->dev, temp64)) { |
| 2283 | 2283 | /* prevent subsequent unmapping */ |
| 2284 | 2284 | chain_sg->Addr = cpu_to_le64(0); |
| @@ -2297,8 +2297,8 @@ static void hpsa_unmap_sg_chain_block(struct ctlr_info *h, · 12 unmodified lines | ||
| 2297 | 2297 | return; |
| 2298 | 2298 | |
| 2299 | 2299 | chain_sg = &c->SG[h->max_cmd_sg_entries - 1]; |
| 2300 | − pci_unmap_single(h->pdev, le64_to_cpu(chain_sg->Addr), | |
| 2301 | − le32_to_cpu(chain_sg->Len), PCI_DMA_TODEVICE); | |
| 2300 | + dma_unmap_single(&h->pdev->dev, le64_to_cpu(chain_sg->Addr), | |
| 2301 | + le32_to_cpu(chain_sg->Len), DMA_TO_DEVICE); | |
| 2302 | 2302 | } |
| 2303 | 2303 | |
| 2304 | 2304 | |
| @@ -2759,13 +2759,13 @@ static void complete_scsi_command(struct CommandList *cp) · 454 unmodified lines | ||
| 2759 | 2759 | return hpsa_cmd_free_and_done(h, cp, cmd); |
| 2760 | 2760 | } |
| 2761 | 2761 | |
| 2762 | −static void hpsa_pci_unmap(struct pci_dev *pdev, | |
| 2763 | − struct CommandList *c, int sg_used, int data_direction) | |
| 2762 | +static void hpsa_pci_unmap(struct pci_dev *pdev, struct CommandList *c, | |
| 2763 | + int sg_used, enum dma_data_direction data_direction) | |
| 2764 | 2764 | { |
| 2765 | 2765 | int i; |
| 2766 | 2766 | |
| 2767 | 2767 | for (i = 0; i < sg_used; i++) |
| 2768 | − pci_unmap_single(pdev, (dma_addr_t) le64_to_cpu(c->SG[i].Addr), | |
| 2768 | + dma_unmap_single(&pdev->dev, le64_to_cpu(c->SG[i].Addr), | |
| 2769 | 2769 | le32_to_cpu(c->SG[i].Len), |
| 2770 | 2770 | data_direction); |
| 2771 | 2771 | } |
| @@ -2774,17 +2774,17 @@ static int hpsa_map_one(struct pci_dev *pdev, · 2 unmodified lines | ||
| 2774 | 2774 | struct CommandList *cp, |
| 2775 | 2775 | unsigned char *buf, |
| 2776 | 2776 | size_t buflen, |
| 2777 | − int data_direction) | |
| 2777 | + enum dma_data_direction data_direction) | |
| 2778 | 2778 | { |
| 2779 | 2779 | u64 addr64; |
| 2780 | 2780 | |
| 2781 | − if (buflen == 0 || data_direction == PCI_DMA_NONE) { | |
| 2781 | + if (buflen == 0 || data_direction == DMA_NONE) { | |
| 2782 | 2782 | cp->Header.SGList = 0; |
| 2783 | 2783 | cp->Header.SGTotal = cpu_to_le16(0); |
| 2784 | 2784 | return 0; |
| 2785 | 2785 | } |
| 2786 | 2786 | |
| 2787 | − addr64 = pci_map_single(pdev, buf, buflen, data_direction); | |
| 2787 | + addr64 = dma_map_single(&pdev->dev, buf, buflen, data_direction); | |
| 2788 | 2788 | if (dma_mapping_error(&pdev->dev, addr64)) { |
| 2789 | 2789 | /* Prevent subsequent unmap of something never mapped */ |
| 2790 | 2790 | cp->Header.SGList = 0; |
| @@ -2845,7 +2845,8 @@ static u32 lockup_detected(struct ctlr_info *h) · 54 unmodified lines | ||
| 2845 | 2845 | |
| 2846 | 2846 | #define MAX_DRIVER_CMD_RETRIES 25 |
| 2847 | 2847 | static int hpsa_scsi_do_simple_cmd_with_retry(struct ctlr_info *h, |
| 2848 | − struct CommandList *c, int data_direction, unsigned long timeout_msecs) | |
| 2848 | + struct CommandList *c, enum dma_data_direction data_direction, | |
| 2849 | + unsigned long timeout_msecs) | |
| 2849 | 2850 | { |
| 2850 | 2851 | int backoff_time = 10, retry_count = 0; |
| 2851 | 2852 | int rc; |
| @@ -2969,8 +2970,8 @@ static int hpsa_do_receive_diagnostic(struct ctlr_info *h, u8 *scsi3addr, · 117 unmodified lines | ||
| 2969 | 2970 | rc = -1; |
| 2970 | 2971 | goto out; |
| 2971 | 2972 | } |
| 2972 | − rc = hpsa_scsi_do_simple_cmd_with_retry(h, c, | |
| 2973 | − PCI_DMA_FROMDEVICE, NO_TIMEOUT); | |
| 2973 | + rc = hpsa_scsi_do_simple_cmd_with_retry(h, c, DMA_FROM_DEVICE, | |
| 2974 | + NO_TIMEOUT); | |
| 2974 | 2975 | if (rc) |
| 2975 | 2976 | goto out; |
| 2976 | 2977 | ei = c->err_info; |
| @@ -3022,8 +3023,8 @@ static int hpsa_scsi_do_inquiry(struct ctlr_info *h, unsigned char *scsi3addr, · 45 unmodified lines | ||
| 3022 | 3023 | rc = -1; |
| 3023 | 3024 | goto out; |
| 3024 | 3025 | } |
| 3025 | − rc = hpsa_scsi_do_simple_cmd_with_retry(h, c, | |
| 3026 | − PCI_DMA_FROMDEVICE, NO_TIMEOUT); | |
| 3026 | + rc = hpsa_scsi_do_simple_cmd_with_retry(h, c, DMA_FROM_DEVICE, | |
| 3027 | + NO_TIMEOUT); | |
| 3027 | 3028 | if (rc) |
| 3028 | 3029 | goto out; |
| 3029 | 3030 | ei = c->err_info; |
| @@ -3306,8 +3307,8 @@ static int hpsa_get_raid_map(struct ctlr_info *h, · 276 unmodified lines | ||
| 3306 | 3307 | cmd_free(h, c); |
| 3307 | 3308 | return -1; |
| 3308 | 3309 | } |
| 3309 | − rc = hpsa_scsi_do_simple_cmd_with_retry(h, c, | |
| 3310 | − PCI_DMA_FROMDEVICE, NO_TIMEOUT); | |
| 3310 | + rc = hpsa_scsi_do_simple_cmd_with_retry(h, c, DMA_FROM_DEVICE, | |
| 3311 | + NO_TIMEOUT); | |
| 3311 | 3312 | if (rc) |
| 3312 | 3313 | goto out; |
| 3313 | 3314 | ei = c->err_info; |
| @@ -3349,8 +3350,8 @@ static int hpsa_bmic_sense_subsystem_information(struct ctlr_info *h, · 35 unmodified lines | ||
| 3349 | 3350 | c->Request.CDB[2] = bmic_device_index & 0xff; |
| 3350 | 3351 | c->Request.CDB[9] = (bmic_device_index >> 8) & 0xff; |
| 3351 | 3352 | |
| 3352 | − rc = hpsa_scsi_do_simple_cmd_with_retry(h, c, | |
| 3353 | − PCI_DMA_FROMDEVICE, NO_TIMEOUT); | |
| 3353 | + rc = hpsa_scsi_do_simple_cmd_with_retry(h, c, DMA_FROM_DEVICE, | |
| 3354 | + NO_TIMEOUT); | |
| 3354 | 3355 | if (rc) |
| 3355 | 3356 | goto out; |
| 3356 | 3357 | ei = c->err_info; |
| @@ -3377,8 +3378,8 @@ static int hpsa_bmic_id_controller(struct ctlr_info *h, · 20 unmodified lines | ||
| 3377 | 3378 | if (rc) |
| 3378 | 3379 | goto out; |
| 3379 | 3380 | |
| 3380 | − rc = hpsa_scsi_do_simple_cmd_with_retry(h, c, | |
| 3381 | − PCI_DMA_FROMDEVICE, NO_TIMEOUT); | |
| 3381 | + rc = hpsa_scsi_do_simple_cmd_with_retry(h, c, DMA_FROM_DEVICE, | |
| 3382 | + NO_TIMEOUT); | |
| 3382 | 3383 | if (rc) |
| 3383 | 3384 | goto out; |
| 3384 | 3385 | ei = c->err_info; |
| @@ -3408,7 +3409,7 @@ static int hpsa_bmic_id_physical_device(struct ctlr_info *h, · 23 unmodified lines | ||
| 3408 | 3409 | c->Request.CDB[2] = bmic_device_index & 0xff; |
| 3409 | 3410 | c->Request.CDB[9] = (bmic_device_index >> 8) & 0xff; |
| 3410 | 3411 | |
| 3411 | − hpsa_scsi_do_simple_cmd_with_retry(h, c, PCI_DMA_FROMDEVICE, | |
| 3412 | + hpsa_scsi_do_simple_cmd_with_retry(h, c, DMA_FROM_DEVICE, | |
| 3412 | 3413 | NO_TIMEOUT); |
| 3413 | 3414 | ei = c->err_info; |
| 3414 | 3415 | if (ei->CommandStatus != 0 && ei->CommandStatus != CMD_DATA_UNDERRUN) { |
| @@ -3484,7 +3485,7 @@ static void hpsa_get_enclosure_info(struct ctlr_info *h, · 69 unmodified lines | ||
| 3484 | 3485 | else |
| 3485 | 3486 | c->Request.CDB[5] = 0; |
| 3486 | 3487 | |
| 3487 | − rc = hpsa_scsi_do_simple_cmd_with_retry(h, c, PCI_DMA_FROMDEVICE, | |
| 3488 | + rc = hpsa_scsi_do_simple_cmd_with_retry(h, c, DMA_FROM_DEVICE, | |
| 3488 | 3489 | NO_TIMEOUT); |
| 3489 | 3490 | if (rc) |
| 3490 | 3491 | goto out; |
| @@ -3731,8 +3732,8 @@ static int hpsa_scsi_do_report_luns(struct ctlr_info *h, int logical, · 240 unmodified lines | ||
| 3731 | 3732 | } |
| 3732 | 3733 | if (extended_response) |
| 3733 | 3734 | c->Request.CDB[1] = extended_response; |
| 3734 | − rc = hpsa_scsi_do_simple_cmd_with_retry(h, c, | |
| 3735 | − PCI_DMA_FROMDEVICE, NO_TIMEOUT); | |
| 3735 | + rc = hpsa_scsi_do_simple_cmd_with_retry(h, c, DMA_FROM_DEVICE, | |
| 3736 | + NO_TIMEOUT); | |
| 3736 | 3737 | if (rc) |
| 3737 | 3738 | goto out; |
| 3738 | 3739 | ei = c->err_info; |
| @@ -6320,8 +6321,8 @@ static int hpsa_passthru_ioctl(struct ctlr_info *h, void __user *argp) · 2581 unmodified lines | ||
| 6320 | 6321 | |
| 6321 | 6322 | /* Fill in the scatter gather information */ |
| 6322 | 6323 | if (iocommand.buf_size > 0) { |
| 6323 | − temp64 = pci_map_single(h->pdev, buff, | |
| 6324 | − iocommand.buf_size, PCI_DMA_BIDIRECTIONAL); | |
| 6324 | + temp64 = dma_map_single(&h->pdev->dev, buff, | |
| 6325 | + iocommand.buf_size, DMA_BIDIRECTIONAL); | |
| 6325 | 6326 | if (dma_mapping_error(&h->pdev->dev, (dma_addr_t) temp64)) { |
| 6326 | 6327 | c->SG[0].Addr = cpu_to_le64(0); |
| 6327 | 6328 | c->SG[0].Len = cpu_to_le32(0); |
| @@ -6335,7 +6336,7 @@ static int hpsa_passthru_ioctl(struct ctlr_info *h, void __user *argp) · 7 unmodified lines | ||
| 6335 | 6336 | rc = hpsa_scsi_do_simple_cmd(h, c, DEFAULT_REPLY_QUEUE, |
| 6336 | 6337 | NO_TIMEOUT); |
| 6337 | 6338 | if (iocommand.buf_size > 0) |
| 6338 | − hpsa_pci_unmap(h->pdev, c, 1, PCI_DMA_BIDIRECTIONAL); | |
| 6339 | + hpsa_pci_unmap(h->pdev, c, 1, DMA_BIDIRECTIONAL); | |
| 6339 | 6340 | check_ioctl_unit_attention(h, c); |
| 6340 | 6341 | if (rc) { |
| 6341 | 6342 | rc = -EIO; |
| @@ -6381,13 +6382,9 @@ static int hpsa_big_passthru_ioctl(struct ctlr_info *h, void __user *argp) · 39 unmodified lines | ||
| 6381 | 6382 | return -EINVAL; |
| 6382 | 6383 | if (!capable(CAP_SYS_RAWIO)) |
| 6383 | 6384 | return -EPERM; |
| 6384 | − ioc = kmalloc(sizeof(*ioc), GFP_KERNEL); | |
| 6385 | − if (!ioc) { | |
| 6386 | − status = -ENOMEM; | |
| 6387 | − goto cleanup1; | |
| 6388 | − } | |
| 6389 | − if (copy_from_user(ioc, argp, sizeof(*ioc))) { | |
| 6390 | − status = -EFAULT; | |
| 6385 | + ioc = vmemdup_user(argp, sizeof(*ioc)); | |
| 6386 | + if (IS_ERR(ioc)) { | |
| 6387 | + status = PTR_ERR(ioc); | |
| 6391 | 6388 | goto cleanup1; |
| 6392 | 6389 | } |
| 6393 | 6390 | if ((ioc->buf_size < 1) && |
| @@ -6447,14 +6444,14 @@ static int hpsa_big_passthru_ioctl(struct ctlr_info *h, void __user *argp) · 53 unmodified lines | ||
| 6447 | 6444 | if (ioc->buf_size > 0) { |
| 6448 | 6445 | int i; |
| 6449 | 6446 | for (i = 0; i < sg_used; i++) { |
| 6450 | − temp64 = pci_map_single(h->pdev, buff[i], | |
| 6451 | − buff_size[i], PCI_DMA_BIDIRECTIONAL); | |
| 6447 | + temp64 = dma_map_single(&h->pdev->dev, buff[i], | |
| 6448 | + buff_size[i], DMA_BIDIRECTIONAL); | |
| 6452 | 6449 | if (dma_mapping_error(&h->pdev->dev, |
| 6453 | 6450 | (dma_addr_t) temp64)) { |
| 6454 | 6451 | c->SG[i].Addr = cpu_to_le64(0); |
| 6455 | 6452 | c->SG[i].Len = cpu_to_le32(0); |
| 6456 | 6453 | hpsa_pci_unmap(h->pdev, c, i, |
| 6457 | − PCI_DMA_BIDIRECTIONAL); | |
| 6454 | + DMA_BIDIRECTIONAL); | |
| 6458 | 6455 | status = -ENOMEM; |
| 6459 | 6456 | goto cleanup0; |
| 6460 | 6457 | } |
| @@ -6467,7 +6464,7 @@ static int hpsa_big_passthru_ioctl(struct ctlr_info *h, void __user *argp) · 6 unmodified lines | ||
| 6467 | 6464 | status = hpsa_scsi_do_simple_cmd(h, c, DEFAULT_REPLY_QUEUE, |
| 6468 | 6465 | NO_TIMEOUT); |
| 6469 | 6466 | if (sg_used) |
| 6470 | − hpsa_pci_unmap(h->pdev, c, sg_used, PCI_DMA_BIDIRECTIONAL); | |
| 6467 | + hpsa_pci_unmap(h->pdev, c, sg_used, DMA_BIDIRECTIONAL); | |
| 6471 | 6468 | check_ioctl_unit_attention(h, c); |
| 6472 | 6469 | if (status) { |
| 6473 | 6470 | status = -EIO; |
| @@ -6505,7 +6502,7 @@ cleanup1: · 31 unmodified lines | ||
| 6505 | 6502 | kfree(buff); |
| 6506 | 6503 | } |
| 6507 | 6504 | kfree(buff_size); |
| 6508 | − kfree(ioc); | |
| 6505 | + kvfree(ioc); | |
| 6509 | 6506 | return status; |
| 6510 | 6507 | } |
| 6511 | 6508 | |
| @@ -6579,7 +6576,7 @@ static int fill_cmd(struct CommandList *c, u8 cmd, struct ctlr_info *h, · 67 unmodified lines | ||
| 6579 | 6576 | void *buff, size_t size, u16 page_code, unsigned char *scsi3addr, |
| 6580 | 6577 | int cmd_type) |
| 6581 | 6578 | { |
| 6582 | − int pci_dir = XFER_NONE; | |
| 6579 | + enum dma_data_direction dir = DMA_NONE; | |
| 6583 | 6580 | |
| 6584 | 6581 | c->cmd_type = CMD_IOCTL_PEND; |
| 6585 | 6582 | c->scsi_cmd = SCSI_CMD_BUSY; |
| @@ -6785,18 +6782,18 @@ static int fill_cmd(struct CommandList *c, u8 cmd, struct ctlr_info *h, · 199 unmodified lines | ||
| 6785 | 6782 | |
| 6786 | 6783 | switch (GET_DIR(c->Request.type_attr_dir)) { |
| 6787 | 6784 | case XFER_READ: |
| 6788 | − pci_dir = PCI_DMA_FROMDEVICE; | |
| 6785 | + dir = DMA_FROM_DEVICE; | |
| 6789 | 6786 | break; |
| 6790 | 6787 | case XFER_WRITE: |
| 6791 | − pci_dir = PCI_DMA_TODEVICE; | |
| 6788 | + dir = DMA_TO_DEVICE; | |
| 6792 | 6789 | break; |
| 6793 | 6790 | case XFER_NONE: |
| 6794 | − pci_dir = PCI_DMA_NONE; | |
| 6791 | + dir = DMA_NONE; | |
| 6795 | 6792 | break; |
| 6796 | 6793 | default: |
| 6797 | − pci_dir = PCI_DMA_BIDIRECTIONAL; | |
| 6794 | + dir = DMA_BIDIRECTIONAL; | |
| 6798 | 6795 | } |
| 6799 | − if (hpsa_map_one(h->pdev, c, buff, size, pci_dir)) | |
| 6796 | + if (hpsa_map_one(h->pdev, c, buff, size, dir)) | |
| 6800 | 6797 | return -1; |
| 6801 | 6798 | return 0; |
| 6802 | 6799 | } |
| @@ -6992,13 +6989,13 @@ static int hpsa_message(struct pci_dev *pdev, unsigned char opcode, · 189 unmodified lines | ||
| 6992 | 6989 | * CCISS commands, so they must be allocated from the lower 4GiB of |
| 6993 | 6990 | * memory. |
| 6994 | 6991 | */ |
| 6995 | − err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); | |
| 6992 | + err = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32)); | |
| 6996 | 6993 | if (err) { |
| 6997 | 6994 | iounmap(vaddr); |
| 6998 | 6995 | return err; |
| 6999 | 6996 | } |
| 7000 | 6997 | |
| 7001 | − cmd = pci_alloc_consistent(pdev, cmd_sz, &paddr64); | |
| 6998 | + cmd = dma_alloc_coherent(&pdev->dev, cmd_sz, &paddr64, GFP_KERNEL); | |
| 7002 | 6999 | if (cmd == NULL) { |
| 7003 | 7000 | iounmap(vaddr); |
| 7004 | 7001 | return -ENOMEM; |
| @@ -7047,7 +7044,7 @@ static int hpsa_message(struct pci_dev *pdev, unsigned char opcode, · 42 unmodified lines | ||
| 7047 | 7044 | return -ETIMEDOUT; |
| 7048 | 7045 | } |
| 7049 | 7046 | |
| 7050 | − pci_free_consistent(pdev, cmd_sz, cmd, paddr64); | |
| 7047 | + dma_free_coherent(&pdev->dev, cmd_sz, cmd, paddr64); | |
| 7051 | 7048 | |
| 7052 | 7049 | if (tag & HPSA_ERROR_BIT) { |
| 7053 | 7050 | dev_err(&pdev->dev, "controller message %02x:%02x failed\n", |
| @@ -7914,7 +7911,7 @@ static void hpsa_free_cmd_pool(struct ctlr_info *h) · 860 unmodified lines | ||
| 7914 | 7911 | kfree(h->cmd_pool_bits); |
| 7915 | 7912 | h->cmd_pool_bits = NULL; |
| 7916 | 7913 | if (h->cmd_pool) { |
| 7917 | − pci_free_consistent(h->pdev, | |
| 7914 | + dma_free_coherent(&h->pdev->dev, | |
| 7918 | 7915 | h->nr_cmds * sizeof(struct CommandList), |
| 7919 | 7916 | h->cmd_pool, |
| 7920 | 7917 | h->cmd_pool_dhandle); |
| @@ -7922,7 +7919,7 @@ static void hpsa_free_cmd_pool(struct ctlr_info *h) · 1 unmodified line | ||
| 7922 | 7919 | h->cmd_pool_dhandle = 0; |
| 7923 | 7920 | } |
| 7924 | 7921 | if (h->errinfo_pool) { |
| 7925 | − pci_free_consistent(h->pdev, | |
| 7922 | + dma_free_coherent(&h->pdev->dev, | |
| 7926 | 7923 | h->nr_cmds * sizeof(struct ErrorInfo), |
| 7927 | 7924 | h->errinfo_pool, |
| 7928 | 7925 | h->errinfo_pool_dhandle); |
| @@ -7936,12 +7933,12 @@ static int hpsa_alloc_cmd_pool(struct ctlr_info *h) · 7 unmodified lines | ||
| 7936 | 7933 | h->cmd_pool_bits = kcalloc(DIV_ROUND_UP(h->nr_cmds, BITS_PER_LONG), |
| 7937 | 7934 | sizeof(unsigned long), |
| 7938 | 7935 | GFP_KERNEL); |
| 7939 | − h->cmd_pool = pci_alloc_consistent(h->pdev, | |
| 7936 | + h->cmd_pool = dma_alloc_coherent(&h->pdev->dev, | |
| 7940 | 7937 | h->nr_cmds * sizeof(*h->cmd_pool), |
| 7941 | − &(h->cmd_pool_dhandle)); | |
| 7942 | − h->errinfo_pool = pci_alloc_consistent(h->pdev, | |
| 7938 | + &h->cmd_pool_dhandle, GFP_KERNEL); | |
| 7939 | + h->errinfo_pool = dma_alloc_coherent(&h->pdev->dev, | |
| 7943 | 7940 | h->nr_cmds * sizeof(*h->errinfo_pool), |
| 7944 | − &(h->errinfo_pool_dhandle)); | |
| 7941 | + &h->errinfo_pool_dhandle, GFP_KERNEL); | |
| 7945 | 7942 | if ((h->cmd_pool_bits == NULL) |
| 7946 | 7943 | || (h->cmd_pool == NULL) |
| 7947 | 7944 | || (h->errinfo_pool == NULL)) { |
| @@ -8068,7 +8065,7 @@ static void hpsa_free_reply_queues(struct ctlr_info *h) · 120 unmodified lines | ||
| 8068 | 8065 | for (i = 0; i < h->nreply_queues; i++) { |
| 8069 | 8066 | if (!h->reply_queue[i].head) |
| 8070 | 8067 | continue; |
| 8071 | − pci_free_consistent(h->pdev, | |
| 8068 | + dma_free_coherent(&h->pdev->dev, | |
| 8072 | 8069 | h->reply_queue_size, |
| 8073 | 8070 | h->reply_queue[i].head, |
| 8074 | 8071 | h->reply_queue[i].busaddr); |
| @@ -8594,11 +8591,11 @@ reinit_after_soft_reset: · 519 unmodified lines | ||
| 8594 | 8591 | number_of_controllers++; |
| 8595 | 8592 | |
| 8596 | 8593 | /* configure PCI DMA stuff */ |
| 8597 | − rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(64)); | |
| 8594 | + rc = dma_set_mask(&pdev->dev, DMA_BIT_MASK(64)); | |
| 8598 | 8595 | if (rc == 0) { |
| 8599 | 8596 | dac = 1; |
| 8600 | 8597 | } else { |
| 8601 | − rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); | |
| 8598 | + rc = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32)); | |
| 8602 | 8599 | if (rc == 0) { |
| 8603 | 8600 | dac = 0; |
| 8604 | 8601 | } else { |
| @@ -8797,8 +8794,8 @@ static void hpsa_flush_cache(struct ctlr_info *h) · 192 unmodified lines | ||
| 8797 | 8794 | RAID_CTLR_LUNID, TYPE_CMD)) { |
| 8798 | 8795 | goto out; |
| 8799 | 8796 | } |
| 8800 | − rc = hpsa_scsi_do_simple_cmd_with_retry(h, c, | |
| 8801 | − PCI_DMA_TODEVICE, DEFAULT_TIMEOUT); | |
| 8797 | + rc = hpsa_scsi_do_simple_cmd_with_retry(h, c, DMA_TO_DEVICE, | |
| 8798 | + DEFAULT_TIMEOUT); | |
| 8802 | 8799 | if (rc) |
| 8803 | 8800 | goto out; |
| 8804 | 8801 | if (c->err_info->CommandStatus != 0) |
| @@ -8833,8 +8830,8 @@ static void hpsa_disable_rld_caching(struct ctlr_info *h) · 28 unmodified lines | ||
| 8833 | 8830 | RAID_CTLR_LUNID, TYPE_CMD)) |
| 8834 | 8831 | goto errout; |
| 8835 | 8832 | |
| 8836 | − rc = hpsa_scsi_do_simple_cmd_with_retry(h, c, | |
| 8837 | − PCI_DMA_FROMDEVICE, NO_TIMEOUT); | |
| 8833 | + rc = hpsa_scsi_do_simple_cmd_with_retry(h, c, DMA_FROM_DEVICE, | |
| 8834 | + NO_TIMEOUT); | |
| 8838 | 8835 | if ((rc != 0) || (c->err_info->CommandStatus != 0)) |
| 8839 | 8836 | goto errout; |
| 8840 | 8837 | |
| @@ -8845,8 +8842,8 @@ static void hpsa_disable_rld_caching(struct ctlr_info *h) · 4 unmodified lines | ||
| 8845 | 8842 | RAID_CTLR_LUNID, TYPE_CMD)) |
| 8846 | 8843 | goto errout; |
| 8847 | 8844 | |
| 8848 | − rc = hpsa_scsi_do_simple_cmd_with_retry(h, c, | |
| 8849 | − PCI_DMA_TODEVICE, NO_TIMEOUT); | |
| 8845 | + rc = hpsa_scsi_do_simple_cmd_with_retry(h, c, DMA_TO_DEVICE, | |
| 8846 | + NO_TIMEOUT); | |
| 8850 | 8847 | if ((rc != 0) || (c->err_info->CommandStatus != 0)) |
| 8851 | 8848 | goto errout; |
| 8852 | 8849 | |
| @@ -8855,8 +8852,8 @@ static void hpsa_disable_rld_caching(struct ctlr_info *h) · 2 unmodified lines | ||
| 8855 | 8852 | RAID_CTLR_LUNID, TYPE_CMD)) |
| 8856 | 8853 | goto errout; |
| 8857 | 8854 | |
| 8858 | − rc = hpsa_scsi_do_simple_cmd_with_retry(h, c, | |
| 8859 | − PCI_DMA_FROMDEVICE, NO_TIMEOUT); | |
| 8855 | + rc = hpsa_scsi_do_simple_cmd_with_retry(h, c, DMA_FROM_DEVICE, | |
| 8856 | + NO_TIMEOUT); | |
| 8860 | 8857 | if ((rc != 0) || (c->err_info->CommandStatus != 0)) |
| 8861 | 8858 | goto errout; |
| 8862 | 8859 | |
| @@ -9228,9 +9225,9 @@ static int hpsa_alloc_ioaccel1_cmd_and_bft(struct ctlr_info *h) · 365 unmodified lines | ||
| 9228 | 9225 | BUILD_BUG_ON(sizeof(struct io_accel1_cmd) % |
| 9229 | 9226 | IOACCEL1_COMMANDLIST_ALIGNMENT); |
| 9230 | 9227 | h->ioaccel_cmd_pool = |
| 9231 | − pci_alloc_consistent(h->pdev, | |
| 9228 | + dma_alloc_coherent(&h->pdev->dev, | |
| 9232 | 9229 | h->nr_cmds * sizeof(*h->ioaccel_cmd_pool), |
| 9233 | − &(h->ioaccel_cmd_pool_dhandle)); | |
| 9230 | + &h->ioaccel_cmd_pool_dhandle, GFP_KERNEL); | |
| 9234 | 9231 | |
| 9235 | 9232 | h->ioaccel1_blockFetchTable = |
| 9236 | 9233 | kmalloc(((h->ioaccel_maxsg + 1) * |
| @@ -9281,9 +9278,9 @@ static int hpsa_alloc_ioaccel2_cmd_and_bft(struct ctlr_info *h) · 44 unmodified lines | ||
| 9281 | 9278 | BUILD_BUG_ON(sizeof(struct io_accel2_cmd) % |
| 9282 | 9279 | IOACCEL2_COMMANDLIST_ALIGNMENT); |
| 9283 | 9280 | h->ioaccel2_cmd_pool = |
| 9284 | − pci_alloc_consistent(h->pdev, | |
| 9281 | + dma_alloc_coherent(&h->pdev->dev, | |
| 9285 | 9282 | h->nr_cmds * sizeof(*h->ioaccel2_cmd_pool), |
| 9286 | − &(h->ioaccel2_cmd_pool_dhandle)); | |
| 9283 | + &h->ioaccel2_cmd_pool_dhandle, GFP_KERNEL); | |
| 9287 | 9284 | |
| 9288 | 9285 | h->ioaccel2_blockFetchTable = |
| 9289 | 9286 | kmalloc(((h->ioaccel_maxsg + 1) * |
| @@ -9356,9 +9353,10 @@ static int hpsa_put_ctlr_into_performant_mode(struct ctlr_info *h) · 66 unmodified lines | ||
| 9356 | 9353 | h->reply_queue_size = h->max_commands * sizeof(u64); |
| 9357 | 9354 | |
| 9358 | 9355 | for (i = 0; i < h->nreply_queues; i++) { |
| 9359 | − h->reply_queue[i].head = pci_alloc_consistent(h->pdev, | |
| 9356 | + h->reply_queue[i].head = dma_alloc_coherent(&h->pdev->dev, | |
| 9360 | 9357 | h->reply_queue_size, |
| 9361 | − &(h->reply_queue[i].busaddr)); | |
| 9358 | + &h->reply_queue[i].busaddr, | |
| 9359 | + GFP_KERNEL); | |
| 9362 | 9360 | if (!h->reply_queue[i].head) { |
| 9363 | 9361 | rc = -ENOMEM; |
| 9364 | 9362 | goto clean1; /* rq, ioaccel */ |
| @@ -2266,7 +2266,6 @@ static int ibmvscsis_drop_nexus(struct ibmvscsis_tport *tport) · 2265 unmodified lines | ||
| 2266 | 2266 | /* |
| 2267 | 2267 | * Release the SCSI I_T Nexus to the emulated ibmvscsis Target Port |
| 2268 | 2268 | */ |
| 2269 | − target_wait_for_sess_cmds(se_sess); | |
| 2270 | 2269 | target_remove_session(se_sess); |
| 2271 | 2270 | tport->ibmv_nexus = NULL; |
| 2272 | 2271 | kfree(nexus); |
| @@ -208,7 +208,7 @@ module_param(ips, charp, 0); · 207 unmodified lines | ||
| 208 | 208 | |
| 209 | 209 | #define IPS_DMA_DIR(scb) ((!scb->scsi_cmd || ips_is_passthru(scb->scsi_cmd) || \ |
| 210 | 210 | DMA_NONE == scb->scsi_cmd->sc_data_direction) ? \ |
| 211 | − PCI_DMA_BIDIRECTIONAL : \ | |
| 211 | + DMA_BIDIRECTIONAL : \ | |
| 212 | 212 | scb->scsi_cmd->sc_data_direction) |
| 213 | 213 | |
| 214 | 214 | #ifdef IPS_DEBUG |
| @@ -1529,11 +1529,12 @@ ips_alloc_passthru_buffer(ips_ha_t * ha, int length) · 1314 unmodified lines | ||
| 1529 | 1529 | if (ha->ioctl_data && length <= ha->ioctl_len) |
| 1530 | 1530 | return 0; |
| 1531 | 1531 | /* there is no buffer or it's not big enough, allocate a new one */ |
| 1532 | − bigger_buf = pci_alloc_consistent(ha->pcidev, length, &dma_busaddr); | |
| 1532 | + bigger_buf = dma_alloc_coherent(&ha->pcidev->dev, length, &dma_busaddr, | |
| 1533 | + GFP_KERNEL); | |
| 1533 | 1534 | if (bigger_buf) { |
| 1534 | 1535 | /* free the old memory */ |
| 1535 | − pci_free_consistent(ha->pcidev, ha->ioctl_len, ha->ioctl_data, | |
| 1536 | − ha->ioctl_busaddr); | |
| 1536 | + dma_free_coherent(&ha->pcidev->dev, ha->ioctl_len, | |
| 1537 | + ha->ioctl_data, ha->ioctl_busaddr); | |
| 1537 | 1538 | /* use the new memory */ |
| 1538 | 1539 | ha->ioctl_data = (char *) bigger_buf; |
| 1539 | 1540 | ha->ioctl_len = length; |
| @@ -1678,9 +1679,8 @@ ips_flash_copperhead(ips_ha_t * ha, ips_passthru_t * pt, ips_scb_t * scb) · 138 unmodified lines | ||
| 1678 | 1679 | } else if (!ha->flash_data) { |
| 1679 | 1680 | datasize = pt->CoppCP.cmd.flashfw.total_packets * |
| 1680 | 1681 | pt->CoppCP.cmd.flashfw.count; |
| 1681 | − ha->flash_data = pci_alloc_consistent(ha->pcidev, | |
| 1682 | − datasize, | |
| 1683 | − &ha->flash_busaddr); | |
| 1682 | + ha->flash_data = dma_alloc_coherent(&ha->pcidev->dev, | |
| 1683 | + datasize, &ha->flash_busaddr, GFP_KERNEL); | |
| 1684 | 1684 | if (!ha->flash_data){ |
| 1685 | 1685 | printk(KERN_WARNING "Unable to allocate a flash buffer\n"); |
| 1686 | 1686 | return IPS_FAILURE; |
| @@ -1858,7 +1858,7 @@ ips_flash_firmware(ips_ha_t * ha, ips_passthru_t * pt, ips_scb_t * scb) · 171 unmodified lines | ||
| 1858 | 1858 | |
| 1859 | 1859 | scb->data_len = ha->flash_datasize; |
| 1860 | 1860 | scb->data_busaddr = |
| 1861 | − pci_map_single(ha->pcidev, ha->flash_data, scb->data_len, | |
| 1861 | + dma_map_single(&ha->pcidev->dev, ha->flash_data, scb->data_len, | |
| 1862 | 1862 | IPS_DMA_DIR(scb)); |
| 1863 | 1863 | scb->flags |= IPS_SCB_MAP_SINGLE; |
| 1864 | 1864 | scb->cmd.flashfw.command_id = IPS_COMMAND_ID(ha, scb); |
| @@ -1880,8 +1880,8 @@ ips_free_flash_copperhead(ips_ha_t * ha) · 15 unmodified lines | ||
| 1880 | 1880 | if (ha->flash_data == ips_FlashData) |
| 1881 | 1881 | test_and_clear_bit(0, &ips_FlashDataInUse); |
| 1882 | 1882 | else if (ha->flash_data) |
| 1883 | − pci_free_consistent(ha->pcidev, ha->flash_len, ha->flash_data, | |
| 1884 | − ha->flash_busaddr); | |
| 1883 | + dma_free_coherent(&ha->pcidev->dev, ha->flash_len, | |
| 1884 | + ha->flash_data, ha->flash_busaddr); | |
| 1885 | 1885 | ha->flash_data = NULL; |
| 1886 | 1886 | } |
| 1887 | 1887 | |
| @@ -3485,6 +3485,7 @@ ips_send_cmd(ips_ha_t * ha, ips_scb_t * scb) · 1597 unmodified lines | ||
| 3485 | 3485 | |
| 3486 | 3486 | case START_STOP: |
| 3487 | 3487 | scb->scsi_cmd->result = DID_OK << 16; |
| 3488 | + break; | |
| 3488 | 3489 | |
| 3489 | 3490 | case TEST_UNIT_READY: |
| 3490 | 3491 | case INQUIRY: |
| @@ -4212,7 +4213,7 @@ ips_free(ips_ha_t * ha) · 721 unmodified lines | ||
| 4212 | 4213 | |
| 4213 | 4214 | if (ha) { |
| 4214 | 4215 | if (ha->enq) { |
| 4215 | − pci_free_consistent(ha->pcidev, sizeof(IPS_ENQ), | |
| 4216 | + dma_free_coherent(&ha->pcidev->dev, sizeof(IPS_ENQ), | |
| 4216 | 4217 | ha->enq, ha->enq_busaddr); |
| 4217 | 4218 | ha->enq = NULL; |
| 4218 | 4219 | } |
| @@ -4221,7 +4222,7 @@ ips_free(ips_ha_t * ha) · 2 unmodified lines | ||
| 4221 | 4222 | ha->conf = NULL; |
| 4222 | 4223 | |
| 4223 | 4224 | if (ha->adapt) { |
| 4224 | − pci_free_consistent(ha->pcidev, | |
| 4225 | + dma_free_coherent(&ha->pcidev->dev, | |
| 4225 | 4226 | sizeof (IPS_ADAPTER) + |
| 4226 | 4227 | sizeof (IPS_IO_CMD), ha->adapt, |
| 4227 | 4228 | ha->adapt->hw_status_start); |
| @@ -4229,7 +4230,7 @@ ips_free(ips_ha_t * ha) · 1 unmodified line | ||
| 4229 | 4230 | } |
| 4230 | 4231 | |
| 4231 | 4232 | if (ha->logical_drive_info) { |
| 4232 | − pci_free_consistent(ha->pcidev, | |
| 4233 | + dma_free_coherent(&ha->pcidev->dev, | |
| 4233 | 4234 | sizeof (IPS_LD_INFO), |
| 4234 | 4235 | ha->logical_drive_info, |
| 4235 | 4236 | ha->logical_drive_info_dma_addr); |
| @@ -4243,7 +4244,7 @@ ips_free(ips_ha_t * ha) · 7 unmodified lines | ||
| 4243 | 4244 | ha->subsys = NULL; |
| 4244 | 4245 | |
| 4245 | 4246 | if (ha->ioctl_data) { |
| 4246 | − pci_free_consistent(ha->pcidev, ha->ioctl_len, | |
| 4247 | + dma_free_coherent(&ha->pcidev->dev, ha->ioctl_len, | |
| 4247 | 4248 | ha->ioctl_data, ha->ioctl_busaddr); |
| 4248 | 4249 | ha->ioctl_data = NULL; |
| 4249 | 4250 | ha->ioctl_datasize = 0; |
| @@ -4276,11 +4277,11 @@ static int · 26 unmodified lines | ||
| 4276 | 4277 | ips_deallocatescbs(ips_ha_t * ha, int cmds) |
| 4277 | 4278 | { |
| 4278 | 4279 | if (ha->scbs) { |
| 4279 | − pci_free_consistent(ha->pcidev, | |
| 4280 | + dma_free_coherent(&ha->pcidev->dev, | |
| 4280 | 4281 | IPS_SGLIST_SIZE(ha) * IPS_MAX_SG * cmds, |
| 4281 | 4282 | ha->scbs->sg_list.list, |
| 4282 | 4283 | ha->scbs->sg_busaddr); |
| 4283 | − pci_free_consistent(ha->pcidev, sizeof (ips_scb_t) * cmds, | |
| 4284 | + dma_free_coherent(&ha->pcidev->dev, sizeof (ips_scb_t) * cmds, | |
| 4284 | 4285 | ha->scbs, ha->scbs->scb_busaddr); |
| 4285 | 4286 | ha->scbs = NULL; |
| 4286 | 4287 | } /* end if */ |
| @@ -4307,17 +4308,16 @@ ips_allocatescbs(ips_ha_t * ha) · 20 unmodified lines | ||
| 4307 | 4308 | METHOD_TRACE("ips_allocatescbs", 1); |
| 4308 | 4309 | |
| 4309 | 4310 | /* Allocate memory for the SCBs */ |
| 4310 | − ha->scbs = | |
| 4311 | − pci_alloc_consistent(ha->pcidev, ha->max_cmds * sizeof (ips_scb_t), | |
| 4312 | − &command_dma); | |
| 4311 | + ha->scbs = dma_alloc_coherent(&ha->pcidev->dev, | |
| 4312 | + ha->max_cmds * sizeof (ips_scb_t), | |
| 4313 | + &command_dma, GFP_KERNEL); | |
| 4313 | 4314 | if (ha->scbs == NULL) |
| 4314 | 4315 | return 0; |
| 4315 | − ips_sg.list = | |
| 4316 | − pci_alloc_consistent(ha->pcidev, | |
| 4317 | − IPS_SGLIST_SIZE(ha) * IPS_MAX_SG * | |
| 4318 | − ha->max_cmds, &sg_dma); | |
| 4316 | + ips_sg.list = dma_alloc_coherent(&ha->pcidev->dev, | |
| 4317 | + IPS_SGLIST_SIZE(ha) * IPS_MAX_SG * ha->max_cmds, | |
| 4318 | + &sg_dma, GFP_KERNEL); | |
| 4319 | 4319 | if (ips_sg.list == NULL) { |
| 4320 | − pci_free_consistent(ha->pcidev, | |
| 4320 | + dma_free_coherent(&ha->pcidev->dev, | |
| 4321 | 4321 | ha->max_cmds * sizeof (ips_scb_t), ha->scbs, |
| 4322 | 4322 | command_dma); |
| 4323 | 4323 | return 0; |
| @@ -4446,8 +4446,8 @@ ips_freescb(ips_ha_t * ha, ips_scb_t * scb) · 122 unmodified lines | ||
| 4446 | 4446 | if (scb->flags & IPS_SCB_MAP_SG) |
| 4447 | 4447 | scsi_dma_unmap(scb->scsi_cmd); |
| 4448 | 4448 | else if (scb->flags & IPS_SCB_MAP_SINGLE) |
| 4449 | − pci_unmap_single(ha->pcidev, scb->data_busaddr, scb->data_len, | |
| 4450 | − IPS_DMA_DIR(scb)); | |
| 4449 | + dma_unmap_single(&ha->pcidev->dev, scb->data_busaddr, | |
| 4450 | + scb->data_len, IPS_DMA_DIR(scb)); | |
| 4451 | 4451 | |
| 4452 | 4452 | /* check to make sure this is not our "special" scb */ |
| 4453 | 4453 | if (IPS_COMMAND_ID(ha, scb) < (ha->max_cmds - 1)) { |
| @@ -4559,7 +4559,8 @@ ips_flush_and_reset(ips_ha_t *ha) · 105 unmodified lines | ||
| 4559 | 4559 | dma_addr_t command_dma; |
| 4560 | 4560 | |
| 4561 | 4561 | /* Create a usuable SCB */ |
| 4562 | − scb = pci_alloc_consistent(ha->pcidev, sizeof(ips_scb_t), &command_dma); | |
| 4562 | + scb = dma_alloc_coherent(&ha->pcidev->dev, sizeof(ips_scb_t), | |
| 4563 | + &command_dma, GFP_KERNEL); | |
| 4563 | 4564 | if (scb) { |
| 4564 | 4565 | memset(scb, 0, sizeof(ips_scb_t)); |
| 4565 | 4566 | ips_init_scb(ha, scb); |
| @@ -4594,7 +4595,7 @@ ips_flush_and_reset(ips_ha_t *ha) · 28 unmodified lines | ||
| 4594 | 4595 | /* Now RESET and INIT the adapter */ |
| 4595 | 4596 | (*ha->func.reset) (ha); |
| 4596 | 4597 | |
| 4597 | − pci_free_consistent(ha->pcidev, sizeof(ips_scb_t), scb, command_dma); | |
| 4598 | + dma_free_coherent(&ha->pcidev->dev, sizeof(ips_scb_t), scb, command_dma); | |
| 4598 | 4599 | return; |
| 4599 | 4600 | } |
| 4600 | 4601 | |
| @@ -6926,29 +6927,30 @@ ips_init_phase1(struct pci_dev *pci_dev, int *indexPtr) · 2325 unmodified lines | ||
| 6926 | 6927 | * are guaranteed to be < 4G. |
| 6927 | 6928 | */ |
| 6928 | 6929 | if (IPS_ENABLE_DMA64 && IPS_HAS_ENH_SGLIST(ha) && |
| 6929 | − !pci_set_dma_mask(ha->pcidev, DMA_BIT_MASK(64))) { | |
| 6930 | + !dma_set_mask(&ha->pcidev->dev, DMA_BIT_MASK(64))) { | |
| 6930 | 6931 | (ha)->flags |= IPS_HA_ENH_SG; |
| 6931 | 6932 | } else { |
| 6932 | − if (pci_set_dma_mask(ha->pcidev, DMA_BIT_MASK(32)) != 0) { | |
| 6933 | + if (dma_set_mask(&ha->pcidev->dev, DMA_BIT_MASK(32)) != 0) { | |
| 6933 | 6934 | printk(KERN_WARNING "Unable to set DMA Mask\n"); |
| 6934 | 6935 | return ips_abort_init(ha, index); |
| 6935 | 6936 | } |
| 6936 | 6937 | } |
| 6937 | 6938 | if(ips_cd_boot && !ips_FlashData){ |
| 6938 | − ips_FlashData = pci_alloc_consistent(pci_dev, PAGE_SIZE << 7, | |
| 6939 | − &ips_flashbusaddr); | |
| 6939 | + ips_FlashData = dma_alloc_coherent(&pci_dev->dev, | |
| 6940 | + PAGE_SIZE << 7, &ips_flashbusaddr, GFP_KERNEL); | |
| 6940 | 6941 | } |
| 6941 | 6942 | |
| 6942 | − ha->enq = pci_alloc_consistent(pci_dev, sizeof (IPS_ENQ), | |
| 6943 | − &ha->enq_busaddr); | |
| 6943 | + ha->enq = dma_alloc_coherent(&pci_dev->dev, sizeof (IPS_ENQ), | |
| 6944 | + &ha->enq_busaddr, GFP_KERNEL); | |
| 6944 | 6945 | if (!ha->enq) { |
| 6945 | 6946 | IPS_PRINTK(KERN_WARNING, pci_dev, |
| 6946 | 6947 | "Unable to allocate host inquiry structure\n"); |
| 6947 | 6948 | return ips_abort_init(ha, index); |
| 6948 | 6949 | } |
| 6949 | 6950 | |
| 6950 | − ha->adapt = pci_alloc_consistent(pci_dev, sizeof (IPS_ADAPTER) + | |
| 6951 | − sizeof (IPS_IO_CMD), &dma_address); | |
| 6951 | + ha->adapt = dma_alloc_coherent(&pci_dev->dev, | |
| 6952 | + sizeof (IPS_ADAPTER) + sizeof (IPS_IO_CMD), | |
| 6953 | + &dma_address, GFP_KERNEL); | |
| 6952 | 6954 | if (!ha->adapt) { |
| 6953 | 6955 | IPS_PRINTK(KERN_WARNING, pci_dev, |
| 6954 | 6956 | "Unable to allocate host adapt & dummy structures\n"); |
| @@ -6959,7 +6961,8 @@ ips_init_phase1(struct pci_dev *pci_dev, int *indexPtr) · 4 unmodified lines | ||
| 6959 | 6961 | |
| 6960 | 6962 | |
| 6961 | 6963 | |
| 6962 | − ha->logical_drive_info = pci_alloc_consistent(pci_dev, sizeof (IPS_LD_INFO), &dma_address); | |
| 6964 | + ha->logical_drive_info = dma_alloc_coherent(&pci_dev->dev, | |
| 6965 | + sizeof (IPS_LD_INFO), &dma_address, GFP_KERNEL); | |
| 6963 | 6966 | if (!ha->logical_drive_info) { |
| 6964 | 6967 | IPS_PRINTK(KERN_WARNING, pci_dev, |
| 6965 | 6968 | "Unable to allocate logical drive info structure\n"); |
| @@ -6997,8 +7000,8 @@ ips_init_phase1(struct pci_dev *pci_dev, int *indexPtr) · 31 unmodified lines | ||
| 6997 | 7000 | if (ips_ioctlsize < PAGE_SIZE) |
| 6998 | 7001 | ips_ioctlsize = PAGE_SIZE; |
| 6999 | 7002 | |
| 7000 | − ha->ioctl_data = pci_alloc_consistent(pci_dev, ips_ioctlsize, | |
| 7001 | − &ha->ioctl_busaddr); | |
| 7003 | + ha->ioctl_data = dma_alloc_coherent(&pci_dev->dev, ips_ioctlsize, | |
| 7004 | + &ha->ioctl_busaddr, GFP_KERNEL); | |
| 7002 | 7005 | ha->ioctl_len = ips_ioctlsize; |
| 7003 | 7006 | if (!ha->ioctl_data) { |
| 7004 | 7007 | IPS_PRINTK(KERN_WARNING, pci_dev, |
| @@ -2717,9 +2717,9 @@ enum sci_status sci_controller_continue_io(struct isci_request *ireq) · 2716 unmodified lines | ||
| 2717 | 2717 | * the task management request. |
| 2718 | 2718 | * @task_request: the handle to the task request object to start. |
| 2719 | 2719 | */ |
| 2720 | −enum sci_task_status sci_controller_start_task(struct isci_host *ihost, | |
| 2721 | − struct isci_remote_device *idev, | |
| 2722 | − struct isci_request *ireq) | |
| 2720 | +enum sci_status sci_controller_start_task(struct isci_host *ihost, | |
| 2721 | + struct isci_remote_device *idev, | |
| 2722 | + struct isci_request *ireq) | |
| 2723 | 2723 | { |
| 2724 | 2724 | enum sci_status status; |
| 2725 | 2725 | |
| @@ -2728,7 +2728,7 @@ enum sci_task_status sci_controller_start_task(struct isci_host *ihost, · 2 unmodified lines | ||
| 2728 | 2728 | "%s: SCIC Controller starting task from invalid " |
| 2729 | 2729 | "state\n", |
| 2730 | 2730 | __func__); |
| 2731 | − return SCI_TASK_FAILURE_INVALID_STATE; | |
| 2731 | + return SCI_FAILURE_INVALID_STATE; | |
| 2732 | 2732 | } |
| 2733 | 2733 | |
| 2734 | 2734 | status = sci_remote_device_start_task(ihost, idev, ireq); |
| @@ -489,7 +489,7 @@ enum sci_status sci_controller_start_io( · 488 unmodified lines | ||
| 489 | 489 | struct isci_remote_device *idev, |
| 490 | 490 | struct isci_request *ireq); |
| 491 | 491 | |
| 492 | −enum sci_task_status sci_controller_start_task( | |
| 492 | +enum sci_status sci_controller_start_task( | |
| 493 | 493 | struct isci_host *ihost, |
| 494 | 494 | struct isci_remote_device *idev, |
| 495 | 495 | struct isci_request *ireq); |
| @@ -1626,9 +1626,9 @@ static enum sci_status atapi_d2h_reg_frame_handler(struct isci_request *ireq, · 1625 unmodified lines | ||
| 1626 | 1626 | |
| 1627 | 1627 | if (status == SCI_SUCCESS) { |
| 1628 | 1628 | if (ireq->stp.rsp.status & ATA_ERR) |
| 1629 | − status = SCI_IO_FAILURE_RESPONSE_VALID; | |
| 1629 | + status = SCI_FAILURE_IO_RESPONSE_VALID; | |
| 1630 | 1630 | } else { |
| 1631 | − status = SCI_IO_FAILURE_RESPONSE_VALID; | |
| 1631 | + status = SCI_FAILURE_IO_RESPONSE_VALID; | |
| 1632 | 1632 | } |
| 1633 | 1633 | |
| 1634 | 1634 | if (status != SCI_SUCCESS) { |
| @@ -258,7 +258,7 @@ static int isci_task_execute_tmf(struct isci_host *ihost, · 257 unmodified lines | ||
| 258 | 258 | struct isci_tmf *tmf, unsigned long timeout_ms) |
| 259 | 259 | { |
| 260 | 260 | DECLARE_COMPLETION_ONSTACK(completion); |
| 261 | − enum sci_task_status status = SCI_TASK_FAILURE; | |
| 261 | + enum sci_status status = SCI_FAILURE; | |
| 262 | 262 | struct isci_request *ireq; |
| 263 | 263 | int ret = TMF_RESP_FUNC_FAILED; |
| 264 | 264 | unsigned long flags; |
| @@ -301,7 +301,7 @@ static int isci_task_execute_tmf(struct isci_host *ihost, · 36 unmodified lines | ||
| 301 | 301 | /* start the TMF io. */ |
| 302 | 302 | status = sci_controller_start_task(ihost, idev, ireq); |
| 303 | 303 | |
| 304 | − if (status != SCI_TASK_SUCCESS) { | |
| 304 | + if (status != SCI_SUCCESS) { | |
| 305 | 305 | dev_dbg(&ihost->pdev->dev, |
| 306 | 306 | "%s: start_io failed - status = 0x%x, request = %p\n", |
| 307 | 307 | __func__, |
| @@ -800,7 +800,8 @@ static int iscsi_sw_tcp_host_get_param(struct Scsi_Host *shost, · 799 unmodified lines | ||
| 800 | 800 | return rc; |
| 801 | 801 | |
| 802 | 802 | return iscsi_conn_get_addr_param((struct sockaddr_storage *) |
| 803 | − &addr, param, buf); | |
| 803 | + &addr, | |
| 804 | + (enum iscsi_param)param, buf); | |
| 804 | 805 | default: |
| 805 | 806 | return iscsi_host_get_param(shost, param, buf); |
| 806 | 807 | } |
| @@ -38,30 +38,6 @@ static u8 jazz_esp_read8(struct esp *esp, unsigned long reg) · 37 unmodified lines | ||
| 38 | 38 | return *(volatile u8 *)(esp->regs + reg); |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | −static dma_addr_t jazz_esp_map_single(struct esp *esp, void *buf, | |
| 42 | − size_t sz, int dir) | |
| 43 | −{ | |
| 44 | − return dma_map_single(esp->dev, buf, sz, dir); | |
| 45 | −} | |
| 46 | − | |
| 47 | −static int jazz_esp_map_sg(struct esp *esp, struct scatterlist *sg, | |
| 48 | − int num_sg, int dir) | |
| 49 | −{ | |
| 50 | − return dma_map_sg(esp->dev, sg, num_sg, dir); | |
| 51 | −} | |
| 52 | − | |
| 53 | −static void jazz_esp_unmap_single(struct esp *esp, dma_addr_t addr, | |
| 54 | − size_t sz, int dir) | |
| 55 | −{ | |
| 56 | − dma_unmap_single(esp->dev, addr, sz, dir); | |
| 57 | −} | |
| 58 | − | |
| 59 | −static void jazz_esp_unmap_sg(struct esp *esp, struct scatterlist *sg, | |
| 60 | − int num_sg, int dir) | |
| 61 | −{ | |
| 62 | − dma_unmap_sg(esp->dev, sg, num_sg, dir); | |
| 63 | −} | |
| 64 | − | |
| 65 | 41 | static int jazz_esp_irq_pending(struct esp *esp) |
| 66 | 42 | { |
| 67 | 43 | if (jazz_esp_read8(esp, ESP_STATUS) & ESP_STAT_INTR) |
| @@ -117,10 +93,6 @@ static int jazz_esp_dma_error(struct esp *esp) · 49 unmodified lines | ||
| 117 | 93 | static const struct esp_driver_ops jazz_esp_ops = { |
| 118 | 94 | .esp_write8 = jazz_esp_write8, |
| 119 | 95 | .esp_read8 = jazz_esp_read8, |
| 120 | − .map_single = jazz_esp_map_single, | |
| 121 | − .map_sg = jazz_esp_map_sg, | |
| 122 | − .unmap_single = jazz_esp_unmap_single, | |
| 123 | − .unmap_sg = jazz_esp_unmap_sg, | |
| 124 | 96 | .irq_pending = jazz_esp_irq_pending, |
| 125 | 97 | .reset_dma = jazz_esp_reset_dma, |
| 126 | 98 | .dma_drain = jazz_esp_dma_drain, |
| @@ -182,7 +154,7 @@ static int esp_jazz_probe(struct platform_device *dev) · 55 unmodified lines | ||
| 182 | 154 | |
| 183 | 155 | dev_set_drvdata(&dev->dev, esp); |
| 184 | 156 | |
| 185 | − err = scsi_esp_register(esp, &dev->dev); | |
| 157 | + err = scsi_esp_register(esp); | |
| 186 | 158 | if (err) |
| 187 | 159 | goto fail_free_irq; |
| 188 | 160 | |
| @@ -1872,7 +1872,6 @@ int fc_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *sc_cmd) · 1871 unmodified lines | ||
| 1872 | 1872 | struct fc_lport *lport = shost_priv(shost); |
| 1873 | 1873 | struct fc_rport *rport = starget_to_rport(scsi_target(sc_cmd->device)); |
| 1874 | 1874 | struct fc_fcp_pkt *fsp; |
| 1875 | − struct fc_rport_libfc_priv *rpriv; | |
| 1876 | 1875 | int rval; |
| 1877 | 1876 | int rc = 0; |
| 1878 | 1877 | struct fc_stats *stats; |
| @@ -1894,8 +1893,6 @@ int fc_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *sc_cmd) · 15 unmodified lines | ||
| 1894 | 1893 | goto out; |
| 1895 | 1894 | } |
| 1896 | 1895 | |
| 1897 | − rpriv = rport->dd_data; | |
| 1898 | − | |
| 1899 | 1896 | if (!fc_fcp_lport_queue_ready(lport)) { |
| 1900 | 1897 | if (lport->qfull) { |
| 1901 | 1898 | if (fc_fcp_can_queue_ramp_down(lport)) |
| @@ -2295,8 +2292,7 @@ int fc_setup_fcp(void) · 393 unmodified lines | ||
| 2295 | 2292 | |
| 2296 | 2293 | void fc_destroy_fcp(void) |
| 2297 | 2294 | { |
| 2298 | − if (scsi_pkt_cachep) | |
| 2299 | − kmem_cache_destroy(scsi_pkt_cachep); | |
| 2295 | + kmem_cache_destroy(scsi_pkt_cachep); | |
| 2300 | 2296 | } |
| 2301 | 2297 | |
| 2302 | 2298 | /** |
| @@ -1038,8 +1038,11 @@ static void fc_rport_plogi_resp(struct fc_seq *sp, struct fc_frame *fp, · 1037 unmodified lines | ||
| 1038 | 1038 | struct fc_els_ls_rjt *rjt; |
| 1039 | 1039 | |
| 1040 | 1040 | rjt = fc_frame_payload_get(fp, sizeof(*rjt)); |
| 1041 | − FC_RPORT_DBG(rdata, "PLOGI ELS rejected, reason %x expl %x\n", | |
| 1042 | − rjt->er_reason, rjt->er_explan); | |
| 1041 | + if (!rjt) | |
| 1042 | + FC_RPORT_DBG(rdata, "PLOGI bad response\n"); | |
| 1043 | + else | |
| 1044 | + FC_RPORT_DBG(rdata, "PLOGI ELS rejected, reason %x expl %x\n", | |
| 1045 | + rjt->er_reason, rjt->er_explan); | |
| 1043 | 1046 | fc_rport_error_retry(rdata, -FC_EX_ELS_RJT); |
| 1044 | 1047 | } |
| 1045 | 1048 | out: |
| @@ -1158,8 +1161,10 @@ static void fc_rport_prli_resp(struct fc_seq *sp, struct fc_frame *fp, · 112 unmodified lines | ||
| 1158 | 1161 | op = fc_frame_payload_op(fp); |
| 1159 | 1162 | if (op == ELS_LS_ACC) { |
| 1160 | 1163 | pp = fc_frame_payload_get(fp, sizeof(*pp)); |
| 1161 | − if (!pp) | |
| 1164 | + if (!pp) { | |
| 1165 | + fc_rport_error_retry(rdata, -FC_EX_SEQ_ERR); | |
| 1162 | 1166 | goto out; |
| 1167 | + } | |
| 1163 | 1168 | |
| 1164 | 1169 | resp_code = (pp->spp.spp_flags & FC_SPP_RESP_MASK); |
| 1165 | 1170 | FC_RPORT_DBG(rdata, "PRLI spp_flags = 0x%x spp_type 0x%x\n", |
| @@ -1172,8 +1177,10 @@ static void fc_rport_prli_resp(struct fc_seq *sp, struct fc_frame *fp, · 6 unmodified lines | ||
| 1172 | 1177 | fc_rport_error_retry(rdata, -FC_EX_SEQ_ERR); |
| 1173 | 1178 | goto out; |
| 1174 | 1179 | } |
| 1175 | − if (pp->prli.prli_spp_len < sizeof(pp->spp)) | |
| 1180 | + if (pp->prli.prli_spp_len < sizeof(pp->spp)) { | |
| 1181 | + fc_rport_error_retry(rdata, -FC_EX_SEQ_ERR); | |
| 1176 | 1182 | goto out; |
| 1183 | + } | |
| 1177 | 1184 | |
| 1178 | 1185 | fcp_parm = ntohl(pp->spp.spp_params); |
| 1179 | 1186 | if (fcp_parm & FCP_SPPF_RETRY) |
| @@ -1211,8 +1218,11 @@ static void fc_rport_prli_resp(struct fc_seq *sp, struct fc_frame *fp, · 31 unmodified lines | ||
| 1211 | 1218 | |
| 1212 | 1219 | } else { |
| 1213 | 1220 | rjt = fc_frame_payload_get(fp, sizeof(*rjt)); |
| 1214 | − FC_RPORT_DBG(rdata, "PRLI ELS rejected, reason %x expl %x\n", | |
| 1215 | − rjt->er_reason, rjt->er_explan); | |
| 1221 | + if (!rjt) | |
| 1222 | + FC_RPORT_DBG(rdata, "PRLI bad response\n"); | |
| 1223 | + else | |
| 1224 | + FC_RPORT_DBG(rdata, "PRLI ELS rejected, reason %x expl %x\n", | |
| 1225 | + rjt->er_reason, rjt->er_explan); | |
| 1216 | 1226 | fc_rport_error_retry(rdata, FC_EX_ELS_RJT); |
| 1217 | 1227 | } |
| 1218 | 1228 | |
| @@ -654,7 +654,7 @@ void sas_probe_sata(struct asd_sas_port *port) · 653 unmodified lines | ||
| 654 | 654 | /* if libata could not bring the link up, don't surface |
| 655 | 655 | * the device |
| 656 | 656 | */ |
| 657 | − if (ata_dev_disabled(sas_to_ata_dev(dev))) | |
| 657 | + if (!ata_dev_enabled(sas_to_ata_dev(dev))) | |
| 658 | 658 | sas_fail_probe(dev, __func__, -ENODEV); |
| 659 | 659 | } |
| 660 | 660 | |
| @@ -260,7 +260,7 @@ static void sas_suspend_devices(struct work_struct *work) · 259 unmodified lines | ||
| 260 | 260 | * phy_list is not being mutated |
| 261 | 261 | */ |
| 262 | 262 | list_for_each_entry(phy, &port->phy_list, port_phy_el) { |
| 263 | − if (si->dft->lldd_port_formed) | |
| 263 | + if (si->dft->lldd_port_deformed) | |
| 264 | 264 | si->dft->lldd_port_deformed(phy); |
| 265 | 265 | phy->suspended = 1; |
| 266 | 266 | port->suspended = 1; |
| @@ -48,17 +48,16 @@ static void smp_task_timedout(struct timer_list *t) · 47 unmodified lines | ||
| 48 | 48 | unsigned long flags; |
| 49 | 49 | |
| 50 | 50 | spin_lock_irqsave(&task->task_state_lock, flags); |
| 51 | − if (!(task->task_state_flags & SAS_TASK_STATE_DONE)) | |
| 51 | + if (!(task->task_state_flags & SAS_TASK_STATE_DONE)) { | |
| 52 | 52 | task->task_state_flags |= SAS_TASK_STATE_ABORTED; |
| 53 | + complete(&task->slow_task->completion); | |
| 54 | + } | |
| 53 | 55 | spin_unlock_irqrestore(&task->task_state_lock, flags); |
| 54 | − | |
| 55 | − complete(&task->slow_task->completion); | |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | static void smp_task_done(struct sas_task *task) |
| 59 | 59 | { |
| 60 | − if (!del_timer(&task->slow_task->timer)) | |
| 61 | − return; | |
| 60 | + del_timer(&task->slow_task->timer); | |
| 62 | 61 | complete(&task->slow_task->completion); |
| 63 | 62 | } |
| 64 | 63 | |
| @@ -2054,14 +2053,11 @@ static int sas_rediscover_dev(struct domain_device *dev, int phy_id, bool last) · 1989 unmodified lines | ||
| 2054 | 2053 | return res; |
| 2055 | 2054 | } |
| 2056 | 2055 | |
| 2057 | − /* delete the old link */ | |
| 2058 | − if (SAS_ADDR(phy->attached_sas_addr) && | |
| 2059 | − SAS_ADDR(sas_addr) != SAS_ADDR(phy->attached_sas_addr)) { | |
| 2060 | − SAS_DPRINTK("ex %016llx phy 0x%x replace %016llx\n", | |
| 2061 | − SAS_ADDR(dev->sas_addr), phy_id, | |
| 2062 | − SAS_ADDR(phy->attached_sas_addr)); | |
| 2063 | − sas_unregister_devs_sas_addr(dev, phy_id, last); | |
| 2064 | − } | |
| 2056 | + /* we always have to delete the old device when we went here */ | |
| 2057 | + SAS_DPRINTK("ex %016llx phy 0x%x replace %016llx\n", | |
| 2058 | + SAS_ADDR(dev->sas_addr), phy_id, | |
| 2059 | + SAS_ADDR(phy->attached_sas_addr)); | |
| 2060 | + sas_unregister_devs_sas_addr(dev, phy_id, last); | |
| 2065 | 2061 | |
| 2066 | 2062 | return sas_discover_new(dev, phy_id); |
| 2067 | 2063 | } |
| @@ -52,7 +52,7 @@ struct lpfc_sli2_slim; · 51 unmodified lines | ||
| 52 | 52 | downloads using bsg */ |
| 53 | 53 | |
| 54 | 54 | #define LPFC_MIN_SG_SLI4_BUF_SZ 0x800 /* based on LPFC_DEFAULT_SG_SEG_CNT */ |
| 55 | −#define LPFC_MAX_SG_SLI4_SEG_CNT_DIF 128 /* sg element count per scsi cmnd */ | |
| 55 | +#define LPFC_MAX_BG_SLI4_SEG_CNT_DIF 128 /* sg element count for BlockGuard */ | |
| 56 | 56 | #define LPFC_MAX_SG_SEG_CNT_DIF 512 /* sg element count per scsi cmnd */ |
| 57 | 57 | #define LPFC_MAX_SG_SEG_CNT 4096 /* sg element count per scsi cmnd */ |
| 58 | 58 | #define LPFC_MIN_SG_SEG_CNT 32 /* sg element count per scsi cmnd */ |
| @@ -583,6 +583,25 @@ struct lpfc_mbox_ext_buf_ctx { · 524 unmodified lines | ||
| 583 | 583 | struct list_head ext_dmabuf_list; |
| 584 | 584 | }; |
| 585 | 585 | |
| 586 | +struct lpfc_ras_fwlog { | |
| 587 | + uint8_t *fwlog_buff; | |
| 588 | + uint32_t fw_buffcount; /* Buffer size posted to FW */ | |
| 589 | +#define LPFC_RAS_BUFF_ENTERIES 16 /* Each entry can hold max of 64k */ | |
| 590 | +#define LPFC_RAS_MAX_ENTRY_SIZE (64 * 1024) | |
| 591 | +#define LPFC_RAS_MIN_BUFF_POST_SIZE (256 * 1024) | |
| 592 | +#define LPFC_RAS_MAX_BUFF_POST_SIZE (1024 * 1024) | |
| 593 | + uint32_t fw_loglevel; /* Log level set */ | |
| 594 | + struct lpfc_dmabuf lwpd; | |
| 595 | + struct list_head fwlog_buff_list; | |
| 596 | + | |
| 597 | + /* RAS support status on adapter */ | |
| 598 | + bool ras_hwsupport; /* RAS Support available on HW or not */ | |
| 599 | + bool ras_enabled; /* Ras Enabled for the function */ | |
| 600 | +#define LPFC_RAS_DISABLE_LOGGING 0x00 | |
| 601 | +#define LPFC_RAS_ENABLE_LOGGING 0x01 | |
| 602 | + bool ras_active; /* RAS logging running state */ | |
| 603 | +}; | |
| 604 | + | |
| 586 | 605 | struct lpfc_hba { |
| 587 | 606 | /* SCSI interface function jump table entries */ |
| 588 | 607 | int (*lpfc_new_scsi_buf) |
| @@ -790,6 +809,7 @@ struct lpfc_hba { · 201 unmodified lines | ||
| 790 | 809 | uint32_t cfg_total_seg_cnt; |
| 791 | 810 | uint32_t cfg_sg_seg_cnt; |
| 792 | 811 | uint32_t cfg_nvme_seg_cnt; |
| 812 | + uint32_t cfg_scsi_seg_cnt; | |
| 793 | 813 | uint32_t cfg_sg_dma_buf_size; |
| 794 | 814 | uint64_t cfg_soft_wwnn; |
| 795 | 815 | uint64_t cfg_soft_wwpn; |
| @@ -833,6 +853,9 @@ struct lpfc_hba { · 37 unmodified lines | ||
| 833 | 853 | #define LPFC_FDMI_SUPPORT 1 /* FDMI supported? */ |
| 834 | 854 | uint32_t cfg_enable_SmartSAN; |
| 835 | 855 | uint32_t cfg_enable_mds_diags; |
| 856 | + uint32_t cfg_ras_fwlog_level; | |
| 857 | + uint32_t cfg_ras_fwlog_buffsize; | |
| 858 | + uint32_t cfg_ras_fwlog_func; | |
| 836 | 859 | uint32_t cfg_enable_fc4_type; |
| 837 | 860 | uint32_t cfg_enable_bbcr; /* Enable BB Credit Recovery */ |
| 838 | 861 | uint32_t cfg_enable_dpp; /* Enable Direct Packet Push */ |
| @@ -963,6 +986,7 @@ struct lpfc_hba { · 124 unmodified lines | ||
| 963 | 986 | uint32_t intr_mode; |
| 964 | 987 | #define LPFC_INTR_ERROR 0xFFFFFFFF |
| 965 | 988 | struct list_head port_list; |
| 989 | + spinlock_t port_list_lock; /* lock for port_list mutations */ | |
| 966 | 990 | struct lpfc_vport *pport; /* physical lpfc_vport pointer */ |
| 967 | 991 | uint16_t max_vpi; /* Maximum virtual nports */ |
| 968 | 992 | #define LPFC_MAX_VPI 0xFFFF /* Max number of VPI supported */ |
| @@ -1092,6 +1116,9 @@ struct lpfc_hba { · 123 unmodified lines | ||
| 1092 | 1116 | struct unsol_rcv_ct_ctx ct_ctx[LPFC_CT_CTX_MAX]; |
| 1093 | 1117 | uint32_t ctx_idx; |
| 1094 | 1118 | |
| 1119 | + /* RAS Support */ | |
| 1120 | + struct lpfc_ras_fwlog ras_fwlog; | |
| 1121 | + | |
| 1095 | 1122 | uint8_t menlo_flag; /* menlo generic flags */ |
| 1096 | 1123 | #define HBA_MENLO_SUPPORT 0x1 /* HBA supports menlo commands */ |
| 1097 | 1124 | uint32_t iocb_cnt; |
| @@ -5358,15 +5358,74 @@ LPFC_ATTR(delay_discovery, 0, 0, 1, · 5357 unmodified lines | ||
| 5358 | 5358 | |
| 5359 | 5359 | /* |
| 5360 | 5360 | * lpfc_sg_seg_cnt - Initial Maximum DMA Segment Count |
| 5361 | − * This value can be set to values between 64 and 4096. The default value is | |
| 5362 | − * 64, but may be increased to allow for larger Max I/O sizes. The scsi layer | |
| 5363 | − * will be allowed to request I/Os of sizes up to (MAX_SEG_COUNT * SEG_SIZE). | |
| 5361 | + * This value can be set to values between 64 and 4096. The default value | |
| 5362 | + * is 64, but may be increased to allow for larger Max I/O sizes. The scsi | |
| 5363 | + * and nvme layers will allow I/O sizes up to (MAX_SEG_COUNT * SEG_SIZE). | |
| 5364 | 5364 | * Because of the additional overhead involved in setting up T10-DIF, |
| 5365 | 5365 | * this parameter will be limited to 128 if BlockGuard is enabled under SLI4 |
| 5366 | 5366 | * and will be limited to 512 if BlockGuard is enabled under SLI3. |
| 5367 | 5367 | */ |
| 5368 | −LPFC_ATTR_R(sg_seg_cnt, LPFC_DEFAULT_SG_SEG_CNT, LPFC_MIN_SG_SEG_CNT, | |
| 5369 | − LPFC_MAX_SG_SEG_CNT, "Max Scatter Gather Segment Count"); | |
| 5368 | +static uint lpfc_sg_seg_cnt = LPFC_DEFAULT_SG_SEG_CNT; | |
| 5369 | +module_param(lpfc_sg_seg_cnt, uint, 0444); | |
| 5370 | +MODULE_PARM_DESC(lpfc_sg_seg_cnt, "Max Scatter Gather Segment Count"); | |
| 5371 | + | |
| 5372 | +/** | |
| 5373 | + * lpfc_sg_seg_cnt_show - Display the scatter/gather list sizes | |
| 5374 | + * configured for the adapter | |
| 5375 | + * @dev: class converted to a Scsi_host structure. | |
| 5376 | + * @attr: device attribute, not used. | |
| 5377 | + * @buf: on return contains a string with the list sizes | |
| 5378 | + * | |
| 5379 | + * Returns: size of formatted string. | |
| 5380 | + **/ | |
| 5381 | +static ssize_t | |
| 5382 | +lpfc_sg_seg_cnt_show(struct device *dev, struct device_attribute *attr, | |
| 5383 | + char *buf) | |
| 5384 | +{ | |
| 5385 | + struct Scsi_Host *shost = class_to_shost(dev); | |
| 5386 | + struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; | |
| 5387 | + struct lpfc_hba *phba = vport->phba; | |
| 5388 | + int len; | |
| 5389 | + | |
| 5390 | + len = snprintf(buf, PAGE_SIZE, "SGL sz: %d total SGEs: %d\n", | |
| 5391 | + phba->cfg_sg_dma_buf_size, phba->cfg_total_seg_cnt); | |
| 5392 | + | |
| 5393 | + len += snprintf(buf + len, PAGE_SIZE, "Cfg: %d SCSI: %d NVME: %d\n", | |
| 5394 | + phba->cfg_sg_seg_cnt, phba->cfg_scsi_seg_cnt, | |
| 5395 | + phba->cfg_nvme_seg_cnt); | |
| 5396 | + return len; | |
| 5397 | +} | |
| 5398 | + | |
| 5399 | +static DEVICE_ATTR_RO(lpfc_sg_seg_cnt); | |
| 5400 | + | |
| 5401 | +/** | |
| 5402 | + * lpfc_sg_seg_cnt_init - Set the hba sg_seg_cnt initial value | |
| 5403 | + * @phba: lpfc_hba pointer. | |
| 5404 | + * @val: contains the initial value | |
| 5405 | + * | |
| 5406 | + * Description: | |
| 5407 | + * Validates the initial value is within range and assigns it to the | |
| 5408 | + * adapter. If not in range, an error message is posted and the | |
| 5409 | + * default value is assigned. | |
| 5410 | + * | |
| 5411 | + * Returns: | |
| 5412 | + * zero if value is in range and is set | |
| 5413 | + * -EINVAL if value was out of range | |
| 5414 | + **/ | |
| 5415 | +static int | |
| 5416 | +lpfc_sg_seg_cnt_init(struct lpfc_hba *phba, int val) | |
| 5417 | +{ | |
| 5418 | + if (val >= LPFC_MIN_SG_SEG_CNT && val <= LPFC_MAX_SG_SEG_CNT) { | |
| 5419 | + phba->cfg_sg_seg_cnt = val; | |
| 5420 | + return 0; | |
| 5421 | + } | |
| 5422 | + lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | |
| 5423 | + "0409 "LPFC_DRIVER_NAME"_sg_seg_cnt attribute cannot " | |
| 5424 | + "be set to %d, allowed range is [%d, %d]\n", | |
| 5425 | + val, LPFC_MIN_SG_SEG_CNT, LPFC_MAX_SG_SEG_CNT); | |
| 5426 | + phba->cfg_sg_seg_cnt = LPFC_DEFAULT_SG_SEG_CNT; | |
| 5427 | + return -EINVAL; | |
| 5428 | +} | |
| 5370 | 5429 | |
| 5371 | 5430 | /* |
| 5372 | 5431 | * lpfc_enable_mds_diags: Enable MDS Diagnostics |
| @@ -5376,6 +5435,31 @@ LPFC_ATTR_R(sg_seg_cnt, LPFC_DEFAULT_SG_SEG_CNT, LPFC_MIN_SG_SEG_CNT, · 3 unmodified lines | ||
| 5376 | 5435 | */ |
| 5377 | 5436 | LPFC_ATTR_R(enable_mds_diags, 0, 0, 1, "Enable MDS Diagnostics"); |
| 5378 | 5437 | |
| 5438 | +/* | |
| 5439 | + * lpfc_ras_fwlog_buffsize: Firmware logging host buffer size | |
| 5440 | + * 0 = Disable firmware logging (default) | |
| 5441 | + * [1-4] = Multiple of 1/4th Mb of host memory for FW logging | |
| 5442 | + * Value range [0..4]. Default value is 0 | |
| 5443 | + */ | |
| 5444 | +LPFC_ATTR_RW(ras_fwlog_buffsize, 0, 0, 4, "Host memory for FW logging"); | |
| 5445 | + | |
| 5446 | +/* | |
| 5447 | + * lpfc_ras_fwlog_level: Firmware logging verbosity level | |
| 5448 | + * Valid only if firmware logging is enabled | |
| 5449 | + * 0(Least Verbosity) 4 (most verbosity) | |
| 5450 | + * Value range is [0..4]. Default value is 0 | |
| 5451 | + */ | |
| 5452 | +LPFC_ATTR_RW(ras_fwlog_level, 0, 0, 4, "Firmware Logging Level"); | |
| 5453 | + | |
| 5454 | +/* | |
| 5455 | + * lpfc_ras_fwlog_func: Firmware logging enabled on function number | |
| 5456 | + * Default function which has RAS support : 0 | |
| 5457 | + * Value Range is [0..7]. | |
| 5458 | + * FW logging is a global action and enablement is via a specific | |
| 5459 | + * port. | |
| 5460 | + */ | |
| 5461 | +LPFC_ATTR_RW(ras_fwlog_func, 0, 0, 7, "Firmware Logging Enabled on Function"); | |
| 5462 | + | |
| 5379 | 5463 | /* |
| 5380 | 5464 | * lpfc_enable_bbcr: Enable BB Credit Recovery |
| 5381 | 5465 | * 0 = BB Credit Recovery disabled |
| @@ -5501,6 +5585,9 @@ struct device_attribute *lpfc_hba_attrs[] = { · 119 unmodified lines | ||
| 5501 | 5585 | &dev_attr_protocol, |
| 5502 | 5586 | &dev_attr_lpfc_xlane_supported, |
| 5503 | 5587 | &dev_attr_lpfc_enable_mds_diags, |
| 5588 | + &dev_attr_lpfc_ras_fwlog_buffsize, | |
| 5589 | + &dev_attr_lpfc_ras_fwlog_level, | |
| 5590 | + &dev_attr_lpfc_ras_fwlog_func, | |
| 5504 | 5591 | &dev_attr_lpfc_enable_bbcr, |
| 5505 | 5592 | &dev_attr_lpfc_enable_dpp, |
| 5506 | 5593 | NULL, |
| @@ -6587,6 +6674,20 @@ lpfc_get_cfgparam(struct lpfc_hba *phba) · 1080 unmodified lines | ||
| 6587 | 6674 | lpfc_sli_mode_init(phba, lpfc_sli_mode); |
| 6588 | 6675 | phba->cfg_enable_dss = 1; |
| 6589 | 6676 | lpfc_enable_mds_diags_init(phba, lpfc_enable_mds_diags); |
| 6677 | + lpfc_ras_fwlog_buffsize_init(phba, lpfc_ras_fwlog_buffsize); | |
| 6678 | + lpfc_ras_fwlog_level_init(phba, lpfc_ras_fwlog_level); | |
| 6679 | + lpfc_ras_fwlog_func_init(phba, lpfc_ras_fwlog_func); | |
| 6680 | + | |
| 6681 | + | |
| 6682 | + /* If the NVME FC4 type is enabled, scale the sg_seg_cnt to | |
| 6683 | + * accommodate 512K and 1M IOs in a single nvme buf and supply | |
| 6684 | + * enough NVME LS iocb buffers for larger connectivity counts. | |
| 6685 | + */ | |
| 6686 | + if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { | |
| 6687 | + phba->cfg_sg_seg_cnt = LPFC_MAX_NVME_SEG_CNT; | |
| 6688 | + phba->cfg_iocb_cnt = 5; | |
| 6689 | + } | |
| 6690 | + | |
| 6590 | 6691 | return; |
| 6591 | 6692 | } |
| 6592 | 6693 | |
| @@ -27,6 +27,7 @@ · 26 unmodified lines | ||
| 27 | 27 | #include <linux/delay.h> |
| 28 | 28 | #include <linux/list.h> |
| 29 | 29 | #include <linux/bsg-lib.h> |
| 30 | +#include <linux/vmalloc.h> | |
| 30 | 31 | |
| 31 | 32 | #include <scsi/scsi.h> |
| 32 | 33 | #include <scsi/scsi_host.h> |
| @@ -2843,9 +2844,6 @@ diag_cmd_data_alloc(struct lpfc_hba *phba, · 2810 unmodified lines | ||
| 2843 | 2844 | |
| 2844 | 2845 | if (nocopydata) { |
| 2845 | 2846 | bpl->tus.f.bdeFlags = 0; |
| 2846 | − pci_dma_sync_single_for_device(phba->pcidev, | |
| 2847 | − dmp->dma.phys, LPFC_BPL_SIZE, PCI_DMA_TODEVICE); | |
| 2848 | − | |
| 2849 | 2847 | } else { |
| 2850 | 2848 | memset((uint8_t *)dmp->dma.virt, 0, cnt); |
| 2851 | 2849 | bpl->tus.f.bdeFlags = BUFF_TYPE_BDE_64I; |
| @@ -5308,6 +5306,330 @@ job_error: · 2456 unmodified lines | ||
| 5308 | 5306 | return rc; |
| 5309 | 5307 | } |
| 5310 | 5308 | |
| 5309 | +/** | |
| 5310 | + * lpfc_check_fwlog_support: Check FW log support on the adapter | |
| 5311 | + * @phba: Pointer to HBA context object. | |
| 5312 | + * | |
| 5313 | + * Check if FW Logging support by the adapter | |
| 5314 | + **/ | |
| 5315 | +int | |
| 5316 | +lpfc_check_fwlog_support(struct lpfc_hba *phba) | |
| 5317 | +{ | |
| 5318 | + struct lpfc_ras_fwlog *ras_fwlog = NULL; | |
| 5319 | + | |
| 5320 | + ras_fwlog = &phba->ras_fwlog; | |
| 5321 | + | |
| 5322 | + if (ras_fwlog->ras_hwsupport == false) | |
| 5323 | + return -EACCES; | |
| 5324 | + else if (ras_fwlog->ras_enabled == false) | |
| 5325 | + return -EPERM; | |
| 5326 | + else | |
| 5327 | + return 0; | |
| 5328 | +} | |
| 5329 | + | |
| 5330 | +/** | |
| 5331 | + * lpfc_bsg_get_ras_config: Get RAS configuration settings | |
| 5332 | + * @job: fc_bsg_job to handle | |
| 5333 | + * | |
| 5334 | + * Get RAS configuration values set. | |
| 5335 | + **/ | |
| 5336 | +static int | |
| 5337 | +lpfc_bsg_get_ras_config(struct bsg_job *job) | |
| 5338 | +{ | |
| 5339 | + struct Scsi_Host *shost = fc_bsg_to_shost(job); | |
| 5340 | + struct lpfc_vport *vport = shost_priv(shost); | |
| 5341 | + struct fc_bsg_reply *bsg_reply = job->reply; | |
| 5342 | + struct lpfc_hba *phba = vport->phba; | |
| 5343 | + struct lpfc_bsg_get_ras_config_reply *ras_reply; | |
| 5344 | + struct lpfc_ras_fwlog *ras_fwlog = &phba->ras_fwlog; | |
| 5345 | + int rc = 0; | |
| 5346 | + | |
| 5347 | + if (job->request_len < | |
| 5348 | + sizeof(struct fc_bsg_request) + | |
| 5349 | + sizeof(struct lpfc_bsg_ras_req)) { | |
| 5350 | + lpfc_printf_log(phba, KERN_ERR, LOG_LIBDFC, | |
| 5351 | + "6181 Received RAS_LOG request " | |
| 5352 | + "below minimum size\n"); | |
| 5353 | + rc = -EINVAL; | |
| 5354 | + goto ras_job_error; | |
| 5355 | + } | |
| 5356 | + | |
| 5357 | + /* Check FW log status */ | |
| 5358 | + rc = lpfc_check_fwlog_support(phba); | |
| 5359 | + if (rc == -EACCES || rc == -EPERM) | |
| 5360 | + goto ras_job_error; | |
| 5361 | + | |
| 5362 | + ras_reply = (struct lpfc_bsg_get_ras_config_reply *) | |
| 5363 | + bsg_reply->reply_data.vendor_reply.vendor_rsp; | |
| 5364 | + | |
| 5365 | + /* Current logging state */ | |
| 5366 | + if (ras_fwlog->ras_active == true) | |
| 5367 | + ras_reply->state = LPFC_RASLOG_STATE_RUNNING; | |
| 5368 | + else | |
| 5369 | + ras_reply->state = LPFC_RASLOG_STATE_STOPPED; | |
| 5370 | + | |
| 5371 | + ras_reply->log_level = phba->ras_fwlog.fw_loglevel; | |
| 5372 | + ras_reply->log_buff_sz = phba->cfg_ras_fwlog_buffsize; | |
| 5373 | + | |
| 5374 | +ras_job_error: | |
| 5375 | + /* make error code available to userspace */ | |
| 5376 | + bsg_reply->result = rc; | |
| 5377 | + | |
| 5378 | + /* complete the job back to userspace */ | |
| 5379 | + bsg_job_done(job, bsg_reply->result, bsg_reply->reply_payload_rcv_len); | |
| 5380 | + return rc; | |
| 5381 | +} | |
| 5382 | + | |
| 5383 | +/** | |
| 5384 | + * lpfc_ras_stop_fwlog: Disable FW logging by the adapter | |
| 5385 | + * @phba: Pointer to HBA context object. | |
| 5386 | + * | |
| 5387 | + * Disable FW logging into host memory on the adapter. To | |
| 5388 | + * be done before reading logs from the host memory. | |
| 5389 | + **/ | |
| 5390 | +static void | |
| 5391 | +lpfc_ras_stop_fwlog(struct lpfc_hba *phba) | |
| 5392 | +{ | |
| 5393 | + struct lpfc_ras_fwlog *ras_fwlog = &phba->ras_fwlog; | |
| 5394 | + | |
| 5395 | + ras_fwlog->ras_active = false; | |
| 5396 | + | |
| 5397 | + /* Disable FW logging to host memory */ | |
| 5398 | + writel(LPFC_CTL_PDEV_CTL_DDL_RAS, | |
| 5399 | + phba->sli4_hba.conf_regs_memmap_p + LPFC_CTL_PDEV_CTL_OFFSET); | |
| 5400 | +} | |
| 5401 | + | |
| 5402 | +/** | |
| 5403 | + * lpfc_bsg_set_ras_config: Set FW logging parameters | |
| 5404 | + * @job: fc_bsg_job to handle | |
| 5405 | + * | |
| 5406 | + * Set log-level parameters for FW-logging in host memory | |
| 5407 | + **/ | |
| 5408 | +static int | |
| 5409 | +lpfc_bsg_set_ras_config(struct bsg_job *job) | |
| 5410 | +{ | |
| 5411 | + struct Scsi_Host *shost = fc_bsg_to_shost(job); | |
| 5412 | + struct lpfc_vport *vport = shost_priv(shost); | |
| 5413 | + struct lpfc_hba *phba = vport->phba; | |
| 5414 | + struct lpfc_bsg_set_ras_config_req *ras_req; | |
| 5415 | + struct fc_bsg_request *bsg_request = job->request; | |
| 5416 | + struct lpfc_ras_fwlog *ras_fwlog = &phba->ras_fwlog; | |
| 5417 | + struct fc_bsg_reply *bsg_reply = job->reply; | |
| 5418 | + uint8_t action = 0, log_level = 0; | |
| 5419 | + int rc = 0; | |
| 5420 | + | |
| 5421 | + if (job->request_len < | |
| 5422 | + sizeof(struct fc_bsg_request) + | |
| 5423 | + sizeof(struct lpfc_bsg_set_ras_config_req)) { | |
| 5424 | + lpfc_printf_log(phba, KERN_ERR, LOG_LIBDFC, | |
| 5425 | + "6182 Received RAS_LOG request " | |
| 5426 | + "below minimum size\n"); | |
| 5427 | + rc = -EINVAL; | |
| 5428 | + goto ras_job_error; | |
| 5429 | + } | |
| 5430 | + | |
| 5431 | + /* Check FW log status */ | |
| 5432 | + rc = lpfc_check_fwlog_support(phba); | |
| 5433 | + if (rc == -EACCES || rc == -EPERM) | |
| 5434 | + goto ras_job_error; | |
| 5435 | + | |
| 5436 | + ras_req = (struct lpfc_bsg_set_ras_config_req *) | |
| 5437 | + bsg_request->rqst_data.h_vendor.vendor_cmd; | |
| 5438 | + action = ras_req->action; | |
| 5439 | + log_level = ras_req->log_level; | |
| 5440 | + | |
| 5441 | + if (action == LPFC_RASACTION_STOP_LOGGING) { | |
| 5442 | + /* Check if already disabled */ | |
| 5443 | + if (ras_fwlog->ras_active == false) { | |
| 5444 | + rc = -ESRCH; | |
| 5445 | + goto ras_job_error; | |
| 5446 | + } | |
| 5447 | + | |
| 5448 | + /* Disable logging */ | |
| 5449 | + lpfc_ras_stop_fwlog(phba); | |
| 5450 | + } else { | |
| 5451 | + /*action = LPFC_RASACTION_START_LOGGING*/ | |
| 5452 | + if (ras_fwlog->ras_active == true) { | |
| 5453 | + rc = -EINPROGRESS; | |
| 5454 | + goto ras_job_error; | |
| 5455 | + } | |
| 5456 | + | |
| 5457 | + /* Enable logging */ | |
| 5458 | + rc = lpfc_sli4_ras_fwlog_init(phba, log_level, | |
| 5459 | + LPFC_RAS_ENABLE_LOGGING); | |
| 5460 | + if (rc) | |
| 5461 | + rc = -EINVAL; | |
| 5462 | + } | |
| 5463 | +ras_job_error: | |
| 5464 | + /* make error code available to userspace */ | |
| 5465 | + bsg_reply->result = rc; | |
| 5466 | + | |
| 5467 | + /* complete the job back to userspace */ | |
| 5468 | + bsg_job_done(job, bsg_reply->result, | |
| 5469 | + bsg_reply->reply_payload_rcv_len); | |
| 5470 | + | |
| 5471 | + return rc; | |
| 5472 | +} | |
| 5473 | + | |
| 5474 | +/** | |
| 5475 | + * lpfc_bsg_get_ras_lwpd: Get log write position data | |
| 5476 | + * @job: fc_bsg_job to handle | |
| 5477 | + * | |
| 5478 | + * Get Offset/Wrap count of the log message written | |
| 5479 | + * in host memory | |
| 5480 | + **/ | |
| 5481 | +static int | |
| 5482 | +lpfc_bsg_get_ras_lwpd(struct bsg_job *job) | |
| 5483 | +{ | |
| 5484 | + struct Scsi_Host *shost = fc_bsg_to_shost(job); | |
| 5485 | + struct lpfc_vport *vport = shost_priv(shost); | |
| 5486 | + struct lpfc_bsg_get_ras_lwpd *ras_reply; | |
| 5487 | + struct lpfc_hba *phba = vport->phba; | |
| 5488 | + struct lpfc_ras_fwlog *ras_fwlog = &phba->ras_fwlog; | |
| 5489 | + struct fc_bsg_reply *bsg_reply = job->reply; | |
| 5490 | + uint32_t lwpd_offset = 0; | |
| 5491 | + uint64_t wrap_value = 0; | |
| 5492 | + int rc = 0; | |
| 5493 | + | |
| 5494 | + rc = lpfc_check_fwlog_support(phba); | |
| 5495 | + if (rc == -EACCES || rc == -EPERM) | |
| 5496 | + goto ras_job_error; | |
| 5497 | + | |
| 5498 | + if (job->request_len < | |
| 5499 | + sizeof(struct fc_bsg_request) + | |
| 5500 | + sizeof(struct lpfc_bsg_ras_req)) { | |
| 5501 | + lpfc_printf_log(phba, KERN_ERR, LOG_LIBDFC, | |
| 5502 | + "6183 Received RAS_LOG request " | |
| 5503 | + "below minimum size\n"); | |
| 5504 | + rc = -EINVAL; | |
| 5505 | + goto ras_job_error; | |
| 5506 | + } | |
| 5507 | + | |
| 5508 | + ras_reply = (struct lpfc_bsg_get_ras_lwpd *) | |
| 5509 | + bsg_reply->reply_data.vendor_reply.vendor_rsp; | |
| 5510 | + | |
| 5511 | + lwpd_offset = *((uint32_t *)ras_fwlog->lwpd.virt) & 0xffffffff; | |
| 5512 | + ras_reply->offset = be32_to_cpu(lwpd_offset); | |
| 5513 | + | |
| 5514 | + wrap_value = *((uint64_t *)ras_fwlog->lwpd.virt); | |
| 5515 | + ras_reply->wrap_count = be32_to_cpu((wrap_value >> 32) & 0xffffffff); | |
| 5516 | + | |
| 5517 | +ras_job_error: | |
| 5518 | + /* make error code available to userspace */ | |
| 5519 | + bsg_reply->result = rc; | |
| 5520 | + | |
| 5521 | + /* complete the job back to userspace */ | |
| 5522 | + bsg_job_done(job, bsg_reply->result, bsg_reply->reply_payload_rcv_len); | |
| 5523 | + | |
| 5524 | + return rc; | |
| 5525 | +} | |
| 5526 | + | |
| 5527 | +/** | |
| 5528 | + * lpfc_bsg_get_ras_fwlog: Read FW log | |
| 5529 | + * @job: fc_bsg_job to handle | |
| 5530 | + * | |
| 5531 | + * Copy the FW log into the passed buffer. | |
| 5532 | + **/ | |
| 5533 | +static int | |
| 5534 | +lpfc_bsg_get_ras_fwlog(struct bsg_job *job) | |
| 5535 | +{ | |
| 5536 | + struct Scsi_Host *shost = fc_bsg_to_shost(job); | |
| 5537 | + struct lpfc_vport *vport = shost_priv(shost); | |
| 5538 | + struct lpfc_hba *phba = vport->phba; | |
| 5539 | + struct fc_bsg_request *bsg_request = job->request; | |
| 5540 | + struct fc_bsg_reply *bsg_reply = job->reply; | |
| 5541 | + struct lpfc_bsg_get_fwlog_req *ras_req; | |
| 5542 | + uint32_t rd_offset, rd_index, offset, pending_wlen; | |
| 5543 | + uint32_t boundary = 0, align_len = 0, write_len = 0; | |
| 5544 | + void *dest, *src, *fwlog_buff; | |
| 5545 | + struct lpfc_ras_fwlog *ras_fwlog = NULL; | |
| 5546 | + struct lpfc_dmabuf *dmabuf, *next; | |
| 5547 | + int rc = 0; | |
| 5548 | + | |
| 5549 | + ras_fwlog = &phba->ras_fwlog; | |
| 5550 | + | |
| 5551 | + rc = lpfc_check_fwlog_support(phba); | |
| 5552 | + if (rc == -EACCES || rc == -EPERM) | |
| 5553 | + goto ras_job_error; | |
| 5554 | + | |
| 5555 | + /* Logging to be stopped before reading */ | |
| 5556 | + if (ras_fwlog->ras_active == true) { | |
| 5557 | + rc = -EINPROGRESS; | |
| 5558 | + goto ras_job_error; | |
| 5559 | + } | |
| 5560 | + | |
| 5561 | + if (job->request_len < | |
| 5562 | + sizeof(struct fc_bsg_request) + | |
| 5563 | + sizeof(struct lpfc_bsg_get_fwlog_req)) { | |
| 5564 | + lpfc_printf_log(phba, KERN_ERR, LOG_LIBDFC, | |
| 5565 | + "6184 Received RAS_LOG request " | |
| 5566 | + "below minimum size\n"); | |
| 5567 | + rc = -EINVAL; | |
| 5568 | + goto ras_job_error; | |
| 5569 | + } | |
| 5570 | + | |
| 5571 | + ras_req = (struct lpfc_bsg_get_fwlog_req *) | |
| 5572 | + bsg_request->rqst_data.h_vendor.vendor_cmd; | |
| 5573 | + rd_offset = ras_req->read_offset; | |
| 5574 | + | |
| 5575 | + /* Allocate memory to read fw log*/ | |
| 5576 | + fwlog_buff = vmalloc(ras_req->read_size); | |
| 5577 | + if (!fwlog_buff) { | |
| 5578 | + rc = -ENOMEM; | |
| 5579 | + goto ras_job_error; | |
| 5580 | + } | |
| 5581 | + | |
| 5582 | + rd_index = (rd_offset / LPFC_RAS_MAX_ENTRY_SIZE); | |
| 5583 | + offset = (rd_offset % LPFC_RAS_MAX_ENTRY_SIZE); | |
| 5584 | + pending_wlen = ras_req->read_size; | |
| 5585 | + dest = fwlog_buff; | |
| 5586 | + | |
| 5587 | + list_for_each_entry_safe(dmabuf, next, | |
| 5588 | + &ras_fwlog->fwlog_buff_list, list) { | |
| 5589 | + | |
| 5590 | + if (dmabuf->buffer_tag < rd_index) | |
| 5591 | + continue; | |
| 5592 | + | |
| 5593 | + /* Align read to buffer size */ | |
| 5594 | + if (offset) { | |
| 5595 | + boundary = ((dmabuf->buffer_tag + 1) * | |
| 5596 | + LPFC_RAS_MAX_ENTRY_SIZE); | |
| 5597 | + | |
| 5598 | + align_len = (boundary - offset); | |
| 5599 | + write_len = min_t(u32, align_len, | |
| 5600 | + LPFC_RAS_MAX_ENTRY_SIZE); | |
| 5601 | + } else { | |
| 5602 | + write_len = min_t(u32, pending_wlen, | |
| 5603 | + LPFC_RAS_MAX_ENTRY_SIZE); | |
| 5604 | + align_len = 0; | |
| 5605 | + boundary = 0; | |
| 5606 | + } | |
| 5607 | + src = dmabuf->virt + offset; | |
| 5608 | + memcpy(dest, src, write_len); | |
| 5609 | + | |
| 5610 | + pending_wlen -= write_len; | |
| 5611 | + if (!pending_wlen) | |
| 5612 | + break; | |
| 5613 | + | |
| 5614 | + dest += write_len; | |
| 5615 | + offset = (offset + write_len) % LPFC_RAS_MAX_ENTRY_SIZE; | |
| 5616 | + } | |
| 5617 | + | |
| 5618 | + bsg_reply->reply_payload_rcv_len = | |
| 5619 | + sg_copy_from_buffer(job->reply_payload.sg_list, | |
| 5620 | + job->reply_payload.sg_cnt, | |
| 5621 | + fwlog_buff, ras_req->read_size); | |
| 5622 | + | |
| 5623 | + vfree(fwlog_buff); | |
| 5624 | + | |
| 5625 | +ras_job_error: | |
| 5626 | + bsg_reply->result = rc; | |
| 5627 | + bsg_job_done(job, bsg_reply->result, bsg_reply->reply_payload_rcv_len); | |
| 5628 | + | |
| 5629 | + return rc; | |
| 5630 | +} | |
| 5631 | + | |
| 5632 | + | |
| 5311 | 5633 | /** |
| 5312 | 5634 | * lpfc_bsg_hst_vendor - process a vendor-specific fc_bsg_job |
| 5313 | 5635 | * @job: fc_bsg_job to handle |
| @@ -5355,6 +5677,18 @@ lpfc_bsg_hst_vendor(struct bsg_job *job) · 41 unmodified lines | ||
| 5355 | 5677 | case LPFC_BSG_VENDOR_FORCED_LINK_SPEED: |
| 5356 | 5678 | rc = lpfc_forced_link_speed(job); |
| 5357 | 5679 | break; |
| 5680 | + case LPFC_BSG_VENDOR_RAS_GET_LWPD: | |
| 5681 | + rc = lpfc_bsg_get_ras_lwpd(job); | |
| 5682 | + break; | |
| 5683 | + case LPFC_BSG_VENDOR_RAS_GET_FWLOG: | |
| 5684 | + rc = lpfc_bsg_get_ras_fwlog(job); | |
| 5685 | + break; | |
| 5686 | + case LPFC_BSG_VENDOR_RAS_GET_CONFIG: | |
| 5687 | + rc = lpfc_bsg_get_ras_config(job); | |
| 5688 | + break; | |
| 5689 | + case LPFC_BSG_VENDOR_RAS_SET_CONFIG: | |
| 5690 | + rc = lpfc_bsg_set_ras_config(job); | |
| 5691 | + break; | |
| 5358 | 5692 | default: |
| 5359 | 5693 | rc = -EINVAL; |
| 5360 | 5694 | bsg_reply->reply_payload_rcv_len = 0; |
| @@ -5368,7 +5702,7 @@ lpfc_bsg_hst_vendor(struct bsg_job *job) · 7 unmodified lines | ||
| 5368 | 5702 | |
| 5369 | 5703 | /** |
| 5370 | 5704 | * lpfc_bsg_request - handle a bsg request from the FC transport |
| 5371 | − * @job: fc_bsg_job to handle | |
| 5705 | + * @job: bsg_job to handle | |
| 5372 | 5706 | **/ |
| 5373 | 5707 | int |
| 5374 | 5708 | lpfc_bsg_request(struct bsg_job *job) |
| @@ -5402,7 +5736,7 @@ lpfc_bsg_request(struct bsg_job *job) · 27 unmodified lines | ||
| 5402 | 5736 | |
| 5403 | 5737 | /** |
| 5404 | 5738 | * lpfc_bsg_timeout - handle timeout of a bsg request from the FC transport |
| 5405 | − * @job: fc_bsg_job that has timed out | |
| 5739 | + * @job: bsg_job that has timed out | |
| 5406 | 5740 | * |
| 5407 | 5741 | * This function just aborts the job's IOCB. The aborted IOCB will return to |
| 5408 | 5742 | * the waiting function which will handle passing the error back to userspace |
| @@ -38,6 +38,10 @@ · 37 unmodified lines | ||
| 38 | 38 | #define LPFC_BSG_VENDOR_DIAG_MODE_END 10 |
| 39 | 39 | #define LPFC_BSG_VENDOR_LINK_DIAG_TEST 11 |
| 40 | 40 | #define LPFC_BSG_VENDOR_FORCED_LINK_SPEED 14 |
| 41 | +#define LPFC_BSG_VENDOR_RAS_GET_LWPD 16 | |
| 42 | +#define LPFC_BSG_VENDOR_RAS_GET_FWLOG 17 | |
| 43 | +#define LPFC_BSG_VENDOR_RAS_GET_CONFIG 18 | |
| 44 | +#define LPFC_BSG_VENDOR_RAS_SET_CONFIG 19 | |
| 41 | 45 | |
| 42 | 46 | struct set_ct_event { |
| 43 | 47 | uint32_t command; |
| @@ -296,6 +300,38 @@ struct forced_link_speed_support_reply { · 252 unmodified lines | ||
| 296 | 300 | uint8_t supported; |
| 297 | 301 | }; |
| 298 | 302 | |
| 303 | +struct lpfc_bsg_ras_req { | |
| 304 | + uint32_t command; | |
| 305 | +}; | |
| 306 | + | |
| 307 | +struct lpfc_bsg_get_fwlog_req { | |
| 308 | + uint32_t command; | |
| 309 | + uint32_t read_size; | |
| 310 | + uint32_t read_offset; | |
| 311 | +}; | |
| 312 | + | |
| 313 | +struct lpfc_bsg_get_ras_lwpd { | |
| 314 | + uint32_t offset; | |
| 315 | + uint32_t wrap_count; | |
| 316 | +}; | |
| 317 | + | |
| 318 | +struct lpfc_bsg_set_ras_config_req { | |
| 319 | + uint32_t command; | |
| 320 | + uint8_t action; | |
| 321 | +#define LPFC_RASACTION_STOP_LOGGING 0x00 | |
| 322 | +#define LPFC_RASACTION_START_LOGGING 0x01 | |
| 323 | + uint8_t log_level; | |
| 324 | +}; | |
| 325 | + | |
| 326 | +struct lpfc_bsg_get_ras_config_reply { | |
| 327 | + uint8_t state; | |
| 328 | +#define LPFC_RASLOG_STATE_STOPPED 0x00 | |
| 329 | +#define LPFC_RASLOG_STATE_RUNNING 0x01 | |
| 330 | + uint8_t log_level; | |
| 331 | + uint32_t log_buff_sz; | |
| 332 | +}; | |
| 333 | + | |
| 334 | + | |
| 299 | 335 | /* driver only */ |
| 300 | 336 | #define SLI_CONFIG_NOT_HANDLED 0 |
| 301 | 337 | #define SLI_CONFIG_HANDLED 1 |
| @@ -545,6 +545,13 @@ bool lpfc_find_next_oas_lun(struct lpfc_hba *, struct lpfc_name *, · 544 unmodified lines | ||
| 545 | 545 | int lpfc_sli4_dump_page_a0(struct lpfc_hba *phba, struct lpfcMboxq *mbox); |
| 546 | 546 | void lpfc_mbx_cmpl_rdp_page_a0(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb); |
| 547 | 547 | |
| 548 | +/* RAS Interface */ | |
| 549 | +void lpfc_sli4_ras_init(struct lpfc_hba *phba); | |
| 550 | +void lpfc_sli4_ras_setup(struct lpfc_hba *phba); | |
| 551 | +int lpfc_sli4_ras_fwlog_init(struct lpfc_hba *phba, uint32_t fwlog_level, | |
| 552 | + uint32_t fwlog_enable); | |
| 553 | +int lpfc_check_fwlog_support(struct lpfc_hba *phba); | |
| 554 | + | |
| 548 | 555 | /* NVME interfaces. */ |
| 549 | 556 | void lpfc_nvme_unregister_port(struct lpfc_vport *vport, |
| 550 | 557 | struct lpfc_nodelist *ndlp); |
| @@ -445,14 +445,14 @@ lpfc_find_vport_by_did(struct lpfc_hba *phba, uint32_t did) { · 444 unmodified lines | ||
| 445 | 445 | struct lpfc_vport *vport_curr; |
| 446 | 446 | unsigned long flags; |
| 447 | 447 | |
| 448 | − spin_lock_irqsave(&phba->hbalock, flags); | |
| 448 | + spin_lock_irqsave(&phba->port_list_lock, flags); | |
| 449 | 449 | list_for_each_entry(vport_curr, &phba->port_list, listentry) { |
| 450 | 450 | if ((vport_curr->fc_myDID) && (vport_curr->fc_myDID == did)) { |
| 451 | − spin_unlock_irqrestore(&phba->hbalock, flags); | |
| 451 | + spin_unlock_irqrestore(&phba->port_list_lock, flags); | |
| 452 | 452 | return vport_curr; |
| 453 | 453 | } |
| 454 | 454 | } |
| 455 | − spin_unlock_irqrestore(&phba->hbalock, flags); | |
| 455 | + spin_unlock_irqrestore(&phba->port_list_lock, flags); | |
| 456 | 456 | return NULL; |
| 457 | 457 | } |
| 458 | 458 | |
| @@ -471,11 +471,6 @@ lpfc_prep_node_fc4type(struct lpfc_vport *vport, uint32_t Did, uint8_t fc4_type) · 12 unmodified lines | ||
| 471 | 471 | "Parse GID_FTrsp: did:x%x flg:x%x x%x", |
| 472 | 472 | Did, ndlp->nlp_flag, vport->fc_flag); |
| 473 | 473 | |
| 474 | − /* Don't assume the rport is always the previous | |
| 475 | − * FC4 type. | |
| 476 | − */ | |
| 477 | − ndlp->nlp_fc4_type &= ~(NLP_FC4_FCP | NLP_FC4_NVME); | |
| 478 | − | |
| 479 | 474 | /* By default, the driver expects to support FCP FC4 */ |
| 480 | 475 | if (fc4_type == FC_TYPE_FCP) |
| 481 | 476 | ndlp->nlp_fc4_type |= NLP_FC4_FCP; |
| @@ -550,7 +550,6 @@ lpfc_debugfs_nodelist_data(struct lpfc_vport *vport, char *buf, int size) · 549 unmodified lines | ||
| 550 | 550 | struct lpfc_nodelist *ndlp; |
| 551 | 551 | unsigned char *statep; |
| 552 | 552 | struct nvme_fc_local_port *localport; |
| 553 | − struct lpfc_nvmet_tgtport *tgtp; | |
| 554 | 553 | struct nvme_fc_remote_port *nrport = NULL; |
| 555 | 554 | struct lpfc_nvme_rport *rport; |
| 556 | 555 | |
| @@ -654,7 +653,6 @@ lpfc_debugfs_nodelist_data(struct lpfc_vport *vport, char *buf, int size) · 97 unmodified lines | ||
| 654 | 653 | "\nOutstanding IO x%x\n", outio); |
| 655 | 654 | |
| 656 | 655 | if (phba->nvmet_support && phba->targetport && (vport == phba->pport)) { |
| 657 | − tgtp = (struct lpfc_nvmet_tgtport *)phba->targetport->private; | |
| 658 | 656 | len += snprintf(buf + len, size - len, |
| 659 | 657 | "\nNVME Targetport Entry ...\n"); |
| 660 | 658 | |
| @@ -7673,8 +7673,11 @@ void · 7672 unmodified lines | ||
| 7673 | 7673 | lpfc_els_flush_all_cmd(struct lpfc_hba *phba) |
| 7674 | 7674 | { |
| 7675 | 7675 | struct lpfc_vport *vport; |
| 7676 | + | |
| 7677 | + spin_lock_irq(&phba->port_list_lock); | |
| 7676 | 7678 | list_for_each_entry(vport, &phba->port_list, listentry) |
| 7677 | 7679 | lpfc_els_flush_cmd(vport); |
| 7680 | + spin_unlock_irq(&phba->port_list_lock); | |
| 7678 | 7681 | |
| 7679 | 7682 | return; |
| 7680 | 7683 | } |
| @@ -4193,7 +4193,7 @@ lpfc_nlp_state_cleanup(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, · 4192 unmodified lines | ||
| 4193 | 4193 | |
| 4194 | 4194 | if (new_state == NLP_STE_MAPPED_NODE || |
| 4195 | 4195 | new_state == NLP_STE_UNMAPPED_NODE) { |
| 4196 | − if (ndlp->nlp_fc4_type & NLP_FC4_FCP || | |
| 4196 | + if (ndlp->nlp_fc4_type || | |
| 4197 | 4197 | ndlp->nlp_DID == Fabric_DID || |
| 4198 | 4198 | ndlp->nlp_DID == NameServer_DID || |
| 4199 | 4199 | ndlp->nlp_DID == FDMI_DID) { |
| @@ -5428,12 +5428,10 @@ static void · 1228 unmodified lines | ||
| 5428 | 5428 | lpfc_free_tx(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp) |
| 5429 | 5429 | { |
| 5430 | 5430 | LIST_HEAD(completions); |
| 5431 | − struct lpfc_sli *psli; | |
| 5432 | 5431 | IOCB_t *icmd; |
| 5433 | 5432 | struct lpfc_iocbq *iocb, *next_iocb; |
| 5434 | 5433 | struct lpfc_sli_ring *pring; |
| 5435 | 5434 | |
| 5436 | − psli = &phba->sli; | |
| 5437 | 5435 | pring = lpfc_phba_elsring(phba); |
| 5438 | 5436 | if (unlikely(!pring)) |
| 5439 | 5437 | return; |
| @@ -5938,14 +5936,14 @@ lpfc_find_vport_by_vpid(struct lpfc_hba *phba, uint16_t vpi) · 498 unmodified lines | ||
| 5938 | 5936 | } |
| 5939 | 5937 | } |
| 5940 | 5938 | |
| 5941 | − spin_lock_irqsave(&phba->hbalock, flags); | |
| 5939 | + spin_lock_irqsave(&phba->port_list_lock, flags); | |
| 5942 | 5940 | list_for_each_entry(vport, &phba->port_list, listentry) { |
| 5943 | 5941 | if (vport->vpi == i) { |
| 5944 | − spin_unlock_irqrestore(&phba->hbalock, flags); | |
| 5942 | + spin_unlock_irqrestore(&phba->port_list_lock, flags); | |
| 5945 | 5943 | return vport; |
| 5946 | 5944 | } |
| 5947 | 5945 | } |
| 5948 | − spin_unlock_irqrestore(&phba->hbalock, flags); | |
| 5946 | + spin_unlock_irqrestore(&phba->port_list_lock, flags); | |
| 5949 | 5947 | return NULL; |
| 5950 | 5948 | } |
| 5951 | 5949 | |
| @@ -186,6 +186,7 @@ struct lpfc_sli_intf { · 185 unmodified lines | ||
| 186 | 186 | #define LPFC_CTL_PDEV_CTL_FRL_ALL 0x00 |
| 187 | 187 | #define LPFC_CTL_PDEV_CTL_FRL_FC_FCOE 0x10 |
| 188 | 188 | #define LPFC_CTL_PDEV_CTL_FRL_NIC 0x20 |
| 189 | +#define LPFC_CTL_PDEV_CTL_DDL_RAS 0x1000000 | |
| 189 | 190 | |
| 190 | 191 | #define LPFC_FW_DUMP_REQUEST (LPFC_CTL_PDEV_CTL_DD | LPFC_CTL_PDEV_CTL_FRST) |
| 191 | 192 | |
| @@ -964,6 +965,7 @@ struct mbox_header { · 772 unmodified lines | ||
| 964 | 965 | /* Subsystem Definitions */ |
| 965 | 966 | #define LPFC_MBOX_SUBSYSTEM_NA 0x0 |
| 966 | 967 | #define LPFC_MBOX_SUBSYSTEM_COMMON 0x1 |
| 968 | +#define LPFC_MBOX_SUBSYSTEM_LOWLEVEL 0xB | |
| 967 | 969 | #define LPFC_MBOX_SUBSYSTEM_FCOE 0xC |
| 968 | 970 | |
| 969 | 971 | /* Device Specific Definitions */ |
| @@ -1030,6 +1032,9 @@ struct mbox_header { · 60 unmodified lines | ||
| 1030 | 1032 | #define LPFC_MBOX_OPCODE_FCOE_LINK_DIAG_STATE 0x22 |
| 1031 | 1033 | #define LPFC_MBOX_OPCODE_FCOE_LINK_DIAG_LOOPBACK 0x23 |
| 1032 | 1034 | |
| 1035 | +/* Low level Opcodes */ | |
| 1036 | +#define LPFC_MBOX_OPCODE_SET_DIAG_LOG_OPTION 0x37 | |
| 1037 | + | |
| 1033 | 1038 | /* Mailbox command structures */ |
| 1034 | 1039 | struct eq_context { |
| 1035 | 1040 | uint32_t word0; |
| @@ -1162,6 +1167,45 @@ struct lpfc_mbx_nop { · 126 unmodified lines | ||
| 1162 | 1167 | uint32_t context[2]; |
| 1163 | 1168 | }; |
| 1164 | 1169 | |
| 1170 | + | |
| 1171 | + | |
| 1172 | +struct lpfc_mbx_set_ras_fwlog { | |
| 1173 | + struct mbox_header header; | |
| 1174 | + union { | |
| 1175 | + struct { | |
| 1176 | + uint32_t word4; | |
| 1177 | +#define lpfc_fwlog_enable_SHIFT 0 | |
| 1178 | +#define lpfc_fwlog_enable_MASK 0x00000001 | |
| 1179 | +#define lpfc_fwlog_enable_WORD word4 | |
| 1180 | +#define lpfc_fwlog_loglvl_SHIFT 8 | |
| 1181 | +#define lpfc_fwlog_loglvl_MASK 0x0000000F | |
| 1182 | +#define lpfc_fwlog_loglvl_WORD word4 | |
| 1183 | +#define lpfc_fwlog_ra_SHIFT 15 | |
| 1184 | +#define lpfc_fwlog_ra_WORD 0x00000008 | |
| 1185 | +#define lpfc_fwlog_buffcnt_SHIFT 16 | |
| 1186 | +#define lpfc_fwlog_buffcnt_MASK 0x000000FF | |
| 1187 | +#define lpfc_fwlog_buffcnt_WORD word4 | |
| 1188 | +#define lpfc_fwlog_buffsz_SHIFT 24 | |
| 1189 | +#define lpfc_fwlog_buffsz_MASK 0x000000FF | |
| 1190 | +#define lpfc_fwlog_buffsz_WORD word4 | |
| 1191 | + uint32_t word5; | |
| 1192 | +#define lpfc_fwlog_acqe_SHIFT 0 | |
| 1193 | +#define lpfc_fwlog_acqe_MASK 0x0000FFFF | |
| 1194 | +#define lpfc_fwlog_acqe_WORD word5 | |
| 1195 | +#define lpfc_fwlog_cqid_SHIFT 16 | |
| 1196 | +#define lpfc_fwlog_cqid_MASK 0x0000FFFF | |
| 1197 | +#define lpfc_fwlog_cqid_WORD word5 | |
| 1198 | +#define LPFC_MAX_FWLOG_PAGE 16 | |
| 1199 | + struct dma_address lwpd; | |
| 1200 | + struct dma_address buff_fwlog[LPFC_MAX_FWLOG_PAGE]; | |
| 1201 | + } request; | |
| 1202 | + struct { | |
| 1203 | + uint32_t word0; | |
| 1204 | + } response; | |
| 1205 | + } u; | |
| 1206 | +}; | |
| 1207 | + | |
| 1208 | + | |
| 1165 | 1209 | struct cq_context { |
| 1166 | 1210 | uint32_t word0; |
| 1167 | 1211 | #define lpfc_cq_context_event_SHIFT 31 |
| @@ -3868,6 +3912,7 @@ struct lpfc_mqe { · 2700 unmodified lines | ||
| 3868 | 3912 | struct lpfc_mbx_memory_dump_type3 mem_dump_type3; |
| 3869 | 3913 | struct lpfc_mbx_set_host_data set_host_data; |
| 3870 | 3914 | struct lpfc_mbx_nop nop; |
| 3915 | + struct lpfc_mbx_set_ras_fwlog ras_fwlog; | |
| 3871 | 3916 | } un; |
| 3872 | 3917 | }; |
| 3873 | 3918 | |
| @@ -3956,7 +3956,7 @@ lpfc_create_port(struct lpfc_hba *phba, int instance, struct device *dev) · 3955 unmodified lines | ||
| 3956 | 3956 | if (phba->sli_rev == LPFC_SLI_REV4) { |
| 3957 | 3957 | shost->dma_boundary = |
| 3958 | 3958 | phba->sli4_hba.pc_sli4_params.sge_supp_len-1; |
| 3959 | − shost->sg_tablesize = phba->cfg_sg_seg_cnt; | |
| 3959 | + shost->sg_tablesize = phba->cfg_scsi_seg_cnt; | |
| 3960 | 3960 | } |
| 3961 | 3961 | |
| 3962 | 3962 | /* |
| @@ -3988,9 +3988,9 @@ lpfc_create_port(struct lpfc_hba *phba, int instance, struct device *dev) · 25 unmodified lines | ||
| 3988 | 3988 | if (error) |
| 3989 | 3989 | goto out_put_shost; |
| 3990 | 3990 | |
| 3991 | − spin_lock_irq(&phba->hbalock); | |
| 3991 | + spin_lock_irq(&phba->port_list_lock); | |
| 3992 | 3992 | list_add_tail(&vport->listentry, &phba->port_list); |
| 3993 | − spin_unlock_irq(&phba->hbalock); | |
| 3993 | + spin_unlock_irq(&phba->port_list_lock); | |
| 3994 | 3994 | return vport; |
| 3995 | 3995 | |
| 3996 | 3996 | out_put_shost: |
| @@ -4016,9 +4016,9 @@ destroy_port(struct lpfc_vport *vport) · 19 unmodified lines | ||
| 4016 | 4016 | fc_remove_host(shost); |
| 4017 | 4017 | scsi_remove_host(shost); |
| 4018 | 4018 | |
| 4019 | − spin_lock_irq(&phba->hbalock); | |
| 4019 | + spin_lock_irq(&phba->port_list_lock); | |
| 4020 | 4020 | list_del_init(&vport->listentry); |
| 4021 | − spin_unlock_irq(&phba->hbalock); | |
| 4021 | + spin_unlock_irq(&phba->port_list_lock); | |
| 4022 | 4022 | |
| 4023 | 4023 | lpfc_cleanup(vport); |
| 4024 | 4024 | return; |
| @@ -5621,7 +5621,10 @@ lpfc_setup_driver_resource_phase1(struct lpfc_hba *phba) · 1596 unmodified lines | ||
| 5621 | 5621 | /* Initialize ndlp management spinlock */ |
| 5622 | 5622 | spin_lock_init(&phba->ndlp_lock); |
| 5623 | 5623 | |
| 5624 | + /* Initialize port_list spinlock */ | |
| 5625 | + spin_lock_init(&phba->port_list_lock); | |
| 5624 | 5626 | INIT_LIST_HEAD(&phba->port_list); |
| 5627 | + | |
| 5625 | 5628 | INIT_LIST_HEAD(&phba->work_list); |
| 5626 | 5629 | init_waitqueue_head(&phba->wait_4_mlo_m_q); |
| 5627 | 5630 | |
| @@ -5919,8 +5922,6 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba) · 291 unmodified lines | ||
| 5919 | 5922 | * There are going to be 2 reserved SGEs: 1 FCP cmnd + 1 FCP rsp |
| 5920 | 5923 | */ |
| 5921 | 5924 | max_buf_size = (2 * SLI4_PAGE_SIZE); |
| 5922 | − if (phba->cfg_sg_seg_cnt > LPFC_MAX_SGL_SEG_CNT - extra) | |
| 5923 | − phba->cfg_sg_seg_cnt = LPFC_MAX_SGL_SEG_CNT - extra; | |
| 5924 | 5925 | |
| 5925 | 5926 | /* |
| 5926 | 5927 | * Since lpfc_sg_seg_cnt is module param, the sg_dma_buf_size |
| @@ -5942,9 +5943,16 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba) · 15 unmodified lines | ||
| 5942 | 5943 | /* Total SGEs for scsi_sg_list and scsi_sg_prot_list */ |
| 5943 | 5944 | phba->cfg_total_seg_cnt = LPFC_MAX_SGL_SEG_CNT; |
| 5944 | 5945 | |
| 5945 | − if (phba->cfg_sg_seg_cnt > LPFC_MAX_SG_SLI4_SEG_CNT_DIF) | |
| 5946 | − phba->cfg_sg_seg_cnt = | |
| 5947 | − LPFC_MAX_SG_SLI4_SEG_CNT_DIF; | |
| 5946 | + /* | |
| 5947 | + * If supporting DIF, reduce the seg count for scsi to | |
| 5948 | + * allow room for the DIF sges. | |
| 5949 | + */ | |
| 5950 | + if (phba->cfg_enable_bg && | |
| 5951 | + phba->cfg_sg_seg_cnt > LPFC_MAX_BG_SLI4_SEG_CNT_DIF) | |
| 5952 | + phba->cfg_scsi_seg_cnt = LPFC_MAX_BG_SLI4_SEG_CNT_DIF; | |
| 5953 | + else | |
| 5954 | + phba->cfg_scsi_seg_cnt = phba->cfg_sg_seg_cnt; | |
| 5955 | + | |
| 5948 | 5956 | } else { |
| 5949 | 5957 | /* |
| 5950 | 5958 | * The scsi_buf for a regular I/O holds the FCP cmnd, |
| @@ -5958,6 +5966,7 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba) · 7 unmodified lines | ||
| 5958 | 5966 | |
| 5959 | 5967 | /* Total SGEs for scsi_sg_list */ |
| 5960 | 5968 | phba->cfg_total_seg_cnt = phba->cfg_sg_seg_cnt + extra; |
| 5969 | + phba->cfg_scsi_seg_cnt = phba->cfg_sg_seg_cnt; | |
| 5961 | 5970 | |
| 5962 | 5971 | /* |
| 5963 | 5972 | * NOTE: if (phba->cfg_sg_seg_cnt + extra) <= 256 we only |
| @@ -5965,10 +5974,22 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba) · 1 unmodified line | ||
| 5965 | 5974 | */ |
| 5966 | 5975 | } |
| 5967 | 5976 | |
| 5977 | + /* Limit to LPFC_MAX_NVME_SEG_CNT for NVME. */ | |
| 5978 | + if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { | |
| 5979 | + if (phba->cfg_sg_seg_cnt > LPFC_MAX_NVME_SEG_CNT) { | |
| 5980 | + lpfc_printf_log(phba, KERN_INFO, LOG_NVME | LOG_INIT, | |
| 5981 | + "6300 Reducing NVME sg segment " | |
| 5982 | + "cnt to %d\n", | |
| 5983 | + LPFC_MAX_NVME_SEG_CNT); | |
| 5984 | + phba->cfg_nvme_seg_cnt = LPFC_MAX_NVME_SEG_CNT; | |
| 5985 | + } else | |
| 5986 | + phba->cfg_nvme_seg_cnt = phba->cfg_sg_seg_cnt; | |
| 5987 | + } | |
| 5988 | + | |
| 5968 | 5989 | /* Initialize the host templates with the updated values. */ |
| 5969 | − lpfc_vport_template.sg_tablesize = phba->cfg_sg_seg_cnt; | |
| 5970 | − lpfc_template.sg_tablesize = phba->cfg_sg_seg_cnt; | |
| 5971 | − lpfc_template_no_hr.sg_tablesize = phba->cfg_sg_seg_cnt; | |
| 5990 | + lpfc_vport_template.sg_tablesize = phba->cfg_scsi_seg_cnt; | |
| 5991 | + lpfc_template.sg_tablesize = phba->cfg_scsi_seg_cnt; | |
| 5992 | + lpfc_template_no_hr.sg_tablesize = phba->cfg_scsi_seg_cnt; | |
| 5972 | 5993 | |
| 5973 | 5994 | if (phba->cfg_sg_dma_buf_size <= LPFC_MIN_SG_SLI4_BUF_SZ) |
| 5974 | 5995 | phba->cfg_sg_dma_buf_size = LPFC_MIN_SG_SLI4_BUF_SZ; |
| @@ -5977,9 +5998,11 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba) · 2 unmodified lines | ||
| 5977 | 5998 | SLI4_PAGE_ALIGN(phba->cfg_sg_dma_buf_size); |
| 5978 | 5999 | |
| 5979 | 6000 | lpfc_printf_log(phba, KERN_INFO, LOG_INIT | LOG_FCP, |
| 5980 | − "9087 sg_tablesize:%d dmabuf_size:%d total_sge:%d\n", | |
| 6001 | + "9087 sg_seg_cnt:%d dmabuf_size:%d " | |
| 6002 | + "total:%d scsi:%d nvme:%d\n", | |
| 5981 | 6003 | phba->cfg_sg_seg_cnt, phba->cfg_sg_dma_buf_size, |
| 5982 | − phba->cfg_total_seg_cnt); | |
| 6004 | + phba->cfg_total_seg_cnt, phba->cfg_scsi_seg_cnt, | |
| 6005 | + phba->cfg_nvme_seg_cnt); | |
| 5983 | 6006 | |
| 5984 | 6007 | /* Initialize buffer queue management fields */ |
| 5985 | 6008 | INIT_LIST_HEAD(&phba->hbqs[LPFC_ELS_HBQ].hbq_buffer_list); |
| @@ -6205,6 +6228,9 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba) · 219 unmodified lines | ||
| 6205 | 6228 | if (phba->cfg_fof) |
| 6206 | 6229 | fof_vectors = 1; |
| 6207 | 6230 | |
| 6231 | + /* Verify RAS support on adapter */ | |
| 6232 | + lpfc_sli4_ras_init(phba); | |
| 6233 | + | |
| 6208 | 6234 | /* Verify all the SLI4 queues */ |
| 6209 | 6235 | rc = lpfc_sli4_queue_verify(phba); |
| 6210 | 6236 | if (rc) |
| @@ -7967,7 +7993,7 @@ lpfc_sli4_read_config(struct lpfc_hba *phba) · 1756 unmodified lines | ||
| 7967 | 7993 | else |
| 7968 | 7994 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, |
| 7969 | 7995 | "3028 GET_FUNCTION_CONFIG: failed to find " |
| 7970 | − "Resrouce Descriptor:x%x\n", | |
| 7996 | + "Resource Descriptor:x%x\n", | |
| 7971 | 7997 | LPFC_RSRC_DESC_TYPE_FCFCOE); |
| 7972 | 7998 | |
| 7973 | 7999 | read_cfg_out: |
| @@ -10492,6 +10518,14 @@ lpfc_sli4_hba_unset(struct lpfc_hba *phba) · 2518 unmodified lines | ||
| 10492 | 10518 | /* Stop kthread signal shall trigger work_done one more time */ |
| 10493 | 10519 | kthread_stop(phba->worker_thread); |
| 10494 | 10520 | |
| 10521 | + /* Disable FW logging to host memory */ | |
| 10522 | + writel(LPFC_CTL_PDEV_CTL_DDL_RAS, | |
| 10523 | + phba->sli4_hba.conf_regs_memmap_p + LPFC_CTL_PDEV_CTL_OFFSET); | |
| 10524 | + | |
| 10525 | + /* Free RAS DMA memory */ | |
| 10526 | + if (phba->ras_fwlog.ras_enabled == true) | |
| 10527 | + lpfc_sli4_ras_dma_free(phba); | |
| 10528 | + | |
| 10495 | 10529 | /* Unset the queues shared with the hardware then release all |
| 10496 | 10530 | * allocated resources. |
| 10497 | 10531 | */ |
| @@ -10737,6 +10771,7 @@ lpfc_get_sli4_parameters(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq) · 239 unmodified lines | ||
| 10737 | 10771 | phba->mds_diags_support = 1; |
| 10738 | 10772 | else |
| 10739 | 10773 | phba->mds_diags_support = 0; |
| 10774 | + | |
| 10740 | 10775 | return 0; |
| 10741 | 10776 | } |
| 10742 | 10777 | |
| @@ -10965,9 +11000,9 @@ lpfc_pci_remove_one_s3(struct pci_dev *pdev) · 222 unmodified lines | ||
| 10965 | 11000 | kfree(phba->vpi_ids); |
| 10966 | 11001 | |
| 10967 | 11002 | lpfc_stop_hba_timers(phba); |
| 10968 | − spin_lock_irq(&phba->hbalock); | |
| 11003 | + spin_lock_irq(&phba->port_list_lock); | |
| 10969 | 11004 | list_del_init(&vport->listentry); |
| 10970 | − spin_unlock_irq(&phba->hbalock); | |
| 11005 | + spin_unlock_irq(&phba->port_list_lock); | |
| 10971 | 11006 | |
| 10972 | 11007 | lpfc_debugfs_terminate(vport); |
| 10973 | 11008 | |
| @@ -11694,6 +11729,10 @@ lpfc_pci_probe_one_s4(struct pci_dev *pdev, const struct pci_device_id *pid) · 720 unmodified lines | ||
| 11694 | 11729 | |
| 11695 | 11730 | /* Check if there are static vports to be created. */ |
| 11696 | 11731 | lpfc_create_static_vport(phba); |
| 11732 | + | |
| 11733 | + /* Enable RAS FW log support */ | |
| 11734 | + lpfc_sli4_ras_setup(phba); | |
| 11735 | + | |
| 11697 | 11736 | return 0; |
| 11698 | 11737 | |
| 11699 | 11738 | out_disable_intr: |
| @@ -11773,9 +11812,9 @@ lpfc_pci_remove_one_s4(struct pci_dev *pdev) · 73 unmodified lines | ||
| 11773 | 11812 | lpfc_sli4_hba_unset(phba); |
| 11774 | 11813 | |
| 11775 | 11814 | lpfc_stop_hba_timers(phba); |
| 11776 | − spin_lock_irq(&phba->hbalock); | |
| 11815 | + spin_lock_irq(&phba->port_list_lock); | |
| 11777 | 11816 | list_del_init(&vport->listentry); |
| 11778 | − spin_unlock_irq(&phba->hbalock); | |
| 11817 | + spin_unlock_irq(&phba->port_list_lock); | |
| 11779 | 11818 | |
| 11780 | 11819 | /* Perform scsi free before driver resource_unset since scsi |
| 11781 | 11820 | * buffers are released to their corresponding pools here. |
| @@ -12419,6 +12458,30 @@ lpfc_sli4_oas_verify(struct lpfc_hba *phba) · 637 unmodified lines | ||
| 12419 | 12458 | return; |
| 12420 | 12459 | } |
| 12421 | 12460 | |
| 12461 | +/** | |
| 12462 | + * lpfc_sli4_ras_init - Verify RAS-FW log is supported by this adapter | |
| 12463 | + * @phba: pointer to lpfc hba data structure. | |
| 12464 | + * | |
| 12465 | + * This routine checks to see if RAS is supported by the adapter. Check the | |
| 12466 | + * function through which RAS support enablement is to be done. | |
| 12467 | + **/ | |
| 12468 | +void | |
| 12469 | +lpfc_sli4_ras_init(struct lpfc_hba *phba) | |
| 12470 | +{ | |
| 12471 | + switch (phba->pcidev->device) { | |
| 12472 | + case PCI_DEVICE_ID_LANCER_G6_FC: | |
| 12473 | + case PCI_DEVICE_ID_LANCER_G7_FC: | |
| 12474 | + phba->ras_fwlog.ras_hwsupport = true; | |
| 12475 | + if (phba->cfg_ras_fwlog_func == PCI_FUNC(phba->pcidev->devfn)) | |
| 12476 | + phba->ras_fwlog.ras_enabled = true; | |
| 12477 | + else | |
| 12478 | + phba->ras_fwlog.ras_enabled = false; | |
| 12479 | + break; | |
| 12480 | + default: | |
| 12481 | + phba->ras_fwlog.ras_hwsupport = false; | |
| 12482 | + } | |
| 12483 | +} | |
| 12484 | + | |
| 12422 | 12485 | /** |
| 12423 | 12486 | * lpfc_fof_queue_setup - Set up all the fof queues |
| 12424 | 12487 | * @phba: pointer to lpfc hba data structure. |
| @@ -2318,6 +2318,7 @@ lpfc_device_recov_unmap_node(struct lpfc_vport *vport, · 2317 unmodified lines | ||
| 2318 | 2318 | lpfc_nlp_set_state(vport, ndlp, NLP_STE_NPR_NODE); |
| 2319 | 2319 | spin_lock_irq(shost->host_lock); |
| 2320 | 2320 | ndlp->nlp_flag &= ~(NLP_NODEV_REMOVE | NLP_NPR_2B_DISC); |
| 2321 | + ndlp->nlp_fc4_type &= ~(NLP_FC4_FCP | NLP_FC4_NVME); | |
| 2321 | 2322 | spin_unlock_irq(shost->host_lock); |
| 2322 | 2323 | lpfc_disc_set_adisc(vport, ndlp); |
| 2323 | 2324 | |
| @@ -2395,6 +2396,7 @@ lpfc_device_recov_mapped_node(struct lpfc_vport *vport, · 71 unmodified lines | ||
| 2395 | 2396 | lpfc_nlp_set_state(vport, ndlp, NLP_STE_NPR_NODE); |
| 2396 | 2397 | spin_lock_irq(shost->host_lock); |
| 2397 | 2398 | ndlp->nlp_flag &= ~(NLP_NODEV_REMOVE | NLP_NPR_2B_DISC); |
| 2399 | + ndlp->nlp_fc4_type &= ~(NLP_FC4_FCP | NLP_FC4_NVME); | |
| 2398 | 2400 | spin_unlock_irq(shost->host_lock); |
| 2399 | 2401 | lpfc_disc_set_adisc(vport, ndlp); |
| 2400 | 2402 | return ndlp->nlp_state; |
| @@ -2652,6 +2654,7 @@ lpfc_device_recov_npr_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, · 251 unmodified lines | ||
| 2652 | 2654 | lpfc_cancel_retry_delay_tmo(vport, ndlp); |
| 2653 | 2655 | spin_lock_irq(shost->host_lock); |
| 2654 | 2656 | ndlp->nlp_flag &= ~(NLP_NODEV_REMOVE | NLP_NPR_2B_DISC); |
| 2657 | + ndlp->nlp_fc4_type &= ~(NLP_FC4_FCP | NLP_FC4_NVME); | |
| 2655 | 2658 | spin_unlock_irq(shost->host_lock); |
| 2656 | 2659 | return ndlp->nlp_state; |
| 2657 | 2660 | } |
| @@ -282,7 +282,7 @@ lpfc_nvme_delete_queue(struct nvme_fc_local_port *pnvme_lport, · 281 unmodified lines | ||
| 282 | 282 | vport = lport->vport; |
| 283 | 283 | |
| 284 | 284 | lpfc_printf_vlog(vport, KERN_INFO, LOG_NVME, |
| 285 | − "6001 ENTER. lpfc_pnvme %p, qidx x%xi qhandle %p\n", | |
| 285 | + "6001 ENTER. lpfc_pnvme %p, qidx x%x qhandle %p\n", | |
| 286 | 286 | lport, qidx, handle); |
| 287 | 287 | kfree(handle); |
| 288 | 288 | } |
| @@ -2235,13 +2235,11 @@ lpfc_new_nvme_buf(struct lpfc_vport *vport, int num_to_alloc) · 1946 unmodified lines | ||
| 2235 | 2235 | struct sli4_sge *sgl; |
| 2236 | 2236 | dma_addr_t pdma_phys_sgl; |
| 2237 | 2237 | uint16_t iotag, lxri = 0; |
| 2238 | − int bcnt, num_posted, sgl_size; | |
| 2238 | + int bcnt, num_posted; | |
| 2239 | 2239 | LIST_HEAD(prep_nblist); |
| 2240 | 2240 | LIST_HEAD(post_nblist); |
| 2241 | 2241 | LIST_HEAD(nvme_nblist); |
| 2242 | 2242 | |
| 2243 | − sgl_size = phba->cfg_sg_dma_buf_size; | |
| 2244 | − | |
| 2245 | 2243 | for (bcnt = 0; bcnt < num_to_alloc; bcnt++) { |
| 2246 | 2244 | lpfc_ncmd = kzalloc(sizeof(struct lpfc_nvme_buf), GFP_KERNEL); |
| 2247 | 2245 | if (!lpfc_ncmd) |
| @@ -2462,17 +2460,10 @@ lpfc_nvme_create_localport(struct lpfc_vport *vport) · 214 unmodified lines | ||
| 2462 | 2460 | nfcp_info.node_name = wwn_to_u64(vport->fc_nodename.u.wwn); |
| 2463 | 2461 | nfcp_info.port_name = wwn_to_u64(vport->fc_portname.u.wwn); |
| 2464 | 2462 | |
| 2465 | − /* Limit to LPFC_MAX_NVME_SEG_CNT. | |
| 2466 | − * For now need + 1 to get around NVME transport logic. | |
| 2463 | + /* We need to tell the transport layer + 1 because it takes page | |
| 2464 | + * alignment into account. When space for the SGL is allocated we | |
| 2465 | + * allocate + 3, one for cmd, one for rsp and one for this alignment | |
| 2467 | 2466 | */ |
| 2468 | − if (phba->cfg_sg_seg_cnt > LPFC_MAX_NVME_SEG_CNT) { | |
| 2469 | − lpfc_printf_vlog(vport, KERN_INFO, LOG_NVME | LOG_INIT, | |
| 2470 | − "6300 Reducing sg segment cnt to %d\n", | |
| 2471 | − LPFC_MAX_NVME_SEG_CNT); | |
| 2472 | − phba->cfg_nvme_seg_cnt = LPFC_MAX_NVME_SEG_CNT; | |
| 2473 | − } else { | |
| 2474 | − phba->cfg_nvme_seg_cnt = phba->cfg_sg_seg_cnt; | |
| 2475 | − } | |
| 2476 | 2467 | lpfc_nvme_template.max_sgl_segments = phba->cfg_nvme_seg_cnt + 1; |
| 2477 | 2468 | lpfc_nvme_template.max_hw_queues = phba->cfg_nvme_io_channel; |
| 2478 | 2469 | |
| @@ -1339,15 +1339,14 @@ lpfc_nvmet_setup_io_context(struct lpfc_hba *phba) · 1338 unmodified lines | ||
| 1339 | 1339 | idx = 0; |
| 1340 | 1340 | } |
| 1341 | 1341 | |
| 1342 | − infop = phba->sli4_hba.nvmet_ctx_info; | |
| 1343 | − for (j = 0; j < phba->cfg_nvmet_mrq; j++) { | |
| 1344 | − for (i = 0; i < phba->sli4_hba.num_present_cpu; i++) { | |
| 1342 | + for (i = 0; i < phba->sli4_hba.num_present_cpu; i++) { | |
| 1343 | + for (j = 0; j < phba->cfg_nvmet_mrq; j++) { | |
| 1344 | + infop = lpfc_get_ctx_list(phba, i, j); | |
| 1345 | 1345 | lpfc_printf_log(phba, KERN_INFO, LOG_NVME | LOG_INIT, |
| 1346 | 1346 | "6408 TOTAL NVMET ctx for CPU %d " |
| 1347 | 1347 | "MRQ %d: cnt %d nextcpu %p\n", |
| 1348 | 1348 | i, j, infop->nvmet_ctx_list_cnt, |
| 1349 | 1349 | infop->nvmet_ctx_next_cpu); |
| 1350 | − infop++; | |
| 1351 | 1350 | } |
| 1352 | 1351 | } |
| 1353 | 1352 | return 0; |
| @@ -1373,17 +1372,10 @@ lpfc_nvmet_create_targetport(struct lpfc_hba *phba) · 19 unmodified lines | ||
| 1373 | 1372 | pinfo.port_name = wwn_to_u64(vport->fc_portname.u.wwn); |
| 1374 | 1373 | pinfo.port_id = vport->fc_myDID; |
| 1375 | 1374 | |
| 1376 | − /* Limit to LPFC_MAX_NVME_SEG_CNT. | |
| 1377 | − * For now need + 1 to get around NVME transport logic. | |
| 1375 | + /* We need to tell the transport layer + 1 because it takes page | |
| 1376 | + * alignment into account. When space for the SGL is allocated we | |
| 1377 | + * allocate + 3, one for cmd, one for rsp and one for this alignment | |
| 1378 | 1378 | */ |
| 1379 | − if (phba->cfg_sg_seg_cnt > LPFC_MAX_NVME_SEG_CNT) { | |
| 1380 | − lpfc_printf_log(phba, KERN_INFO, LOG_NVME | LOG_INIT, | |
| 1381 | − "6400 Reducing sg segment cnt to %d\n", | |
| 1382 | − LPFC_MAX_NVME_SEG_CNT); | |
| 1383 | − phba->cfg_nvme_seg_cnt = LPFC_MAX_NVME_SEG_CNT; | |
| 1384 | − } else { | |
| 1385 | − phba->cfg_nvme_seg_cnt = phba->cfg_sg_seg_cnt; | |
| 1386 | − } | |
| 1387 | 1379 | lpfc_tgttemplate.max_sgl_segments = phba->cfg_nvme_seg_cnt + 1; |
| 1388 | 1380 | lpfc_tgttemplate.max_hw_queues = phba->cfg_nvme_io_channel; |
| 1389 | 1381 | lpfc_tgttemplate.target_features = NVMET_FCTGTFEAT_READDATA_RSP; |
| @@ -202,8 +202,8 @@ lpfc_sli4_set_rsp_sgl_last(struct lpfc_hba *phba, · 201 unmodified lines | ||
| 202 | 202 | static void |
| 203 | 203 | lpfc_update_stats(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd) |
| 204 | 204 | { |
| 205 | − struct lpfc_rport_data *rdata = lpfc_cmd->rdata; | |
| 206 | − struct lpfc_nodelist *pnode = rdata->pnode; | |
| 205 | + struct lpfc_rport_data *rdata; | |
| 206 | + struct lpfc_nodelist *pnode; | |
| 207 | 207 | struct scsi_cmnd *cmd = lpfc_cmd->pCmd; |
| 208 | 208 | unsigned long flags; |
| 209 | 209 | struct Scsi_Host *shost = cmd->device->host; |
| @@ -211,17 +211,19 @@ lpfc_update_stats(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd) · 1 unmodified line | ||
| 211 | 211 | unsigned long latency; |
| 212 | 212 | int i; |
| 213 | 213 | |
| 214 | − if (cmd->result) | |
| 214 | + if (!vport->stat_data_enabled || | |
| 215 | + vport->stat_data_blocked || | |
| 216 | + (cmd->result)) | |
| 215 | 217 | return; |
| 216 | 218 | |
| 217 | 219 | latency = jiffies_to_msecs((long)jiffies - (long)lpfc_cmd->start_time); |
| 220 | + rdata = lpfc_cmd->rdata; | |
| 221 | + pnode = rdata->pnode; | |
| 218 | 222 | |
| 219 | 223 | spin_lock_irqsave(shost->host_lock, flags); |
| 220 | − if (!vport->stat_data_enabled || | |
| 221 | − vport->stat_data_blocked || | |
| 222 | − !pnode || | |
| 223 | − !pnode->lat_data || | |
| 224 | − (phba->bucket_type == LPFC_NO_BUCKET)) { | |
| 224 | + if (!pnode || | |
| 225 | + !pnode->lat_data || | |
| 226 | + (phba->bucket_type == LPFC_NO_BUCKET)) { | |
| 225 | 227 | spin_unlock_irqrestore(shost->host_lock, flags); |
| 226 | 228 | return; |
| 227 | 229 | } |
| @@ -1050,7 +1052,7 @@ lpfc_get_scsi_buf_s4(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp) · 822 unmodified lines | ||
| 1050 | 1052 | if (!found) |
| 1051 | 1053 | return NULL; |
| 1052 | 1054 | |
| 1053 | − if (lpfc_ndlp_check_qdepth(phba, ndlp) && lpfc_cmd) { | |
| 1055 | + if (lpfc_ndlp_check_qdepth(phba, ndlp)) { | |
| 1054 | 1056 | atomic_inc(&ndlp->cmd_pending); |
| 1055 | 1057 | lpfc_cmd->flags |= LPFC_SBUF_BUMP_QDEPTH; |
| 1056 | 1058 | } |
| @@ -4158,9 +4160,17 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn, · 3101 unmodified lines | ||
| 4158 | 4160 | } |
| 4159 | 4161 | lpfc_scsi_unprep_dma_buf(phba, lpfc_cmd); |
| 4160 | 4162 | |
| 4161 | − spin_lock_irqsave(&phba->hbalock, flags); | |
| 4162 | − lpfc_cmd->pCmd = NULL; | |
| 4163 | − spin_unlock_irqrestore(&phba->hbalock, flags); | |
| 4163 | + /* If pCmd was set to NULL from abort path, do not call scsi_done */ | |
| 4164 | + if (xchg(&lpfc_cmd->pCmd, NULL) == NULL) { | |
| 4165 | + lpfc_printf_vlog(vport, KERN_INFO, LOG_FCP, | |
| 4166 | + "0711 FCP cmd already NULL, sid: 0x%06x, " | |
| 4167 | + "did: 0x%06x, oxid: 0x%04x\n", | |
| 4168 | + vport->fc_myDID, | |
| 4169 | + (pnode) ? pnode->nlp_DID : 0, | |
| 4170 | + phba->sli_rev == LPFC_SLI_REV4 ? | |
| 4171 | + lpfc_cmd->cur_iocbq.sli4_xritag : 0xffff); | |
| 4172 | + return; | |
| 4173 | + } | |
| 4164 | 4174 | |
| 4165 | 4175 | /* The sdev is not guaranteed to be valid post scsi_done upcall. */ |
| 4166 | 4176 | cmd->scsi_done(cmd); |
| @@ -392,11 +392,7 @@ lpfc_sli4_if6_eq_clr_intr(struct lpfc_queue *q) · 391 unmodified lines | ||
| 392 | 392 | struct lpfc_register doorbell; |
| 393 | 393 | |
| 394 | 394 | doorbell.word0 = 0; |
| 395 | − bf_set(lpfc_eqcq_doorbell_eqci, &doorbell, 1); | |
| 396 | − bf_set(lpfc_eqcq_doorbell_qt, &doorbell, LPFC_QUEUE_TYPE_EVENT); | |
| 397 | − bf_set(lpfc_eqcq_doorbell_eqid_hi, &doorbell, | |
| 398 | − (q->queue_id >> LPFC_EQID_HI_FIELD_SHIFT)); | |
| 399 | − bf_set(lpfc_eqcq_doorbell_eqid_lo, &doorbell, q->queue_id); | |
| 395 | + bf_set(lpfc_if6_eq_doorbell_eqid, &doorbell, q->queue_id); | |
| 400 | 396 | writel(doorbell.word0, q->phba->sli4_hba.EQDBregaddr); |
| 401 | 397 | } |
| 402 | 398 | |
| @@ -3797,6 +3793,7 @@ lpfc_sli_handle_slow_ring_event_s4(struct lpfc_hba *phba, · 3394 unmodified lines | ||
| 3797 | 3793 | struct hbq_dmabuf *dmabuf; |
| 3798 | 3794 | struct lpfc_cq_event *cq_event; |
| 3799 | 3795 | unsigned long iflag; |
| 3796 | + int count = 0; | |
| 3800 | 3797 | |
| 3801 | 3798 | spin_lock_irqsave(&phba->hbalock, iflag); |
| 3802 | 3799 | phba->hba_flag &= ~HBA_SP_QUEUE_EVT; |
| @@ -3818,16 +3815,22 @@ lpfc_sli_handle_slow_ring_event_s4(struct lpfc_hba *phba, · 15 unmodified lines | ||
| 3818 | 3815 | if (irspiocbq) |
| 3819 | 3816 | lpfc_sli_sp_handle_rspiocb(phba, pring, |
| 3820 | 3817 | irspiocbq); |
| 3818 | + count++; | |
| 3821 | 3819 | break; |
| 3822 | 3820 | case CQE_CODE_RECEIVE: |
| 3823 | 3821 | case CQE_CODE_RECEIVE_V1: |
| 3824 | 3822 | dmabuf = container_of(cq_event, struct hbq_dmabuf, |
| 3825 | 3823 | cq_event); |
| 3826 | 3824 | lpfc_sli4_handle_received_buffer(phba, dmabuf); |
| 3825 | + count++; | |
| 3827 | 3826 | break; |
| 3828 | 3827 | default: |
| 3829 | 3828 | break; |
| 3830 | 3829 | } |
| 3830 | + | |
| 3831 | + /* Limit the number of events to 64 to avoid soft lockups */ | |
| 3832 | + if (count == 64) | |
| 3833 | + break; | |
| 3831 | 3834 | } |
| 3832 | 3835 | } |
| 3833 | 3836 | |
| @@ -6145,6 +6148,271 @@ lpfc_set_features(struct lpfc_hba *phba, LPFC_MBOXQ_t *mbox, · 2311 unmodified lines | ||
| 6145 | 6148 | return; |
| 6146 | 6149 | } |
| 6147 | 6150 | |
| 6151 | +/** | |
| 6152 | + * lpfc_sli4_ras_dma_free - Free memory allocated for FW logging. | |
| 6153 | + * @phba: Pointer to HBA context object. | |
| 6154 | + * | |
| 6155 | + * This function is called to free memory allocated for RAS FW logging | |
| 6156 | + * support in the driver. | |
| 6157 | + **/ | |
| 6158 | +void | |
| 6159 | +lpfc_sli4_ras_dma_free(struct lpfc_hba *phba) | |
| 6160 | +{ | |
| 6161 | + struct lpfc_ras_fwlog *ras_fwlog = &phba->ras_fwlog; | |
| 6162 | + struct lpfc_dmabuf *dmabuf, *next; | |
| 6163 | + | |
| 6164 | + if (!list_empty(&ras_fwlog->fwlog_buff_list)) { | |
| 6165 | + list_for_each_entry_safe(dmabuf, next, | |
| 6166 | + &ras_fwlog->fwlog_buff_list, | |
| 6167 | + list) { | |
| 6168 | + list_del(&dmabuf->list); | |
| 6169 | + dma_free_coherent(&phba->pcidev->dev, | |
| 6170 | + LPFC_RAS_MAX_ENTRY_SIZE, | |
| 6171 | + dmabuf->virt, dmabuf->phys); | |
| 6172 | + kfree(dmabuf); | |
| 6173 | + } | |
| 6174 | + } | |
| 6175 | + | |
| 6176 | + if (ras_fwlog->lwpd.virt) { | |
| 6177 | + dma_free_coherent(&phba->pcidev->dev, | |
| 6178 | + sizeof(uint32_t) * 2, | |
| 6179 | + ras_fwlog->lwpd.virt, | |
| 6180 | + ras_fwlog->lwpd.phys); | |
| 6181 | + ras_fwlog->lwpd.virt = NULL; | |
| 6182 | + } | |
| 6183 | + | |
| 6184 | + ras_fwlog->ras_active = false; | |
| 6185 | +} | |
| 6186 | + | |
| 6187 | +/** | |
| 6188 | + * lpfc_sli4_ras_dma_alloc: Allocate memory for FW support | |
| 6189 | + * @phba: Pointer to HBA context object. | |
| 6190 | + * @fwlog_buff_count: Count of buffers to be created. | |
| 6191 | + * | |
| 6192 | + * This routine DMA memory for Log Write Position Data[LPWD] and buffer | |
| 6193 | + * to update FW log is posted to the adapter. | |
| 6194 | + * Buffer count is calculated based on module param ras_fwlog_buffsize | |
| 6195 | + * Size of each buffer posted to FW is 64K. | |
| 6196 | + **/ | |
| 6197 | + | |
| 6198 | +static int | |
| 6199 | +lpfc_sli4_ras_dma_alloc(struct lpfc_hba *phba, | |
| 6200 | + uint32_t fwlog_buff_count) | |
| 6201 | +{ | |
| 6202 | + struct lpfc_ras_fwlog *ras_fwlog = &phba->ras_fwlog; | |
| 6203 | + struct lpfc_dmabuf *dmabuf; | |
| 6204 | + int rc = 0, i = 0; | |
| 6205 | + | |
| 6206 | + /* Initialize List */ | |
| 6207 | + INIT_LIST_HEAD(&ras_fwlog->fwlog_buff_list); | |
| 6208 | + | |
| 6209 | + /* Allocate memory for the LWPD */ | |
| 6210 | + ras_fwlog->lwpd.virt = dma_alloc_coherent(&phba->pcidev->dev, | |
| 6211 | + sizeof(uint32_t) * 2, | |
| 6212 | + &ras_fwlog->lwpd.phys, | |
| 6213 | + GFP_KERNEL); | |
| 6214 | + if (!ras_fwlog->lwpd.virt) { | |
| 6215 | + lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, | |
| 6216 | + "6185 LWPD Memory Alloc Failed\n"); | |
| 6217 | + | |
| 6218 | + return -ENOMEM; | |
| 6219 | + } | |
| 6220 | + | |
| 6221 | + ras_fwlog->fw_buffcount = fwlog_buff_count; | |
| 6222 | + for (i = 0; i < ras_fwlog->fw_buffcount; i++) { | |
| 6223 | + dmabuf = kzalloc(sizeof(struct lpfc_dmabuf), | |
| 6224 | + GFP_KERNEL); | |
| 6225 | + if (!dmabuf) { | |
| 6226 | + rc = -ENOMEM; | |
| 6227 | + lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, | |
| 6228 | + "6186 Memory Alloc failed FW logging"); | |
| 6229 | + goto free_mem; | |
| 6230 | + } | |
| 6231 | + | |
| 6232 | + dmabuf->virt = dma_alloc_coherent(&phba->pcidev->dev, | |
| 6233 | + LPFC_RAS_MAX_ENTRY_SIZE, | |
| 6234 | + &dmabuf->phys, | |
| 6235 | + GFP_KERNEL); | |
| 6236 | + if (!dmabuf->virt) { | |
| 6237 | + kfree(dmabuf); | |
| 6238 | + rc = -ENOMEM; | |
| 6239 | + lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, | |
| 6240 | + "6187 DMA Alloc Failed FW logging"); | |
| 6241 | + goto free_mem; | |
| 6242 | + } | |
| 6243 | + memset(dmabuf->virt, 0, LPFC_RAS_MAX_ENTRY_SIZE); | |
| 6244 | + dmabuf->buffer_tag = i; | |
| 6245 | + list_add_tail(&dmabuf->list, &ras_fwlog->fwlog_buff_list); | |
| 6246 | + } | |
| 6247 | + | |
| 6248 | +free_mem: | |
| 6249 | + if (rc) | |
| 6250 | + lpfc_sli4_ras_dma_free(phba); | |
| 6251 | + | |
| 6252 | + return rc; | |
| 6253 | +} | |
| 6254 | + | |
| 6255 | +/** | |
| 6256 | + * lpfc_sli4_ras_mbox_cmpl: Completion handler for RAS MBX command | |
| 6257 | + * @phba: pointer to lpfc hba data structure. | |
| 6258 | + * @pmboxq: pointer to the driver internal queue element for mailbox command. | |
| 6259 | + * | |
| 6260 | + * Completion handler for driver's RAS MBX command to the device. | |
| 6261 | + **/ | |
| 6262 | +static void | |
| 6263 | +lpfc_sli4_ras_mbox_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) | |
| 6264 | +{ | |
| 6265 | + MAILBOX_t *mb; | |
| 6266 | + union lpfc_sli4_cfg_shdr *shdr; | |
| 6267 | + uint32_t shdr_status, shdr_add_status; | |
| 6268 | + struct lpfc_ras_fwlog *ras_fwlog = &phba->ras_fwlog; | |
| 6269 | + | |
| 6270 | + mb = &pmb->u.mb; | |
| 6271 | + | |
| 6272 | + shdr = (union lpfc_sli4_cfg_shdr *) | |
| 6273 | + &pmb->u.mqe.un.ras_fwlog.header.cfg_shdr; | |
| 6274 | + shdr_status = bf_get(lpfc_mbox_hdr_status, &shdr->response); | |
| 6275 | + shdr_add_status = bf_get(lpfc_mbox_hdr_add_status, &shdr->response); | |
| 6276 | + | |
| 6277 | + if (mb->mbxStatus != MBX_SUCCESS || shdr_status) { | |
| 6278 | + lpfc_printf_log(phba, KERN_WARNING, LOG_MBOX, | |
| 6279 | + "6188 FW LOG mailbox " | |
| 6280 | + "completed with status x%x add_status x%x," | |
| 6281 | + " mbx status x%x\n", | |
| 6282 | + shdr_status, shdr_add_status, mb->mbxStatus); | |
| 6283 | + goto disable_ras; | |
| 6284 | + } | |
| 6285 | + | |
| 6286 | + ras_fwlog->ras_active = true; | |
| 6287 | + mempool_free(pmb, phba->mbox_mem_pool); | |
| 6288 | + | |
| 6289 | + return; | |
| 6290 | + | |
| 6291 | +disable_ras: | |
| 6292 | + /* Free RAS DMA memory */ | |
| 6293 | + lpfc_sli4_ras_dma_free(phba); | |
| 6294 | + mempool_free(pmb, phba->mbox_mem_pool); | |
| 6295 | +} | |
| 6296 | + | |
| 6297 | +/** | |
| 6298 | + * lpfc_sli4_ras_fwlog_init: Initialize memory and post RAS MBX command | |
| 6299 | + * @phba: pointer to lpfc hba data structure. | |
| 6300 | + * @fwlog_level: Logging verbosity level. | |
| 6301 | + * @fwlog_enable: Enable/Disable logging. | |
| 6302 | + * | |
| 6303 | + * Initialize memory and post mailbox command to enable FW logging in host | |
| 6304 | + * memory. | |
| 6305 | + **/ | |
| 6306 | +int | |
| 6307 | +lpfc_sli4_ras_fwlog_init(struct lpfc_hba *phba, | |
| 6308 | + uint32_t fwlog_level, | |
| 6309 | + uint32_t fwlog_enable) | |
| 6310 | +{ | |
| 6311 | + struct lpfc_ras_fwlog *ras_fwlog = &phba->ras_fwlog; | |
| 6312 | + struct lpfc_mbx_set_ras_fwlog *mbx_fwlog = NULL; | |
| 6313 | + struct lpfc_dmabuf *dmabuf; | |
| 6314 | + LPFC_MBOXQ_t *mbox; | |
| 6315 | + uint32_t len = 0, fwlog_buffsize, fwlog_entry_count; | |
| 6316 | + int rc = 0; | |
| 6317 | + | |
| 6318 | + fwlog_buffsize = (LPFC_RAS_MIN_BUFF_POST_SIZE * | |
| 6319 | + phba->cfg_ras_fwlog_buffsize); | |
| 6320 | + fwlog_entry_count = (fwlog_buffsize/LPFC_RAS_MAX_ENTRY_SIZE); | |
| 6321 | + | |
| 6322 | + /* | |
| 6323 | + * If re-enabling FW logging support use earlier allocated | |
| 6324 | + * DMA buffers while posting MBX command. | |
| 6325 | + **/ | |
| 6326 | + if (!ras_fwlog->lwpd.virt) { | |
| 6327 | + rc = lpfc_sli4_ras_dma_alloc(phba, fwlog_entry_count); | |
| 6328 | + if (rc) { | |
| 6329 | + lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, | |
| 6330 | + "6189 RAS FW Log Support Not Enabled"); | |
| 6331 | + return rc; | |
| 6332 | + } | |
| 6333 | + } | |
| 6334 | + | |
| 6335 | + /* Setup Mailbox command */ | |
| 6336 | + mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); | |
| 6337 | + if (!mbox) { | |
| 6338 | + lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, | |
| 6339 | + "6190 RAS MBX Alloc Failed"); | |
| 6340 | + rc = -ENOMEM; | |
| 6341 | + goto mem_free; | |
| 6342 | + } | |
| 6343 | + | |
| 6344 | + ras_fwlog->fw_loglevel = fwlog_level; | |
| 6345 | + len = (sizeof(struct lpfc_mbx_set_ras_fwlog) - | |
| 6346 | + sizeof(struct lpfc_sli4_cfg_mhdr)); | |
| 6347 | + | |
| 6348 | + lpfc_sli4_config(phba, mbox, LPFC_MBOX_SUBSYSTEM_LOWLEVEL, | |
| 6349 | + LPFC_MBOX_OPCODE_SET_DIAG_LOG_OPTION, | |
| 6350 | + len, LPFC_SLI4_MBX_EMBED); | |
| 6351 | + | |
| 6352 | + mbx_fwlog = (struct lpfc_mbx_set_ras_fwlog *)&mbox->u.mqe.un.ras_fwlog; | |
| 6353 | + bf_set(lpfc_fwlog_enable, &mbx_fwlog->u.request, | |
| 6354 | + fwlog_enable); | |
| 6355 | + bf_set(lpfc_fwlog_loglvl, &mbx_fwlog->u.request, | |
| 6356 | + ras_fwlog->fw_loglevel); | |
| 6357 | + bf_set(lpfc_fwlog_buffcnt, &mbx_fwlog->u.request, | |
| 6358 | + ras_fwlog->fw_buffcount); | |
| 6359 | + bf_set(lpfc_fwlog_buffsz, &mbx_fwlog->u.request, | |
| 6360 | + LPFC_RAS_MAX_ENTRY_SIZE/SLI4_PAGE_SIZE); | |
| 6361 | + | |
| 6362 | + /* Update DMA buffer address */ | |
| 6363 | + list_for_each_entry(dmabuf, &ras_fwlog->fwlog_buff_list, list) { | |
| 6364 | + memset(dmabuf->virt, 0, LPFC_RAS_MAX_ENTRY_SIZE); | |
| 6365 | + | |
| 6366 | + mbx_fwlog->u.request.buff_fwlog[dmabuf->buffer_tag].addr_lo = | |
| 6367 | + putPaddrLow(dmabuf->phys); | |
| 6368 | + | |
| 6369 | + mbx_fwlog->u.request.buff_fwlog[dmabuf->buffer_tag].addr_hi = | |
| 6370 | + putPaddrHigh(dmabuf->phys); | |
| 6371 | + } | |
| 6372 | + | |
| 6373 | + /* Update LPWD address */ | |
| 6374 | + mbx_fwlog->u.request.lwpd.addr_lo = putPaddrLow(ras_fwlog->lwpd.phys); | |
| 6375 | + mbx_fwlog->u.request.lwpd.addr_hi = putPaddrHigh(ras_fwlog->lwpd.phys); | |
| 6376 | + | |
| 6377 | + mbox->vport = phba->pport; | |
| 6378 | + mbox->mbox_cmpl = lpfc_sli4_ras_mbox_cmpl; | |
| 6379 | + | |
| 6380 | + rc = lpfc_sli_issue_mbox(phba, mbox, MBX_NOWAIT); | |
| 6381 | + | |
| 6382 | + if (rc == MBX_NOT_FINISHED) { | |
| 6383 | + lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, | |
| 6384 | + "6191 RAS Mailbox failed. " | |
| 6385 | + "status %d mbxStatus : x%x", rc, | |
| 6386 | + bf_get(lpfc_mqe_status, &mbox->u.mqe)); | |
| 6387 | + mempool_free(mbox, phba->mbox_mem_pool); | |
| 6388 | + rc = -EIO; | |
| 6389 | + goto mem_free; | |
| 6390 | + } else | |
| 6391 | + rc = 0; | |
| 6392 | +mem_free: | |
| 6393 | + if (rc) | |
| 6394 | + lpfc_sli4_ras_dma_free(phba); | |
| 6395 | + | |
| 6396 | + return rc; | |
| 6397 | +} | |
| 6398 | + | |
| 6399 | +/** | |
| 6400 | + * lpfc_sli4_ras_setup - Check if RAS supported on the adapter | |
| 6401 | + * @phba: Pointer to HBA context object. | |
| 6402 | + * | |
| 6403 | + * Check if RAS is supported on the adapter and initialize it. | |
| 6404 | + **/ | |
| 6405 | +void | |
| 6406 | +lpfc_sli4_ras_setup(struct lpfc_hba *phba) | |
| 6407 | +{ | |
| 6408 | + /* Check RAS FW Log needs to be enabled or not */ | |
| 6409 | + if (lpfc_check_fwlog_support(phba)) | |
| 6410 | + return; | |
| 6411 | + | |
| 6412 | + lpfc_sli4_ras_fwlog_init(phba, phba->cfg_ras_fwlog_level, | |
| 6413 | + LPFC_RAS_ENABLE_LOGGING); | |
| 6414 | +} | |
| 6415 | + | |
| 6148 | 6416 | /** |
| 6149 | 6417 | * lpfc_sli4_alloc_resource_identifiers - Allocate all SLI4 resource extents. |
| 6150 | 6418 | * @phba: Pointer to HBA context object. |
| @@ -10266,8 +10534,12 @@ lpfc_sli_mbox_sys_flush(struct lpfc_hba *phba) · 4115 unmodified lines | ||
| 10266 | 10534 | LPFC_MBOXQ_t *pmb; |
| 10267 | 10535 | unsigned long iflag; |
| 10268 | 10536 | |
| 10537 | + /* Disable softirqs, including timers from obtaining phba->hbalock */ | |
| 10538 | + local_bh_disable(); | |
| 10539 | + | |
| 10269 | 10540 | /* Flush all the mailbox commands in the mbox system */ |
| 10270 | 10541 | spin_lock_irqsave(&phba->hbalock, iflag); |
| 10542 | + | |
| 10271 | 10543 | /* The pending mailbox command queue */ |
| 10272 | 10544 | list_splice_init(&phba->sli.mboxq, &completions); |
| 10273 | 10545 | /* The outstanding active mailbox command */ |
| @@ -10280,6 +10552,9 @@ lpfc_sli_mbox_sys_flush(struct lpfc_hba *phba) · 6 unmodified lines | ||
| 10280 | 10552 | list_splice_init(&phba->sli.mboxq_cmpl, &completions); |
| 10281 | 10553 | spin_unlock_irqrestore(&phba->hbalock, iflag); |
| 10282 | 10554 | |
| 10555 | + /* Enable softirqs again, done with phba->hbalock */ | |
| 10556 | + local_bh_enable(); | |
| 10557 | + | |
| 10283 | 10558 | /* Return all flushed mailbox commands with MBX_NOT_FINISHED status */ |
| 10284 | 10559 | while (!list_empty(&completions)) { |
| 10285 | 10560 | list_remove_head(&completions, pmb, LPFC_MBOXQ_t, list); |
| @@ -10419,6 +10694,9 @@ lpfc_sli_hba_down(struct lpfc_hba *phba) · 133 unmodified lines | ||
| 10419 | 10694 | |
| 10420 | 10695 | lpfc_hba_down_prep(phba); |
| 10421 | 10696 | |
| 10697 | + /* Disable softirqs, including timers from obtaining phba->hbalock */ | |
| 10698 | + local_bh_disable(); | |
| 10699 | + | |
| 10422 | 10700 | lpfc_fabric_abort_hba(phba); |
| 10423 | 10701 | |
| 10424 | 10702 | spin_lock_irqsave(&phba->hbalock, flags); |
| @@ -10472,6 +10750,9 @@ lpfc_sli_hba_down(struct lpfc_hba *phba) · 47 unmodified lines | ||
| 10472 | 10750 | kfree(buf_ptr); |
| 10473 | 10751 | } |
| 10474 | 10752 | |
| 10753 | + /* Enable softirqs again, done with phba->hbalock */ | |
| 10754 | + local_bh_enable(); | |
| 10755 | + | |
| 10475 | 10756 | /* Return any active mbox cmds */ |
| 10476 | 10757 | del_timer_sync(&psli->mbox_tmo); |
| 10477 | 10758 | |
| @@ -11775,6 +12056,9 @@ lpfc_sli_mbox_sys_shutdown(struct lpfc_hba *phba, int mbx_action) · 1297 unmodified lines | ||
| 11775 | 12056 | } |
| 11776 | 12057 | timeout = msecs_to_jiffies(LPFC_MBOX_TMO * 1000) + jiffies; |
| 11777 | 12058 | |
| 12059 | + /* Disable softirqs, including timers from obtaining phba->hbalock */ | |
| 12060 | + local_bh_disable(); | |
| 12061 | + | |
| 11778 | 12062 | spin_lock_irq(&phba->hbalock); |
| 11779 | 12063 | psli->sli_flag |= LPFC_SLI_ASYNC_MBX_BLK; |
| 11780 | 12064 | |
| @@ -11788,6 +12072,9 @@ lpfc_sli_mbox_sys_shutdown(struct lpfc_hba *phba, int mbx_action) · 7 unmodified lines | ||
| 11788 | 12072 | 1000) + jiffies; |
| 11789 | 12073 | spin_unlock_irq(&phba->hbalock); |
| 11790 | 12074 | |
| 12075 | + /* Enable softirqs again, done with phba->hbalock */ | |
| 12076 | + local_bh_enable(); | |
| 12077 | + | |
| 11791 | 12078 | while (phba->sli.mbox_active) { |
| 11792 | 12079 | /* Check active mailbox complete status every 2ms */ |
| 11793 | 12080 | msleep(2); |
| @@ -11797,9 +12084,13 @@ lpfc_sli_mbox_sys_shutdown(struct lpfc_hba *phba, int mbx_action) · 3 unmodified lines | ||
| 11797 | 12084 | */ |
| 11798 | 12085 | break; |
| 11799 | 12086 | } |
| 11800 | − } else | |
| 12087 | + } else { | |
| 11801 | 12088 | spin_unlock_irq(&phba->hbalock); |
| 11802 | 12089 | |
| 12090 | + /* Enable softirqs again, done with phba->hbalock */ | |
| 12091 | + local_bh_enable(); | |
| 12092 | + } | |
| 12093 | + | |
| 11803 | 12094 | lpfc_sli_mbox_sys_flush(phba); |
| 11804 | 12095 | } |
| 11805 | 12096 | |
| @@ -13136,7 +13427,6 @@ static bool · 1330 unmodified lines | ||
| 13136 | 13427 | lpfc_sli4_sp_handle_rcqe(struct lpfc_hba *phba, struct lpfc_rcqe *rcqe) |
| 13137 | 13428 | { |
| 13138 | 13429 | bool workposted = false; |
| 13139 | − struct fc_frame_header *fc_hdr; | |
| 13140 | 13430 | struct lpfc_queue *hrq = phba->sli4_hba.hdr_rq; |
| 13141 | 13431 | struct lpfc_queue *drq = phba->sli4_hba.dat_rq; |
| 13142 | 13432 | struct lpfc_nvmet_tgtport *tgtp; |
| @@ -13173,9 +13463,6 @@ lpfc_sli4_sp_handle_rcqe(struct lpfc_hba *phba, struct lpfc_rcqe *rcqe) · 30 unmodified lines | ||
| 13173 | 13463 | hrq->RQ_buf_posted--; |
| 13174 | 13464 | memcpy(&dma_buf->cq_event.cqe.rcqe_cmpl, rcqe, sizeof(*rcqe)); |
| 13175 | 13465 | |
| 13176 | − /* If a NVME LS event (type 0x28), treat it as Fast path */ | |
| 13177 | − fc_hdr = (struct fc_frame_header *)dma_buf->hbuf.virt; | |
| 13178 | − | |
| 13179 | 13466 | /* save off the frame for the word thread to process */ |
| 13180 | 13467 | list_add_tail(&dma_buf->cq_event.list, |
| 13181 | 13468 | &phba->sli4_hba.sp_queue_event); |
| @@ -14558,13 +14845,10 @@ lpfc_cq_create(struct lpfc_hba *phba, struct lpfc_queue *cq, · 1376 unmodified lines | ||
| 14558 | 14845 | int rc, length, status = 0; |
| 14559 | 14846 | uint32_t shdr_status, shdr_add_status; |
| 14560 | 14847 | union lpfc_sli4_cfg_shdr *shdr; |
| 14561 | − uint32_t hw_page_size = phba->sli4_hba.pc_sli4_params.if_page_sz; | |
| 14562 | 14848 | |
| 14563 | 14849 | /* sanity check on queue memory */ |
| 14564 | 14850 | if (!cq || !eq) |
| 14565 | 14851 | return -ENODEV; |
| 14566 | − if (!phba->sli4_hba.pc_sli4_params.supported) | |
| 14567 | − hw_page_size = cq->page_size; | |
| 14568 | 14852 | |
| 14569 | 14853 | mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); |
| 14570 | 14854 | if (!mbox) |
| @@ -886,3 +886,4 @@ int lpfc_sli4_unregister_fcf(struct lpfc_hba *); · 885 unmodified lines | ||
| 886 | 886 | int lpfc_sli4_post_status_check(struct lpfc_hba *); |
| 887 | 887 | uint8_t lpfc_sli_config_mbox_subsys_get(struct lpfc_hba *, LPFC_MBOXQ_t *); |
| 888 | 888 | uint8_t lpfc_sli_config_mbox_opcode_get(struct lpfc_hba *, LPFC_MBOXQ_t *); |
| 889 | +void lpfc_sli4_ras_dma_free(struct lpfc_hba *phba); | |
| @@ -20,7 +20,7 @@ · 19 unmodified lines | ||
| 20 | 20 | * included with this package. * |
| 21 | 21 | *******************************************************************/ |
| 22 | 22 | |
| 23 | −#define LPFC_DRIVER_VERSION "12.0.0.6" | |
| 23 | +#define LPFC_DRIVER_VERSION "12.0.0.7" | |
| 24 | 24 | #define LPFC_DRIVER_NAME "lpfc" |
| 25 | 25 | |
| 26 | 26 | /* Used for SLI 2/3 */ |
| @@ -207,7 +207,7 @@ lpfc_unique_wwpn(struct lpfc_hba *phba, struct lpfc_vport *new_vport) · 206 unmodified lines | ||
| 207 | 207 | struct lpfc_vport *vport; |
| 208 | 208 | unsigned long flags; |
| 209 | 209 | |
| 210 | − spin_lock_irqsave(&phba->hbalock, flags); | |
| 210 | + spin_lock_irqsave(&phba->port_list_lock, flags); | |
| 211 | 211 | list_for_each_entry(vport, &phba->port_list, listentry) { |
| 212 | 212 | if (vport == new_vport) |
| 213 | 213 | continue; |
| @@ -215,11 +215,11 @@ lpfc_unique_wwpn(struct lpfc_hba *phba, struct lpfc_vport *new_vport) · 1 unmodified line | ||
| 215 | 215 | if (memcmp(&vport->fc_sparam.portName, |
| 216 | 216 | &new_vport->fc_sparam.portName, |
| 217 | 217 | sizeof(struct lpfc_name)) == 0) { |
| 218 | − spin_unlock_irqrestore(&phba->hbalock, flags); | |
| 218 | + spin_unlock_irqrestore(&phba->port_list_lock, flags); | |
| 219 | 219 | return 0; |
| 220 | 220 | } |
| 221 | 221 | } |
| 222 | − spin_unlock_irqrestore(&phba->hbalock, flags); | |
| 222 | + spin_unlock_irqrestore(&phba->port_list_lock, flags); | |
| 223 | 223 | return 1; |
| 224 | 224 | } |
| 225 | 225 | |
| @@ -825,9 +825,9 @@ skip_logo: · 599 unmodified lines | ||
| 825 | 825 | |
| 826 | 826 | lpfc_free_vpi(phba, vport->vpi); |
| 827 | 827 | vport->work_port_events = 0; |
| 828 | − spin_lock_irq(&phba->hbalock); | |
| 828 | + spin_lock_irq(&phba->port_list_lock); | |
| 829 | 829 | list_del_init(&vport->listentry); |
| 830 | − spin_unlock_irq(&phba->hbalock); | |
| 830 | + spin_unlock_irq(&phba->port_list_lock); | |
| 831 | 831 | lpfc_printf_vlog(vport, KERN_ERR, LOG_VPORT, |
| 832 | 832 | "1828 Vport Deleted.\n"); |
| 833 | 833 | scsi_host_put(shost); |
| @@ -844,7 +844,7 @@ lpfc_create_vport_work_array(struct lpfc_hba *phba) · 10 unmodified lines | ||
| 844 | 844 | GFP_KERNEL); |
| 845 | 845 | if (vports == NULL) |
| 846 | 846 | return NULL; |
| 847 | − spin_lock_irq(&phba->hbalock); | |
| 847 | + spin_lock_irq(&phba->port_list_lock); | |
| 848 | 848 | list_for_each_entry(port_iterator, &phba->port_list, listentry) { |
| 849 | 849 | if (port_iterator->load_flag & FC_UNLOADING) |
| 850 | 850 | continue; |
| @@ -856,7 +856,7 @@ lpfc_create_vport_work_array(struct lpfc_hba *phba) · 5 unmodified lines | ||
| 856 | 856 | } |
| 857 | 857 | vports[index++] = port_iterator; |
| 858 | 858 | } |
| 859 | − spin_unlock_irq(&phba->hbalock); | |
| 859 | + spin_unlock_irq(&phba->port_list_lock); | |
| 860 | 860 | return vports; |
| 861 | 861 | } |
| 862 | 862 | |
| @@ -52,14 +52,12 @@ struct mac_esp_priv { · 51 unmodified lines | ||
| 52 | 52 | struct esp *esp; |
| 53 | 53 | void __iomem *pdma_regs; |
| 54 | 54 | void __iomem *pdma_io; |
| 55 | − int error; | |
| 56 | 55 | }; |
| 57 | 56 | static struct esp *esp_chips[2]; |
| 58 | 57 | static DEFINE_SPINLOCK(esp_chips_lock); |
| 59 | 58 | |
| 60 | 59 | #define MAC_ESP_GET_PRIV(esp) ((struct mac_esp_priv *) \ |
| 61 | − platform_get_drvdata((struct platform_device *) \ | |
| 62 | − (esp->dev))) | |
| 60 | + dev_get_drvdata((esp)->dev)) | |
| 63 | 61 | |
| 64 | 62 | static inline void mac_esp_write8(struct esp *esp, u8 val, unsigned long reg) |
| 65 | 63 | { |
| @@ -71,38 +69,6 @@ static inline u8 mac_esp_read8(struct esp *esp, unsigned long reg) · 5 unmodified lines | ||
| 71 | 69 | return nubus_readb(esp->regs + reg * 16); |
| 72 | 70 | } |
| 73 | 71 | |
| 74 | −/* For pseudo DMA and PIO we need the virtual address | |
| 75 | − * so this address mapping is the identity mapping. | |
| 76 | − */ | |
| 77 | − | |
| 78 | −static dma_addr_t mac_esp_map_single(struct esp *esp, void *buf, | |
| 79 | − size_t sz, int dir) | |
| 80 | −{ | |
| 81 | − return (dma_addr_t)buf; | |
| 82 | −} | |
| 83 | − | |
| 84 | −static int mac_esp_map_sg(struct esp *esp, struct scatterlist *sg, | |
| 85 | − int num_sg, int dir) | |
| 86 | −{ | |
| 87 | − int i; | |
| 88 | − | |
| 89 | − for (i = 0; i < num_sg; i++) | |
| 90 | − sg[i].dma_address = (u32)sg_virt(&sg[i]); | |
| 91 | − return num_sg; | |
| 92 | −} | |
| 93 | − | |
| 94 | −static void mac_esp_unmap_single(struct esp *esp, dma_addr_t addr, | |
| 95 | − size_t sz, int dir) | |
| 96 | −{ | |
| 97 | − /* Nothing to do. */ | |
| 98 | −} | |
| 99 | − | |
| 100 | −static void mac_esp_unmap_sg(struct esp *esp, struct scatterlist *sg, | |
| 101 | − int num_sg, int dir) | |
| 102 | −{ | |
| 103 | − /* Nothing to do. */ | |
| 104 | −} | |
| 105 | − | |
| 106 | 72 | static void mac_esp_reset_dma(struct esp *esp) |
| 107 | 73 | { |
| 108 | 74 | /* Nothing to do. */ |
| @@ -120,12 +86,11 @@ static void mac_esp_dma_invalidate(struct esp *esp) · 11 unmodified lines | ||
| 120 | 86 | |
| 121 | 87 | static int mac_esp_dma_error(struct esp *esp) |
| 122 | 88 | { |
| 123 | − return MAC_ESP_GET_PRIV(esp)->error; | |
| 89 | + return esp->send_cmd_error; | |
| 124 | 90 | } |
| 125 | 91 | |
| 126 | 92 | static inline int mac_esp_wait_for_empty_fifo(struct esp *esp) |
| 127 | 93 | { |
| 128 | − struct mac_esp_priv *mep = MAC_ESP_GET_PRIV(esp); | |
| 129 | 94 | int i = 500000; |
| 130 | 95 | |
| 131 | 96 | do { |
| @@ -140,7 +105,7 @@ static inline int mac_esp_wait_for_empty_fifo(struct esp *esp) · 8 unmodified lines | ||
| 140 | 105 | |
| 141 | 106 | printk(KERN_ERR PFX "FIFO is not empty (sreg %02x)\n", |
| 142 | 107 | esp_read8(ESP_STATUS)); |
| 143 | − mep->error = 1; | |
| 108 | + esp->send_cmd_error = 1; | |
| 144 | 109 | return 1; |
| 145 | 110 | } |
| 146 | 111 | |
| @@ -166,7 +131,7 @@ static inline int mac_esp_wait_for_dreq(struct esp *esp) · 19 unmodified lines | ||
| 166 | 131 | |
| 167 | 132 | printk(KERN_ERR PFX "PDMA timeout (sreg %02x)\n", |
| 168 | 133 | esp_read8(ESP_STATUS)); |
| 169 | − mep->error = 1; | |
| 134 | + esp->send_cmd_error = 1; | |
| 170 | 135 | return 1; |
| 171 | 136 | } |
| 172 | 137 | |
| @@ -233,7 +198,7 @@ static void mac_esp_send_pdma_cmd(struct esp *esp, u32 addr, u32 esp_count, · 60 unmodified lines | ||
| 233 | 198 | { |
| 234 | 199 | struct mac_esp_priv *mep = MAC_ESP_GET_PRIV(esp); |
| 235 | 200 | |
| 236 | − mep->error = 0; | |
| 201 | + esp->send_cmd_error = 0; | |
| 237 | 202 | |
| 238 | 203 | if (!write) |
| 239 | 204 | scsi_esp_cmd(esp, ESP_CMD_FLUSH); |
| @@ -271,164 +236,6 @@ static void mac_esp_send_pdma_cmd(struct esp *esp, u32 addr, u32 esp_count, · 31 unmodified lines | ||
| 271 | 236 | } while (esp_count); |
| 272 | 237 | } |
| 273 | 238 | |
| 274 | −/* | |
| 275 | − * Programmed IO routines follow. | |
| 276 | − */ | |
| 277 | − | |
| 278 | −static inline unsigned int mac_esp_wait_for_fifo(struct esp *esp) | |
| 279 | −{ | |
| 280 | − int i = 500000; | |
| 281 | − | |
| 282 | − do { | |
| 283 | − unsigned int fbytes = esp_read8(ESP_FFLAGS) & ESP_FF_FBYTES; | |
| 284 | − | |
| 285 | − if (fbytes) | |
| 286 | − return fbytes; | |
| 287 | − | |
| 288 | − udelay(2); | |
| 289 | − } while (--i); | |
| 290 | − | |
| 291 | − printk(KERN_ERR PFX "FIFO is empty (sreg %02x)\n", | |
| 292 | − esp_read8(ESP_STATUS)); | |
| 293 | − return 0; | |
| 294 | −} | |
| 295 | − | |
| 296 | −static inline int mac_esp_wait_for_intr(struct esp *esp) | |
| 297 | −{ | |
| 298 | − struct mac_esp_priv *mep = MAC_ESP_GET_PRIV(esp); | |
| 299 | − int i = 500000; | |
| 300 | − | |
| 301 | − do { | |
| 302 | − esp->sreg = esp_read8(ESP_STATUS); | |
| 303 | − if (esp->sreg & ESP_STAT_INTR) | |
| 304 | − return 0; | |
| 305 | − | |
| 306 | − udelay(2); | |
| 307 | − } while (--i); | |
| 308 | − | |
| 309 | − printk(KERN_ERR PFX "IRQ timeout (sreg %02x)\n", esp->sreg); | |
| 310 | − mep->error = 1; | |
| 311 | − return 1; | |
| 312 | −} | |
| 313 | − | |
| 314 | −#define MAC_ESP_PIO_LOOP(operands, reg1) \ | |
| 315 | − asm volatile ( \ | |
| 316 | − "1: moveb " operands " \n" \ | |
| 317 | − " subqw #1,%1 \n" \ | |
| 318 | − " jbne 1b \n" \ | |
| 319 | − : "+a" (addr), "+r" (reg1) \ | |
| 320 | − : "a" (fifo)) | |
| 321 | − | |
| 322 | −#define MAC_ESP_PIO_FILL(operands, reg1) \ | |
| 323 | − asm volatile ( \ | |
| 324 | − " moveb " operands " \n" \ | |
| 325 | − " moveb " operands " \n" \ | |
| 326 | − " moveb " operands " \n" \ | |
| 327 | − " moveb " operands " \n" \ | |
| 328 | − " moveb " operands " \n" \ | |
| 329 | − " moveb " operands " \n" \ | |
| 330 | − " moveb " operands " \n" \ | |
| 331 | − " moveb " operands " \n" \ | |
| 332 | − " moveb " operands " \n" \ | |
| 333 | − " moveb " operands " \n" \ | |
| 334 | − " moveb " operands " \n" \ | |
| 335 | − " moveb " operands " \n" \ | |
| 336 | − " moveb " operands " \n" \ | |
| 337 | − " moveb " operands " \n" \ | |
| 338 | − " moveb " operands " \n" \ | |
| 339 | − " moveb " operands " \n" \ | |
| 340 | − " subqw #8,%1 \n" \ | |
| 341 | − " subqw #8,%1 \n" \ | |
| 342 | − : "+a" (addr), "+r" (reg1) \ | |
| 343 | − : "a" (fifo)) | |
| 344 | − | |
| 345 | −#define MAC_ESP_FIFO_SIZE 16 | |
| 346 | − | |
| 347 | −static void mac_esp_send_pio_cmd(struct esp *esp, u32 addr, u32 esp_count, | |
| 348 | − u32 dma_count, int write, u8 cmd) | |
| 349 | −{ | |
| 350 | − struct mac_esp_priv *mep = MAC_ESP_GET_PRIV(esp); | |
| 351 | − u8 __iomem *fifo = esp->regs + ESP_FDATA * 16; | |
| 352 | − u8 phase = esp->sreg & ESP_STAT_PMASK; | |
| 353 | − | |
| 354 | − cmd &= ~ESP_CMD_DMA; | |
| 355 | − mep->error = 0; | |
| 356 | − | |
| 357 | − if (write) { | |
| 358 | − u8 *dst = (u8 *)addr; | |
| 359 | − u8 mask = ~(phase == ESP_MIP ? ESP_INTR_FDONE : ESP_INTR_BSERV); | |
| 360 | − | |
| 361 | − scsi_esp_cmd(esp, cmd); | |
| 362 | − | |
| 363 | − while (1) { | |
| 364 | − if (!mac_esp_wait_for_fifo(esp)) | |
| 365 | − break; | |
| 366 | − | |
| 367 | − *dst++ = esp_read8(ESP_FDATA); | |
| 368 | − --esp_count; | |
| 369 | − | |
| 370 | − if (!esp_count) | |
| 371 | − break; | |
| 372 | − | |
| 373 | − if (mac_esp_wait_for_intr(esp)) | |
| 374 | − break; | |
| 375 | − | |
| 376 | − if ((esp->sreg & ESP_STAT_PMASK) != phase) | |
| 377 | − break; | |
| 378 | − | |
| 379 | − esp->ireg = esp_read8(ESP_INTRPT); | |
| 380 | − if (esp->ireg & mask) { | |
| 381 | − mep->error = 1; | |
| 382 | − break; | |
| 383 | − } | |
| 384 | − | |
| 385 | − if (phase == ESP_MIP) | |
| 386 | − scsi_esp_cmd(esp, ESP_CMD_MOK); | |
| 387 | − | |
| 388 | − scsi_esp_cmd(esp, ESP_CMD_TI); | |
| 389 | − } | |
| 390 | − } else { | |
| 391 | − scsi_esp_cmd(esp, ESP_CMD_FLUSH); | |
| 392 | − | |
| 393 | − if (esp_count >= MAC_ESP_FIFO_SIZE) | |
| 394 | − MAC_ESP_PIO_FILL("%0@+,%2@", esp_count); | |
| 395 | − else | |
| 396 | − MAC_ESP_PIO_LOOP("%0@+,%2@", esp_count); | |
| 397 | − | |
| 398 | − scsi_esp_cmd(esp, cmd); | |
| 399 | − | |
| 400 | − while (esp_count) { | |
| 401 | − unsigned int n; | |
| 402 | − | |
| 403 | − if (mac_esp_wait_for_intr(esp)) | |
| 404 | − break; | |
| 405 | − | |
| 406 | − if ((esp->sreg & ESP_STAT_PMASK) != phase) | |
| 407 | − break; | |
| 408 | − | |
| 409 | − esp->ireg = esp_read8(ESP_INTRPT); | |
| 410 | − if (esp->ireg & ~ESP_INTR_BSERV) { | |
| 411 | − mep->error = 1; | |
| 412 | − break; | |
| 413 | − } | |
| 414 | − | |
| 415 | − n = MAC_ESP_FIFO_SIZE - | |
| 416 | − (esp_read8(ESP_FFLAGS) & ESP_FF_FBYTES); | |
| 417 | − if (n > esp_count) | |
| 418 | − n = esp_count; | |
| 419 | − | |
| 420 | − if (n == MAC_ESP_FIFO_SIZE) { | |
| 421 | − MAC_ESP_PIO_FILL("%0@+,%2@", esp_count); | |
| 422 | − } else { | |
| 423 | − esp_count -= n; | |
| 424 | − MAC_ESP_PIO_LOOP("%0@+,%2@", n); | |
| 425 | − } | |
| 426 | − | |
| 427 | − scsi_esp_cmd(esp, ESP_CMD_TI); | |
| 428 | − } | |
| 429 | − } | |
| 430 | −} | |
| 431 | − | |
| 432 | 239 | static int mac_esp_irq_pending(struct esp *esp) |
| 433 | 240 | { |
| 434 | 241 | if (esp_read8(ESP_STATUS) & ESP_STAT_INTR) |
| @@ -470,10 +277,6 @@ static irqreturn_t mac_scsi_esp_intr(int irq, void *dev_id) · 35 unmodified lines | ||
| 470 | 277 | static struct esp_driver_ops mac_esp_ops = { |
| 471 | 278 | .esp_write8 = mac_esp_write8, |
| 472 | 279 | .esp_read8 = mac_esp_read8, |
| 473 | − .map_single = mac_esp_map_single, | |
| 474 | − .map_sg = mac_esp_map_sg, | |
| 475 | − .unmap_single = mac_esp_unmap_single, | |
| 476 | − .unmap_sg = mac_esp_unmap_sg, | |
| 477 | 280 | .irq_pending = mac_esp_irq_pending, |
| 478 | 281 | .dma_length_limit = mac_esp_dma_length_limit, |
| 479 | 282 | .reset_dma = mac_esp_reset_dma, |
| @@ -508,7 +311,7 @@ static int esp_mac_probe(struct platform_device *dev) · 28 unmodified lines | ||
| 508 | 311 | esp = shost_priv(host); |
| 509 | 312 | |
| 510 | 313 | esp->host = host; |
| 511 | − esp->dev = dev; | |
| 314 | + esp->dev = &dev->dev; | |
| 512 | 315 | |
| 513 | 316 | esp->command_block = kzalloc(16, GFP_KERNEL); |
| 514 | 317 | if (!esp->command_block) |
| @@ -551,14 +354,16 @@ static int esp_mac_probe(struct platform_device *dev) · 36 unmodified lines | ||
| 551 | 354 | mep->pdma_regs = NULL; |
| 552 | 355 | break; |
| 553 | 356 | } |
| 357 | + esp->fifo_reg = esp->regs + ESP_FDATA * 16; | |
| 554 | 358 | |
| 555 | 359 | esp->ops = &mac_esp_ops; |
| 360 | + esp->flags = ESP_FLAG_NO_DMA_MAP; | |
| 556 | 361 | if (mep->pdma_io == NULL) { |
| 557 | 362 | printk(KERN_INFO PFX "using PIO for controller %d\n", dev->id); |
| 558 | 363 | esp_write8(0, ESP_TCLOW); |
| 559 | 364 | esp_write8(0, ESP_TCMED); |
| 560 | − esp->flags = ESP_FLAG_DISABLE_SYNC; | |
| 561 | − mac_esp_ops.send_dma_cmd = mac_esp_send_pio_cmd; | |
| 365 | + esp->flags |= ESP_FLAG_DISABLE_SYNC; | |
| 366 | + mac_esp_ops.send_dma_cmd = esp_send_pio_cmd; | |
| 562 | 367 | } else { |
| 563 | 368 | printk(KERN_INFO PFX "using PDMA for controller %d\n", dev->id); |
| 564 | 369 | } |
| @@ -577,7 +382,7 @@ static int esp_mac_probe(struct platform_device *dev) · 12 unmodified lines | ||
| 577 | 382 | esp_chips[dev->id] = esp; |
| 578 | 383 | spin_unlock(&esp_chips_lock); |
| 579 | 384 | |
| 580 | − err = scsi_esp_register(esp, &dev->dev); | |
| 385 | + err = scsi_esp_register(esp); | |
| 581 | 386 | if (err) |
| 582 | 387 | goto fail_free_irq; |
| 583 | 388 | |
| @@ -201,13 +201,6 @@ int mraid_debug_level = CL_ANN; · 200 unmodified lines | ||
| 201 | 201 | module_param_named(debug_level, mraid_debug_level, int, 0); |
| 202 | 202 | MODULE_PARM_DESC(debug_level, "Debug level for driver (default=0)"); |
| 203 | 203 | |
| 204 | −/* | |
| 205 | − * ### global data ### | |
| 206 | − */ | |
| 207 | −static uint8_t megaraid_mbox_version[8] = | |
| 208 | − { 0x02, 0x20, 0x04, 0x06, 3, 7, 20, 5 }; | |
| 209 | − | |
| 210 | − | |
| 211 | 204 | /* |
| 212 | 205 | * PCI table for all supported controllers. |
| 213 | 206 | */ |
| @@ -457,10 +450,9 @@ megaraid_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) · 243 unmodified lines | ||
| 457 | 450 | |
| 458 | 451 | // Setup the default DMA mask. This would be changed later on |
| 459 | 452 | // depending on hardware capabilities |
| 460 | − if (pci_set_dma_mask(adapter->pdev, DMA_BIT_MASK(32)) != 0) { | |
| 461 | − | |
| 453 | + if (dma_set_mask(&adapter->pdev->dev, DMA_BIT_MASK(32))) { | |
| 462 | 454 | con_log(CL_ANN, (KERN_WARNING |
| 463 | − "megaraid: pci_set_dma_mask failed:%d\n", __LINE__)); | |
| 455 | + "megaraid: dma_set_mask failed:%d\n", __LINE__)); | |
| 464 | 456 | |
| 465 | 457 | goto out_free_adapter; |
| 466 | 458 | } |
| @@ -484,7 +476,7 @@ megaraid_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) · 17 unmodified lines | ||
| 484 | 476 | // Start the mailbox based controller |
| 485 | 477 | if (megaraid_init_mbox(adapter) != 0) { |
| 486 | 478 | con_log(CL_ANN, (KERN_WARNING |
| 487 | − "megaraid: maibox adapter did not initialize\n")); | |
| 479 | + "megaraid: mailbox adapter did not initialize\n")); | |
| 488 | 480 | |
| 489 | 481 | goto out_free_adapter; |
| 490 | 482 | } |
| @@ -878,11 +870,12 @@ megaraid_init_mbox(adapter_t *adapter) · 387 unmodified lines | ||
| 878 | 870 | adapter->pdev->device == PCI_DEVICE_ID_PERC4_DI_EVERGLADES) || |
| 879 | 871 | (adapter->pdev->vendor == PCI_VENDOR_ID_DELL && |
| 880 | 872 | adapter->pdev->device == PCI_DEVICE_ID_PERC4E_DI_KOBUK)) { |
| 881 | − if (pci_set_dma_mask(adapter->pdev, DMA_BIT_MASK(64))) { | |
| 873 | + if (dma_set_mask(&adapter->pdev->dev, DMA_BIT_MASK(64))) { | |
| 882 | 874 | con_log(CL_ANN, (KERN_WARNING |
| 883 | 875 | "megaraid: DMA mask for 64-bit failed\n")); |
| 884 | 876 | |
| 885 | − if (pci_set_dma_mask (adapter->pdev, DMA_BIT_MASK(32))) { | |
| 877 | + if (dma_set_mask(&adapter->pdev->dev, | |
| 878 | + DMA_BIT_MASK(32))) { | |
| 886 | 879 | con_log(CL_ANN, (KERN_WARNING |
| 887 | 880 | "megaraid: 32-bit DMA mask failed\n")); |
| 888 | 881 | goto out_free_sysfs_res; |
| @@ -950,7 +943,7 @@ megaraid_fini_mbox(adapter_t *adapter) · 61 unmodified lines | ||
| 950 | 943 | * megaraid_alloc_cmd_packets - allocate shared mailbox |
| 951 | 944 | * @adapter : soft state of the raid controller |
| 952 | 945 | * |
| 953 | − * Allocate and align the shared mailbox. This maibox is used to issue | |
| 946 | + * Allocate and align the shared mailbox. This mailbox is used to issue | |
| 954 | 947 | * all the commands. For IO based controllers, the mailbox is also registered |
| 955 | 948 | * with the FW. Allocate memory for all commands as well. |
| 956 | 949 | * This is our big allocator. |
| @@ -975,9 +968,9 @@ megaraid_alloc_cmd_packets(adapter_t *adapter) · 18 unmodified lines | ||
| 975 | 968 | * Allocate the common 16-byte aligned memory for the handshake |
| 976 | 969 | * mailbox. |
| 977 | 970 | */ |
| 978 | − raid_dev->una_mbox64 = pci_zalloc_consistent(adapter->pdev, | |
| 979 | − sizeof(mbox64_t), | |
| 980 | − &raid_dev->una_mbox64_dma); | |
| 971 | + raid_dev->una_mbox64 = dma_zalloc_coherent(&adapter->pdev->dev, | |
| 972 | + sizeof(mbox64_t), &raid_dev->una_mbox64_dma, | |
| 973 | + GFP_KERNEL); | |
| 981 | 974 | |
| 982 | 975 | if (!raid_dev->una_mbox64) { |
| 983 | 976 | con_log(CL_ANN, (KERN_WARNING |
| @@ -1003,8 +996,8 @@ megaraid_alloc_cmd_packets(adapter_t *adapter) · 19 unmodified lines | ||
| 1003 | 996 | align; |
| 1004 | 997 | |
| 1005 | 998 | // Allocate memory for commands issued internally |
| 1006 | − adapter->ibuf = pci_zalloc_consistent(pdev, MBOX_IBUF_SIZE, | |
| 1007 | − &adapter->ibuf_dma_h); | |
| 999 | + adapter->ibuf = dma_zalloc_coherent(&pdev->dev, MBOX_IBUF_SIZE, | |
| 1000 | + &adapter->ibuf_dma_h, GFP_KERNEL); | |
| 1008 | 1001 | if (!adapter->ibuf) { |
| 1009 | 1002 | |
| 1010 | 1003 | con_log(CL_ANN, (KERN_WARNING |
| @@ -1082,7 +1075,7 @@ megaraid_alloc_cmd_packets(adapter_t *adapter) · 71 unmodified lines | ||
| 1082 | 1075 | |
| 1083 | 1076 | scb->scp = NULL; |
| 1084 | 1077 | scb->state = SCB_FREE; |
| 1085 | − scb->dma_direction = PCI_DMA_NONE; | |
| 1078 | + scb->dma_direction = DMA_NONE; | |
| 1086 | 1079 | scb->dma_type = MRAID_DMA_NONE; |
| 1087 | 1080 | scb->dev_channel = -1; |
| 1088 | 1081 | scb->dev_target = -1; |
| @@ -1098,10 +1091,10 @@ out_teardown_dma_pools: · 9 unmodified lines | ||
| 1098 | 1091 | out_free_scb_list: |
| 1099 | 1092 | kfree(adapter->kscb_list); |
| 1100 | 1093 | out_free_ibuf: |
| 1101 | − pci_free_consistent(pdev, MBOX_IBUF_SIZE, (void *)adapter->ibuf, | |
| 1094 | + dma_free_coherent(&pdev->dev, MBOX_IBUF_SIZE, (void *)adapter->ibuf, | |
| 1102 | 1095 | adapter->ibuf_dma_h); |
| 1103 | 1096 | out_free_common_mbox: |
| 1104 | − pci_free_consistent(adapter->pdev, sizeof(mbox64_t), | |
| 1097 | + dma_free_coherent(&adapter->pdev->dev, sizeof(mbox64_t), | |
| 1105 | 1098 | (caddr_t)raid_dev->una_mbox64, raid_dev->una_mbox64_dma); |
| 1106 | 1099 | |
| 1107 | 1100 | return -1; |
| @@ -1123,10 +1116,10 @@ megaraid_free_cmd_packets(adapter_t *adapter) · 15 unmodified lines | ||
| 1123 | 1116 | |
| 1124 | 1117 | kfree(adapter->kscb_list); |
| 1125 | 1118 | |
| 1126 | − pci_free_consistent(adapter->pdev, MBOX_IBUF_SIZE, | |
| 1119 | + dma_free_coherent(&adapter->pdev->dev, MBOX_IBUF_SIZE, | |
| 1127 | 1120 | (void *)adapter->ibuf, adapter->ibuf_dma_h); |
| 1128 | 1121 | |
| 1129 | − pci_free_consistent(adapter->pdev, sizeof(mbox64_t), | |
| 1122 | + dma_free_coherent(&adapter->pdev->dev, sizeof(mbox64_t), | |
| 1130 | 1123 | (caddr_t)raid_dev->una_mbox64, raid_dev->una_mbox64_dma); |
| 1131 | 1124 | return; |
| 1132 | 1125 | } |
| @@ -1428,12 +1421,6 @@ mbox_post_cmd(adapter_t *adapter, scb_t *scb) · 295 unmodified lines | ||
| 1428 | 1421 | |
| 1429 | 1422 | adapter->outstanding_cmds++; |
| 1430 | 1423 | |
| 1431 | − if (scb->dma_direction == PCI_DMA_TODEVICE) | |
| 1432 | − pci_dma_sync_sg_for_device(adapter->pdev, | |
| 1433 | − scsi_sglist(scb->scp), | |
| 1434 | − scsi_sg_count(scb->scp), | |
| 1435 | − PCI_DMA_TODEVICE); | |
| 1436 | − | |
| 1437 | 1424 | mbox->busy = 1; // Set busy |
| 1438 | 1425 | mbox->poll = 0; |
| 1439 | 1426 | mbox->ack = 0; |
| @@ -2180,31 +2167,6 @@ megaraid_isr(int irq, void *devp) · 740 unmodified lines | ||
| 2180 | 2167 | } |
| 2181 | 2168 | |
| 2182 | 2169 | |
| 2183 | −/** | |
| 2184 | − * megaraid_mbox_sync_scb - sync kernel buffers | |
| 2185 | − * @adapter : controller's soft state | |
| 2186 | − * @scb : pointer to the resource packet | |
| 2187 | − * | |
| 2188 | − * DMA sync if required. | |
| 2189 | − */ | |
| 2190 | −static void | |
| 2191 | −megaraid_mbox_sync_scb(adapter_t *adapter, scb_t *scb) | |
| 2192 | −{ | |
| 2193 | − mbox_ccb_t *ccb; | |
| 2194 | − | |
| 2195 | − ccb = (mbox_ccb_t *)scb->ccb; | |
| 2196 | − | |
| 2197 | − if (scb->dma_direction == PCI_DMA_FROMDEVICE) | |
| 2198 | − pci_dma_sync_sg_for_cpu(adapter->pdev, | |
| 2199 | − scsi_sglist(scb->scp), | |
| 2200 | − scsi_sg_count(scb->scp), | |
| 2201 | − PCI_DMA_FROMDEVICE); | |
| 2202 | − | |
| 2203 | − scsi_dma_unmap(scb->scp); | |
| 2204 | − return; | |
| 2205 | −} | |
| 2206 | − | |
| 2207 | − | |
| 2208 | 2170 | /** |
| 2209 | 2171 | * megaraid_mbox_dpc - the tasklet to complete the commands from completed list |
| 2210 | 2172 | * @devp : pointer to HBA soft state |
| @@ -2403,9 +2365,7 @@ megaraid_mbox_dpc(unsigned long devp) · 192 unmodified lines | ||
| 2403 | 2365 | megaraid_mbox_display_scb(adapter, scb); |
| 2404 | 2366 | } |
| 2405 | 2367 | |
| 2406 | − // Free our internal resources and call the mid-layer callback | |
| 2407 | − // routine | |
| 2408 | − megaraid_mbox_sync_scb(adapter, scb); | |
| 2368 | + scsi_dma_unmap(scp); | |
| 2409 | 2369 | |
| 2410 | 2370 | // remove from local clist |
| 2411 | 2371 | list_del_init(&scb->list); |
| @@ -2577,7 +2537,6 @@ megaraid_reset_handler(struct scsi_cmnd *scp) · 165 unmodified lines | ||
| 2577 | 2537 | uint8_t raw_mbox[sizeof(mbox_t)]; |
| 2578 | 2538 | int rval; |
| 2579 | 2539 | int recovery_window; |
| 2580 | − int recovering; | |
| 2581 | 2540 | int i; |
| 2582 | 2541 | uioc_t *kioc; |
| 2583 | 2542 | |
| @@ -2591,7 +2550,6 @@ megaraid_reset_handler(struct scsi_cmnd *scp) · 7 unmodified lines | ||
| 2591 | 2550 | return FAILED; |
| 2592 | 2551 | } |
| 2593 | 2552 | |
| 2594 | − | |
| 2595 | 2553 | // Under exceptional conditions, FW can take up to 3 minutes to |
| 2596 | 2554 | // complete command processing. Wait for additional 2 minutes for the |
| 2597 | 2555 | // pending commands counter to go down to 0. If it doesn't, let the |
| @@ -2640,8 +2598,6 @@ megaraid_reset_handler(struct scsi_cmnd *scp) · 42 unmodified lines | ||
| 2640 | 2598 | |
| 2641 | 2599 | recovery_window = MBOX_RESET_WAIT + MBOX_RESET_EXT_WAIT; |
| 2642 | 2600 | |
| 2643 | − recovering = adapter->outstanding_cmds; | |
| 2644 | − | |
| 2645 | 2601 | for (i = 0; i < recovery_window; i++) { |
| 2646 | 2602 | |
| 2647 | 2603 | megaraid_ack_sequence(adapter); |
| @@ -2725,13 +2681,10 @@ static int · 77 unmodified lines | ||
| 2725 | 2681 | mbox_post_sync_cmd(adapter_t *adapter, uint8_t raw_mbox[]) |
| 2726 | 2682 | { |
| 2727 | 2683 | mraid_device_t *raid_dev = ADAP2RAIDDEV(adapter); |
| 2728 | − mbox64_t *mbox64; | |
| 2729 | 2684 | mbox_t *mbox; |
| 2730 | 2685 | uint8_t status; |
| 2731 | 2686 | int i; |
| 2732 | 2687 | |
| 2733 | − | |
| 2734 | − mbox64 = raid_dev->mbox64; | |
| 2735 | 2688 | mbox = raid_dev->mbox; |
| 2736 | 2689 | |
| 2737 | 2690 | /* |
| @@ -2948,9 +2901,8 @@ megaraid_mbox_product_info(adapter_t *adapter) · 210 unmodified lines | ||
| 2948 | 2901 | * Issue an ENQUIRY3 command to find out certain adapter parameters, |
| 2949 | 2902 | * e.g., max channels, max commands etc. |
| 2950 | 2903 | */ |
| 2951 | − pinfo = pci_zalloc_consistent(adapter->pdev, sizeof(mraid_pinfo_t), | |
| 2952 | − &pinfo_dma_h); | |
| 2953 | − | |
| 2904 | + pinfo = dma_zalloc_coherent(&adapter->pdev->dev, sizeof(mraid_pinfo_t), | |
| 2905 | + &pinfo_dma_h, GFP_KERNEL); | |
| 2954 | 2906 | if (pinfo == NULL) { |
| 2955 | 2907 | con_log(CL_ANN, (KERN_WARNING |
| 2956 | 2908 | "megaraid: out of memory, %s %d\n", __func__, |
| @@ -2971,7 +2923,7 @@ megaraid_mbox_product_info(adapter_t *adapter) · 14 unmodified lines | ||
| 2971 | 2923 | |
| 2972 | 2924 | con_log(CL_ANN, (KERN_WARNING "megaraid: Inquiry3 failed\n")); |
| 2973 | 2925 | |
| 2974 | − pci_free_consistent(adapter->pdev, sizeof(mraid_pinfo_t), | |
| 2926 | + dma_free_coherent(&adapter->pdev->dev, sizeof(mraid_pinfo_t), | |
| 2975 | 2927 | pinfo, pinfo_dma_h); |
| 2976 | 2928 | |
| 2977 | 2929 | return -1; |
| @@ -3002,7 +2954,7 @@ megaraid_mbox_product_info(adapter_t *adapter) · 24 unmodified lines | ||
| 3002 | 2954 | con_log(CL_ANN, (KERN_WARNING |
| 3003 | 2955 | "megaraid: product info failed\n")); |
| 3004 | 2956 | |
| 3005 | − pci_free_consistent(adapter->pdev, sizeof(mraid_pinfo_t), | |
| 2957 | + dma_free_coherent(&adapter->pdev->dev, sizeof(mraid_pinfo_t), | |
| 3006 | 2958 | pinfo, pinfo_dma_h); |
| 3007 | 2959 | |
| 3008 | 2960 | return -1; |
| @@ -3038,7 +2990,7 @@ megaraid_mbox_product_info(adapter_t *adapter) · 29 unmodified lines | ||
| 3038 | 2990 | "megaraid: fw version:[%s] bios version:[%s]\n", |
| 3039 | 2991 | adapter->fw_version, adapter->bios_version)); |
| 3040 | 2992 | |
| 3041 | − pci_free_consistent(adapter->pdev, sizeof(mraid_pinfo_t), pinfo, | |
| 2993 | + dma_free_coherent(&adapter->pdev->dev, sizeof(mraid_pinfo_t), pinfo, | |
| 3042 | 2994 | pinfo_dma_h); |
| 3043 | 2995 | |
| 3044 | 2996 | return 0; |
| @@ -3135,7 +3087,6 @@ megaraid_mbox_support_ha(adapter_t *adapter, uint16_t *init_id) · 90 unmodified lines | ||
| 3135 | 3087 | static int |
| 3136 | 3088 | megaraid_mbox_support_random_del(adapter_t *adapter) |
| 3137 | 3089 | { |
| 3138 | − mbox_t *mbox; | |
| 3139 | 3090 | uint8_t raw_mbox[sizeof(mbox_t)]; |
| 3140 | 3091 | int rval; |
| 3141 | 3092 | |
| @@ -3157,8 +3108,6 @@ megaraid_mbox_support_random_del(adapter_t *adapter) · 15 unmodified lines | ||
| 3157 | 3108 | return 0; |
| 3158 | 3109 | } |
| 3159 | 3110 | |
| 3160 | − mbox = (mbox_t *)raw_mbox; | |
| 3161 | − | |
| 3162 | 3111 | memset((caddr_t)raw_mbox, 0, sizeof(mbox_t)); |
| 3163 | 3112 | |
| 3164 | 3113 | raw_mbox[0] = FC_DEL_LOGDRV; |
| @@ -3263,12 +3212,8 @@ megaraid_mbox_enum_raid_scsi(adapter_t *adapter) · 98 unmodified lines | ||
| 3263 | 3212 | static void |
| 3264 | 3213 | megaraid_mbox_flush_cache(adapter_t *adapter) |
| 3265 | 3214 | { |
| 3266 | − mbox_t *mbox; | |
| 3267 | 3215 | uint8_t raw_mbox[sizeof(mbox_t)]; |
| 3268 | 3216 | |
| 3269 | − | |
| 3270 | − mbox = (mbox_t *)raw_mbox; | |
| 3271 | − | |
| 3272 | 3217 | memset((caddr_t)raw_mbox, 0, sizeof(mbox_t)); |
| 3273 | 3218 | |
| 3274 | 3219 | raw_mbox[0] = FLUSH_ADAPTER; |
| @@ -3299,7 +3244,6 @@ megaraid_mbox_fire_sync_cmd(adapter_t *adapter) · 24 unmodified lines | ||
| 3299 | 3244 | mbox_t *mbox; |
| 3300 | 3245 | uint8_t raw_mbox[sizeof(mbox_t)]; |
| 3301 | 3246 | mraid_device_t *raid_dev = ADAP2RAIDDEV(adapter); |
| 3302 | − mbox64_t *mbox64; | |
| 3303 | 3247 | int status = 0; |
| 3304 | 3248 | int i; |
| 3305 | 3249 | uint32_t dword; |
| @@ -3310,7 +3254,6 @@ megaraid_mbox_fire_sync_cmd(adapter_t *adapter) · 4 unmodified lines | ||
| 3310 | 3254 | |
| 3311 | 3255 | raw_mbox[0] = 0xFF; |
| 3312 | 3256 | |
| 3313 | − mbox64 = raid_dev->mbox64; | |
| 3314 | 3257 | mbox = raid_dev->mbox; |
| 3315 | 3258 | |
| 3316 | 3259 | /* Wait until mailbox is free */ |
| @@ -3515,7 +3458,7 @@ megaraid_cmm_register(adapter_t *adapter) · 198 unmodified lines | ||
| 3515 | 3458 | |
| 3516 | 3459 | scb->scp = NULL; |
| 3517 | 3460 | scb->state = SCB_FREE; |
| 3518 | − scb->dma_direction = PCI_DMA_NONE; | |
| 3461 | + scb->dma_direction = DMA_NONE; | |
| 3519 | 3462 | scb->dma_type = MRAID_DMA_NONE; |
| 3520 | 3463 | scb->dev_channel = -1; |
| 3521 | 3464 | scb->dev_target = -1; |
| @@ -3653,7 +3596,7 @@ megaraid_mbox_mm_command(adapter_t *adapter, uioc_t *kioc) · 131 unmodified lines | ||
| 3653 | 3596 | |
| 3654 | 3597 | scb->state = SCB_ACTIVE; |
| 3655 | 3598 | scb->dma_type = MRAID_DMA_NONE; |
| 3656 | − scb->dma_direction = PCI_DMA_NONE; | |
| 3599 | + scb->dma_direction = DMA_NONE; | |
| 3657 | 3600 | |
| 3658 | 3601 | ccb = (mbox_ccb_t *)scb->ccb; |
| 3659 | 3602 | mbox64 = (mbox64_t *)(unsigned long)kioc->cmdbuf; |
| @@ -3794,10 +3737,6 @@ megaraid_mbox_mm_done(adapter_t *adapter, scb_t *scb) · 134 unmodified lines | ||
| 3794 | 3737 | static int |
| 3795 | 3738 | gather_hbainfo(adapter_t *adapter, mraid_hba_info_t *hinfo) |
| 3796 | 3739 | { |
| 3797 | − uint8_t dmajor; | |
| 3798 | − | |
| 3799 | − dmajor = megaraid_mbox_version[0]; | |
| 3800 | − | |
| 3801 | 3740 | hinfo->pci_vendor_id = adapter->pdev->vendor; |
| 3802 | 3741 | hinfo->pci_device_id = adapter->pdev->device; |
| 3803 | 3742 | hinfo->subsys_vendor_id = adapter->pdev->subsystem_vendor; |
| @@ -3843,8 +3782,8 @@ megaraid_sysfs_alloc_resources(adapter_t *adapter) · 39 unmodified lines | ||
| 3843 | 3782 | |
| 3844 | 3783 | raid_dev->sysfs_mbox64 = kmalloc(sizeof(mbox64_t), GFP_KERNEL); |
| 3845 | 3784 | |
| 3846 | − raid_dev->sysfs_buffer = pci_alloc_consistent(adapter->pdev, | |
| 3847 | − PAGE_SIZE, &raid_dev->sysfs_buffer_dma); | |
| 3785 | + raid_dev->sysfs_buffer = dma_alloc_coherent(&adapter->pdev->dev, | |
| 3786 | + PAGE_SIZE, &raid_dev->sysfs_buffer_dma, GFP_KERNEL); | |
| 3848 | 3787 | |
| 3849 | 3788 | if (!raid_dev->sysfs_uioc || !raid_dev->sysfs_mbox64 || |
| 3850 | 3789 | !raid_dev->sysfs_buffer) { |
| @@ -3881,7 +3820,7 @@ megaraid_sysfs_free_resources(adapter_t *adapter) · 30 unmodified lines | ||
| 3881 | 3820 | kfree(raid_dev->sysfs_mbox64); |
| 3882 | 3821 | |
| 3883 | 3822 | if (raid_dev->sysfs_buffer) { |
| 3884 | − pci_free_consistent(adapter->pdev, PAGE_SIZE, | |
| 3823 | + dma_free_coherent(&adapter->pdev->dev, PAGE_SIZE, | |
| 3885 | 3824 | raid_dev->sysfs_buffer, raid_dev->sysfs_buffer_dma); |
| 3886 | 3825 | } |
| 3887 | 3826 | } |
| @@ -117,7 +117,7 @@ · 116 unmodified lines | ||
| 117 | 117 | * @raw_mbox : raw mailbox pointer |
| 118 | 118 | * @mbox : mailbox |
| 119 | 119 | * @mbox64 : extended mailbox |
| 120 | − * @mbox_dma_h : maibox dma address | |
| 120 | + * @mbox_dma_h : mailbox dma address | |
| 121 | 121 | * @sgl64 : 64-bit scatter-gather list |
| 122 | 122 | * @sgl32 : 32-bit scatter-gather list |
| 123 | 123 | * @sgl_dma_h : dma handle for the scatter-gather list |
| @@ -1330,11 +1330,11 @@ megasas_build_dcdb(struct megasas_instance *instance, struct scsi_cmnd *scp, · 1329 unmodified lines | ||
| 1330 | 1330 | device_id = MEGASAS_DEV_INDEX(scp); |
| 1331 | 1331 | pthru = (struct megasas_pthru_frame *)cmd->frame; |
| 1332 | 1332 | |
| 1333 | − if (scp->sc_data_direction == PCI_DMA_TODEVICE) | |
| 1333 | + if (scp->sc_data_direction == DMA_TO_DEVICE) | |
| 1334 | 1334 | flags = MFI_FRAME_DIR_WRITE; |
| 1335 | − else if (scp->sc_data_direction == PCI_DMA_FROMDEVICE) | |
| 1335 | + else if (scp->sc_data_direction == DMA_FROM_DEVICE) | |
| 1336 | 1336 | flags = MFI_FRAME_DIR_READ; |
| 1337 | − else if (scp->sc_data_direction == PCI_DMA_NONE) | |
| 1337 | + else if (scp->sc_data_direction == DMA_NONE) | |
| 1338 | 1338 | flags = MFI_FRAME_DIR_NONE; |
| 1339 | 1339 | |
| 1340 | 1340 | if (instance->flag_ieee == 1) { |
| @@ -1428,9 +1428,9 @@ megasas_build_ldio(struct megasas_instance *instance, struct scsi_cmnd *scp, · 87 unmodified lines | ||
| 1428 | 1428 | device_id = MEGASAS_DEV_INDEX(scp); |
| 1429 | 1429 | ldio = (struct megasas_io_frame *)cmd->frame; |
| 1430 | 1430 | |
| 1431 | − if (scp->sc_data_direction == PCI_DMA_TODEVICE) | |
| 1431 | + if (scp->sc_data_direction == DMA_TO_DEVICE) | |
| 1432 | 1432 | flags = MFI_FRAME_DIR_WRITE; |
| 1433 | − else if (scp->sc_data_direction == PCI_DMA_FROMDEVICE) | |
| 1433 | + else if (scp->sc_data_direction == DMA_FROM_DEVICE) | |
| 1434 | 1434 | flags = MFI_FRAME_DIR_READ; |
| 1435 | 1435 | |
| 1436 | 1436 | if (instance->flag_ieee == 1) { |
| @@ -2240,9 +2240,9 @@ static int megasas_get_ld_vf_affiliation_111(struct megasas_instance *instance, · 803 unmodified lines | ||
| 2240 | 2240 | sizeof(struct MR_LD_VF_AFFILIATION_111)); |
| 2241 | 2241 | else { |
| 2242 | 2242 | new_affiliation_111 = |
| 2243 | − pci_zalloc_consistent(instance->pdev, | |
| 2243 | + dma_zalloc_coherent(&instance->pdev->dev, | |
| 2244 | 2244 | sizeof(struct MR_LD_VF_AFFILIATION_111), |
| 2245 | − &new_affiliation_111_h); | |
| 2245 | + &new_affiliation_111_h, GFP_KERNEL); | |
| 2246 | 2246 | if (!new_affiliation_111) { |
| 2247 | 2247 | dev_printk(KERN_DEBUG, &instance->pdev->dev, "SR-IOV: Couldn't allocate " |
| 2248 | 2248 | "memory for new affiliation for scsi%d\n", |
| @@ -2302,7 +2302,7 @@ static int megasas_get_ld_vf_affiliation_111(struct megasas_instance *instance, · 53 unmodified lines | ||
| 2302 | 2302 | } |
| 2303 | 2303 | out: |
| 2304 | 2304 | if (new_affiliation_111) { |
| 2305 | − pci_free_consistent(instance->pdev, | |
| 2305 | + dma_free_coherent(&instance->pdev->dev, | |
| 2306 | 2306 | sizeof(struct MR_LD_VF_AFFILIATION_111), |
| 2307 | 2307 | new_affiliation_111, |
| 2308 | 2308 | new_affiliation_111_h); |
| @@ -2347,10 +2347,10 @@ static int megasas_get_ld_vf_affiliation_12(struct megasas_instance *instance, · 38 unmodified lines | ||
| 2347 | 2347 | sizeof(struct MR_LD_VF_AFFILIATION)); |
| 2348 | 2348 | else { |
| 2349 | 2349 | new_affiliation = |
| 2350 | − pci_zalloc_consistent(instance->pdev, | |
| 2350 | + dma_zalloc_coherent(&instance->pdev->dev, | |
| 2351 | 2351 | (MAX_LOGICAL_DRIVES + 1) * |
| 2352 | 2352 | sizeof(struct MR_LD_VF_AFFILIATION), |
| 2353 | − &new_affiliation_h); | |
| 2353 | + &new_affiliation_h, GFP_KERNEL); | |
| 2354 | 2354 | if (!new_affiliation) { |
| 2355 | 2355 | dev_printk(KERN_DEBUG, &instance->pdev->dev, "SR-IOV: Couldn't allocate " |
| 2356 | 2356 | "memory for new affiliation for scsi%d\n", |
| @@ -2470,7 +2470,7 @@ out: · 113 unmodified lines | ||
| 2470 | 2470 | } |
| 2471 | 2471 | |
| 2472 | 2472 | if (new_affiliation) |
| 2473 | − pci_free_consistent(instance->pdev, | |
| 2473 | + dma_free_coherent(&instance->pdev->dev, | |
| 2474 | 2474 | (MAX_LOGICAL_DRIVES + 1) * |
| 2475 | 2475 | sizeof(struct MR_LD_VF_AFFILIATION), |
| 2476 | 2476 | new_affiliation, new_affiliation_h); |
| @@ -2513,9 +2513,9 @@ int megasas_sriov_start_heartbeat(struct megasas_instance *instance, · 36 unmodified lines | ||
| 2513 | 2513 | |
| 2514 | 2514 | if (initial) { |
| 2515 | 2515 | instance->hb_host_mem = |
| 2516 | − pci_zalloc_consistent(instance->pdev, | |
| 2516 | + dma_zalloc_coherent(&instance->pdev->dev, | |
| 2517 | 2517 | sizeof(struct MR_CTRL_HB_HOST_MEM), |
| 2518 | − &instance->hb_host_mem_h); | |
| 2518 | + &instance->hb_host_mem_h, GFP_KERNEL); | |
| 2519 | 2519 | if (!instance->hb_host_mem) { |
| 2520 | 2520 | dev_printk(KERN_DEBUG, &instance->pdev->dev, "SR-IOV: Couldn't allocate" |
| 2521 | 2521 | " memory for heartbeat host memory for scsi%d\n", |
| @@ -4995,9 +4995,8 @@ megasas_init_adapter_mfi(struct megasas_instance *instance) · 2473 unmodified lines | ||
| 4995 | 4995 | context_sz = sizeof(u32); |
| 4996 | 4996 | reply_q_sz = context_sz * (instance->max_fw_cmds + 1); |
| 4997 | 4997 | |
| 4998 | − instance->reply_queue = pci_alloc_consistent(instance->pdev, | |
| 4999 | − reply_q_sz, | |
| 5000 | − &instance->reply_queue_h); | |
| 4998 | + instance->reply_queue = dma_alloc_coherent(&instance->pdev->dev, | |
| 4999 | + reply_q_sz, &instance->reply_queue_h, GFP_KERNEL); | |
| 5001 | 5000 | |
| 5002 | 5001 | if (!instance->reply_queue) { |
| 5003 | 5002 | dev_printk(KERN_DEBUG, &instance->pdev->dev, "Out of DMA mem for reply queue\n"); |
| @@ -5029,7 +5028,7 @@ megasas_init_adapter_mfi(struct megasas_instance *instance) · 25 unmodified lines | ||
| 5029 | 5028 | |
| 5030 | 5029 | fail_fw_init: |
| 5031 | 5030 | |
| 5032 | − pci_free_consistent(instance->pdev, reply_q_sz, | |
| 5031 | + dma_free_coherent(&instance->pdev->dev, reply_q_sz, | |
| 5033 | 5032 | instance->reply_queue, instance->reply_queue_h); |
| 5034 | 5033 | fail_reply_queue: |
| 5035 | 5034 | megasas_free_cmds(instance); |
| @@ -5533,7 +5532,7 @@ static int megasas_init_fw(struct megasas_instance *instance) · 497 unmodified lines | ||
| 5533 | 5532 | |
| 5534 | 5533 | else { |
| 5535 | 5534 | if (instance->crash_dump_buf) |
| 5536 | − pci_free_consistent(instance->pdev, | |
| 5535 | + dma_free_coherent(&instance->pdev->dev, | |
| 5537 | 5536 | CRASH_DMA_BUF_SIZE, |
| 5538 | 5537 | instance->crash_dump_buf, |
| 5539 | 5538 | instance->crash_dump_h); |
| @@ -5616,7 +5615,7 @@ static void megasas_release_mfi(struct megasas_instance *instance) · 76 unmodified lines | ||
| 5616 | 5615 | u32 reply_q_sz = sizeof(u32) *(instance->max_mfi_cmds + 1); |
| 5617 | 5616 | |
| 5618 | 5617 | if (instance->reply_queue) |
| 5619 | − pci_free_consistent(instance->pdev, reply_q_sz, | |
| 5618 | + dma_free_coherent(&instance->pdev->dev, reply_q_sz, | |
| 5620 | 5619 | instance->reply_queue, instance->reply_queue_h); |
| 5621 | 5620 | |
| 5622 | 5621 | megasas_free_cmds(instance); |
| @@ -5655,10 +5654,9 @@ megasas_get_seq_num(struct megasas_instance *instance, · 32 unmodified lines | ||
| 5655 | 5654 | } |
| 5656 | 5655 | |
| 5657 | 5656 | dcmd = &cmd->frame->dcmd; |
| 5658 | − el_info = pci_zalloc_consistent(instance->pdev, | |
| 5659 | − sizeof(struct megasas_evt_log_info), | |
| 5660 | − &el_info_h); | |
| 5661 | − | |
| 5657 | + el_info = dma_zalloc_coherent(&instance->pdev->dev, | |
| 5658 | + sizeof(struct megasas_evt_log_info), &el_info_h, | |
| 5659 | + GFP_KERNEL); | |
| 5662 | 5660 | if (!el_info) { |
| 5663 | 5661 | megasas_return_cmd(instance, cmd); |
| 5664 | 5662 | return -ENOMEM; |
| @@ -5695,8 +5693,9 @@ megasas_get_seq_num(struct megasas_instance *instance, · 30 unmodified lines | ||
| 5695 | 5693 | eli->boot_seq_num = el_info->boot_seq_num; |
| 5696 | 5694 | |
| 5697 | 5695 | dcmd_failed: |
| 5698 | − pci_free_consistent(instance->pdev, sizeof(struct megasas_evt_log_info), | |
| 5699 | − el_info, el_info_h); | |
| 5696 | + dma_free_coherent(&instance->pdev->dev, | |
| 5697 | + sizeof(struct megasas_evt_log_info), | |
| 5698 | + el_info, el_info_h); | |
| 5700 | 5699 | |
| 5701 | 5700 | megasas_return_cmd(instance, cmd); |
| 5702 | 5701 | |
| @@ -6134,10 +6133,10 @@ static inline void megasas_set_adapter_type(struct megasas_instance *instance) · 431 unmodified lines | ||
| 6134 | 6133 | |
| 6135 | 6134 | static inline int megasas_alloc_mfi_ctrl_mem(struct megasas_instance *instance) |
| 6136 | 6135 | { |
| 6137 | − instance->producer = pci_alloc_consistent(instance->pdev, sizeof(u32), | |
| 6138 | − &instance->producer_h); | |
| 6139 | − instance->consumer = pci_alloc_consistent(instance->pdev, sizeof(u32), | |
| 6140 | − &instance->consumer_h); | |
| 6136 | + instance->producer = dma_alloc_coherent(&instance->pdev->dev, | |
| 6137 | + sizeof(u32), &instance->producer_h, GFP_KERNEL); | |
| 6138 | + instance->consumer = dma_alloc_coherent(&instance->pdev->dev, | |
| 6139 | + sizeof(u32), &instance->consumer_h, GFP_KERNEL); | |
| 6141 | 6140 | |
| 6142 | 6141 | if (!instance->producer || !instance->consumer) { |
| 6143 | 6142 | dev_err(&instance->pdev->dev, |
| @@ -6199,11 +6198,11 @@ static inline void megasas_free_ctrl_mem(struct megasas_instance *instance) · 55 unmodified lines | ||
| 6199 | 6198 | kfree(instance->reply_map); |
| 6200 | 6199 | if (instance->adapter_type == MFI_SERIES) { |
| 6201 | 6200 | if (instance->producer) |
| 6202 | − pci_free_consistent(instance->pdev, sizeof(u32), | |
| 6201 | + dma_free_coherent(&instance->pdev->dev, sizeof(u32), | |
| 6203 | 6202 | instance->producer, |
| 6204 | 6203 | instance->producer_h); |
| 6205 | 6204 | if (instance->consumer) |
| 6206 | − pci_free_consistent(instance->pdev, sizeof(u32), | |
| 6205 | + dma_free_coherent(&instance->pdev->dev, sizeof(u32), | |
| 6207 | 6206 | instance->consumer, |
| 6208 | 6207 | instance->consumer_h); |
| 6209 | 6208 | } else { |
| @@ -6224,10 +6223,9 @@ int megasas_alloc_ctrl_dma_buffers(struct megasas_instance *instance) · 14 unmodified lines | ||
| 6224 | 6223 | struct pci_dev *pdev = instance->pdev; |
| 6225 | 6224 | struct fusion_context *fusion = instance->ctrl_context; |
| 6226 | 6225 | |
| 6227 | − instance->evt_detail = | |
| 6228 | − pci_alloc_consistent(pdev, | |
| 6229 | − sizeof(struct megasas_evt_detail), | |
| 6230 | − &instance->evt_detail_h); | |
| 6226 | + instance->evt_detail = dma_alloc_coherent(&pdev->dev, | |
| 6227 | + sizeof(struct megasas_evt_detail), | |
| 6228 | + &instance->evt_detail_h, GFP_KERNEL); | |
| 6231 | 6229 | |
| 6232 | 6230 | if (!instance->evt_detail) { |
| 6233 | 6231 | dev_err(&instance->pdev->dev, |
| @@ -6250,9 +6248,9 @@ int megasas_alloc_ctrl_dma_buffers(struct megasas_instance *instance) · 16 unmodified lines | ||
| 6250 | 6248 | } |
| 6251 | 6249 | |
| 6252 | 6250 | instance->pd_list_buf = |
| 6253 | − pci_alloc_consistent(pdev, | |
| 6251 | + dma_alloc_coherent(&pdev->dev, | |
| 6254 | 6252 | MEGASAS_MAX_PD * sizeof(struct MR_PD_LIST), |
| 6255 | − &instance->pd_list_buf_h); | |
| 6253 | + &instance->pd_list_buf_h, GFP_KERNEL); | |
| 6256 | 6254 | |
| 6257 | 6255 | if (!instance->pd_list_buf) { |
| 6258 | 6256 | dev_err(&pdev->dev, "Failed to allocate PD list buffer\n"); |
| @@ -6260,9 +6258,9 @@ int megasas_alloc_ctrl_dma_buffers(struct megasas_instance *instance) · 1 unmodified line | ||
| 6260 | 6258 | } |
| 6261 | 6259 | |
| 6262 | 6260 | instance->ctrl_info_buf = |
| 6263 | − pci_alloc_consistent(pdev, | |
| 6261 | + dma_alloc_coherent(&pdev->dev, | |
| 6264 | 6262 | sizeof(struct megasas_ctrl_info), |
| 6265 | − &instance->ctrl_info_buf_h); | |
| 6263 | + &instance->ctrl_info_buf_h, GFP_KERNEL); | |
| 6266 | 6264 | |
| 6267 | 6265 | if (!instance->ctrl_info_buf) { |
| 6268 | 6266 | dev_err(&pdev->dev, |
| @@ -6271,9 +6269,9 @@ int megasas_alloc_ctrl_dma_buffers(struct megasas_instance *instance) · 2 unmodified lines | ||
| 6271 | 6269 | } |
| 6272 | 6270 | |
| 6273 | 6271 | instance->ld_list_buf = |
| 6274 | − pci_alloc_consistent(pdev, | |
| 6272 | + dma_alloc_coherent(&pdev->dev, | |
| 6275 | 6273 | sizeof(struct MR_LD_LIST), |
| 6276 | − &instance->ld_list_buf_h); | |
| 6274 | + &instance->ld_list_buf_h, GFP_KERNEL); | |
| 6277 | 6275 | |
| 6278 | 6276 | if (!instance->ld_list_buf) { |
| 6279 | 6277 | dev_err(&pdev->dev, "Failed to allocate LD list buffer\n"); |
| @@ -6281,9 +6279,9 @@ int megasas_alloc_ctrl_dma_buffers(struct megasas_instance *instance) · 1 unmodified line | ||
| 6281 | 6279 | } |
| 6282 | 6280 | |
| 6283 | 6281 | instance->ld_targetid_list_buf = |
| 6284 | − pci_alloc_consistent(pdev, | |
| 6285 | − sizeof(struct MR_LD_TARGETID_LIST), | |
| 6286 | − &instance->ld_targetid_list_buf_h); | |
| 6282 | + dma_alloc_coherent(&pdev->dev, | |
| 6283 | + sizeof(struct MR_LD_TARGETID_LIST), | |
| 6284 | + &instance->ld_targetid_list_buf_h, GFP_KERNEL); | |
| 6287 | 6285 | |
| 6288 | 6286 | if (!instance->ld_targetid_list_buf) { |
| 6289 | 6287 | dev_err(&pdev->dev, |
| @@ -6293,21 +6291,20 @@ int megasas_alloc_ctrl_dma_buffers(struct megasas_instance *instance) · 3 unmodified lines | ||
| 6293 | 6291 | |
| 6294 | 6292 | if (!reset_devices) { |
| 6295 | 6293 | instance->system_info_buf = |
| 6296 | − pci_alloc_consistent(pdev, | |
| 6297 | − sizeof(struct MR_DRV_SYSTEM_INFO), | |
| 6298 | − &instance->system_info_h); | |
| 6294 | + dma_alloc_coherent(&pdev->dev, | |
| 6295 | + sizeof(struct MR_DRV_SYSTEM_INFO), | |
| 6296 | + &instance->system_info_h, GFP_KERNEL); | |
| 6299 | 6297 | instance->pd_info = |
| 6300 | − pci_alloc_consistent(pdev, | |
| 6301 | − sizeof(struct MR_PD_INFO), | |
| 6302 | − &instance->pd_info_h); | |
| 6298 | + dma_alloc_coherent(&pdev->dev, | |
| 6299 | + sizeof(struct MR_PD_INFO), | |
| 6300 | + &instance->pd_info_h, GFP_KERNEL); | |
| 6303 | 6301 | instance->tgt_prop = |
| 6304 | − pci_alloc_consistent(pdev, | |
| 6305 | − sizeof(struct MR_TARGET_PROPERTIES), | |
| 6306 | − &instance->tgt_prop_h); | |
| 6302 | + dma_alloc_coherent(&pdev->dev, | |
| 6303 | + sizeof(struct MR_TARGET_PROPERTIES), | |
| 6304 | + &instance->tgt_prop_h, GFP_KERNEL); | |
| 6307 | 6305 | instance->crash_dump_buf = |
| 6308 | − pci_alloc_consistent(pdev, | |
| 6309 | − CRASH_DMA_BUF_SIZE, | |
| 6310 | − &instance->crash_dump_h); | |
| 6306 | + dma_alloc_coherent(&pdev->dev, CRASH_DMA_BUF_SIZE, | |
| 6307 | + &instance->crash_dump_h, GFP_KERNEL); | |
| 6311 | 6308 | |
| 6312 | 6309 | if (!instance->system_info_buf) |
| 6313 | 6310 | dev_err(&instance->pdev->dev, |
| @@ -6343,7 +6340,7 @@ void megasas_free_ctrl_dma_buffers(struct megasas_instance *instance) · 29 unmodified lines | ||
| 6343 | 6340 | struct fusion_context *fusion = instance->ctrl_context; |
| 6344 | 6341 | |
| 6345 | 6342 | if (instance->evt_detail) |
| 6346 | − pci_free_consistent(pdev, sizeof(struct megasas_evt_detail), | |
| 6343 | + dma_free_coherent(&pdev->dev, sizeof(struct megasas_evt_detail), | |
| 6347 | 6344 | instance->evt_detail, |
| 6348 | 6345 | instance->evt_detail_h); |
| 6349 | 6346 | |
| @@ -6354,41 +6351,41 @@ void megasas_free_ctrl_dma_buffers(struct megasas_instance *instance) · 4 unmodified lines | ||
| 6354 | 6351 | fusion->ioc_init_request_phys); |
| 6355 | 6352 | |
| 6356 | 6353 | if (instance->pd_list_buf) |
| 6357 | − pci_free_consistent(pdev, | |
| 6354 | + dma_free_coherent(&pdev->dev, | |
| 6358 | 6355 | MEGASAS_MAX_PD * sizeof(struct MR_PD_LIST), |
| 6359 | 6356 | instance->pd_list_buf, |
| 6360 | 6357 | instance->pd_list_buf_h); |
| 6361 | 6358 | |
| 6362 | 6359 | if (instance->ld_list_buf) |
| 6363 | − pci_free_consistent(pdev, sizeof(struct MR_LD_LIST), | |
| 6360 | + dma_free_coherent(&pdev->dev, sizeof(struct MR_LD_LIST), | |
| 6364 | 6361 | instance->ld_list_buf, |
| 6365 | 6362 | instance->ld_list_buf_h); |
| 6366 | 6363 | |
| 6367 | 6364 | if (instance->ld_targetid_list_buf) |
| 6368 | − pci_free_consistent(pdev, sizeof(struct MR_LD_TARGETID_LIST), | |
| 6365 | + dma_free_coherent(&pdev->dev, sizeof(struct MR_LD_TARGETID_LIST), | |
| 6369 | 6366 | instance->ld_targetid_list_buf, |
| 6370 | 6367 | instance->ld_targetid_list_buf_h); |
| 6371 | 6368 | |
| 6372 | 6369 | if (instance->ctrl_info_buf) |
| 6373 | − pci_free_consistent(pdev, sizeof(struct megasas_ctrl_info), | |
| 6370 | + dma_free_coherent(&pdev->dev, sizeof(struct megasas_ctrl_info), | |
| 6374 | 6371 | instance->ctrl_info_buf, |
| 6375 | 6372 | instance->ctrl_info_buf_h); |
| 6376 | 6373 | |
| 6377 | 6374 | if (instance->system_info_buf) |
| 6378 | − pci_free_consistent(pdev, sizeof(struct MR_DRV_SYSTEM_INFO), | |
| 6375 | + dma_free_coherent(&pdev->dev, sizeof(struct MR_DRV_SYSTEM_INFO), | |
| 6379 | 6376 | instance->system_info_buf, |
| 6380 | 6377 | instance->system_info_h); |
| 6381 | 6378 | |
| 6382 | 6379 | if (instance->pd_info) |
| 6383 | − pci_free_consistent(pdev, sizeof(struct MR_PD_INFO), | |
| 6380 | + dma_free_coherent(&pdev->dev, sizeof(struct MR_PD_INFO), | |
| 6384 | 6381 | instance->pd_info, instance->pd_info_h); |
| 6385 | 6382 | |
| 6386 | 6383 | if (instance->tgt_prop) |
| 6387 | − pci_free_consistent(pdev, sizeof(struct MR_TARGET_PROPERTIES), | |
| 6384 | + dma_free_coherent(&pdev->dev, sizeof(struct MR_TARGET_PROPERTIES), | |
| 6388 | 6385 | instance->tgt_prop, instance->tgt_prop_h); |
| 6389 | 6386 | |
| 6390 | 6387 | if (instance->crash_dump_buf) |
| 6391 | − pci_free_consistent(pdev, CRASH_DMA_BUF_SIZE, | |
| 6388 | + dma_free_coherent(&pdev->dev, CRASH_DMA_BUF_SIZE, | |
| 6392 | 6389 | instance->crash_dump_buf, |
| 6393 | 6390 | instance->crash_dump_h); |
| 6394 | 6391 | } |
| @@ -6516,17 +6513,20 @@ static int megasas_probe_one(struct pci_dev *pdev, · 121 unmodified lines | ||
| 6516 | 6513 | if (instance->requestorId) { |
| 6517 | 6514 | if (instance->PlasmaFW111) { |
| 6518 | 6515 | instance->vf_affiliation_111 = |
| 6519 | − pci_alloc_consistent(pdev, sizeof(struct MR_LD_VF_AFFILIATION_111), | |
| 6520 | − &instance->vf_affiliation_111_h); | |
| 6516 | + dma_alloc_coherent(&pdev->dev, | |
| 6517 | + sizeof(struct MR_LD_VF_AFFILIATION_111), | |
| 6518 | + &instance->vf_affiliation_111_h, | |
| 6519 | + GFP_KERNEL); | |
| 6521 | 6520 | if (!instance->vf_affiliation_111) |
| 6522 | 6521 | dev_warn(&pdev->dev, "Can't allocate " |
| 6523 | 6522 | "memory for VF affiliation buffer\n"); |
| 6524 | 6523 | } else { |
| 6525 | 6524 | instance->vf_affiliation = |
| 6526 | − pci_alloc_consistent(pdev, | |
| 6527 | − (MAX_LOGICAL_DRIVES + 1) * | |
| 6528 | − sizeof(struct MR_LD_VF_AFFILIATION), | |
| 6529 | − &instance->vf_affiliation_h); | |
| 6525 | + dma_alloc_coherent(&pdev->dev, | |
| 6526 | + (MAX_LOGICAL_DRIVES + 1) * | |
| 6527 | + sizeof(struct MR_LD_VF_AFFILIATION), | |
| 6528 | + &instance->vf_affiliation_h, | |
| 6529 | + GFP_KERNEL); | |
| 6530 | 6530 | if (!instance->vf_affiliation) |
| 6531 | 6531 | dev_warn(&pdev->dev, "Can't allocate " |
| 6532 | 6532 | "memory for VF affiliation buffer\n"); |
| @@ -6994,19 +6994,19 @@ skip_firing_dcmds: · 461 unmodified lines | ||
| 6994 | 6994 | } |
| 6995 | 6995 | |
| 6996 | 6996 | if (instance->vf_affiliation) |
| 6997 | − pci_free_consistent(pdev, (MAX_LOGICAL_DRIVES + 1) * | |
| 6997 | + dma_free_coherent(&pdev->dev, (MAX_LOGICAL_DRIVES + 1) * | |
| 6998 | 6998 | sizeof(struct MR_LD_VF_AFFILIATION), |
| 6999 | 6999 | instance->vf_affiliation, |
| 7000 | 7000 | instance->vf_affiliation_h); |
| 7001 | 7001 | |
| 7002 | 7002 | if (instance->vf_affiliation_111) |
| 7003 | − pci_free_consistent(pdev, | |
| 7003 | + dma_free_coherent(&pdev->dev, | |
| 7004 | 7004 | sizeof(struct MR_LD_VF_AFFILIATION_111), |
| 7005 | 7005 | instance->vf_affiliation_111, |
| 7006 | 7006 | instance->vf_affiliation_111_h); |
| 7007 | 7007 | |
| 7008 | 7008 | if (instance->hb_host_mem) |
| 7009 | − pci_free_consistent(pdev, sizeof(struct MR_CTRL_HB_HOST_MEM), | |
| 7009 | + dma_free_coherent(&pdev->dev, sizeof(struct MR_CTRL_HB_HOST_MEM), | |
| 7010 | 7010 | instance->hb_host_mem, |
| 7011 | 7011 | instance->hb_host_mem_h); |
| 7012 | 7012 | |
| @@ -7254,7 +7254,7 @@ megasas_mgmt_fw_ioctl(struct megasas_instance *instance, · 241 unmodified lines | ||
| 7254 | 7254 | |
| 7255 | 7255 | /* |
| 7256 | 7256 | * We don't change the dma_coherent_mask, so |
| 7257 | − * pci_alloc_consistent only returns 32bit addresses | |
| 7257 | + * dma_alloc_coherent only returns 32bit addresses | |
| 7258 | 7258 | */ |
| 7259 | 7259 | if (instance->consistent_mask_64bit) { |
| 7260 | 7260 | kern_sge64[i].phys_addr = cpu_to_le64(buf_handle); |
| @@ -7523,6 +7523,9 @@ static int megasas_mgmt_compat_ioctl_fw(struct file *file, unsigned long arg) · 262 unmodified lines | ||
| 7523 | 7523 | get_user(user_sense_off, &cioc->sense_off)) |
| 7524 | 7524 | return -EFAULT; |
| 7525 | 7525 | |
| 7526 | + if (local_sense_off != user_sense_off) | |
| 7527 | + return -EINVAL; | |
| 7528 | + | |
| 7526 | 7529 | if (local_sense_len) { |
| 7527 | 7530 | void __user **sense_ioc_ptr = |
| 7528 | 7531 | (void __user **)((u8 *)((unsigned long)&ioc->frame.raw) + local_sense_off); |
| @@ -684,8 +684,8 @@ megasas_alloc_rdpq_fusion(struct megasas_instance *instance) · 683 unmodified lines | ||
| 684 | 684 | array_size = sizeof(struct MPI2_IOC_INIT_RDPQ_ARRAY_ENTRY) * |
| 685 | 685 | MAX_MSIX_QUEUES_FUSION; |
| 686 | 686 | |
| 687 | − fusion->rdpq_virt = pci_zalloc_consistent(instance->pdev, array_size, | |
| 688 | − &fusion->rdpq_phys); | |
| 687 | + fusion->rdpq_virt = dma_zalloc_coherent(&instance->pdev->dev, | |
| 688 | + array_size, &fusion->rdpq_phys, GFP_KERNEL); | |
| 689 | 689 | if (!fusion->rdpq_virt) { |
| 690 | 690 | dev_err(&instance->pdev->dev, |
| 691 | 691 | "Failed from %s %d\n", __func__, __LINE__); |
| @@ -813,7 +813,7 @@ megasas_free_rdpq_fusion(struct megasas_instance *instance) { · 121 unmodified lines | ||
| 813 | 813 | dma_pool_destroy(fusion->reply_frames_desc_pool_align); |
| 814 | 814 | |
| 815 | 815 | if (fusion->rdpq_virt) |
| 816 | − pci_free_consistent(instance->pdev, | |
| 816 | + dma_free_coherent(&instance->pdev->dev, | |
| 817 | 817 | sizeof(struct MPI2_IOC_INIT_RDPQ_ARRAY_ENTRY) * MAX_MSIX_QUEUES_FUSION, |
| 818 | 818 | fusion->rdpq_virt, fusion->rdpq_phys); |
| 819 | 819 | } |
| @@ -2209,7 +2209,7 @@ megasas_set_pd_lba(struct MPI2_RAID_SCSI_IO_REQUEST *io_request, u8 cdb_len, · 1389 unmodified lines | ||
| 2209 | 2209 | cdb[0] = MEGASAS_SCSI_VARIABLE_LENGTH_CMD; |
| 2210 | 2210 | cdb[7] = MEGASAS_SCSI_ADDL_CDB_LEN; |
| 2211 | 2211 | |
| 2212 | − if (scp->sc_data_direction == PCI_DMA_FROMDEVICE) | |
| 2212 | + if (scp->sc_data_direction == DMA_FROM_DEVICE) | |
| 2213 | 2213 | cdb[9] = MEGASAS_SCSI_SERVICE_ACTION_READ32; |
| 2214 | 2214 | else |
| 2215 | 2215 | cdb[9] = MEGASAS_SCSI_SERVICE_ACTION_WRITE32; |
| @@ -2238,7 +2238,7 @@ megasas_set_pd_lba(struct MPI2_RAID_SCSI_IO_REQUEST *io_request, u8 cdb_len, · 22 unmodified lines | ||
| 2238 | 2238 | cdb[31] = (u8)(num_blocks & 0xff); |
| 2239 | 2239 | |
| 2240 | 2240 | /* set SCSI IO EEDPFlags */ |
| 2241 | − if (scp->sc_data_direction == PCI_DMA_FROMDEVICE) { | |
| 2241 | + if (scp->sc_data_direction == DMA_FROM_DEVICE) { | |
| 2242 | 2242 | io_request->EEDPFlags = cpu_to_le16( |
| 2243 | 2243 | MPI2_SCSIIO_EEDPFLAGS_INC_PRI_REFTAG | |
| 2244 | 2244 | MPI2_SCSIIO_EEDPFLAGS_CHECK_REFTAG | |
| @@ -2621,7 +2621,7 @@ megasas_build_ldio_fusion(struct megasas_instance *instance, · 376 unmodified lines | ||
| 2621 | 2621 | scsi_buff_len = scsi_bufflen(scp); |
| 2622 | 2622 | io_request->DataLength = cpu_to_le32(scsi_buff_len); |
| 2623 | 2623 | |
| 2624 | − if (scp->sc_data_direction == PCI_DMA_FROMDEVICE) | |
| 2624 | + if (scp->sc_data_direction == DMA_FROM_DEVICE) | |
| 2625 | 2625 | io_info.isRead = 1; |
| 2626 | 2626 | |
| 2627 | 2627 | local_map_ptr = fusion->ld_drv_map[(instance->map_id & 1)]; |
| @@ -3088,9 +3088,9 @@ megasas_build_io_fusion(struct megasas_instance *instance, · 460 unmodified lines | ||
| 3088 | 3088 | |
| 3089 | 3089 | io_request->SGLFlags = cpu_to_le16(MPI2_SGE_FLAGS_64_BIT_ADDRESSING); |
| 3090 | 3090 | |
| 3091 | − if (scp->sc_data_direction == PCI_DMA_TODEVICE) | |
| 3091 | + if (scp->sc_data_direction == DMA_TO_DEVICE) | |
| 3092 | 3092 | io_request->Control |= cpu_to_le32(MPI2_SCSIIO_CONTROL_WRITE); |
| 3093 | − else if (scp->sc_data_direction == PCI_DMA_FROMDEVICE) | |
| 3093 | + else if (scp->sc_data_direction == DMA_FROM_DEVICE) | |
| 3094 | 3094 | io_request->Control |= cpu_to_le32(MPI2_SCSIIO_CONTROL_READ); |
| 3095 | 3095 | |
| 3096 | 3096 | io_request->SGLOffset0 = |
| @@ -1915,8 +1915,8 @@ static int mesh_probe(struct macio_dev *mdev, const struct of_device_id *match) · 1914 unmodified lines | ||
| 1915 | 1915 | /* We use the PCI APIs for now until the generic one gets fixed |
| 1916 | 1916 | * enough or until we get some macio-specific versions |
| 1917 | 1917 | */ |
| 1918 | − dma_cmd_space = pci_zalloc_consistent(macio_get_pci_dev(mdev), | |
| 1919 | − ms->dma_cmd_size, &dma_cmd_bus); | |
| 1918 | + dma_cmd_space = dma_zalloc_coherent(&macio_get_pci_dev(mdev)->dev, | |
| 1919 | + ms->dma_cmd_size, &dma_cmd_bus, GFP_KERNEL); | |
| 1920 | 1920 | if (dma_cmd_space == NULL) { |
| 1921 | 1921 | printk(KERN_ERR "mesh: can't allocate DMA table\n"); |
| 1922 | 1922 | goto out_unmap; |
| @@ -1974,7 +1974,7 @@ static int mesh_probe(struct macio_dev *mdev, const struct of_device_id *match) · 51 unmodified lines | ||
| 1974 | 1974 | */ |
| 1975 | 1975 | mesh_shutdown(mdev); |
| 1976 | 1976 | set_mesh_power(ms, 0); |
| 1977 | − pci_free_consistent(macio_get_pci_dev(mdev), ms->dma_cmd_size, | |
| 1977 | + dma_free_coherent(&macio_get_pci_dev(mdev)->dev, ms->dma_cmd_size, | |
| 1978 | 1978 | ms->dma_cmd_space, ms->dma_cmd_bus); |
| 1979 | 1979 | out_unmap: |
| 1980 | 1980 | iounmap(ms->dma); |
| @@ -2007,7 +2007,7 @@ static int mesh_remove(struct macio_dev *mdev) · 26 unmodified lines | ||
| 2007 | 2007 | iounmap(ms->dma); |
| 2008 | 2008 | |
| 2009 | 2009 | /* Free DMA commands memory */ |
| 2010 | − pci_free_consistent(macio_get_pci_dev(mdev), ms->dma_cmd_size, | |
| 2010 | + dma_free_coherent(&macio_get_pci_dev(mdev)->dev, ms->dma_cmd_size, | |
| 2011 | 2011 | ms->dma_cmd_space, ms->dma_cmd_bus); |
| 2012 | 2012 | |
| 2013 | 2013 | /* Release memory resources */ |
| @@ -122,8 +122,8 @@ mpt3sas_base_check_cmd_timeout(struct MPT3SAS_ADAPTER *ioc, · 121 unmodified lines | ||
| 122 | 122 | if (!(status & MPT3_CMD_RESET)) |
| 123 | 123 | issue_reset = 1; |
| 124 | 124 | |
| 125 | − pr_err(MPT3SAS_FMT "Command %s\n", ioc->name, | |
| 126 | − ((issue_reset == 0) ? "terminated due to Host Reset" : "Timeout")); | |
| 125 | + ioc_err(ioc, "Command %s\n", | |
| 126 | + issue_reset == 0 ? "terminated due to Host Reset" : "Timeout"); | |
| 127 | 127 | _debug_dump_mf(mpi_request, sz); |
| 128 | 128 | |
| 129 | 129 | return issue_reset; |
| @@ -336,9 +336,7 @@ _base_get_chain_buffer_dma_to_chain_buffer(struct MPT3SAS_ADAPTER *ioc, · 206 unmodified lines | ||
| 336 | 336 | return ct->chain_buffer; |
| 337 | 337 | } |
| 338 | 338 | } |
| 339 | − pr_info(MPT3SAS_FMT | |
| 340 | − "Provided chain_buffer_dma address is not in the lookup list\n", | |
| 341 | − ioc->name); | |
| 339 | + ioc_info(ioc, "Provided chain_buffer_dma address is not in the lookup list\n"); | |
| 342 | 340 | return NULL; |
| 343 | 341 | } |
| 344 | 342 | |
| @@ -394,7 +392,7 @@ static void _clone_sg_entries(struct MPT3SAS_ADAPTER *ioc, · 49 unmodified lines | ||
| 394 | 392 | /* Get scsi_cmd using smid */ |
| 395 | 393 | scmd = mpt3sas_scsih_scsi_lookup_get(ioc, smid); |
| 396 | 394 | if (scmd == NULL) { |
| 397 | − pr_err(MPT3SAS_FMT "scmd is NULL\n", ioc->name); | |
| 395 | + ioc_err(ioc, "scmd is NULL\n"); | |
| 398 | 396 | return; |
| 399 | 397 | } |
| 400 | 398 | |
| @@ -532,11 +530,11 @@ static int mpt3sas_remove_dead_ioc_func(void *arg) · 131 unmodified lines | ||
| 532 | 530 | struct MPT3SAS_ADAPTER *ioc = (struct MPT3SAS_ADAPTER *)arg; |
| 533 | 531 | struct pci_dev *pdev; |
| 534 | 532 | |
| 535 | − if ((ioc == NULL)) | |
| 533 | + if (!ioc) | |
| 536 | 534 | return -1; |
| 537 | 535 | |
| 538 | 536 | pdev = ioc->pdev; |
| 539 | − if ((pdev == NULL)) | |
| 537 | + if (!pdev) | |
| 540 | 538 | return -1; |
| 541 | 539 | pci_stop_and_remove_bus_device_locked(pdev); |
| 542 | 540 | return 0; |
| @@ -566,8 +564,7 @@ _base_fault_reset_work(struct work_struct *work) · 23 unmodified lines | ||
| 566 | 564 | |
| 567 | 565 | doorbell = mpt3sas_base_get_iocstate(ioc, 0); |
| 568 | 566 | if ((doorbell & MPI2_IOC_STATE_MASK) == MPI2_IOC_STATE_MASK) { |
| 569 | − pr_err(MPT3SAS_FMT "SAS host is non-operational !!!!\n", | |
| 570 | − ioc->name); | |
| 567 | + ioc_err(ioc, "SAS host is non-operational !!!!\n"); | |
| 571 | 568 | |
| 572 | 569 | /* It may be possible that EEH recovery can resolve some of |
| 573 | 570 | * pci bus failure issues rather removing the dead ioc function |
| @@ -600,13 +597,11 @@ _base_fault_reset_work(struct work_struct *work) · 26 unmodified lines | ||
| 600 | 597 | p = kthread_run(mpt3sas_remove_dead_ioc_func, ioc, |
| 601 | 598 | "%s_dead_ioc_%d", ioc->driver_name, ioc->id); |
| 602 | 599 | if (IS_ERR(p)) |
| 603 | − pr_err(MPT3SAS_FMT | |
| 604 | − "%s: Running mpt3sas_dead_ioc thread failed !!!!\n", | |
| 605 | − ioc->name, __func__); | |
| 600 | + ioc_err(ioc, "%s: Running mpt3sas_dead_ioc thread failed !!!!\n", | |
| 601 | + __func__); | |
| 606 | 602 | else |
| 607 | − pr_err(MPT3SAS_FMT | |
| 608 | − "%s: Running mpt3sas_dead_ioc thread success !!!!\n", | |
| 609 | − ioc->name, __func__); | |
| 603 | + ioc_err(ioc, "%s: Running mpt3sas_dead_ioc thread success !!!!\n", | |
| 604 | + __func__); | |
| 610 | 605 | return; /* don't rearm timer */ |
| 611 | 606 | } |
| 612 | 607 | |
| @@ -614,8 +609,8 @@ _base_fault_reset_work(struct work_struct *work) · 1 unmodified line | ||
| 614 | 609 | |
| 615 | 610 | if ((doorbell & MPI2_IOC_STATE_MASK) != MPI2_IOC_STATE_OPERATIONAL) { |
| 616 | 611 | rc = mpt3sas_base_hard_reset_handler(ioc, FORCE_BIG_HAMMER); |
| 617 | − pr_warn(MPT3SAS_FMT "%s: hard reset: %s\n", ioc->name, | |
| 618 | − __func__, (rc == 0) ? "success" : "failed"); | |
| 612 | + ioc_warn(ioc, "%s: hard reset: %s\n", | |
| 613 | + __func__, rc == 0 ? "success" : "failed"); | |
| 619 | 614 | doorbell = mpt3sas_base_get_iocstate(ioc, 0); |
| 620 | 615 | if ((doorbell & MPI2_IOC_STATE_MASK) == MPI2_IOC_STATE_FAULT) |
| 621 | 616 | mpt3sas_base_fault_info(ioc, doorbell & |
| @@ -657,8 +652,7 @@ mpt3sas_base_start_watchdog(struct MPT3SAS_ADAPTER *ioc) · 35 unmodified lines | ||
| 657 | 652 | ioc->fault_reset_work_q = |
| 658 | 653 | create_singlethread_workqueue(ioc->fault_reset_work_q_name); |
| 659 | 654 | if (!ioc->fault_reset_work_q) { |
| 660 | − pr_err(MPT3SAS_FMT "%s: failed (line=%d)\n", | |
| 661 | − ioc->name, __func__, __LINE__); | |
| 655 | + ioc_err(ioc, "%s: failed (line=%d)\n", __func__, __LINE__); | |
| 662 | 656 | return; |
| 663 | 657 | } |
| 664 | 658 | spin_lock_irqsave(&ioc->ioc_reset_in_progress_lock, flags); |
| @@ -700,8 +694,7 @@ mpt3sas_base_stop_watchdog(struct MPT3SAS_ADAPTER *ioc) · 35 unmodified lines | ||
| 700 | 694 | void |
| 701 | 695 | mpt3sas_base_fault_info(struct MPT3SAS_ADAPTER *ioc , u16 fault_code) |
| 702 | 696 | { |
| 703 | − pr_err(MPT3SAS_FMT "fault_state(0x%04x)!\n", | |
| 704 | − ioc->name, fault_code); | |
| 697 | + ioc_err(ioc, "fault_state(0x%04x)!\n", fault_code); | |
| 705 | 698 | } |
| 706 | 699 | |
| 707 | 700 | /** |
| @@ -728,8 +721,7 @@ mpt3sas_halt_firmware(struct MPT3SAS_ADAPTER *ioc) · 20 unmodified lines | ||
| 728 | 721 | mpt3sas_base_fault_info(ioc , doorbell); |
| 729 | 722 | else { |
| 730 | 723 | writel(0xC0FFEE00, &ioc->chip->Doorbell); |
| 731 | − pr_err(MPT3SAS_FMT "Firmware is halted due to command timeout\n", | |
| 732 | − ioc->name); | |
| 724 | + ioc_err(ioc, "Firmware is halted due to command timeout\n"); | |
| 733 | 725 | } |
| 734 | 726 | |
| 735 | 727 | if (ioc->fwfault_debug == 2) |
| @@ -956,8 +948,8 @@ _base_sas_ioc_info(struct MPT3SAS_ADAPTER *ioc, MPI2DefaultReply_t *mpi_reply, · 220 unmodified lines | ||
| 956 | 948 | break; |
| 957 | 949 | } |
| 958 | 950 | |
| 959 | − pr_warn(MPT3SAS_FMT "ioc_status: %s(0x%04x), request(0x%p),(%s)\n", | |
| 960 | − ioc->name, desc, ioc_status, request_hdr, func_str); | |
| 951 | + ioc_warn(ioc, "ioc_status: %s(0x%04x), request(0x%p),(%s)\n", | |
| 952 | + desc, ioc_status, request_hdr, func_str); | |
| 961 | 953 | |
| 962 | 954 | _debug_dump_mf(request_hdr, frame_sz/4); |
| 963 | 955 | } |
| @@ -1003,9 +995,9 @@ _base_display_event_data(struct MPT3SAS_ADAPTER *ioc, · 39 unmodified lines | ||
| 1003 | 995 | { |
| 1004 | 996 | Mpi2EventDataSasDiscovery_t *event_data = |
| 1005 | 997 | (Mpi2EventDataSasDiscovery_t *)mpi_reply->EventData; |
| 1006 | − pr_info(MPT3SAS_FMT "Discovery: (%s)", ioc->name, | |
| 1007 | − (event_data->ReasonCode == MPI2_EVENT_SAS_DISC_RC_STARTED) ? | |
| 1008 | − "start" : "stop"); | |
| 998 | + ioc_info(ioc, "Discovery: (%s)", | |
| 999 | + event_data->ReasonCode == MPI2_EVENT_SAS_DISC_RC_STARTED ? | |
| 1000 | + "start" : "stop"); | |
| 1009 | 1001 | if (event_data->DiscoveryStatus) |
| 1010 | 1002 | pr_cont(" discovery_status(0x%08x)", |
| 1011 | 1003 | le32_to_cpu(event_data->DiscoveryStatus)); |
| @@ -1059,14 +1051,13 @@ _base_display_event_data(struct MPT3SAS_ADAPTER *ioc, · 47 unmodified lines | ||
| 1059 | 1051 | { |
| 1060 | 1052 | Mpi26EventDataPCIeEnumeration_t *event_data = |
| 1061 | 1053 | (Mpi26EventDataPCIeEnumeration_t *)mpi_reply->EventData; |
| 1062 | − pr_info(MPT3SAS_FMT "PCIE Enumeration: (%s)", ioc->name, | |
| 1063 | − (event_data->ReasonCode == | |
| 1064 | − MPI26_EVENT_PCIE_ENUM_RC_STARTED) ? | |
| 1065 | − "start" : "stop"); | |
| 1054 | + ioc_info(ioc, "PCIE Enumeration: (%s)", | |
| 1055 | + event_data->ReasonCode == MPI26_EVENT_PCIE_ENUM_RC_STARTED ? | |
| 1056 | + "start" : "stop"); | |
| 1066 | 1057 | if (event_data->EnumerationStatus) |
| 1067 | − pr_info("enumeration_status(0x%08x)", | |
| 1068 | − le32_to_cpu(event_data->EnumerationStatus)); | |
| 1069 | − pr_info("\n"); | |
| 1058 | + pr_cont("enumeration_status(0x%08x)", | |
| 1059 | + le32_to_cpu(event_data->EnumerationStatus)); | |
| 1060 | + pr_cont("\n"); | |
| 1070 | 1061 | return; |
| 1071 | 1062 | } |
| 1072 | 1063 | case MPI2_EVENT_PCIE_TOPOLOGY_CHANGE_LIST: |
| @@ -1077,7 +1068,7 @@ _base_display_event_data(struct MPT3SAS_ADAPTER *ioc, · 4 unmodified lines | ||
| 1077 | 1068 | if (!desc) |
| 1078 | 1069 | return; |
| 1079 | 1070 | |
| 1080 | − pr_info(MPT3SAS_FMT "%s\n", ioc->name, desc); | |
| 1071 | + ioc_info(ioc, "%s\n", desc); | |
| 1081 | 1072 | } |
| 1082 | 1073 | |
| 1083 | 1074 | /** |
| @@ -1128,11 +1119,9 @@ _base_sas_log_info(struct MPT3SAS_ADAPTER *ioc , u32 log_info) · 44 unmodified lines | ||
| 1128 | 1119 | break; |
| 1129 | 1120 | } |
| 1130 | 1121 | |
| 1131 | − pr_warn(MPT3SAS_FMT | |
| 1132 | − "log_info(0x%08x): originator(%s), code(0x%02x), sub_code(0x%04x)\n", | |
| 1133 | − ioc->name, log_info, | |
| 1134 | − originator_str, sas_loginfo.dw.code, | |
| 1135 | − sas_loginfo.dw.subcode); | |
| 1122 | + ioc_warn(ioc, "log_info(0x%08x): originator(%s), code(0x%02x), sub_code(0x%04x)\n", | |
| 1123 | + log_info, | |
| 1124 | + originator_str, sas_loginfo.dw.code, sas_loginfo.dw.subcode); | |
| 1136 | 1125 | } |
| 1137 | 1126 | |
| 1138 | 1127 | /** |
| @@ -1152,8 +1141,8 @@ _base_display_reply_info(struct MPT3SAS_ADAPTER *ioc, u16 smid, u8 msix_index, · 13 unmodified lines | ||
| 1152 | 1141 | |
| 1153 | 1142 | mpi_reply = mpt3sas_base_get_reply_virt_addr(ioc, reply); |
| 1154 | 1143 | if (unlikely(!mpi_reply)) { |
| 1155 | − pr_err(MPT3SAS_FMT "mpi_reply not valid at %s:%d/%s()!\n", | |
| 1156 | − ioc->name, __FILE__, __LINE__, __func__); | |
| 1144 | + ioc_err(ioc, "mpi_reply not valid at %s:%d/%s()!\n", | |
| 1145 | + __FILE__, __LINE__, __func__); | |
| 1157 | 1146 | return; |
| 1158 | 1147 | } |
| 1159 | 1148 | ioc_status = le16_to_cpu(mpi_reply->IOCStatus); |
| @@ -1249,9 +1238,9 @@ _base_async_event(struct MPT3SAS_ADAPTER *ioc, u8 msix_index, u32 reply) · 89 unmodified lines | ||
| 1249 | 1238 | delayed_event_ack->EventContext = mpi_reply->EventContext; |
| 1250 | 1239 | list_add_tail(&delayed_event_ack->list, |
| 1251 | 1240 | &ioc->delayed_event_ack_list); |
| 1252 | − dewtprintk(ioc, pr_info(MPT3SAS_FMT | |
| 1253 | − "DELAYED: EVENT ACK: event (0x%04x)\n", | |
| 1254 | − ioc->name, le16_to_cpu(mpi_reply->Event))); | |
| 1241 | + dewtprintk(ioc, | |
| 1242 | + ioc_info(ioc, "DELAYED: EVENT ACK: event (0x%04x)\n", | |
| 1243 | + le16_to_cpu(mpi_reply->Event))); | |
| 1255 | 1244 | goto out; |
| 1256 | 1245 | } |
| 1257 | 1246 | |
| @@ -2270,7 +2259,7 @@ _base_build_sg_scmd(struct MPT3SAS_ADAPTER *ioc, · 1012 unmodified lines | ||
| 2270 | 2259 | sges_left = scsi_dma_map(scmd); |
| 2271 | 2260 | if (sges_left < 0) { |
| 2272 | 2261 | sdev_printk(KERN_ERR, scmd->device, |
| 2273 | − "pci_map_sg failed: request for %d bytes!\n", | |
| 2262 | + "scsi_dma_map failed: request for %d bytes!\n", | |
| 2274 | 2263 | scsi_bufflen(scmd)); |
| 2275 | 2264 | return -ENOMEM; |
| 2276 | 2265 | } |
| @@ -2418,7 +2407,7 @@ _base_build_sg_scmd_ieee(struct MPT3SAS_ADAPTER *ioc, · 141 unmodified lines | ||
| 2418 | 2407 | sges_left = scsi_dma_map(scmd); |
| 2419 | 2408 | if (sges_left < 0) { |
| 2420 | 2409 | sdev_printk(KERN_ERR, scmd->device, |
| 2421 | − "pci_map_sg failed: request for %d bytes!\n", | |
| 2410 | + "scsi_dma_map failed: request for %d bytes!\n", | |
| 2422 | 2411 | scsi_bufflen(scmd)); |
| 2423 | 2412 | return -ENOMEM; |
| 2424 | 2413 | } |
| @@ -2563,44 +2552,41 @@ _base_build_sg_ieee(struct MPT3SAS_ADAPTER *ioc, void *psge, · 138 unmodified lines | ||
| 2563 | 2552 | static int |
| 2564 | 2553 | _base_config_dma_addressing(struct MPT3SAS_ADAPTER *ioc, struct pci_dev *pdev) |
| 2565 | 2554 | { |
| 2555 | + u64 required_mask, coherent_mask; | |
| 2566 | 2556 | struct sysinfo s; |
| 2567 | − u64 consistent_dma_mask; | |
| 2568 | 2557 | |
| 2569 | 2558 | if (ioc->is_mcpu_endpoint) |
| 2570 | 2559 | goto try_32bit; |
| 2571 | 2560 | |
| 2561 | + required_mask = dma_get_required_mask(&pdev->dev); | |
| 2562 | + if (sizeof(dma_addr_t) == 4 || required_mask == 32) | |
| 2563 | + goto try_32bit; | |
| 2564 | + | |
| 2572 | 2565 | if (ioc->dma_mask) |
| 2573 | − consistent_dma_mask = DMA_BIT_MASK(64); | |
| 2566 | + coherent_mask = DMA_BIT_MASK(64); | |
| 2574 | 2567 | else |
| 2575 | − consistent_dma_mask = DMA_BIT_MASK(32); | |
| 2576 | − | |
| 2577 | − if (sizeof(dma_addr_t) > 4) { | |
| 2578 | − const uint64_t required_mask = | |
| 2579 | − dma_get_required_mask(&pdev->dev); | |
| 2580 | − if ((required_mask > DMA_BIT_MASK(32)) && | |
| 2581 | − !pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) && | |
| 2582 | − !pci_set_consistent_dma_mask(pdev, consistent_dma_mask)) { | |
| 2583 | − ioc->base_add_sg_single = &_base_add_sg_single_64; | |
| 2584 | − ioc->sge_size = sizeof(Mpi2SGESimple64_t); | |
| 2585 | − ioc->dma_mask = 64; | |
| 2586 | − goto out; | |
| 2587 | − } | |
| 2588 | − } | |
| 2568 | + coherent_mask = DMA_BIT_MASK(32); | |
| 2569 | + | |
| 2570 | + if (dma_set_mask(&pdev->dev, DMA_BIT_MASK(64)) || | |
| 2571 | + dma_set_coherent_mask(&pdev->dev, coherent_mask)) | |
| 2572 | + goto try_32bit; | |
| 2573 | + | |
| 2574 | + ioc->base_add_sg_single = &_base_add_sg_single_64; | |
| 2575 | + ioc->sge_size = sizeof(Mpi2SGESimple64_t); | |
| 2576 | + ioc->dma_mask = 64; | |
| 2577 | + goto out; | |
| 2589 | 2578 | |
| 2590 | 2579 | try_32bit: |
| 2591 | − if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(32)) | |
| 2592 | − && !pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32))) { | |
| 2593 | − ioc->base_add_sg_single = &_base_add_sg_single_32; | |
| 2594 | − ioc->sge_size = sizeof(Mpi2SGESimple32_t); | |
| 2595 | − ioc->dma_mask = 32; | |
| 2596 | − } else | |
| 2580 | + if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) | |
| 2597 | 2581 | return -ENODEV; |
| 2598 | 2582 | |
| 2583 | + ioc->base_add_sg_single = &_base_add_sg_single_32; | |
| 2584 | + ioc->sge_size = sizeof(Mpi2SGESimple32_t); | |
| 2585 | + ioc->dma_mask = 32; | |
| 2599 | 2586 | out: |
| 2600 | 2587 | si_meminfo(&s); |
| 2601 | − pr_info(MPT3SAS_FMT | |
| 2602 | − "%d BIT PCI BUS DMA ADDRESSING SUPPORTED, total mem (%ld kB)\n", | |
| 2603 | − ioc->name, ioc->dma_mask, convert_to_kb(s.totalram)); | |
| 2588 | + ioc_info(ioc, "%d BIT PCI BUS DMA ADDRESSING SUPPORTED, total mem (%ld kB)\n", | |
| 2589 | + ioc->dma_mask, convert_to_kb(s.totalram)); | |
| 2604 | 2590 | |
| 2605 | 2591 | return 0; |
| 2606 | 2592 | } |
| @@ -2639,8 +2625,7 @@ _base_check_enable_msix(struct MPT3SAS_ADAPTER *ioc) · 32 unmodified lines | ||
| 2639 | 2625 | |
| 2640 | 2626 | base = pci_find_capability(ioc->pdev, PCI_CAP_ID_MSIX); |
| 2641 | 2627 | if (!base) { |
| 2642 | − dfailprintk(ioc, pr_info(MPT3SAS_FMT "msix not supported\n", | |
| 2643 | − ioc->name)); | |
| 2628 | + dfailprintk(ioc, ioc_info(ioc, "msix not supported\n")); | |
| 2644 | 2629 | return -EINVAL; |
| 2645 | 2630 | } |
| 2646 | 2631 | |
| @@ -2658,9 +2643,8 @@ _base_check_enable_msix(struct MPT3SAS_ADAPTER *ioc) · 11 unmodified lines | ||
| 2658 | 2643 | pci_read_config_word(ioc->pdev, base + 2, &message_control); |
| 2659 | 2644 | ioc->msix_vector_count = (message_control & 0x3FF) + 1; |
| 2660 | 2645 | } |
| 2661 | − dinitprintk(ioc, pr_info(MPT3SAS_FMT | |
| 2662 | − "msix is supported, vector_count(%d)\n", | |
| 2663 | − ioc->name, ioc->msix_vector_count)); | |
| 2646 | + dinitprintk(ioc, ioc_info(ioc, "msix is supported, vector_count(%d)\n", | |
| 2647 | + ioc->msix_vector_count)); | |
| 2664 | 2648 | return 0; |
| 2665 | 2649 | } |
| 2666 | 2650 | |
| @@ -2702,8 +2686,8 @@ _base_request_irq(struct MPT3SAS_ADAPTER *ioc, u8 index) · 35 unmodified lines | ||
| 2702 | 2686 | |
| 2703 | 2687 | reply_q = kzalloc(sizeof(struct adapter_reply_queue), GFP_KERNEL); |
| 2704 | 2688 | if (!reply_q) { |
| 2705 | − pr_err(MPT3SAS_FMT "unable to allocate memory %d!\n", | |
| 2706 | − ioc->name, (int)sizeof(struct adapter_reply_queue)); | |
| 2689 | + ioc_err(ioc, "unable to allocate memory %zu!\n", | |
| 2690 | + sizeof(struct adapter_reply_queue)); | |
| 2707 | 2691 | return -ENOMEM; |
| 2708 | 2692 | } |
| 2709 | 2693 | reply_q->ioc = ioc; |
| @@ -2719,7 +2703,7 @@ _base_request_irq(struct MPT3SAS_ADAPTER *ioc, u8 index) · 9 unmodified lines | ||
| 2719 | 2703 | r = request_irq(pci_irq_vector(pdev, index), _base_interrupt, |
| 2720 | 2704 | IRQF_SHARED, reply_q->name, reply_q); |
| 2721 | 2705 | if (r) { |
| 2722 | − pr_err(MPT3SAS_FMT "unable to allocate interrupt %d!\n", | |
| 2706 | + pr_err("%s: unable to allocate interrupt %d!\n", | |
| 2723 | 2707 | reply_q->name, pci_irq_vector(pdev, index)); |
| 2724 | 2708 | kfree(reply_q); |
| 2725 | 2709 | return -EBUSY; |
| @@ -2761,8 +2745,8 @@ _base_assign_reply_queues(struct MPT3SAS_ADAPTER *ioc) · 35 unmodified lines | ||
| 2761 | 2745 | const cpumask_t *mask = pci_irq_get_affinity(ioc->pdev, |
| 2762 | 2746 | reply_q->msix_index); |
| 2763 | 2747 | if (!mask) { |
| 2764 | − pr_warn(MPT3SAS_FMT "no affinity for msi %x\n", | |
| 2765 | − ioc->name, reply_q->msix_index); | |
| 2748 | + ioc_warn(ioc, "no affinity for msi %x\n", | |
| 2749 | + reply_q->msix_index); | |
| 2766 | 2750 | continue; |
| 2767 | 2751 | } |
| 2768 | 2752 | |
| @@ -2833,9 +2817,8 @@ _base_enable_msix(struct MPT3SAS_ADAPTER *ioc) · 64 unmodified lines | ||
| 2833 | 2817 | ioc->reply_queue_count = min_t(int, ioc->cpu_count, |
| 2834 | 2818 | ioc->msix_vector_count); |
| 2835 | 2819 | |
| 2836 | − printk(MPT3SAS_FMT "MSI-X vectors supported: %d, no of cores" | |
| 2837 | − ": %d, max_msix_vectors: %d\n", ioc->name, ioc->msix_vector_count, | |
| 2838 | − ioc->cpu_count, max_msix_vectors); | |
| 2820 | + ioc_info(ioc, "MSI-X vectors supported: %d, no of cores: %d, max_msix_vectors: %d\n", | |
| 2821 | + ioc->msix_vector_count, ioc->cpu_count, max_msix_vectors); | |
| 2839 | 2822 | |
| 2840 | 2823 | if (!ioc->rdpq_array_enable && max_msix_vectors == -1) |
| 2841 | 2824 | local_max_msix_vectors = (reset_devices) ? 1 : 8; |
| @@ -2857,9 +2840,9 @@ _base_enable_msix(struct MPT3SAS_ADAPTER *ioc) · 15 unmodified lines | ||
| 2857 | 2840 | r = pci_alloc_irq_vectors(ioc->pdev, 1, ioc->reply_queue_count, |
| 2858 | 2841 | irq_flags); |
| 2859 | 2842 | if (r < 0) { |
| 2860 | − dfailprintk(ioc, pr_info(MPT3SAS_FMT | |
| 2861 | − "pci_alloc_irq_vectors failed (r=%d) !!!\n", | |
| 2862 | − ioc->name, r)); | |
| 2843 | + dfailprintk(ioc, | |
| 2844 | + ioc_info(ioc, "pci_alloc_irq_vectors failed (r=%d) !!!\n", | |
| 2845 | + r)); | |
| 2863 | 2846 | goto try_ioapic; |
| 2864 | 2847 | } |
| 2865 | 2848 | |
| @@ -2882,9 +2865,9 @@ _base_enable_msix(struct MPT3SAS_ADAPTER *ioc) · 16 unmodified lines | ||
| 2882 | 2865 | ioc->reply_queue_count = 1; |
| 2883 | 2866 | r = pci_alloc_irq_vectors(ioc->pdev, 1, 1, PCI_IRQ_LEGACY); |
| 2884 | 2867 | if (r < 0) { |
| 2885 | − dfailprintk(ioc, pr_info(MPT3SAS_FMT | |
| 2886 | − "pci_alloc_irq_vector(legacy) failed (r=%d) !!!\n", | |
| 2887 | − ioc->name, r)); | |
| 2868 | + dfailprintk(ioc, | |
| 2869 | + ioc_info(ioc, "pci_alloc_irq_vector(legacy) failed (r=%d) !!!\n", | |
| 2870 | + r)); | |
| 2888 | 2871 | } else |
| 2889 | 2872 | r = _base_request_irq(ioc, 0); |
| 2890 | 2873 | |
| @@ -2900,8 +2883,7 @@ mpt3sas_base_unmap_resources(struct MPT3SAS_ADAPTER *ioc) · 9 unmodified lines | ||
| 2900 | 2883 | { |
| 2901 | 2884 | struct pci_dev *pdev = ioc->pdev; |
| 2902 | 2885 | |
| 2903 | − dexitprintk(ioc, printk(MPT3SAS_FMT "%s\n", | |
| 2904 | − ioc->name, __func__)); | |
| 2886 | + dexitprintk(ioc, ioc_info(ioc, "%s\n", __func__)); | |
| 2905 | 2887 | |
| 2906 | 2888 | _base_free_irq(ioc); |
| 2907 | 2889 | _base_disable_msix(ioc); |
| @@ -2939,13 +2921,11 @@ mpt3sas_base_map_resources(struct MPT3SAS_ADAPTER *ioc) · 31 unmodified lines | ||
| 2939 | 2921 | phys_addr_t chip_phys = 0; |
| 2940 | 2922 | struct adapter_reply_queue *reply_q; |
| 2941 | 2923 | |
| 2942 | − dinitprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", | |
| 2943 | − ioc->name, __func__)); | |
| 2924 | + dinitprintk(ioc, ioc_info(ioc, "%s\n", __func__)); | |
| 2944 | 2925 | |
| 2945 | 2926 | ioc->bars = pci_select_bars(pdev, IORESOURCE_MEM); |
| 2946 | 2927 | if (pci_enable_device_mem(pdev)) { |
| 2947 | − pr_warn(MPT3SAS_FMT "pci_enable_device_mem: failed\n", | |
| 2948 | − ioc->name); | |
| 2928 | + ioc_warn(ioc, "pci_enable_device_mem: failed\n"); | |
| 2949 | 2929 | ioc->bars = 0; |
| 2950 | 2930 | return -ENODEV; |
| 2951 | 2931 | } |
| @@ -2953,8 +2933,7 @@ mpt3sas_base_map_resources(struct MPT3SAS_ADAPTER *ioc) · 1 unmodified line | ||
| 2953 | 2933 | |
| 2954 | 2934 | if (pci_request_selected_regions(pdev, ioc->bars, |
| 2955 | 2935 | ioc->driver_name)) { |
| 2956 | − pr_warn(MPT3SAS_FMT "pci_request_selected_regions: failed\n", | |
| 2957 | − ioc->name); | |
| 2936 | + ioc_warn(ioc, "pci_request_selected_regions: failed\n"); | |
| 2958 | 2937 | ioc->bars = 0; |
| 2959 | 2938 | r = -ENODEV; |
| 2960 | 2939 | goto out_fail; |
| @@ -2967,8 +2946,7 @@ mpt3sas_base_map_resources(struct MPT3SAS_ADAPTER *ioc) · 6 unmodified lines | ||
| 2967 | 2946 | |
| 2968 | 2947 | |
| 2969 | 2948 | if (_base_config_dma_addressing(ioc, pdev) != 0) { |
| 2970 | − pr_warn(MPT3SAS_FMT "no suitable DMA mask for %s\n", | |
| 2971 | − ioc->name, pci_name(pdev)); | |
| 2949 | + ioc_warn(ioc, "no suitable DMA mask for %s\n", pci_name(pdev)); | |
| 2972 | 2950 | r = -ENODEV; |
| 2973 | 2951 | goto out_fail; |
| 2974 | 2952 | } |
| @@ -2991,8 +2969,7 @@ mpt3sas_base_map_resources(struct MPT3SAS_ADAPTER *ioc) · 16 unmodified lines | ||
| 2991 | 2969 | } |
| 2992 | 2970 | |
| 2993 | 2971 | if (ioc->chip == NULL) { |
| 2994 | − pr_err(MPT3SAS_FMT "unable to map adapter memory! " | |
| 2995 | − " or resource not found\n", ioc->name); | |
| 2972 | + ioc_err(ioc, "unable to map adapter memory! or resource not found\n"); | |
| 2996 | 2973 | r = -EINVAL; |
| 2997 | 2974 | goto out_fail; |
| 2998 | 2975 | } |
| @@ -3026,9 +3003,8 @@ mpt3sas_base_map_resources(struct MPT3SAS_ADAPTER *ioc) · 27 unmodified lines | ||
| 3026 | 3003 | ioc->combined_reply_index_count, |
| 3027 | 3004 | sizeof(resource_size_t *), GFP_KERNEL); |
| 3028 | 3005 | if (!ioc->replyPostRegisterIndex) { |
| 3029 | − dfailprintk(ioc, printk(MPT3SAS_FMT | |
| 3030 | − "allocation for reply Post Register Index failed!!!\n", | |
| 3031 | − ioc->name)); | |
| 3006 | + dfailprintk(ioc, | |
| 3007 | + ioc_warn(ioc, "allocation for reply Post Register Index failed!!!\n")); | |
| 3032 | 3008 | r = -ENOMEM; |
| 3033 | 3009 | goto out_fail; |
| 3034 | 3010 | } |
| @@ -3053,15 +3029,15 @@ mpt3sas_base_map_resources(struct MPT3SAS_ADAPTER *ioc) · 18 unmodified lines | ||
| 3053 | 3029 | } |
| 3054 | 3030 | |
| 3055 | 3031 | list_for_each_entry(reply_q, &ioc->reply_queue_list, list) |
| 3056 | − pr_info(MPT3SAS_FMT "%s: IRQ %d\n", | |
| 3057 | − reply_q->name, ((ioc->msix_enable) ? "PCI-MSI-X enabled" : | |
| 3058 | − "IO-APIC enabled"), | |
| 3059 | − pci_irq_vector(ioc->pdev, reply_q->msix_index)); | |
| 3032 | + pr_info("%s: %s enabled: IRQ %d\n", | |
| 3033 | + reply_q->name, | |
| 3034 | + ioc->msix_enable ? "PCI-MSI-X" : "IO-APIC", | |
| 3035 | + pci_irq_vector(ioc->pdev, reply_q->msix_index)); | |
| 3060 | 3036 | |
| 3061 | − pr_info(MPT3SAS_FMT "iomem(%pap), mapped(0x%p), size(%d)\n", | |
| 3062 | − ioc->name, &chip_phys, ioc->chip, memap_sz); | |
| 3063 | − pr_info(MPT3SAS_FMT "ioport(0x%016llx), size(%d)\n", | |
| 3064 | − ioc->name, (unsigned long long)pio_chip, pio_sz); | |
| 3037 | + ioc_info(ioc, "iomem(%pap), mapped(0x%p), size(%d)\n", | |
| 3038 | + &chip_phys, ioc->chip, memap_sz); | |
| 3039 | + ioc_info(ioc, "ioport(0x%016llx), size(%d)\n", | |
| 3040 | + (unsigned long long)pio_chip, pio_sz); | |
| 3065 | 3041 | |
| 3066 | 3042 | /* Save PCI configuration state for recovery from PCI AER/EEH errors */ |
| 3067 | 3043 | pci_save_state(pdev); |
| @@ -3176,8 +3152,7 @@ mpt3sas_base_get_smid(struct MPT3SAS_ADAPTER *ioc, u8 cb_idx) · 108 unmodified lines | ||
| 3176 | 3152 | spin_lock_irqsave(&ioc->scsi_lookup_lock, flags); |
| 3177 | 3153 | if (list_empty(&ioc->internal_free_list)) { |
| 3178 | 3154 | spin_unlock_irqrestore(&ioc->scsi_lookup_lock, flags); |
| 3179 | − pr_err(MPT3SAS_FMT "%s: smid not available\n", | |
| 3180 | − ioc->name, __func__); | |
| 3155 | + ioc_err(ioc, "%s: smid not available\n", __func__); | |
| 3181 | 3156 | return 0; |
| 3182 | 3157 | } |
| 3183 | 3158 | |
| @@ -3545,89 +3520,85 @@ _base_display_OEMs_branding(struct MPT3SAS_ADAPTER *ioc) · 361 unmodified lines | ||
| 3545 | 3520 | case MPI2_MFGPAGE_DEVID_SAS2008: |
| 3546 | 3521 | switch (ioc->pdev->subsystem_device) { |
| 3547 | 3522 | case MPT2SAS_INTEL_RMS2LL080_SSDID: |
| 3548 | − pr_info(MPT3SAS_FMT "%s\n", ioc->name, | |
| 3549 | − MPT2SAS_INTEL_RMS2LL080_BRANDING); | |
| 3523 | + ioc_info(ioc, "%s\n", | |
| 3524 | + MPT2SAS_INTEL_RMS2LL080_BRANDING); | |
| 3550 | 3525 | break; |
| 3551 | 3526 | case MPT2SAS_INTEL_RMS2LL040_SSDID: |
| 3552 | − pr_info(MPT3SAS_FMT "%s\n", ioc->name, | |
| 3553 | − MPT2SAS_INTEL_RMS2LL040_BRANDING); | |
| 3527 | + ioc_info(ioc, "%s\n", | |
| 3528 | + MPT2SAS_INTEL_RMS2LL040_BRANDING); | |
| 3554 | 3529 | break; |
| 3555 | 3530 | case MPT2SAS_INTEL_SSD910_SSDID: |
| 3556 | − pr_info(MPT3SAS_FMT "%s\n", ioc->name, | |
| 3557 | − MPT2SAS_INTEL_SSD910_BRANDING); | |
| 3531 | + ioc_info(ioc, "%s\n", | |
| 3532 | + MPT2SAS_INTEL_SSD910_BRANDING); | |
| 3558 | 3533 | break; |
| 3559 | 3534 | default: |
| 3560 | − pr_info(MPT3SAS_FMT | |
| 3561 | − "Intel(R) Controller: Subsystem ID: 0x%X\n", | |
| 3562 | − ioc->name, ioc->pdev->subsystem_device); | |
| 3535 | + ioc_info(ioc, "Intel(R) Controller: Subsystem ID: 0x%X\n", | |
| 3536 | + ioc->pdev->subsystem_device); | |
| 3563 | 3537 | break; |
| 3564 | 3538 | } |
| 3565 | 3539 | case MPI2_MFGPAGE_DEVID_SAS2308_2: |
| 3566 | 3540 | switch (ioc->pdev->subsystem_device) { |
| 3567 | 3541 | case MPT2SAS_INTEL_RS25GB008_SSDID: |
| 3568 | − pr_info(MPT3SAS_FMT "%s\n", ioc->name, | |
| 3569 | − MPT2SAS_INTEL_RS25GB008_BRANDING); | |
| 3542 | + ioc_info(ioc, "%s\n", | |
| 3543 | + MPT2SAS_INTEL_RS25GB008_BRANDING); | |
| 3570 | 3544 | break; |
| 3571 | 3545 | case MPT2SAS_INTEL_RMS25JB080_SSDID: |
| 3572 | − pr_info(MPT3SAS_FMT "%s\n", ioc->name, | |
| 3573 | − MPT2SAS_INTEL_RMS25JB080_BRANDING); | |
| 3546 | + ioc_info(ioc, "%s\n", | |
| 3547 | + MPT2SAS_INTEL_RMS25JB080_BRANDING); | |
| 3574 | 3548 | break; |
| 3575 | 3549 | case MPT2SAS_INTEL_RMS25JB040_SSDID: |
| 3576 | − pr_info(MPT3SAS_FMT "%s\n", ioc->name, | |
| 3577 | − MPT2SAS_INTEL_RMS25JB040_BRANDING); | |
| 3550 | + ioc_info(ioc, "%s\n", | |
| 3551 | + MPT2SAS_INTEL_RMS25JB040_BRANDING); | |
| 3578 | 3552 | break; |
| 3579 | 3553 | case MPT2SAS_INTEL_RMS25KB080_SSDID: |
| 3580 | − pr_info(MPT3SAS_FMT "%s\n", ioc->name, | |
| 3581 | − MPT2SAS_INTEL_RMS25KB080_BRANDING); | |
| 3554 | + ioc_info(ioc, "%s\n", | |
| 3555 | + MPT2SAS_INTEL_RMS25KB080_BRANDING); | |
| 3582 | 3556 | break; |
| 3583 | 3557 | case MPT2SAS_INTEL_RMS25KB040_SSDID: |
| 3584 | − pr_info(MPT3SAS_FMT "%s\n", ioc->name, | |
| 3585 | − MPT2SAS_INTEL_RMS25KB040_BRANDING); | |
| 3558 | + ioc_info(ioc, "%s\n", | |
| 3559 | + MPT2SAS_INTEL_RMS25KB040_BRANDING); | |
| 3586 | 3560 | break; |
| 3587 | 3561 | case MPT2SAS_INTEL_RMS25LB040_SSDID: |
| 3588 | − pr_info(MPT3SAS_FMT "%s\n", ioc->name, | |
| 3589 | − MPT2SAS_INTEL_RMS25LB040_BRANDING); | |
| 3562 | + ioc_info(ioc, "%s\n", | |
| 3563 | + MPT2SAS_INTEL_RMS25LB040_BRANDING); | |
| 3590 | 3564 | break; |
| 3591 | 3565 | case MPT2SAS_INTEL_RMS25LB080_SSDID: |
| 3592 | − pr_info(MPT3SAS_FMT "%s\n", ioc->name, | |
| 3593 | − MPT2SAS_INTEL_RMS25LB080_BRANDING); | |
| 3566 | + ioc_info(ioc, "%s\n", | |
| 3567 | + MPT2SAS_INTEL_RMS25LB080_BRANDING); | |
| 3594 | 3568 | break; |
| 3595 | 3569 | default: |
| 3596 | − pr_info(MPT3SAS_FMT | |
| 3597 | − "Intel(R) Controller: Subsystem ID: 0x%X\n", | |
| 3598 | − ioc->name, ioc->pdev->subsystem_device); | |
| 3570 | + ioc_info(ioc, "Intel(R) Controller: Subsystem ID: 0x%X\n", | |
| 3571 | + ioc->pdev->subsystem_device); | |
| 3599 | 3572 | break; |
| 3600 | 3573 | } |
| 3601 | 3574 | case MPI25_MFGPAGE_DEVID_SAS3008: |
| 3602 | 3575 | switch (ioc->pdev->subsystem_device) { |
| 3603 | 3576 | case MPT3SAS_INTEL_RMS3JC080_SSDID: |
| 3604 | − pr_info(MPT3SAS_FMT "%s\n", ioc->name, | |
| 3605 | − MPT3SAS_INTEL_RMS3JC080_BRANDING); | |
| 3577 | + ioc_info(ioc, "%s\n", | |
| 3578 | + MPT3SAS_INTEL_RMS3JC080_BRANDING); | |
| 3606 | 3579 | break; |
| 3607 | 3580 | |
| 3608 | 3581 | case MPT3SAS_INTEL_RS3GC008_SSDID: |
| 3609 | − pr_info(MPT3SAS_FMT "%s\n", ioc->name, | |
| 3610 | − MPT3SAS_INTEL_RS3GC008_BRANDING); | |
| 3582 | + ioc_info(ioc, "%s\n", | |
| 3583 | + MPT3SAS_INTEL_RS3GC008_BRANDING); | |
| 3611 | 3584 | break; |
| 3612 | 3585 | case MPT3SAS_INTEL_RS3FC044_SSDID: |
| 3613 | − pr_info(MPT3SAS_FMT "%s\n", ioc->name, | |
| 3614 | − MPT3SAS_INTEL_RS3FC044_BRANDING); | |
| 3586 | + ioc_info(ioc, "%s\n", | |
| 3587 | + MPT3SAS_INTEL_RS3FC044_BRANDING); | |
| 3615 | 3588 | break; |
| 3616 | 3589 | case MPT3SAS_INTEL_RS3UC080_SSDID: |
| 3617 | − pr_info(MPT3SAS_FMT "%s\n", ioc->name, | |
| 3618 | − MPT3SAS_INTEL_RS3UC080_BRANDING); | |
| 3590 | + ioc_info(ioc, "%s\n", | |
| 3591 | + MPT3SAS_INTEL_RS3UC080_BRANDING); | |
| 3619 | 3592 | break; |
| 3620 | 3593 | default: |
| 3621 | − pr_info(MPT3SAS_FMT | |
| 3622 | − "Intel(R) Controller: Subsystem ID: 0x%X\n", | |
| 3623 | − ioc->name, ioc->pdev->subsystem_device); | |
| 3594 | + ioc_info(ioc, "Intel(R) Controller: Subsystem ID: 0x%X\n", | |
| 3595 | + ioc->pdev->subsystem_device); | |
| 3624 | 3596 | break; |
| 3625 | 3597 | } |
| 3626 | 3598 | break; |
| 3627 | 3599 | default: |
| 3628 | − pr_info(MPT3SAS_FMT | |
| 3629 | − "Intel(R) Controller: Subsystem ID: 0x%X\n", | |
| 3630 | − ioc->name, ioc->pdev->subsystem_device); | |
| 3600 | + ioc_info(ioc, "Intel(R) Controller: Subsystem ID: 0x%X\n", | |
| 3601 | + ioc->pdev->subsystem_device); | |
| 3631 | 3602 | break; |
| 3632 | 3603 | } |
| 3633 | 3604 | break; |
| @@ -3636,57 +3607,54 @@ _base_display_OEMs_branding(struct MPT3SAS_ADAPTER *ioc) · 2 unmodified lines | ||
| 3636 | 3607 | case MPI2_MFGPAGE_DEVID_SAS2008: |
| 3637 | 3608 | switch (ioc->pdev->subsystem_device) { |
| 3638 | 3609 | case MPT2SAS_DELL_6GBPS_SAS_HBA_SSDID: |
| 3639 | − pr_info(MPT3SAS_FMT "%s\n", ioc->name, | |
| 3640 | − MPT2SAS_DELL_6GBPS_SAS_HBA_BRANDING); | |
| 3610 | + ioc_info(ioc, "%s\n", | |
| 3611 | + MPT2SAS_DELL_6GBPS_SAS_HBA_BRANDING); | |
| 3641 | 3612 | break; |
| 3642 | 3613 | case MPT2SAS_DELL_PERC_H200_ADAPTER_SSDID: |
| 3643 | − pr_info(MPT3SAS_FMT "%s\n", ioc->name, | |
| 3644 | − MPT2SAS_DELL_PERC_H200_ADAPTER_BRANDING); | |
| 3614 | + ioc_info(ioc, "%s\n", | |
| 3615 | + MPT2SAS_DELL_PERC_H200_ADAPTER_BRANDING); | |
| 3645 | 3616 | break; |
| 3646 | 3617 | case MPT2SAS_DELL_PERC_H200_INTEGRATED_SSDID: |
| 3647 | − pr_info(MPT3SAS_FMT "%s\n", ioc->name, | |
| 3648 | − MPT2SAS_DELL_PERC_H200_INTEGRATED_BRANDING); | |
| 3618 | + ioc_info(ioc, "%s\n", | |
| 3619 | + MPT2SAS_DELL_PERC_H200_INTEGRATED_BRANDING); | |
| 3649 | 3620 | break; |
| 3650 | 3621 | case MPT2SAS_DELL_PERC_H200_MODULAR_SSDID: |
| 3651 | − pr_info(MPT3SAS_FMT "%s\n", ioc->name, | |
| 3652 | − MPT2SAS_DELL_PERC_H200_MODULAR_BRANDING); | |
| 3622 | + ioc_info(ioc, "%s\n", | |
| 3623 | + MPT2SAS_DELL_PERC_H200_MODULAR_BRANDING); | |
| 3653 | 3624 | break; |
| 3654 | 3625 | case MPT2SAS_DELL_PERC_H200_EMBEDDED_SSDID: |
| 3655 | − pr_info(MPT3SAS_FMT "%s\n", ioc->name, | |
| 3656 | − MPT2SAS_DELL_PERC_H200_EMBEDDED_BRANDING); | |
| 3626 | + ioc_info(ioc, "%s\n", | |
| 3627 | + MPT2SAS_DELL_PERC_H200_EMBEDDED_BRANDING); | |
| 3657 | 3628 | break; |
| 3658 | 3629 | case MPT2SAS_DELL_PERC_H200_SSDID: |
| 3659 | − pr_info(MPT3SAS_FMT "%s\n", ioc->name, | |
| 3660 | − MPT2SAS_DELL_PERC_H200_BRANDING); | |
| 3630 | + ioc_info(ioc, "%s\n", | |
| 3631 | + MPT2SAS_DELL_PERC_H200_BRANDING); | |
| 3661 | 3632 | break; |
| 3662 | 3633 | case MPT2SAS_DELL_6GBPS_SAS_SSDID: |
| 3663 | − pr_info(MPT3SAS_FMT "%s\n", ioc->name, | |
| 3664 | − MPT2SAS_DELL_6GBPS_SAS_BRANDING); | |
| 3634 | + ioc_info(ioc, "%s\n", | |
| 3635 | + MPT2SAS_DELL_6GBPS_SAS_BRANDING); | |
| 3665 | 3636 | break; |
| 3666 | 3637 | default: |
| 3667 | − pr_info(MPT3SAS_FMT | |
| 3668 | − "Dell 6Gbps HBA: Subsystem ID: 0x%X\n", | |
| 3669 | − ioc->name, ioc->pdev->subsystem_device); | |
| 3638 | + ioc_info(ioc, "Dell 6Gbps HBA: Subsystem ID: 0x%X\n", | |
| 3639 | + ioc->pdev->subsystem_device); | |
| 3670 | 3640 | break; |
| 3671 | 3641 | } |
| 3672 | 3642 | break; |
| 3673 | 3643 | case MPI25_MFGPAGE_DEVID_SAS3008: |
| 3674 | 3644 | switch (ioc->pdev->subsystem_device) { |
| 3675 | 3645 | case MPT3SAS_DELL_12G_HBA_SSDID: |
| 3676 | − pr_info(MPT3SAS_FMT "%s\n", ioc->name, | |
| 3677 | − MPT3SAS_DELL_12G_HBA_BRANDING); | |
| 3646 | + ioc_info(ioc, "%s\n", | |
| 3647 | + MPT3SAS_DELL_12G_HBA_BRANDING); | |
| 3678 | 3648 | break; |
| 3679 | 3649 | default: |
| 3680 | − pr_info(MPT3SAS_FMT | |
| 3681 | − "Dell 12Gbps HBA: Subsystem ID: 0x%X\n", | |
| 3682 | − ioc->name, ioc->pdev->subsystem_device); | |
| 3650 | + ioc_info(ioc, "Dell 12Gbps HBA: Subsystem ID: 0x%X\n", | |
| 3651 | + ioc->pdev->subsystem_device); | |
| 3683 | 3652 | break; |
| 3684 | 3653 | } |
| 3685 | 3654 | break; |
| 3686 | 3655 | default: |
| 3687 | − pr_info(MPT3SAS_FMT | |
| 3688 | − "Dell HBA: Subsystem ID: 0x%X\n", ioc->name, | |
| 3689 | − ioc->pdev->subsystem_device); | |
| 3656 | + ioc_info(ioc, "Dell HBA: Subsystem ID: 0x%X\n", | |
| 3657 | + ioc->pdev->subsystem_device); | |
| 3690 | 3658 | break; |
| 3691 | 3659 | } |
| 3692 | 3660 | break; |
| @@ -3695,46 +3663,42 @@ _base_display_OEMs_branding(struct MPT3SAS_ADAPTER *ioc) · 2 unmodified lines | ||
| 3695 | 3663 | case MPI25_MFGPAGE_DEVID_SAS3008: |
| 3696 | 3664 | switch (ioc->pdev->subsystem_device) { |
| 3697 | 3665 | case MPT3SAS_CISCO_12G_8E_HBA_SSDID: |
| 3698 | − pr_info(MPT3SAS_FMT "%s\n", ioc->name, | |
| 3699 | − MPT3SAS_CISCO_12G_8E_HBA_BRANDING); | |
| 3666 | + ioc_info(ioc, "%s\n", | |
| 3667 | + MPT3SAS_CISCO_12G_8E_HBA_BRANDING); | |
| 3700 | 3668 | break; |
| 3701 | 3669 | case MPT3SAS_CISCO_12G_8I_HBA_SSDID: |
| 3702 | − pr_info(MPT3SAS_FMT "%s\n", ioc->name, | |
| 3703 | − MPT3SAS_CISCO_12G_8I_HBA_BRANDING); | |
| 3670 | + ioc_info(ioc, "%s\n", | |
| 3671 | + MPT3SAS_CISCO_12G_8I_HBA_BRANDING); | |
| 3704 | 3672 | break; |
| 3705 | 3673 | case MPT3SAS_CISCO_12G_AVILA_HBA_SSDID: |
| 3706 | − pr_info(MPT3SAS_FMT "%s\n", ioc->name, | |
| 3707 | − MPT3SAS_CISCO_12G_AVILA_HBA_BRANDING); | |
| 3674 | + ioc_info(ioc, "%s\n", | |
| 3675 | + MPT3SAS_CISCO_12G_AVILA_HBA_BRANDING); | |
| 3708 | 3676 | break; |
| 3709 | 3677 | default: |
| 3710 | − pr_info(MPT3SAS_FMT | |
| 3711 | − "Cisco 12Gbps SAS HBA: Subsystem ID: 0x%X\n", | |
| 3712 | − ioc->name, ioc->pdev->subsystem_device); | |
| 3678 | + ioc_info(ioc, "Cisco 12Gbps SAS HBA: Subsystem ID: 0x%X\n", | |
| 3679 | + ioc->pdev->subsystem_device); | |
| 3713 | 3680 | break; |
| 3714 | 3681 | } |
| 3715 | 3682 | break; |
| 3716 | 3683 | case MPI25_MFGPAGE_DEVID_SAS3108_1: |
| 3717 | 3684 | switch (ioc->pdev->subsystem_device) { |
| 3718 | 3685 | case MPT3SAS_CISCO_12G_AVILA_HBA_SSDID: |
| 3719 | − pr_info(MPT3SAS_FMT "%s\n", ioc->name, | |
| 3720 | − MPT3SAS_CISCO_12G_AVILA_HBA_BRANDING); | |
| 3686 | + ioc_info(ioc, "%s\n", | |
| 3687 | + MPT3SAS_CISCO_12G_AVILA_HBA_BRANDING); | |
| 3721 | 3688 | break; |
| 3722 | 3689 | case MPT3SAS_CISCO_12G_COLUSA_MEZZANINE_HBA_SSDID: |
| 3723 | − pr_info(MPT3SAS_FMT "%s\n", ioc->name, | |
| 3724 | − MPT3SAS_CISCO_12G_COLUSA_MEZZANINE_HBA_BRANDING | |
| 3725 | − ); | |
| 3690 | + ioc_info(ioc, "%s\n", | |
| 3691 | + MPT3SAS_CISCO_12G_COLUSA_MEZZANINE_HBA_BRANDING); | |
| 3726 | 3692 | break; |
| 3727 | 3693 | default: |
| 3728 | − pr_info(MPT3SAS_FMT | |
| 3729 | − "Cisco 12Gbps SAS HBA: Subsystem ID: 0x%X\n", | |
| 3730 | − ioc->name, ioc->pdev->subsystem_device); | |
| 3694 | + ioc_info(ioc, "Cisco 12Gbps SAS HBA: Subsystem ID: 0x%X\n", | |
| 3695 | + ioc->pdev->subsystem_device); | |
| 3731 | 3696 | break; |
| 3732 | 3697 | } |
| 3733 | 3698 | break; |
| 3734 | 3699 | default: |
| 3735 | − pr_info(MPT3SAS_FMT | |
| 3736 | − "Cisco SAS HBA: Subsystem ID: 0x%X\n", | |
| 3737 | − ioc->name, ioc->pdev->subsystem_device); | |
| 3700 | + ioc_info(ioc, "Cisco SAS HBA: Subsystem ID: 0x%X\n", | |
| 3701 | + ioc->pdev->subsystem_device); | |
| 3738 | 3702 | break; |
| 3739 | 3703 | } |
| 3740 | 3704 | break; |
| @@ -3743,43 +3707,40 @@ _base_display_OEMs_branding(struct MPT3SAS_ADAPTER *ioc) · 2 unmodified lines | ||
| 3743 | 3707 | case MPI2_MFGPAGE_DEVID_SAS2004: |
| 3744 | 3708 | switch (ioc->pdev->subsystem_device) { |
| 3745 | 3709 | case MPT2SAS_HP_DAUGHTER_2_4_INTERNAL_SSDID: |
| 3746 | − pr_info(MPT3SAS_FMT "%s\n", ioc->name, | |
| 3747 | − MPT2SAS_HP_DAUGHTER_2_4_INTERNAL_BRANDING); | |
| 3710 | + ioc_info(ioc, "%s\n", | |
| 3711 | + MPT2SAS_HP_DAUGHTER_2_4_INTERNAL_BRANDING); | |
| 3748 | 3712 | break; |
| 3749 | 3713 | default: |
| 3750 | − pr_info(MPT3SAS_FMT | |
| 3751 | − "HP 6Gbps SAS HBA: Subsystem ID: 0x%X\n", | |
| 3752 | − ioc->name, ioc->pdev->subsystem_device); | |
| 3714 | + ioc_info(ioc, "HP 6Gbps SAS HBA: Subsystem ID: 0x%X\n", | |
| 3715 | + ioc->pdev->subsystem_device); | |
| 3753 | 3716 | break; |
| 3754 | 3717 | } |
| 3755 | 3718 | case MPI2_MFGPAGE_DEVID_SAS2308_2: |
| 3756 | 3719 | switch (ioc->pdev->subsystem_device) { |
| 3757 | 3720 | case MPT2SAS_HP_2_4_INTERNAL_SSDID: |
| 3758 | − pr_info(MPT3SAS_FMT "%s\n", ioc->name, | |
| 3759 | − MPT2SAS_HP_2_4_INTERNAL_BRANDING); | |
| 3721 | + ioc_info(ioc, "%s\n", | |
| 3722 | + MPT2SAS_HP_2_4_INTERNAL_BRANDING); | |
| 3760 | 3723 | break; |
| 3761 | 3724 | case MPT2SAS_HP_2_4_EXTERNAL_SSDID: |
| 3762 | − pr_info(MPT3SAS_FMT "%s\n", ioc->name, | |
| 3763 | − MPT2SAS_HP_2_4_EXTERNAL_BRANDING); | |
| 3725 | + ioc_info(ioc, "%s\n", | |
| 3726 | + MPT2SAS_HP_2_4_EXTERNAL_BRANDING); | |
| 3764 | 3727 | break; |
| 3765 | 3728 | case MPT2SAS_HP_1_4_INTERNAL_1_4_EXTERNAL_SSDID: |
| 3766 | − pr_info(MPT3SAS_FMT "%s\n", ioc->name, | |
| 3767 | − MPT2SAS_HP_1_4_INTERNAL_1_4_EXTERNAL_BRANDING); | |
| 3729 | + ioc_info(ioc, "%s\n", | |
| 3730 | + MPT2SAS_HP_1_4_INTERNAL_1_4_EXTERNAL_BRANDING); | |
| 3768 | 3731 | break; |
| 3769 | 3732 | case MPT2SAS_HP_EMBEDDED_2_4_INTERNAL_SSDID: |
| 3770 | − pr_info(MPT3SAS_FMT "%s\n", ioc->name, | |
| 3771 | − MPT2SAS_HP_EMBEDDED_2_4_INTERNAL_BRANDING); | |
| 3733 | + ioc_info(ioc, "%s\n", | |
| 3734 | + MPT2SAS_HP_EMBEDDED_2_4_INTERNAL_BRANDING); | |
| 3772 | 3735 | break; |
| 3773 | 3736 | default: |
| 3774 | − pr_info(MPT3SAS_FMT | |
| 3775 | − "HP 6Gbps SAS HBA: Subsystem ID: 0x%X\n", | |
| 3776 | − ioc->name, ioc->pdev->subsystem_device); | |
| 3737 | + ioc_info(ioc, "HP 6Gbps SAS HBA: Subsystem ID: 0x%X\n", | |
| 3738 | + ioc->pdev->subsystem_device); | |
| 3777 | 3739 | break; |
| 3778 | 3740 | } |
| 3779 | 3741 | default: |
| 3780 | − pr_info(MPT3SAS_FMT | |
| 3781 | − "HP SAS HBA: Subsystem ID: 0x%X\n", | |
| 3782 | − ioc->name, ioc->pdev->subsystem_device); | |
| 3742 | + ioc_info(ioc, "HP SAS HBA: Subsystem ID: 0x%X\n", | |
| 3743 | + ioc->pdev->subsystem_device); | |
| 3783 | 3744 | break; |
| 3784 | 3745 | } |
| 3785 | 3746 | default: |
| @@ -3806,28 +3767,25 @@ _base_display_fwpkg_version(struct MPT3SAS_ADAPTER *ioc) · 20 unmodified lines | ||
| 3806 | 3767 | u16 smid, ioc_status; |
| 3807 | 3768 | size_t data_length; |
| 3808 | 3769 | |
| 3809 | − dinitprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name, | |
| 3810 | − __func__)); | |
| 3770 | + dinitprintk(ioc, ioc_info(ioc, "%s\n", __func__)); | |
| 3811 | 3771 | |
| 3812 | 3772 | if (ioc->base_cmds.status & MPT3_CMD_PENDING) { |
| 3813 | − pr_err(MPT3SAS_FMT "%s: internal command already in use\n", | |
| 3814 | − ioc->name, __func__); | |
| 3773 | + ioc_err(ioc, "%s: internal command already in use\n", __func__); | |
| 3815 | 3774 | return -EAGAIN; |
| 3816 | 3775 | } |
| 3817 | 3776 | |
| 3818 | 3777 | data_length = sizeof(Mpi2FWImageHeader_t); |
| 3819 | − fwpkg_data = pci_alloc_consistent(ioc->pdev, data_length, | |
| 3820 | − &fwpkg_data_dma); | |
| 3778 | + fwpkg_data = dma_alloc_coherent(&ioc->pdev->dev, data_length, | |
| 3779 | + &fwpkg_data_dma, GFP_KERNEL); | |
| 3821 | 3780 | if (!fwpkg_data) { |
| 3822 | − pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", | |
| 3823 | − ioc->name, __FILE__, __LINE__, __func__); | |
| 3781 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", | |
| 3782 | + __FILE__, __LINE__, __func__); | |
| 3824 | 3783 | return -ENOMEM; |
| 3825 | 3784 | } |
| 3826 | 3785 | |
| 3827 | 3786 | smid = mpt3sas_base_get_smid(ioc, ioc->base_cb_idx); |
| 3828 | 3787 | if (!smid) { |
| 3829 | − pr_err(MPT3SAS_FMT "%s: failed obtaining a smid\n", | |
| 3830 | − ioc->name, __func__); | |
| 3788 | + ioc_err(ioc, "%s: failed obtaining a smid\n", __func__); | |
| 3831 | 3789 | r = -EAGAIN; |
| 3832 | 3790 | goto out; |
| 3833 | 3791 | } |
| @@ -3846,11 +3804,9 @@ _base_display_fwpkg_version(struct MPT3SAS_ADAPTER *ioc) · 12 unmodified lines | ||
| 3846 | 3804 | /* Wait for 15 seconds */ |
| 3847 | 3805 | wait_for_completion_timeout(&ioc->base_cmds.done, |
| 3848 | 3806 | FW_IMG_HDR_READ_TIMEOUT*HZ); |
| 3849 | − pr_info(MPT3SAS_FMT "%s: complete\n", | |
| 3850 | − ioc->name, __func__); | |
| 3807 | + ioc_info(ioc, "%s: complete\n", __func__); | |
| 3851 | 3808 | if (!(ioc->base_cmds.status & MPT3_CMD_COMPLETE)) { |
| 3852 | − pr_err(MPT3SAS_FMT "%s: timeout\n", | |
| 3853 | − ioc->name, __func__); | |
| 3809 | + ioc_err(ioc, "%s: timeout\n", __func__); | |
| 3854 | 3810 | _debug_dump_mf(mpi_request, |
| 3855 | 3811 | sizeof(Mpi25FWUploadRequest_t)/4); |
| 3856 | 3812 | r = -ETIME; |
| @@ -3864,13 +3820,11 @@ _base_display_fwpkg_version(struct MPT3SAS_ADAPTER *ioc) · 7 unmodified lines | ||
| 3864 | 3820 | if (ioc_status == MPI2_IOCSTATUS_SUCCESS) { |
| 3865 | 3821 | FWImgHdr = (Mpi2FWImageHeader_t *)fwpkg_data; |
| 3866 | 3822 | if (FWImgHdr->PackageVersion.Word) { |
| 3867 | − pr_info(MPT3SAS_FMT "FW Package Version" | |
| 3868 | − "(%02d.%02d.%02d.%02d)\n", | |
| 3869 | − ioc->name, | |
| 3870 | − FWImgHdr->PackageVersion.Struct.Major, | |
| 3871 | − FWImgHdr->PackageVersion.Struct.Minor, | |
| 3872 | − FWImgHdr->PackageVersion.Struct.Unit, | |
| 3873 | − FWImgHdr->PackageVersion.Struct.Dev); | |
| 3823 | + ioc_info(ioc, "FW Package Version (%02d.%02d.%02d.%02d)\n", | |
| 3824 | + FWImgHdr->PackageVersion.Struct.Major, | |
| 3825 | + FWImgHdr->PackageVersion.Struct.Minor, | |
| 3826 | + FWImgHdr->PackageVersion.Struct.Unit, | |
| 3827 | + FWImgHdr->PackageVersion.Struct.Dev); | |
| 3874 | 3828 | } |
| 3875 | 3829 | } else { |
| 3876 | 3830 | _debug_dump_mf(&mpi_reply, |
| @@ -3881,7 +3835,7 @@ _base_display_fwpkg_version(struct MPT3SAS_ADAPTER *ioc) · 4 unmodified lines | ||
| 3881 | 3835 | ioc->base_cmds.status = MPT3_CMD_NOT_USED; |
| 3882 | 3836 | out: |
| 3883 | 3837 | if (fwpkg_data) |
| 3884 | − pci_free_consistent(ioc->pdev, data_length, fwpkg_data, | |
| 3838 | + dma_free_coherent(&ioc->pdev->dev, data_length, fwpkg_data, | |
| 3885 | 3839 | fwpkg_data_dma); |
| 3886 | 3840 | return r; |
| 3887 | 3841 | } |
| @@ -3900,18 +3854,17 @@ _base_display_ioc_capabilities(struct MPT3SAS_ADAPTER *ioc) · 12 unmodified lines | ||
| 3900 | 3854 | |
| 3901 | 3855 | bios_version = le32_to_cpu(ioc->bios_pg3.BiosVersion); |
| 3902 | 3856 | strncpy(desc, ioc->manu_pg0.ChipName, 16); |
| 3903 | − pr_info(MPT3SAS_FMT "%s: FWVersion(%02d.%02d.%02d.%02d), "\ | |
| 3904 | − "ChipRevision(0x%02x), BiosVersion(%02d.%02d.%02d.%02d)\n", | |
| 3905 | − ioc->name, desc, | |
| 3906 | − (ioc->facts.FWVersion.Word & 0xFF000000) >> 24, | |
| 3907 | − (ioc->facts.FWVersion.Word & 0x00FF0000) >> 16, | |
| 3908 | − (ioc->facts.FWVersion.Word & 0x0000FF00) >> 8, | |
| 3909 | − ioc->facts.FWVersion.Word & 0x000000FF, | |
| 3910 | − ioc->pdev->revision, | |
| 3911 | − (bios_version & 0xFF000000) >> 24, | |
| 3912 | − (bios_version & 0x00FF0000) >> 16, | |
| 3913 | − (bios_version & 0x0000FF00) >> 8, | |
| 3914 | − bios_version & 0x000000FF); | |
| 3857 | + ioc_info(ioc, "%s: FWVersion(%02d.%02d.%02d.%02d), ChipRevision(0x%02x), BiosVersion(%02d.%02d.%02d.%02d)\n", | |
| 3858 | + desc, | |
| 3859 | + (ioc->facts.FWVersion.Word & 0xFF000000) >> 24, | |
| 3860 | + (ioc->facts.FWVersion.Word & 0x00FF0000) >> 16, | |
| 3861 | + (ioc->facts.FWVersion.Word & 0x0000FF00) >> 8, | |
| 3862 | + ioc->facts.FWVersion.Word & 0x000000FF, | |
| 3863 | + ioc->pdev->revision, | |
| 3864 | + (bios_version & 0xFF000000) >> 24, | |
| 3865 | + (bios_version & 0x00FF0000) >> 16, | |
| 3866 | + (bios_version & 0x0000FF00) >> 8, | |
| 3867 | + bios_version & 0x000000FF); | |
| 3915 | 3868 | |
| 3916 | 3869 | _base_display_OEMs_branding(ioc); |
| 3917 | 3870 | |
| @@ -3920,82 +3873,81 @@ _base_display_ioc_capabilities(struct MPT3SAS_ADAPTER *ioc) · 2 unmodified lines | ||
| 3920 | 3873 | i++; |
| 3921 | 3874 | } |
| 3922 | 3875 | |
| 3923 | − pr_info(MPT3SAS_FMT "Protocol=(", ioc->name); | |
| 3876 | + ioc_info(ioc, "Protocol=("); | |
| 3924 | 3877 | |
| 3925 | 3878 | if (ioc->facts.ProtocolFlags & MPI2_IOCFACTS_PROTOCOL_SCSI_INITIATOR) { |
| 3926 | − pr_info("Initiator"); | |
| 3879 | + pr_cont("Initiator"); | |
| 3927 | 3880 | i++; |
| 3928 | 3881 | } |
| 3929 | 3882 | |
| 3930 | 3883 | if (ioc->facts.ProtocolFlags & MPI2_IOCFACTS_PROTOCOL_SCSI_TARGET) { |
| 3931 | − pr_info("%sTarget", i ? "," : ""); | |
| 3884 | + pr_cont("%sTarget", i ? "," : ""); | |
| 3932 | 3885 | i++; |
| 3933 | 3886 | } |
| 3934 | 3887 | |
| 3935 | 3888 | i = 0; |
| 3936 | − pr_info("), "); | |
| 3937 | − pr_info("Capabilities=("); | |
| 3889 | + pr_cont("), Capabilities=("); | |
| 3938 | 3890 | |
| 3939 | 3891 | if (!ioc->hide_ir_msg) { |
| 3940 | 3892 | if (ioc->facts.IOCCapabilities & |
| 3941 | 3893 | MPI2_IOCFACTS_CAPABILITY_INTEGRATED_RAID) { |
| 3942 | − pr_info("Raid"); | |
| 3894 | + pr_cont("Raid"); | |
| 3943 | 3895 | i++; |
| 3944 | 3896 | } |
| 3945 | 3897 | } |
| 3946 | 3898 | |
| 3947 | 3899 | if (ioc->facts.IOCCapabilities & MPI2_IOCFACTS_CAPABILITY_TLR) { |
| 3948 | − pr_info("%sTLR", i ? "," : ""); | |
| 3900 | + pr_cont("%sTLR", i ? "," : ""); | |
| 3949 | 3901 | i++; |
| 3950 | 3902 | } |
| 3951 | 3903 | |
| 3952 | 3904 | if (ioc->facts.IOCCapabilities & MPI2_IOCFACTS_CAPABILITY_MULTICAST) { |
| 3953 | − pr_info("%sMulticast", i ? "," : ""); | |
| 3905 | + pr_cont("%sMulticast", i ? "," : ""); | |
| 3954 | 3906 | i++; |
| 3955 | 3907 | } |
| 3956 | 3908 | |
| 3957 | 3909 | if (ioc->facts.IOCCapabilities & |
| 3958 | 3910 | MPI2_IOCFACTS_CAPABILITY_BIDIRECTIONAL_TARGET) { |
| 3959 | − pr_info("%sBIDI Target", i ? "," : ""); | |
| 3911 | + pr_cont("%sBIDI Target", i ? "," : ""); | |
| 3960 | 3912 | i++; |
| 3961 | 3913 | } |
| 3962 | 3914 | |
| 3963 | 3915 | if (ioc->facts.IOCCapabilities & MPI2_IOCFACTS_CAPABILITY_EEDP) { |
| 3964 | − pr_info("%sEEDP", i ? "," : ""); | |
| 3916 | + pr_cont("%sEEDP", i ? "," : ""); | |
| 3965 | 3917 | i++; |
| 3966 | 3918 | } |
| 3967 | 3919 | |
| 3968 | 3920 | if (ioc->facts.IOCCapabilities & |
| 3969 | 3921 | MPI2_IOCFACTS_CAPABILITY_SNAPSHOT_BUFFER) { |
| 3970 | − pr_info("%sSnapshot Buffer", i ? "," : ""); | |
| 3922 | + pr_cont("%sSnapshot Buffer", i ? "," : ""); | |
| 3971 | 3923 | i++; |
| 3972 | 3924 | } |
| 3973 | 3925 | |
| 3974 | 3926 | if (ioc->facts.IOCCapabilities & |
| 3975 | 3927 | MPI2_IOCFACTS_CAPABILITY_DIAG_TRACE_BUFFER) { |
| 3976 | − pr_info("%sDiag Trace Buffer", i ? "," : ""); | |
| 3928 | + pr_cont("%sDiag Trace Buffer", i ? "," : ""); | |
| 3977 | 3929 | i++; |
| 3978 | 3930 | } |
| 3979 | 3931 | |
| 3980 | 3932 | if (ioc->facts.IOCCapabilities & |
| 3981 | 3933 | MPI2_IOCFACTS_CAPABILITY_EXTENDED_BUFFER) { |
| 3982 | − pr_info("%sDiag Extended Buffer", i ? "," : ""); | |
| 3934 | + pr_cont("%sDiag Extended Buffer", i ? "," : ""); | |
| 3983 | 3935 | i++; |
| 3984 | 3936 | } |
| 3985 | 3937 | |
| 3986 | 3938 | if (ioc->facts.IOCCapabilities & |
| 3987 | 3939 | MPI2_IOCFACTS_CAPABILITY_TASK_SET_FULL_HANDLING) { |
| 3988 | − pr_info("%sTask Set Full", i ? "," : ""); | |
| 3940 | + pr_cont("%sTask Set Full", i ? "," : ""); | |
| 3989 | 3941 | i++; |
| 3990 | 3942 | } |
| 3991 | 3943 | |
| 3992 | 3944 | iounit_pg1_flags = le32_to_cpu(ioc->iounit_pg1.Flags); |
| 3993 | 3945 | if (!(iounit_pg1_flags & MPI2_IOUNITPAGE1_NATIVE_COMMAND_Q_DISABLE)) { |
| 3994 | − pr_info("%sNCQ", i ? "," : ""); | |
| 3946 | + pr_cont("%sNCQ", i ? "," : ""); | |
| 3995 | 3947 | i++; |
| 3996 | 3948 | } |
| 3997 | 3949 | |
| 3998 | − pr_info(")\n"); | |
| 3950 | + pr_cont(")\n"); | |
| 3999 | 3951 | } |
| 4000 | 3952 | |
| 4001 | 3953 | /** |
| @@ -4028,21 +3980,21 @@ mpt3sas_base_update_missing_delay(struct MPT3SAS_ADAPTER *ioc, · 26 unmodified lines | ||
| 4028 | 3980 | sizeof(Mpi2SasIOUnit1PhyData_t)); |
| 4029 | 3981 | sas_iounit_pg1 = kzalloc(sz, GFP_KERNEL); |
| 4030 | 3982 | if (!sas_iounit_pg1) { |
| 4031 | − pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", | |
| 4032 | − ioc->name, __FILE__, __LINE__, __func__); | |
| 3983 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", | |
| 3984 | + __FILE__, __LINE__, __func__); | |
| 4033 | 3985 | goto out; |
| 4034 | 3986 | } |
| 4035 | 3987 | if ((mpt3sas_config_get_sas_iounit_pg1(ioc, &mpi_reply, |
| 4036 | 3988 | sas_iounit_pg1, sz))) { |
| 4037 | − pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", | |
| 4038 | − ioc->name, __FILE__, __LINE__, __func__); | |
| 3989 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", | |
| 3990 | + __FILE__, __LINE__, __func__); | |
| 4039 | 3991 | goto out; |
| 4040 | 3992 | } |
| 4041 | 3993 | ioc_status = le16_to_cpu(mpi_reply.IOCStatus) & |
| 4042 | 3994 | MPI2_IOCSTATUS_MASK; |
| 4043 | 3995 | if (ioc_status != MPI2_IOCSTATUS_SUCCESS) { |
| 4044 | − pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", | |
| 4045 | − ioc->name, __FILE__, __LINE__, __func__); | |
| 3996 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", | |
| 3997 | + __FILE__, __LINE__, __func__); | |
| 4046 | 3998 | goto out; |
| 4047 | 3999 | } |
| 4048 | 4000 | |
| @@ -4074,11 +4026,11 @@ mpt3sas_base_update_missing_delay(struct MPT3SAS_ADAPTER *ioc, · 25 unmodified lines | ||
| 4074 | 4026 | else |
| 4075 | 4027 | dmd_new = |
| 4076 | 4028 | dmd & MPI2_SASIOUNIT1_REPORT_MISSING_TIMEOUT_MASK; |
| 4077 | − pr_info(MPT3SAS_FMT "device_missing_delay: old(%d), new(%d)\n", | |
| 4078 | − ioc->name, dmd_orignal, dmd_new); | |
| 4079 | − pr_info(MPT3SAS_FMT "ioc_missing_delay: old(%d), new(%d)\n", | |
| 4080 | − ioc->name, io_missing_delay_original, | |
| 4081 | − io_missing_delay); | |
| 4029 | + ioc_info(ioc, "device_missing_delay: old(%d), new(%d)\n", | |
| 4030 | + dmd_orignal, dmd_new); | |
| 4031 | + ioc_info(ioc, "ioc_missing_delay: old(%d), new(%d)\n", | |
| 4032 | + io_missing_delay_original, | |
| 4033 | + io_missing_delay); | |
| 4082 | 4034 | ioc->device_missing_delay = dmd_new; |
| 4083 | 4035 | ioc->io_missing_delay = io_missing_delay; |
| 4084 | 4036 | } |
| @@ -4189,33 +4141,32 @@ _base_release_memory_pools(struct MPT3SAS_ADAPTER *ioc) · 104 unmodified lines | ||
| 4189 | 4141 | struct chain_tracker *ct; |
| 4190 | 4142 | struct reply_post_struct *rps; |
| 4191 | 4143 | |
| 4192 | − dexitprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name, | |
| 4193 | − __func__)); | |
| 4144 | + dexitprintk(ioc, ioc_info(ioc, "%s\n", __func__)); | |
| 4194 | 4145 | |
| 4195 | 4146 | if (ioc->request) { |
| 4196 | − pci_free_consistent(ioc->pdev, ioc->request_dma_sz, | |
| 4147 | + dma_free_coherent(&ioc->pdev->dev, ioc->request_dma_sz, | |
| 4197 | 4148 | ioc->request, ioc->request_dma); |
| 4198 | − dexitprintk(ioc, pr_info(MPT3SAS_FMT | |
| 4199 | − "request_pool(0x%p): free\n", | |
| 4200 | − ioc->name, ioc->request)); | |
| 4149 | + dexitprintk(ioc, | |
| 4150 | + ioc_info(ioc, "request_pool(0x%p): free\n", | |
| 4151 | + ioc->request)); | |
| 4201 | 4152 | ioc->request = NULL; |
| 4202 | 4153 | } |
| 4203 | 4154 | |
| 4204 | 4155 | if (ioc->sense) { |
| 4205 | 4156 | dma_pool_free(ioc->sense_dma_pool, ioc->sense, ioc->sense_dma); |
| 4206 | 4157 | dma_pool_destroy(ioc->sense_dma_pool); |
| 4207 | − dexitprintk(ioc, pr_info(MPT3SAS_FMT | |
| 4208 | − "sense_pool(0x%p): free\n", | |
| 4209 | − ioc->name, ioc->sense)); | |
| 4158 | + dexitprintk(ioc, | |
| 4159 | + ioc_info(ioc, "sense_pool(0x%p): free\n", | |
| 4160 | + ioc->sense)); | |
| 4210 | 4161 | ioc->sense = NULL; |
| 4211 | 4162 | } |
| 4212 | 4163 | |
| 4213 | 4164 | if (ioc->reply) { |
| 4214 | 4165 | dma_pool_free(ioc->reply_dma_pool, ioc->reply, ioc->reply_dma); |
| 4215 | 4166 | dma_pool_destroy(ioc->reply_dma_pool); |
| 4216 | − dexitprintk(ioc, pr_info(MPT3SAS_FMT | |
| 4217 | − "reply_pool(0x%p): free\n", | |
| 4218 | − ioc->name, ioc->reply)); | |
| 4167 | + dexitprintk(ioc, | |
| 4168 | + ioc_info(ioc, "reply_pool(0x%p): free\n", | |
| 4169 | + ioc->reply)); | |
| 4219 | 4170 | ioc->reply = NULL; |
| 4220 | 4171 | } |
| 4221 | 4172 | |
| @@ -4223,9 +4174,9 @@ _base_release_memory_pools(struct MPT3SAS_ADAPTER *ioc) · 1 unmodified line | ||
| 4223 | 4174 | dma_pool_free(ioc->reply_free_dma_pool, ioc->reply_free, |
| 4224 | 4175 | ioc->reply_free_dma); |
| 4225 | 4176 | dma_pool_destroy(ioc->reply_free_dma_pool); |
| 4226 | − dexitprintk(ioc, pr_info(MPT3SAS_FMT | |
| 4227 | − "reply_free_pool(0x%p): free\n", | |
| 4228 | − ioc->name, ioc->reply_free)); | |
| 4177 | + dexitprintk(ioc, | |
| 4178 | + ioc_info(ioc, "reply_free_pool(0x%p): free\n", | |
| 4179 | + ioc->reply_free)); | |
| 4229 | 4180 | ioc->reply_free = NULL; |
| 4230 | 4181 | } |
| 4231 | 4182 | |
| @@ -4237,9 +4188,9 @@ _base_release_memory_pools(struct MPT3SAS_ADAPTER *ioc) · 5 unmodified lines | ||
| 4237 | 4188 | ioc->reply_post_free_dma_pool, |
| 4238 | 4189 | rps->reply_post_free, |
| 4239 | 4190 | rps->reply_post_free_dma); |
| 4240 | − dexitprintk(ioc, pr_info(MPT3SAS_FMT | |
| 4241 | − "reply_post_free_pool(0x%p): free\n", | |
| 4242 | − ioc->name, rps->reply_post_free)); | |
| 4191 | + dexitprintk(ioc, | |
| 4192 | + ioc_info(ioc, "reply_post_free_pool(0x%p): free\n", | |
| 4193 | + rps->reply_post_free)); | |
| 4243 | 4194 | rps->reply_post_free = NULL; |
| 4244 | 4195 | } |
| 4245 | 4196 | } while (ioc->rdpq_array_enable && |
| @@ -4267,10 +4218,10 @@ _base_release_memory_pools(struct MPT3SAS_ADAPTER *ioc) · 21 unmodified lines | ||
| 4267 | 4218 | } |
| 4268 | 4219 | |
| 4269 | 4220 | if (ioc->config_page) { |
| 4270 | − dexitprintk(ioc, pr_info(MPT3SAS_FMT | |
| 4271 | − "config_page(0x%p): free\n", ioc->name, | |
| 4272 | − ioc->config_page)); | |
| 4273 | − pci_free_consistent(ioc->pdev, ioc->config_page_sz, | |
| 4221 | + dexitprintk(ioc, | |
| 4222 | + ioc_info(ioc, "config_page(0x%p): free\n", | |
| 4223 | + ioc->config_page)); | |
| 4224 | + dma_free_coherent(&ioc->pdev->dev, ioc->config_page_sz, | |
| 4274 | 4225 | ioc->config_page, ioc->config_page_dma); |
| 4275 | 4226 | } |
| 4276 | 4227 | |
| @@ -4338,8 +4289,7 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) · 61 unmodified lines | ||
| 4338 | 4289 | int i, j; |
| 4339 | 4290 | struct chain_tracker *ct; |
| 4340 | 4291 | |
| 4341 | − dinitprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name, | |
| 4342 | − __func__)); | |
| 4292 | + dinitprintk(ioc, ioc_info(ioc, "%s\n", __func__)); | |
| 4343 | 4293 | |
| 4344 | 4294 | |
| 4345 | 4295 | retry_sz = 0; |
| @@ -4368,10 +4318,8 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) · 22 unmodified lines | ||
| 4368 | 4318 | else if (sg_tablesize > MPT_MAX_PHYS_SEGMENTS) { |
| 4369 | 4319 | sg_tablesize = min_t(unsigned short, sg_tablesize, |
| 4370 | 4320 | SG_MAX_SEGMENTS); |
| 4371 | − pr_warn(MPT3SAS_FMT | |
| 4372 | − "sg_tablesize(%u) is bigger than kernel " | |
| 4373 | − "defined SG_CHUNK_SIZE(%u)\n", ioc->name, | |
| 4374 | − sg_tablesize, MPT_MAX_PHYS_SEGMENTS); | |
| 4321 | + ioc_warn(ioc, "sg_tablesize(%u) is bigger than kernel defined SG_CHUNK_SIZE(%u)\n", | |
| 4322 | + sg_tablesize, MPT_MAX_PHYS_SEGMENTS); | |
| 4375 | 4323 | } |
| 4376 | 4324 | ioc->shost->sg_tablesize = sg_tablesize; |
| 4377 | 4325 | } |
| @@ -4381,9 +4329,8 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) · 3 unmodified lines | ||
| 4381 | 4329 | if (ioc->internal_depth < INTERNAL_CMDS_COUNT) { |
| 4382 | 4330 | if (facts->RequestCredit <= (INTERNAL_CMDS_COUNT + |
| 4383 | 4331 | INTERNAL_SCSIIO_CMDS_COUNT)) { |
| 4384 | − pr_err(MPT3SAS_FMT "IOC doesn't have enough Request \ | |
| 4385 | − Credits, it has just %d number of credits\n", | |
| 4386 | − ioc->name, facts->RequestCredit); | |
| 4332 | + ioc_err(ioc, "IOC doesn't have enough Request Credits, it has just %d number of credits\n", | |
| 4333 | + facts->RequestCredit); | |
| 4387 | 4334 | return -ENOMEM; |
| 4388 | 4335 | } |
| 4389 | 4336 | ioc->internal_depth = 10; |
| @@ -4482,11 +4429,12 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) · 92 unmodified lines | ||
| 4482 | 4429 | ioc->reply_free_queue_depth = ioc->hba_queue_depth + 64; |
| 4483 | 4430 | } |
| 4484 | 4431 | |
| 4485 | − dinitprintk(ioc, pr_info(MPT3SAS_FMT "scatter gather: " \ | |
| 4486 | − "sge_in_main_msg(%d), sge_per_chain(%d), sge_per_io(%d), " | |
| 4487 | − "chains_per_io(%d)\n", ioc->name, ioc->max_sges_in_main_message, | |
| 4488 | − ioc->max_sges_in_chain_message, ioc->shost->sg_tablesize, | |
| 4489 | − ioc->chains_needed_per_io)); | |
| 4432 | + dinitprintk(ioc, | |
| 4433 | + ioc_info(ioc, "scatter gather: sge_in_main_msg(%d), sge_per_chain(%d), sge_per_io(%d), chains_per_io(%d)\n", | |
| 4434 | + ioc->max_sges_in_main_message, | |
| 4435 | + ioc->max_sges_in_chain_message, | |
| 4436 | + ioc->shost->sg_tablesize, | |
| 4437 | + ioc->chains_needed_per_io)); | |
| 4490 | 4438 | |
| 4491 | 4439 | /* reply post queue, 16 byte align */ |
| 4492 | 4440 | reply_post_free_sz = ioc->reply_post_queue_depth * |
| @@ -4501,48 +4449,40 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) · 8 unmodified lines | ||
| 4501 | 4449 | sizeof(struct reply_post_struct), GFP_KERNEL); |
| 4502 | 4450 | |
| 4503 | 4451 | if (!ioc->reply_post) { |
| 4504 | − pr_err(MPT3SAS_FMT "reply_post_free pool: kcalloc failed\n", | |
| 4505 | − ioc->name); | |
| 4452 | + ioc_err(ioc, "reply_post_free pool: kcalloc failed\n"); | |
| 4506 | 4453 | goto out; |
| 4507 | 4454 | } |
| 4508 | 4455 | ioc->reply_post_free_dma_pool = dma_pool_create("reply_post_free pool", |
| 4509 | 4456 | &ioc->pdev->dev, sz, 16, 0); |
| 4510 | 4457 | if (!ioc->reply_post_free_dma_pool) { |
| 4511 | − pr_err(MPT3SAS_FMT | |
| 4512 | − "reply_post_free pool: dma_pool_create failed\n", | |
| 4513 | − ioc->name); | |
| 4458 | + ioc_err(ioc, "reply_post_free pool: dma_pool_create failed\n"); | |
| 4514 | 4459 | goto out; |
| 4515 | 4460 | } |
| 4516 | 4461 | i = 0; |
| 4517 | 4462 | do { |
| 4518 | 4463 | ioc->reply_post[i].reply_post_free = |
| 4519 | − dma_pool_alloc(ioc->reply_post_free_dma_pool, | |
| 4464 | + dma_pool_zalloc(ioc->reply_post_free_dma_pool, | |
| 4520 | 4465 | GFP_KERNEL, |
| 4521 | 4466 | &ioc->reply_post[i].reply_post_free_dma); |
| 4522 | 4467 | if (!ioc->reply_post[i].reply_post_free) { |
| 4523 | − pr_err(MPT3SAS_FMT | |
| 4524 | − "reply_post_free pool: dma_pool_alloc failed\n", | |
| 4525 | − ioc->name); | |
| 4468 | + ioc_err(ioc, "reply_post_free pool: dma_pool_alloc failed\n"); | |
| 4526 | 4469 | goto out; |
| 4527 | 4470 | } |
| 4528 | − memset(ioc->reply_post[i].reply_post_free, 0, sz); | |
| 4529 | − dinitprintk(ioc, pr_info(MPT3SAS_FMT | |
| 4530 | − "reply post free pool (0x%p): depth(%d)," | |
| 4531 | − "element_size(%d), pool_size(%d kB)\n", ioc->name, | |
| 4532 | − ioc->reply_post[i].reply_post_free, | |
| 4533 | − ioc->reply_post_queue_depth, 8, sz/1024)); | |
| 4534 | − dinitprintk(ioc, pr_info(MPT3SAS_FMT | |
| 4535 | − "reply_post_free_dma = (0x%llx)\n", ioc->name, | |
| 4536 | − (unsigned long long) | |
| 4537 | − ioc->reply_post[i].reply_post_free_dma)); | |
| 4471 | + dinitprintk(ioc, | |
| 4472 | + ioc_info(ioc, "reply post free pool (0x%p): depth(%d), element_size(%d), pool_size(%d kB)\n", | |
| 4473 | + ioc->reply_post[i].reply_post_free, | |
| 4474 | + ioc->reply_post_queue_depth, | |
| 4475 | + 8, sz / 1024)); | |
| 4476 | + dinitprintk(ioc, | |
| 4477 | + ioc_info(ioc, "reply_post_free_dma = (0x%llx)\n", | |
| 4478 | + (u64)ioc->reply_post[i].reply_post_free_dma)); | |
| 4538 | 4479 | total_sz += sz; |
| 4539 | 4480 | } while (ioc->rdpq_array_enable && (++i < ioc->reply_queue_count)); |
| 4540 | 4481 | |
| 4541 | 4482 | if (ioc->dma_mask == 64) { |
| 4542 | 4483 | if (_base_change_consistent_dma_mask(ioc, ioc->pdev) != 0) { |
| 4543 | − pr_warn(MPT3SAS_FMT | |
| 4544 | − "no suitable consistent DMA mask for %s\n", | |
| 4545 | − ioc->name, pci_name(ioc->pdev)); | |
| 4484 | + ioc_warn(ioc, "no suitable consistent DMA mask for %s\n", | |
| 4485 | + pci_name(ioc->pdev)); | |
| 4546 | 4486 | goto out; |
| 4547 | 4487 | } |
| 4548 | 4488 | } |
| @@ -4554,9 +4494,9 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) · 5 unmodified lines | ||
| 4554 | 4494 | * with some internal commands that could be outstanding |
| 4555 | 4495 | */ |
| 4556 | 4496 | ioc->shost->can_queue = ioc->scsiio_depth - INTERNAL_SCSIIO_CMDS_COUNT; |
| 4557 | − dinitprintk(ioc, pr_info(MPT3SAS_FMT | |
| 4558 | − "scsi host: can_queue depth (%d)\n", | |
| 4559 | − ioc->name, ioc->shost->can_queue)); | |
| 4497 | + dinitprintk(ioc, | |
| 4498 | + ioc_info(ioc, "scsi host: can_queue depth (%d)\n", | |
| 4499 | + ioc->shost->can_queue)); | |
| 4560 | 4500 | |
| 4561 | 4501 | |
| 4562 | 4502 | /* contiguous pool for request and chains, 16 byte align, one extra " |
| @@ -4572,12 +4512,12 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) · 9 unmodified lines | ||
| 4572 | 4512 | sz += (ioc->internal_depth * ioc->request_sz); |
| 4573 | 4513 | |
| 4574 | 4514 | ioc->request_dma_sz = sz; |
| 4575 | − ioc->request = pci_alloc_consistent(ioc->pdev, sz, &ioc->request_dma); | |
| 4515 | + ioc->request = dma_alloc_coherent(&ioc->pdev->dev, sz, | |
| 4516 | + &ioc->request_dma, GFP_KERNEL); | |
| 4576 | 4517 | if (!ioc->request) { |
| 4577 | − pr_err(MPT3SAS_FMT "request pool: pci_alloc_consistent " \ | |
| 4578 | − "failed: hba_depth(%d), chains_per_io(%d), frame_sz(%d), " | |
| 4579 | − "total(%d kB)\n", ioc->name, ioc->hba_queue_depth, | |
| 4580 | − ioc->chains_needed_per_io, ioc->request_sz, sz/1024); | |
| 4518 | + ioc_err(ioc, "request pool: dma_alloc_coherent failed: hba_depth(%d), chains_per_io(%d), frame_sz(%d), total(%d kB)\n", | |
| 4519 | + ioc->hba_queue_depth, ioc->chains_needed_per_io, | |
| 4520 | + ioc->request_sz, sz / 1024); | |
| 4581 | 4521 | if (ioc->scsiio_depth < MPT3SAS_SAS_QUEUE_DEPTH) |
| 4582 | 4522 | goto out; |
| 4583 | 4523 | retry_sz = 64; |
| @@ -4587,10 +4527,9 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) · 3 unmodified lines | ||
| 4587 | 4527 | } |
| 4588 | 4528 | |
| 4589 | 4529 | if (retry_sz) |
| 4590 | − pr_err(MPT3SAS_FMT "request pool: pci_alloc_consistent " \ | |
| 4591 | − "succeed: hba_depth(%d), chains_per_io(%d), frame_sz(%d), " | |
| 4592 | − "total(%d kb)\n", ioc->name, ioc->hba_queue_depth, | |
| 4593 | − ioc->chains_needed_per_io, ioc->request_sz, sz/1024); | |
| 4530 | + ioc_err(ioc, "request pool: dma_alloc_coherent succeed: hba_depth(%d), chains_per_io(%d), frame_sz(%d), total(%d kb)\n", | |
| 4531 | + ioc->hba_queue_depth, ioc->chains_needed_per_io, | |
| 4532 | + ioc->request_sz, sz / 1024); | |
| 4594 | 4533 | |
| 4595 | 4534 | /* hi-priority queue */ |
| 4596 | 4535 | ioc->hi_priority = ioc->request + ((ioc->scsiio_depth + 1) * |
| @@ -4604,24 +4543,26 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) · 7 unmodified lines | ||
| 4604 | 4543 | ioc->internal_dma = ioc->hi_priority_dma + (ioc->hi_priority_depth * |
| 4605 | 4544 | ioc->request_sz); |
| 4606 | 4545 | |
| 4607 | − dinitprintk(ioc, pr_info(MPT3SAS_FMT | |
| 4608 | − "request pool(0x%p): depth(%d), frame_size(%d), pool_size(%d kB)\n", | |
| 4609 | − ioc->name, ioc->request, ioc->hba_queue_depth, ioc->request_sz, | |
| 4610 | − (ioc->hba_queue_depth * ioc->request_sz)/1024)); | |
| 4546 | + dinitprintk(ioc, | |
| 4547 | + ioc_info(ioc, "request pool(0x%p): depth(%d), frame_size(%d), pool_size(%d kB)\n", | |
| 4548 | + ioc->request, ioc->hba_queue_depth, | |
| 4549 | + ioc->request_sz, | |
| 4550 | + (ioc->hba_queue_depth * ioc->request_sz) / 1024)); | |
| 4611 | 4551 | |
| 4612 | − dinitprintk(ioc, pr_info(MPT3SAS_FMT "request pool: dma(0x%llx)\n", | |
| 4613 | − ioc->name, (unsigned long long) ioc->request_dma)); | |
| 4552 | + dinitprintk(ioc, | |
| 4553 | + ioc_info(ioc, "request pool: dma(0x%llx)\n", | |
| 4554 | + (unsigned long long)ioc->request_dma)); | |
| 4614 | 4555 | total_sz += sz; |
| 4615 | 4556 | |
| 4616 | − dinitprintk(ioc, pr_info(MPT3SAS_FMT "scsiio(0x%p): depth(%d)\n", | |
| 4617 | − ioc->name, ioc->request, ioc->scsiio_depth)); | |
| 4557 | + dinitprintk(ioc, | |
| 4558 | + ioc_info(ioc, "scsiio(0x%p): depth(%d)\n", | |
| 4559 | + ioc->request, ioc->scsiio_depth)); | |
| 4618 | 4560 | |
| 4619 | 4561 | ioc->chain_depth = min_t(u32, ioc->chain_depth, MAX_CHAIN_DEPTH); |
| 4620 | 4562 | sz = ioc->scsiio_depth * sizeof(struct chain_lookup); |
| 4621 | 4563 | ioc->chain_lookup = kzalloc(sz, GFP_KERNEL); |
| 4622 | 4564 | if (!ioc->chain_lookup) { |
| 4623 | − pr_err(MPT3SAS_FMT "chain_lookup: __get_free_pages " | |
| 4624 | − "failed\n", ioc->name); | |
| 4565 | + ioc_err(ioc, "chain_lookup: __get_free_pages failed\n"); | |
| 4625 | 4566 | goto out; |
| 4626 | 4567 | } |
| 4627 | 4568 | |
| @@ -4629,8 +4570,7 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) · 1 unmodified line | ||
| 4629 | 4570 | for (i = 0; i < ioc->scsiio_depth; i++) { |
| 4630 | 4571 | ioc->chain_lookup[i].chains_per_smid = kzalloc(sz, GFP_KERNEL); |
| 4631 | 4572 | if (!ioc->chain_lookup[i].chains_per_smid) { |
| 4632 | − pr_err(MPT3SAS_FMT "chain_lookup: " | |
| 4633 | − " kzalloc failed\n", ioc->name); | |
| 4573 | + ioc_err(ioc, "chain_lookup: kzalloc failed\n"); | |
| 4634 | 4574 | goto out; |
| 4635 | 4575 | } |
| 4636 | 4576 | } |
| @@ -4639,29 +4579,27 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) · 2 unmodified lines | ||
| 4639 | 4579 | ioc->hpr_lookup = kcalloc(ioc->hi_priority_depth, |
| 4640 | 4580 | sizeof(struct request_tracker), GFP_KERNEL); |
| 4641 | 4581 | if (!ioc->hpr_lookup) { |
| 4642 | − pr_err(MPT3SAS_FMT "hpr_lookup: kcalloc failed\n", | |
| 4643 | − ioc->name); | |
| 4582 | + ioc_err(ioc, "hpr_lookup: kcalloc failed\n"); | |
| 4644 | 4583 | goto out; |
| 4645 | 4584 | } |
| 4646 | 4585 | ioc->hi_priority_smid = ioc->scsiio_depth + 1; |
| 4647 | − dinitprintk(ioc, pr_info(MPT3SAS_FMT | |
| 4648 | − "hi_priority(0x%p): depth(%d), start smid(%d)\n", | |
| 4649 | − ioc->name, ioc->hi_priority, | |
| 4650 | − ioc->hi_priority_depth, ioc->hi_priority_smid)); | |
| 4586 | + dinitprintk(ioc, | |
| 4587 | + ioc_info(ioc, "hi_priority(0x%p): depth(%d), start smid(%d)\n", | |
| 4588 | + ioc->hi_priority, | |
| 4589 | + ioc->hi_priority_depth, ioc->hi_priority_smid)); | |
| 4651 | 4590 | |
| 4652 | 4591 | /* initialize internal queue smid's */ |
| 4653 | 4592 | ioc->internal_lookup = kcalloc(ioc->internal_depth, |
| 4654 | 4593 | sizeof(struct request_tracker), GFP_KERNEL); |
| 4655 | 4594 | if (!ioc->internal_lookup) { |
| 4656 | − pr_err(MPT3SAS_FMT "internal_lookup: kcalloc failed\n", | |
| 4657 | − ioc->name); | |
| 4595 | + ioc_err(ioc, "internal_lookup: kcalloc failed\n"); | |
| 4658 | 4596 | goto out; |
| 4659 | 4597 | } |
| 4660 | 4598 | ioc->internal_smid = ioc->hi_priority_smid + ioc->hi_priority_depth; |
| 4661 | − dinitprintk(ioc, pr_info(MPT3SAS_FMT | |
| 4662 | − "internal(0x%p): depth(%d), start smid(%d)\n", | |
| 4663 | − ioc->name, ioc->internal, | |
| 4664 | − ioc->internal_depth, ioc->internal_smid)); | |
| 4599 | + dinitprintk(ioc, | |
| 4600 | + ioc_info(ioc, "internal(0x%p): depth(%d), start smid(%d)\n", | |
| 4601 | + ioc->internal, | |
| 4602 | + ioc->internal_depth, ioc->internal_smid)); | |
| 4665 | 4603 | /* |
| 4666 | 4604 | * The number of NVMe page sized blocks needed is: |
| 4667 | 4605 | * (((sg_tablesize * 8) - 1) / (page_size - 8)) + 1 |
| @@ -4685,17 +4623,14 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) · 17 unmodified lines | ||
| 4685 | 4623 | sz = sizeof(struct pcie_sg_list) * ioc->scsiio_depth; |
| 4686 | 4624 | ioc->pcie_sg_lookup = kzalloc(sz, GFP_KERNEL); |
| 4687 | 4625 | if (!ioc->pcie_sg_lookup) { |
| 4688 | − pr_info(MPT3SAS_FMT | |
| 4689 | − "PCIe SGL lookup: kzalloc failed\n", ioc->name); | |
| 4626 | + ioc_info(ioc, "PCIe SGL lookup: kzalloc failed\n"); | |
| 4690 | 4627 | goto out; |
| 4691 | 4628 | } |
| 4692 | 4629 | sz = nvme_blocks_needed * ioc->page_size; |
| 4693 | 4630 | ioc->pcie_sgl_dma_pool = |
| 4694 | 4631 | dma_pool_create("PCIe SGL pool", &ioc->pdev->dev, sz, 16, 0); |
| 4695 | 4632 | if (!ioc->pcie_sgl_dma_pool) { |
| 4696 | − pr_info(MPT3SAS_FMT | |
| 4697 | − "PCIe SGL pool: dma_pool_create failed\n", | |
| 4698 | − ioc->name); | |
| 4633 | + ioc_info(ioc, "PCIe SGL pool: dma_pool_create failed\n"); | |
| 4699 | 4634 | goto out; |
| 4700 | 4635 | } |
| 4701 | 4636 | |
| @@ -4708,9 +4643,7 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) · 6 unmodified lines | ||
| 4708 | 4643 | ioc->pcie_sgl_dma_pool, GFP_KERNEL, |
| 4709 | 4644 | &ioc->pcie_sg_lookup[i].pcie_sgl_dma); |
| 4710 | 4645 | if (!ioc->pcie_sg_lookup[i].pcie_sgl) { |
| 4711 | − pr_info(MPT3SAS_FMT | |
| 4712 | − "PCIe SGL pool: dma_pool_alloc failed\n", | |
| 4713 | − ioc->name); | |
| 4646 | + ioc_info(ioc, "PCIe SGL pool: dma_pool_alloc failed\n"); | |
| 4714 | 4647 | goto out; |
| 4715 | 4648 | } |
| 4716 | 4649 | for (j = 0; j < ioc->chains_per_prp_buffer; j++) { |
| @@ -4724,20 +4657,20 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) · 7 unmodified lines | ||
| 4724 | 4657 | } |
| 4725 | 4658 | } |
| 4726 | 4659 | |
| 4727 | − dinitprintk(ioc, pr_info(MPT3SAS_FMT "PCIe sgl pool depth(%d), " | |
| 4728 | − "element_size(%d), pool_size(%d kB)\n", ioc->name, | |
| 4729 | − ioc->scsiio_depth, sz, (sz * ioc->scsiio_depth)/1024)); | |
| 4730 | − dinitprintk(ioc, pr_info(MPT3SAS_FMT "Number of chains can " | |
| 4731 | − "fit in a PRP page(%d)\n", ioc->name, | |
| 4732 | − ioc->chains_per_prp_buffer)); | |
| 4660 | + dinitprintk(ioc, | |
| 4661 | + ioc_info(ioc, "PCIe sgl pool depth(%d), element_size(%d), pool_size(%d kB)\n", | |
| 4662 | + ioc->scsiio_depth, sz, | |
| 4663 | + (sz * ioc->scsiio_depth) / 1024)); | |
| 4664 | + dinitprintk(ioc, | |
| 4665 | + ioc_info(ioc, "Number of chains can fit in a PRP page(%d)\n", | |
| 4666 | + ioc->chains_per_prp_buffer)); | |
| 4733 | 4667 | total_sz += sz * ioc->scsiio_depth; |
| 4734 | 4668 | } |
| 4735 | 4669 | |
| 4736 | 4670 | ioc->chain_dma_pool = dma_pool_create("chain pool", &ioc->pdev->dev, |
| 4737 | 4671 | ioc->chain_segment_sz, 16, 0); |
| 4738 | 4672 | if (!ioc->chain_dma_pool) { |
| 4739 | − pr_err(MPT3SAS_FMT "chain_dma_pool: dma_pool_create failed\n", | |
| 4740 | − ioc->name); | |
| 4673 | + ioc_err(ioc, "chain_dma_pool: dma_pool_create failed\n"); | |
| 4741 | 4674 | goto out; |
| 4742 | 4675 | } |
| 4743 | 4676 | for (i = 0; i < ioc->scsiio_depth; i++) { |
| @@ -4748,8 +4681,7 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) · 4 unmodified lines | ||
| 4748 | 4681 | ioc->chain_dma_pool, GFP_KERNEL, |
| 4749 | 4682 | &ct->chain_buffer_dma); |
| 4750 | 4683 | if (!ct->chain_buffer) { |
| 4751 | − pr_err(MPT3SAS_FMT "chain_lookup: " | |
| 4752 | − " pci_pool_alloc failed\n", ioc->name); | |
| 4684 | + ioc_err(ioc, "chain_lookup: pci_pool_alloc failed\n"); | |
| 4753 | 4685 | _base_release_memory_pools(ioc); |
| 4754 | 4686 | goto out; |
| 4755 | 4687 | } |
| @@ -4757,25 +4689,23 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) · 1 unmodified line | ||
| 4757 | 4689 | total_sz += ioc->chain_segment_sz; |
| 4758 | 4690 | } |
| 4759 | 4691 | |
| 4760 | − dinitprintk(ioc, pr_info(MPT3SAS_FMT | |
| 4761 | − "chain pool depth(%d), frame_size(%d), pool_size(%d kB)\n", | |
| 4762 | − ioc->name, ioc->chain_depth, ioc->chain_segment_sz, | |
| 4763 | − ((ioc->chain_depth * ioc->chain_segment_sz))/1024)); | |
| 4692 | + dinitprintk(ioc, | |
| 4693 | + ioc_info(ioc, "chain pool depth(%d), frame_size(%d), pool_size(%d kB)\n", | |
| 4694 | + ioc->chain_depth, ioc->chain_segment_sz, | |
| 4695 | + (ioc->chain_depth * ioc->chain_segment_sz) / 1024)); | |
| 4764 | 4696 | |
| 4765 | 4697 | /* sense buffers, 4 byte align */ |
| 4766 | 4698 | sz = ioc->scsiio_depth * SCSI_SENSE_BUFFERSIZE; |
| 4767 | 4699 | ioc->sense_dma_pool = dma_pool_create("sense pool", &ioc->pdev->dev, sz, |
| 4768 | 4700 | 4, 0); |
| 4769 | 4701 | if (!ioc->sense_dma_pool) { |
| 4770 | − pr_err(MPT3SAS_FMT "sense pool: dma_pool_create failed\n", | |
| 4771 | − ioc->name); | |
| 4702 | + ioc_err(ioc, "sense pool: dma_pool_create failed\n"); | |
| 4772 | 4703 | goto out; |
| 4773 | 4704 | } |
| 4774 | 4705 | ioc->sense = dma_pool_alloc(ioc->sense_dma_pool, GFP_KERNEL, |
| 4775 | 4706 | &ioc->sense_dma); |
| 4776 | 4707 | if (!ioc->sense) { |
| 4777 | − pr_err(MPT3SAS_FMT "sense pool: dma_pool_alloc failed\n", | |
| 4778 | − ioc->name); | |
| 4708 | + ioc_err(ioc, "sense pool: dma_pool_alloc failed\n"); | |
| 4779 | 4709 | goto out; |
| 4780 | 4710 | } |
| 4781 | 4711 | /* sense buffer requires to be in same 4 gb region. |
| @@ -4797,24 +4727,23 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) · 15 unmodified lines | ||
| 4797 | 4727 | dma_pool_create("sense pool", &ioc->pdev->dev, sz, |
| 4798 | 4728 | roundup_pow_of_two(sz), 0); |
| 4799 | 4729 | if (!ioc->sense_dma_pool) { |
| 4800 | − pr_err(MPT3SAS_FMT "sense pool: pci_pool_create failed\n", | |
| 4801 | − ioc->name); | |
| 4730 | + ioc_err(ioc, "sense pool: pci_pool_create failed\n"); | |
| 4802 | 4731 | goto out; |
| 4803 | 4732 | } |
| 4804 | 4733 | ioc->sense = dma_pool_alloc(ioc->sense_dma_pool, GFP_KERNEL, |
| 4805 | 4734 | &ioc->sense_dma); |
| 4806 | 4735 | if (!ioc->sense) { |
| 4807 | − pr_err(MPT3SAS_FMT "sense pool: pci_pool_alloc failed\n", | |
| 4808 | − ioc->name); | |
| 4736 | + ioc_err(ioc, "sense pool: pci_pool_alloc failed\n"); | |
| 4809 | 4737 | goto out; |
| 4810 | 4738 | } |
| 4811 | 4739 | } |
| 4812 | − dinitprintk(ioc, pr_info(MPT3SAS_FMT | |
| 4813 | − "sense pool(0x%p): depth(%d), element_size(%d), pool_size" | |
| 4814 | − "(%d kB)\n", ioc->name, ioc->sense, ioc->scsiio_depth, | |
| 4815 | − SCSI_SENSE_BUFFERSIZE, sz/1024)); | |
| 4816 | − dinitprintk(ioc, pr_info(MPT3SAS_FMT "sense_dma(0x%llx)\n", | |
| 4817 | − ioc->name, (unsigned long long)ioc->sense_dma)); | |
| 4740 | + dinitprintk(ioc, | |
| 4741 | + ioc_info(ioc, "sense pool(0x%p): depth(%d), element_size(%d), pool_size(%d kB)\n", | |
| 4742 | + ioc->sense, ioc->scsiio_depth, | |
| 4743 | + SCSI_SENSE_BUFFERSIZE, sz / 1024)); | |
| 4744 | + dinitprintk(ioc, | |
| 4745 | + ioc_info(ioc, "sense_dma(0x%llx)\n", | |
| 4746 | + (unsigned long long)ioc->sense_dma)); | |
| 4818 | 4747 | total_sz += sz; |
| 4819 | 4748 | |
| 4820 | 4749 | /* reply pool, 4 byte align */ |
| @@ -4822,25 +4751,24 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) · 1 unmodified line | ||
| 4822 | 4751 | ioc->reply_dma_pool = dma_pool_create("reply pool", &ioc->pdev->dev, sz, |
| 4823 | 4752 | 4, 0); |
| 4824 | 4753 | if (!ioc->reply_dma_pool) { |
| 4825 | − pr_err(MPT3SAS_FMT "reply pool: dma_pool_create failed\n", | |
| 4826 | − ioc->name); | |
| 4754 | + ioc_err(ioc, "reply pool: dma_pool_create failed\n"); | |
| 4827 | 4755 | goto out; |
| 4828 | 4756 | } |
| 4829 | 4757 | ioc->reply = dma_pool_alloc(ioc->reply_dma_pool, GFP_KERNEL, |
| 4830 | 4758 | &ioc->reply_dma); |
| 4831 | 4759 | if (!ioc->reply) { |
| 4832 | − pr_err(MPT3SAS_FMT "reply pool: dma_pool_alloc failed\n", | |
| 4833 | − ioc->name); | |
| 4760 | + ioc_err(ioc, "reply pool: dma_pool_alloc failed\n"); | |
| 4834 | 4761 | goto out; |
| 4835 | 4762 | } |
| 4836 | 4763 | ioc->reply_dma_min_address = (u32)(ioc->reply_dma); |
| 4837 | 4764 | ioc->reply_dma_max_address = (u32)(ioc->reply_dma) + sz; |
| 4838 | − dinitprintk(ioc, pr_info(MPT3SAS_FMT | |
| 4839 | − "reply pool(0x%p): depth(%d), frame_size(%d), pool_size(%d kB)\n", | |
| 4840 | − ioc->name, ioc->reply, | |
| 4841 | − ioc->reply_free_queue_depth, ioc->reply_sz, sz/1024)); | |
| 4842 | − dinitprintk(ioc, pr_info(MPT3SAS_FMT "reply_dma(0x%llx)\n", | |
| 4843 | − ioc->name, (unsigned long long)ioc->reply_dma)); | |
| 4765 | + dinitprintk(ioc, | |
| 4766 | + ioc_info(ioc, "reply pool(0x%p): depth(%d), frame_size(%d), pool_size(%d kB)\n", | |
| 4767 | + ioc->reply, ioc->reply_free_queue_depth, | |
| 4768 | + ioc->reply_sz, sz / 1024)); | |
| 4769 | + dinitprintk(ioc, | |
| 4770 | + ioc_info(ioc, "reply_dma(0x%llx)\n", | |
| 4771 | + (unsigned long long)ioc->reply_dma)); | |
| 4844 | 4772 | total_sz += sz; |
| 4845 | 4773 | |
| 4846 | 4774 | /* reply free queue, 16 byte align */ |
| @@ -4848,24 +4776,22 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) · 1 unmodified line | ||
| 4848 | 4776 | ioc->reply_free_dma_pool = dma_pool_create("reply_free pool", |
| 4849 | 4777 | &ioc->pdev->dev, sz, 16, 0); |
| 4850 | 4778 | if (!ioc->reply_free_dma_pool) { |
| 4851 | − pr_err(MPT3SAS_FMT "reply_free pool: dma_pool_create failed\n", | |
| 4852 | − ioc->name); | |
| 4779 | + ioc_err(ioc, "reply_free pool: dma_pool_create failed\n"); | |
| 4853 | 4780 | goto out; |
| 4854 | 4781 | } |
| 4855 | − ioc->reply_free = dma_pool_alloc(ioc->reply_free_dma_pool, GFP_KERNEL, | |
| 4782 | + ioc->reply_free = dma_pool_zalloc(ioc->reply_free_dma_pool, GFP_KERNEL, | |
| 4856 | 4783 | &ioc->reply_free_dma); |
| 4857 | 4784 | if (!ioc->reply_free) { |
| 4858 | − pr_err(MPT3SAS_FMT "reply_free pool: dma_pool_alloc failed\n", | |
| 4859 | − ioc->name); | |
| 4785 | + ioc_err(ioc, "reply_free pool: dma_pool_alloc failed\n"); | |
| 4860 | 4786 | goto out; |
| 4861 | 4787 | } |
| 4862 | − memset(ioc->reply_free, 0, sz); | |
| 4863 | − dinitprintk(ioc, pr_info(MPT3SAS_FMT "reply_free pool(0x%p): " \ | |
| 4864 | − "depth(%d), element_size(%d), pool_size(%d kB)\n", ioc->name, | |
| 4865 | − ioc->reply_free, ioc->reply_free_queue_depth, 4, sz/1024)); | |
| 4866 | − dinitprintk(ioc, pr_info(MPT3SAS_FMT | |
| 4867 | − "reply_free_dma (0x%llx)\n", | |
| 4868 | − ioc->name, (unsigned long long)ioc->reply_free_dma)); | |
| 4788 | + dinitprintk(ioc, | |
| 4789 | + ioc_info(ioc, "reply_free pool(0x%p): depth(%d), element_size(%d), pool_size(%d kB)\n", | |
| 4790 | + ioc->reply_free, ioc->reply_free_queue_depth, | |
| 4791 | + 4, sz / 1024)); | |
| 4792 | + dinitprintk(ioc, | |
| 4793 | + ioc_info(ioc, "reply_free_dma (0x%llx)\n", | |
| 4794 | + (unsigned long long)ioc->reply_free_dma)); | |
| 4869 | 4795 | total_sz += sz; |
| 4870 | 4796 | |
| 4871 | 4797 | if (ioc->rdpq_array_enable) { |
| @@ -4876,8 +4802,7 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) · 4 unmodified lines | ||
| 4876 | 4802 | &ioc->pdev->dev, reply_post_free_array_sz, 16, 0); |
| 4877 | 4803 | if (!ioc->reply_post_free_array_dma_pool) { |
| 4878 | 4804 | dinitprintk(ioc, |
| 4879 | − pr_info(MPT3SAS_FMT "reply_post_free_array pool: " | |
| 4880 | − "dma_pool_create failed\n", ioc->name)); | |
| 4805 | + ioc_info(ioc, "reply_post_free_array pool: dma_pool_create failed\n")); | |
| 4881 | 4806 | goto out; |
| 4882 | 4807 | } |
| 4883 | 4808 | ioc->reply_post_free_array = |
| @@ -4885,34 +4810,31 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) · 1 unmodified line | ||
| 4885 | 4810 | GFP_KERNEL, &ioc->reply_post_free_array_dma); |
| 4886 | 4811 | if (!ioc->reply_post_free_array) { |
| 4887 | 4812 | dinitprintk(ioc, |
| 4888 | − pr_info(MPT3SAS_FMT "reply_post_free_array pool: " | |
| 4889 | − "dma_pool_alloc failed\n", ioc->name)); | |
| 4813 | + ioc_info(ioc, "reply_post_free_array pool: dma_pool_alloc failed\n")); | |
| 4890 | 4814 | goto out; |
| 4891 | 4815 | } |
| 4892 | 4816 | } |
| 4893 | 4817 | ioc->config_page_sz = 512; |
| 4894 | − ioc->config_page = pci_alloc_consistent(ioc->pdev, | |
| 4895 | − ioc->config_page_sz, &ioc->config_page_dma); | |
| 4818 | + ioc->config_page = dma_alloc_coherent(&ioc->pdev->dev, | |
| 4819 | + ioc->config_page_sz, &ioc->config_page_dma, GFP_KERNEL); | |
| 4896 | 4820 | if (!ioc->config_page) { |
| 4897 | − pr_err(MPT3SAS_FMT | |
| 4898 | − "config page: dma_pool_alloc failed\n", | |
| 4899 | − ioc->name); | |
| 4821 | + ioc_err(ioc, "config page: dma_pool_alloc failed\n"); | |
| 4900 | 4822 | goto out; |
| 4901 | 4823 | } |
| 4902 | − dinitprintk(ioc, pr_info(MPT3SAS_FMT | |
| 4903 | − "config page(0x%p): size(%d)\n", | |
| 4904 | − ioc->name, ioc->config_page, ioc->config_page_sz)); | |
| 4905 | − dinitprintk(ioc, pr_info(MPT3SAS_FMT "config_page_dma(0x%llx)\n", | |
| 4906 | − ioc->name, (unsigned long long)ioc->config_page_dma)); | |
| 4824 | + dinitprintk(ioc, | |
| 4825 | + ioc_info(ioc, "config page(0x%p): size(%d)\n", | |
| 4826 | + ioc->config_page, ioc->config_page_sz)); | |
| 4827 | + dinitprintk(ioc, | |
| 4828 | + ioc_info(ioc, "config_page_dma(0x%llx)\n", | |
| 4829 | + (unsigned long long)ioc->config_page_dma)); | |
| 4907 | 4830 | total_sz += ioc->config_page_sz; |
| 4908 | 4831 | |
| 4909 | − pr_info(MPT3SAS_FMT "Allocated physical memory: size(%d kB)\n", | |
| 4910 | − ioc->name, total_sz/1024); | |
| 4911 | − pr_info(MPT3SAS_FMT | |
| 4912 | − "Current Controller Queue Depth(%d),Max Controller Queue Depth(%d)\n", | |
| 4913 | − ioc->name, ioc->shost->can_queue, facts->RequestCredit); | |
| 4914 | − pr_info(MPT3SAS_FMT "Scatter Gather Elements per IO(%d)\n", | |
| 4915 | − ioc->name, ioc->shost->sg_tablesize); | |
| 4832 | + ioc_info(ioc, "Allocated physical memory: size(%d kB)\n", | |
| 4833 | + total_sz / 1024); | |
| 4834 | + ioc_info(ioc, "Current Controller Queue Depth(%d),Max Controller Queue Depth(%d)\n", | |
| 4835 | + ioc->shost->can_queue, facts->RequestCredit); | |
| 4836 | + ioc_info(ioc, "Scatter Gather Elements per IO(%d)\n", | |
| 4837 | + ioc->shost->sg_tablesize); | |
| 4916 | 4838 | return 0; |
| 4917 | 4839 | |
| 4918 | 4840 | out: |
| @@ -4990,9 +4912,9 @@ _base_wait_for_doorbell_int(struct MPT3SAS_ADAPTER *ioc, int timeout) · 71 unmodified lines | ||
| 4990 | 4912 | do { |
| 4991 | 4913 | int_status = readl(&ioc->chip->HostInterruptStatus); |
| 4992 | 4914 | if (int_status & MPI2_HIS_IOC2SYS_DB_STATUS) { |
| 4993 | − dhsprintk(ioc, pr_info(MPT3SAS_FMT | |
| 4994 | − "%s: successful count(%d), timeout(%d)\n", | |
| 4995 | − ioc->name, __func__, count, timeout)); | |
| 4915 | + dhsprintk(ioc, | |
| 4916 | + ioc_info(ioc, "%s: successful count(%d), timeout(%d)\n", | |
| 4917 | + __func__, count, timeout)); | |
| 4996 | 4918 | return 0; |
| 4997 | 4919 | } |
| 4998 | 4920 | |
| @@ -5000,9 +4922,8 @@ _base_wait_for_doorbell_int(struct MPT3SAS_ADAPTER *ioc, int timeout) · 1 unmodified line | ||
| 5000 | 4922 | count++; |
| 5001 | 4923 | } while (--cntdn); |
| 5002 | 4924 | |
| 5003 | − pr_err(MPT3SAS_FMT | |
| 5004 | − "%s: failed due to timeout count(%d), int_status(%x)!\n", | |
| 5005 | − ioc->name, __func__, count, int_status); | |
| 4925 | + ioc_err(ioc, "%s: failed due to timeout count(%d), int_status(%x)!\n", | |
| 4926 | + __func__, count, int_status); | |
| 5006 | 4927 | return -EFAULT; |
| 5007 | 4928 | } |
| 5008 | 4929 | |
| @@ -5017,9 +4938,9 @@ _base_spin_on_doorbell_int(struct MPT3SAS_ADAPTER *ioc, int timeout) · 8 unmodified lines | ||
| 5017 | 4938 | do { |
| 5018 | 4939 | int_status = readl(&ioc->chip->HostInterruptStatus); |
| 5019 | 4940 | if (int_status & MPI2_HIS_IOC2SYS_DB_STATUS) { |
| 5020 | − dhsprintk(ioc, pr_info(MPT3SAS_FMT | |
| 5021 | − "%s: successful count(%d), timeout(%d)\n", | |
| 5022 | − ioc->name, __func__, count, timeout)); | |
| 4941 | + dhsprintk(ioc, | |
| 4942 | + ioc_info(ioc, "%s: successful count(%d), timeout(%d)\n", | |
| 4943 | + __func__, count, timeout)); | |
| 5023 | 4944 | return 0; |
| 5024 | 4945 | } |
| 5025 | 4946 | |
| @@ -5027,9 +4948,8 @@ _base_spin_on_doorbell_int(struct MPT3SAS_ADAPTER *ioc, int timeout) · 1 unmodified line | ||
| 5027 | 4948 | count++; |
| 5028 | 4949 | } while (--cntdn); |
| 5029 | 4950 | |
| 5030 | − pr_err(MPT3SAS_FMT | |
| 5031 | − "%s: failed due to timeout count(%d), int_status(%x)!\n", | |
| 5032 | − ioc->name, __func__, count, int_status); | |
| 4951 | + ioc_err(ioc, "%s: failed due to timeout count(%d), int_status(%x)!\n", | |
| 4952 | + __func__, count, int_status); | |
| 5033 | 4953 | return -EFAULT; |
| 5034 | 4954 | |
| 5035 | 4955 | } |
| @@ -5056,9 +4976,9 @@ _base_wait_for_doorbell_ack(struct MPT3SAS_ADAPTER *ioc, int timeout) · 20 unmodified lines | ||
| 5056 | 4976 | do { |
| 5057 | 4977 | int_status = readl(&ioc->chip->HostInterruptStatus); |
| 5058 | 4978 | if (!(int_status & MPI2_HIS_SYS2IOC_DB_STATUS)) { |
| 5059 | − dhsprintk(ioc, pr_info(MPT3SAS_FMT | |
| 5060 | − "%s: successful count(%d), timeout(%d)\n", | |
| 5061 | − ioc->name, __func__, count, timeout)); | |
| 4979 | + dhsprintk(ioc, | |
| 4980 | + ioc_info(ioc, "%s: successful count(%d), timeout(%d)\n", | |
| 4981 | + __func__, count, timeout)); | |
| 5062 | 4982 | return 0; |
| 5063 | 4983 | } else if (int_status & MPI2_HIS_IOC2SYS_DB_STATUS) { |
| 5064 | 4984 | doorbell = readl(&ioc->chip->Doorbell); |
| @@ -5075,9 +4995,8 @@ _base_wait_for_doorbell_ack(struct MPT3SAS_ADAPTER *ioc, int timeout) · 10 unmodified lines | ||
| 5075 | 4995 | } while (--cntdn); |
| 5076 | 4996 | |
| 5077 | 4997 | out: |
| 5078 | − pr_err(MPT3SAS_FMT | |
| 5079 | − "%s: failed due to timeout count(%d), int_status(%x)!\n", | |
| 5080 | − ioc->name, __func__, count, int_status); | |
| 4998 | + ioc_err(ioc, "%s: failed due to timeout count(%d), int_status(%x)!\n", | |
| 4999 | + __func__, count, int_status); | |
| 5081 | 5000 | return -EFAULT; |
| 5082 | 5001 | } |
| 5083 | 5002 | |
| @@ -5099,9 +5018,9 @@ _base_wait_for_doorbell_not_used(struct MPT3SAS_ADAPTER *ioc, int timeout) · 15 unmodified lines | ||
| 5099 | 5018 | do { |
| 5100 | 5019 | doorbell_reg = readl(&ioc->chip->Doorbell); |
| 5101 | 5020 | if (!(doorbell_reg & MPI2_DOORBELL_USED)) { |
| 5102 | − dhsprintk(ioc, pr_info(MPT3SAS_FMT | |
| 5103 | − "%s: successful count(%d), timeout(%d)\n", | |
| 5104 | − ioc->name, __func__, count, timeout)); | |
| 5021 | + dhsprintk(ioc, | |
| 5022 | + ioc_info(ioc, "%s: successful count(%d), timeout(%d)\n", | |
| 5023 | + __func__, count, timeout)); | |
| 5105 | 5024 | return 0; |
| 5106 | 5025 | } |
| 5107 | 5026 | |
| @@ -5109,9 +5028,8 @@ _base_wait_for_doorbell_not_used(struct MPT3SAS_ADAPTER *ioc, int timeout) · 1 unmodified line | ||
| 5109 | 5028 | count++; |
| 5110 | 5029 | } while (--cntdn); |
| 5111 | 5030 | |
| 5112 | − pr_err(MPT3SAS_FMT | |
| 5113 | − "%s: failed due to timeout count(%d), doorbell_reg(%x)!\n", | |
| 5114 | − ioc->name, __func__, count, doorbell_reg); | |
| 5031 | + ioc_err(ioc, "%s: failed due to timeout count(%d), doorbell_reg(%x)!\n", | |
| 5032 | + __func__, count, doorbell_reg); | |
| 5115 | 5033 | return -EFAULT; |
| 5116 | 5034 | } |
| 5117 | 5035 | |
| @@ -5130,8 +5048,7 @@ _base_send_ioc_reset(struct MPT3SAS_ADAPTER *ioc, u8 reset_type, int timeout) · 12 unmodified lines | ||
| 5130 | 5048 | int r = 0; |
| 5131 | 5049 | |
| 5132 | 5050 | if (reset_type != MPI2_FUNCTION_IOC_MESSAGE_UNIT_RESET) { |
| 5133 | − pr_err(MPT3SAS_FMT "%s: unknown reset_type\n", | |
| 5134 | − ioc->name, __func__); | |
| 5051 | + ioc_err(ioc, "%s: unknown reset_type\n", __func__); | |
| 5135 | 5052 | return -EFAULT; |
| 5136 | 5053 | } |
| 5137 | 5054 | |
| @@ -5139,7 +5056,7 @@ _base_send_ioc_reset(struct MPT3SAS_ADAPTER *ioc, u8 reset_type, int timeout) · 1 unmodified line | ||
| 5139 | 5056 | MPI2_IOCFACTS_CAPABILITY_EVENT_REPLAY)) |
| 5140 | 5057 | return -EFAULT; |
| 5141 | 5058 | |
| 5142 | − pr_info(MPT3SAS_FMT "sending message unit reset !!\n", ioc->name); | |
| 5059 | + ioc_info(ioc, "sending message unit reset !!\n"); | |
| 5143 | 5060 | |
| 5144 | 5061 | writel(reset_type << MPI2_DOORBELL_FUNCTION_SHIFT, |
| 5145 | 5062 | &ioc->chip->Doorbell); |
| @@ -5149,15 +5066,14 @@ _base_send_ioc_reset(struct MPT3SAS_ADAPTER *ioc, u8 reset_type, int timeout) · 3 unmodified lines | ||
| 5149 | 5066 | } |
| 5150 | 5067 | ioc_state = _base_wait_on_iocstate(ioc, MPI2_IOC_STATE_READY, timeout); |
| 5151 | 5068 | if (ioc_state) { |
| 5152 | − pr_err(MPT3SAS_FMT | |
| 5153 | − "%s: failed going to ready state (ioc_state=0x%x)\n", | |
| 5154 | − ioc->name, __func__, ioc_state); | |
| 5069 | + ioc_err(ioc, "%s: failed going to ready state (ioc_state=0x%x)\n", | |
| 5070 | + __func__, ioc_state); | |
| 5155 | 5071 | r = -EFAULT; |
| 5156 | 5072 | goto out; |
| 5157 | 5073 | } |
| 5158 | 5074 | out: |
| 5159 | − pr_info(MPT3SAS_FMT "message unit reset: %s\n", | |
| 5160 | − ioc->name, ((r == 0) ? "SUCCESS" : "FAILED")); | |
| 5075 | + ioc_info(ioc, "message unit reset: %s\n", | |
| 5076 | + r == 0 ? "SUCCESS" : "FAILED"); | |
| 5161 | 5077 | return r; |
| 5162 | 5078 | } |
| 5163 | 5079 | |
| @@ -5183,9 +5099,7 @@ _base_handshake_req_reply_wait(struct MPT3SAS_ADAPTER *ioc, int request_bytes, · 19 unmodified lines | ||
| 5183 | 5099 | |
| 5184 | 5100 | /* make sure doorbell is not in use */ |
| 5185 | 5101 | if ((readl(&ioc->chip->Doorbell) & MPI2_DOORBELL_USED)) { |
| 5186 | − pr_err(MPT3SAS_FMT | |
| 5187 | − "doorbell is in use (line=%d)\n", | |
| 5188 | − ioc->name, __LINE__); | |
| 5102 | + ioc_err(ioc, "doorbell is in use (line=%d)\n", __LINE__); | |
| 5189 | 5103 | return -EFAULT; |
| 5190 | 5104 | } |
| 5191 | 5105 | |
| @@ -5200,17 +5114,15 @@ _base_handshake_req_reply_wait(struct MPT3SAS_ADAPTER *ioc, int request_bytes, · 8 unmodified lines | ||
| 5200 | 5114 | &ioc->chip->Doorbell); |
| 5201 | 5115 | |
| 5202 | 5116 | if ((_base_spin_on_doorbell_int(ioc, 5))) { |
| 5203 | − pr_err(MPT3SAS_FMT | |
| 5204 | − "doorbell handshake int failed (line=%d)\n", | |
| 5205 | − ioc->name, __LINE__); | |
| 5117 | + ioc_err(ioc, "doorbell handshake int failed (line=%d)\n", | |
| 5118 | + __LINE__); | |
| 5206 | 5119 | return -EFAULT; |
| 5207 | 5120 | } |
| 5208 | 5121 | writel(0, &ioc->chip->HostInterruptStatus); |
| 5209 | 5122 | |
| 5210 | 5123 | if ((_base_wait_for_doorbell_ack(ioc, 5))) { |
| 5211 | − pr_err(MPT3SAS_FMT | |
| 5212 | − "doorbell handshake ack failed (line=%d)\n", | |
| 5213 | − ioc->name, __LINE__); | |
| 5124 | + ioc_err(ioc, "doorbell handshake ack failed (line=%d)\n", | |
| 5125 | + __LINE__); | |
| 5214 | 5126 | return -EFAULT; |
| 5215 | 5127 | } |
| 5216 | 5128 | |
| @@ -5222,17 +5134,15 @@ _base_handshake_req_reply_wait(struct MPT3SAS_ADAPTER *ioc, int request_bytes, · 5 unmodified lines | ||
| 5222 | 5134 | } |
| 5223 | 5135 | |
| 5224 | 5136 | if (failed) { |
| 5225 | − pr_err(MPT3SAS_FMT | |
| 5226 | − "doorbell handshake sending request failed (line=%d)\n", | |
| 5227 | − ioc->name, __LINE__); | |
| 5137 | + ioc_err(ioc, "doorbell handshake sending request failed (line=%d)\n", | |
| 5138 | + __LINE__); | |
| 5228 | 5139 | return -EFAULT; |
| 5229 | 5140 | } |
| 5230 | 5141 | |
| 5231 | 5142 | /* now wait for the reply */ |
| 5232 | 5143 | if ((_base_wait_for_doorbell_int(ioc, timeout))) { |
| 5233 | − pr_err(MPT3SAS_FMT | |
| 5234 | − "doorbell handshake int failed (line=%d)\n", | |
| 5235 | − ioc->name, __LINE__); | |
| 5144 | + ioc_err(ioc, "doorbell handshake int failed (line=%d)\n", | |
| 5145 | + __LINE__); | |
| 5236 | 5146 | return -EFAULT; |
| 5237 | 5147 | } |
| 5238 | 5148 | |
| @@ -5241,9 +5151,8 @@ _base_handshake_req_reply_wait(struct MPT3SAS_ADAPTER *ioc, int request_bytes, · 2 unmodified lines | ||
| 5241 | 5151 | & MPI2_DOORBELL_DATA_MASK); |
| 5242 | 5152 | writel(0, &ioc->chip->HostInterruptStatus); |
| 5243 | 5153 | if ((_base_wait_for_doorbell_int(ioc, 5))) { |
| 5244 | − pr_err(MPT3SAS_FMT | |
| 5245 | − "doorbell handshake int failed (line=%d)\n", | |
| 5246 | − ioc->name, __LINE__); | |
| 5154 | + ioc_err(ioc, "doorbell handshake int failed (line=%d)\n", | |
| 5155 | + __LINE__); | |
| 5247 | 5156 | return -EFAULT; |
| 5248 | 5157 | } |
| 5249 | 5158 | reply[1] = le16_to_cpu(readl(&ioc->chip->Doorbell) |
| @@ -5252,9 +5161,8 @@ _base_handshake_req_reply_wait(struct MPT3SAS_ADAPTER *ioc, int request_bytes, · 2 unmodified lines | ||
| 5252 | 5161 | |
| 5253 | 5162 | for (i = 2; i < default_reply->MsgLength * 2; i++) { |
| 5254 | 5163 | if ((_base_wait_for_doorbell_int(ioc, 5))) { |
| 5255 | − pr_err(MPT3SAS_FMT | |
| 5256 | − "doorbell handshake int failed (line=%d)\n", | |
| 5257 | − ioc->name, __LINE__); | |
| 5164 | + ioc_err(ioc, "doorbell handshake int failed (line=%d)\n", | |
| 5165 | + __LINE__); | |
| 5258 | 5166 | return -EFAULT; |
| 5259 | 5167 | } |
| 5260 | 5168 | if (i >= reply_bytes/2) /* overflow case */ |
| @@ -5267,8 +5175,9 @@ _base_handshake_req_reply_wait(struct MPT3SAS_ADAPTER *ioc, int request_bytes, · 6 unmodified lines | ||
| 5267 | 5175 | |
| 5268 | 5176 | _base_wait_for_doorbell_int(ioc, 5); |
| 5269 | 5177 | if (_base_wait_for_doorbell_not_used(ioc, 5) != 0) { |
| 5270 | − dhsprintk(ioc, pr_info(MPT3SAS_FMT | |
| 5271 | − "doorbell is in use (line=%d)\n", ioc->name, __LINE__)); | |
| 5178 | + dhsprintk(ioc, | |
| 5179 | + ioc_info(ioc, "doorbell is in use (line=%d)\n", | |
| 5180 | + __LINE__)); | |
| 5272 | 5181 | } |
| 5273 | 5182 | writel(0, &ioc->chip->HostInterruptStatus); |
| 5274 | 5183 | |
| @@ -5308,14 +5217,12 @@ mpt3sas_base_sas_iounit_control(struct MPT3SAS_ADAPTER *ioc, · 33 unmodified lines | ||
| 5308 | 5217 | void *request; |
| 5309 | 5218 | u16 wait_state_count; |
| 5310 | 5219 | |
| 5311 | − dinitprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name, | |
| 5312 | − __func__)); | |
| 5220 | + dinitprintk(ioc, ioc_info(ioc, "%s\n", __func__)); | |
| 5313 | 5221 | |
| 5314 | 5222 | mutex_lock(&ioc->base_cmds.mutex); |
| 5315 | 5223 | |
| 5316 | 5224 | if (ioc->base_cmds.status != MPT3_CMD_NOT_USED) { |
| 5317 | − pr_err(MPT3SAS_FMT "%s: base_cmd in use\n", | |
| 5318 | − ioc->name, __func__); | |
| 5225 | + ioc_err(ioc, "%s: base_cmd in use\n", __func__); | |
| 5319 | 5226 | rc = -EAGAIN; |
| 5320 | 5227 | goto out; |
| 5321 | 5228 | } |
| @@ -5324,23 +5231,20 @@ mpt3sas_base_sas_iounit_control(struct MPT3SAS_ADAPTER *ioc, · 2 unmodified lines | ||
| 5324 | 5231 | ioc_state = mpt3sas_base_get_iocstate(ioc, 1); |
| 5325 | 5232 | while (ioc_state != MPI2_IOC_STATE_OPERATIONAL) { |
| 5326 | 5233 | if (wait_state_count++ == 10) { |
| 5327 | − pr_err(MPT3SAS_FMT | |
| 5328 | − "%s: failed due to ioc not operational\n", | |
| 5329 | − ioc->name, __func__); | |
| 5234 | + ioc_err(ioc, "%s: failed due to ioc not operational\n", | |
| 5235 | + __func__); | |
| 5330 | 5236 | rc = -EFAULT; |
| 5331 | 5237 | goto out; |
| 5332 | 5238 | } |
| 5333 | 5239 | ssleep(1); |
| 5334 | 5240 | ioc_state = mpt3sas_base_get_iocstate(ioc, 1); |
| 5335 | − pr_info(MPT3SAS_FMT | |
| 5336 | − "%s: waiting for operational state(count=%d)\n", | |
| 5337 | − ioc->name, __func__, wait_state_count); | |
| 5241 | + ioc_info(ioc, "%s: waiting for operational state(count=%d)\n", | |
| 5242 | + __func__, wait_state_count); | |
| 5338 | 5243 | } |
| 5339 | 5244 | |
| 5340 | 5245 | smid = mpt3sas_base_get_smid(ioc, ioc->base_cb_idx); |
| 5341 | 5246 | if (!smid) { |
| 5342 | − pr_err(MPT3SAS_FMT "%s: failed obtaining a smid\n", | |
| 5343 | − ioc->name, __func__); | |
| 5247 | + ioc_err(ioc, "%s: failed obtaining a smid\n", __func__); | |
| 5344 | 5248 | rc = -EAGAIN; |
| 5345 | 5249 | goto out; |
| 5346 | 5250 | } |
| @@ -5408,14 +5312,12 @@ mpt3sas_base_scsi_enclosure_processor(struct MPT3SAS_ADAPTER *ioc, · 61 unmodified lines | ||
| 5408 | 5312 | void *request; |
| 5409 | 5313 | u16 wait_state_count; |
| 5410 | 5314 | |
| 5411 | − dinitprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name, | |
| 5412 | − __func__)); | |
| 5315 | + dinitprintk(ioc, ioc_info(ioc, "%s\n", __func__)); | |
| 5413 | 5316 | |
| 5414 | 5317 | mutex_lock(&ioc->base_cmds.mutex); |
| 5415 | 5318 | |
| 5416 | 5319 | if (ioc->base_cmds.status != MPT3_CMD_NOT_USED) { |
| 5417 | − pr_err(MPT3SAS_FMT "%s: base_cmd in use\n", | |
| 5418 | − ioc->name, __func__); | |
| 5320 | + ioc_err(ioc, "%s: base_cmd in use\n", __func__); | |
| 5419 | 5321 | rc = -EAGAIN; |
| 5420 | 5322 | goto out; |
| 5421 | 5323 | } |
| @@ -5424,24 +5326,20 @@ mpt3sas_base_scsi_enclosure_processor(struct MPT3SAS_ADAPTER *ioc, · 2 unmodified lines | ||
| 5424 | 5326 | ioc_state = mpt3sas_base_get_iocstate(ioc, 1); |
| 5425 | 5327 | while (ioc_state != MPI2_IOC_STATE_OPERATIONAL) { |
| 5426 | 5328 | if (wait_state_count++ == 10) { |
| 5427 | − pr_err(MPT3SAS_FMT | |
| 5428 | − "%s: failed due to ioc not operational\n", | |
| 5429 | − ioc->name, __func__); | |
| 5329 | + ioc_err(ioc, "%s: failed due to ioc not operational\n", | |
| 5330 | + __func__); | |
| 5430 | 5331 | rc = -EFAULT; |
| 5431 | 5332 | goto out; |
| 5432 | 5333 | } |
| 5433 | 5334 | ssleep(1); |
| 5434 | 5335 | ioc_state = mpt3sas_base_get_iocstate(ioc, 1); |
| 5435 | − pr_info(MPT3SAS_FMT | |
| 5436 | − "%s: waiting for operational state(count=%d)\n", | |
| 5437 | − ioc->name, | |
| 5438 | − __func__, wait_state_count); | |
| 5336 | + ioc_info(ioc, "%s: waiting for operational state(count=%d)\n", | |
| 5337 | + __func__, wait_state_count); | |
| 5439 | 5338 | } |
| 5440 | 5339 | |
| 5441 | 5340 | smid = mpt3sas_base_get_smid(ioc, ioc->base_cb_idx); |
| 5442 | 5341 | if (!smid) { |
| 5443 | − pr_err(MPT3SAS_FMT "%s: failed obtaining a smid\n", | |
| 5444 | − ioc->name, __func__); | |
| 5342 | + ioc_err(ioc, "%s: failed obtaining a smid\n", __func__); | |
| 5445 | 5343 | rc = -EAGAIN; |
| 5446 | 5344 | goto out; |
| 5447 | 5345 | } |
| @@ -5495,8 +5393,7 @@ _base_get_port_facts(struct MPT3SAS_ADAPTER *ioc, int port) · 47 unmodified lines | ||
| 5495 | 5393 | struct mpt3sas_port_facts *pfacts; |
| 5496 | 5394 | int mpi_reply_sz, mpi_request_sz, r; |
| 5497 | 5395 | |
| 5498 | − dinitprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name, | |
| 5499 | − __func__)); | |
| 5396 | + dinitprintk(ioc, ioc_info(ioc, "%s\n", __func__)); | |
| 5500 | 5397 | |
| 5501 | 5398 | mpi_reply_sz = sizeof(Mpi2PortFactsReply_t); |
| 5502 | 5399 | mpi_request_sz = sizeof(Mpi2PortFactsRequest_t); |
| @@ -5507,8 +5404,7 @@ _base_get_port_facts(struct MPT3SAS_ADAPTER *ioc, int port) · 4 unmodified lines | ||
| 5507 | 5404 | (u32 *)&mpi_request, mpi_reply_sz, (u16 *)&mpi_reply, 5); |
| 5508 | 5405 | |
| 5509 | 5406 | if (r != 0) { |
| 5510 | − pr_err(MPT3SAS_FMT "%s: handshake failed (r=%d)\n", | |
| 5511 | − ioc->name, __func__, r); | |
| 5407 | + ioc_err(ioc, "%s: handshake failed (r=%d)\n", __func__, r); | |
| 5512 | 5408 | return r; |
| 5513 | 5409 | } |
| 5514 | 5410 | |
| @@ -5536,26 +5432,26 @@ _base_wait_for_iocstate(struct MPT3SAS_ADAPTER *ioc, int timeout) · 21 unmodified lines | ||
| 5536 | 5432 | u32 ioc_state; |
| 5537 | 5433 | int rc; |
| 5538 | 5434 | |
| 5539 | − dinitprintk(ioc, printk(MPT3SAS_FMT "%s\n", ioc->name, | |
| 5540 | − __func__)); | |
| 5435 | + dinitprintk(ioc, ioc_info(ioc, "%s\n", __func__)); | |
| 5541 | 5436 | |
| 5542 | 5437 | if (ioc->pci_error_recovery) { |
| 5543 | − dfailprintk(ioc, printk(MPT3SAS_FMT | |
| 5544 | − "%s: host in pci error recovery\n", ioc->name, __func__)); | |
| 5438 | + dfailprintk(ioc, | |
| 5439 | + ioc_info(ioc, "%s: host in pci error recovery\n", | |
| 5440 | + __func__)); | |
| 5545 | 5441 | return -EFAULT; |
| 5546 | 5442 | } |
| 5547 | 5443 | |
| 5548 | 5444 | ioc_state = mpt3sas_base_get_iocstate(ioc, 0); |
| 5549 | − dhsprintk(ioc, printk(MPT3SAS_FMT "%s: ioc_state(0x%08x)\n", | |
| 5550 | − ioc->name, __func__, ioc_state)); | |
| 5445 | + dhsprintk(ioc, | |
| 5446 | + ioc_info(ioc, "%s: ioc_state(0x%08x)\n", | |
| 5447 | + __func__, ioc_state)); | |
| 5551 | 5448 | |
| 5552 | 5449 | if (((ioc_state & MPI2_IOC_STATE_MASK) == MPI2_IOC_STATE_READY) || |
| 5553 | 5450 | (ioc_state & MPI2_IOC_STATE_MASK) == MPI2_IOC_STATE_OPERATIONAL) |
| 5554 | 5451 | return 0; |
| 5555 | 5452 | |
| 5556 | 5453 | if (ioc_state & MPI2_DOORBELL_USED) { |
| 5557 | − dhsprintk(ioc, printk(MPT3SAS_FMT | |
| 5558 | − "unexpected doorbell active!\n", ioc->name)); | |
| 5454 | + dhsprintk(ioc, ioc_info(ioc, "unexpected doorbell active!\n")); | |
| 5559 | 5455 | goto issue_diag_reset; |
| 5560 | 5456 | } |
| 5561 | 5457 | |
| @@ -5567,9 +5463,9 @@ _base_wait_for_iocstate(struct MPT3SAS_ADAPTER *ioc, int timeout) · 5 unmodified lines | ||
| 5567 | 5463 | |
| 5568 | 5464 | ioc_state = _base_wait_on_iocstate(ioc, MPI2_IOC_STATE_READY, timeout); |
| 5569 | 5465 | if (ioc_state) { |
| 5570 | − dfailprintk(ioc, printk(MPT3SAS_FMT | |
| 5571 | − "%s: failed going to ready state (ioc_state=0x%x)\n", | |
| 5572 | − ioc->name, __func__, ioc_state)); | |
| 5466 | + dfailprintk(ioc, | |
| 5467 | + ioc_info(ioc, "%s: failed going to ready state (ioc_state=0x%x)\n", | |
| 5468 | + __func__, ioc_state)); | |
| 5573 | 5469 | return -EFAULT; |
| 5574 | 5470 | } |
| 5575 | 5471 | |
| @@ -5592,14 +5488,13 @@ _base_get_ioc_facts(struct MPT3SAS_ADAPTER *ioc) · 16 unmodified lines | ||
| 5592 | 5488 | struct mpt3sas_facts *facts; |
| 5593 | 5489 | int mpi_reply_sz, mpi_request_sz, r; |
| 5594 | 5490 | |
| 5595 | − dinitprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name, | |
| 5596 | − __func__)); | |
| 5491 | + dinitprintk(ioc, ioc_info(ioc, "%s\n", __func__)); | |
| 5597 | 5492 | |
| 5598 | 5493 | r = _base_wait_for_iocstate(ioc, 10); |
| 5599 | 5494 | if (r) { |
| 5600 | − dfailprintk(ioc, printk(MPT3SAS_FMT | |
| 5601 | − "%s: failed getting to correct state\n", | |
| 5602 | − ioc->name, __func__)); | |
| 5495 | + dfailprintk(ioc, | |
| 5496 | + ioc_info(ioc, "%s: failed getting to correct state\n", | |
| 5497 | + __func__)); | |
| 5603 | 5498 | return r; |
| 5604 | 5499 | } |
| 5605 | 5500 | mpi_reply_sz = sizeof(Mpi2IOCFactsReply_t); |
| @@ -5610,8 +5505,7 @@ _base_get_ioc_facts(struct MPT3SAS_ADAPTER *ioc) · 4 unmodified lines | ||
| 5610 | 5505 | (u32 *)&mpi_request, mpi_reply_sz, (u16 *)&mpi_reply, 5); |
| 5611 | 5506 | |
| 5612 | 5507 | if (r != 0) { |
| 5613 | − pr_err(MPT3SAS_FMT "%s: handshake failed (r=%d)\n", | |
| 5614 | − ioc->name, __func__, r); | |
| 5508 | + ioc_err(ioc, "%s: handshake failed (r=%d)\n", __func__, r); | |
| 5615 | 5509 | return r; |
| 5616 | 5510 | } |
| 5617 | 5511 | |
| @@ -5663,20 +5557,20 @@ _base_get_ioc_facts(struct MPT3SAS_ADAPTER *ioc) · 45 unmodified lines | ||
| 5663 | 5557 | */ |
| 5664 | 5558 | ioc->page_size = 1 << facts->CurrentHostPageSize; |
| 5665 | 5559 | if (ioc->page_size == 1) { |
| 5666 | − pr_info(MPT3SAS_FMT "CurrentHostPageSize is 0: Setting " | |
| 5667 | − "default host page size to 4k\n", ioc->name); | |
| 5560 | + ioc_info(ioc, "CurrentHostPageSize is 0: Setting default host page size to 4k\n"); | |
| 5668 | 5561 | ioc->page_size = 1 << MPT3SAS_HOST_PAGE_SIZE_4K; |
| 5669 | 5562 | } |
| 5670 | − dinitprintk(ioc, pr_info(MPT3SAS_FMT "CurrentHostPageSize(%d)\n", | |
| 5671 | − ioc->name, facts->CurrentHostPageSize)); | |
| 5672 | − | |
| 5673 | − dinitprintk(ioc, pr_info(MPT3SAS_FMT | |
| 5674 | − "hba queue depth(%d), max chains per io(%d)\n", | |
| 5675 | − ioc->name, facts->RequestCredit, | |
| 5676 | − facts->MaxChainDepth)); | |
| 5677 | − dinitprintk(ioc, pr_info(MPT3SAS_FMT | |
| 5678 | − "request frame size(%d), reply frame size(%d)\n", ioc->name, | |
| 5679 | − facts->IOCRequestFrameSize * 4, facts->ReplyFrameSize * 4)); | |
| 5563 | + dinitprintk(ioc, | |
| 5564 | + ioc_info(ioc, "CurrentHostPageSize(%d)\n", | |
| 5565 | + facts->CurrentHostPageSize)); | |
| 5566 | + | |
| 5567 | + dinitprintk(ioc, | |
| 5568 | + ioc_info(ioc, "hba queue depth(%d), max chains per io(%d)\n", | |
| 5569 | + facts->RequestCredit, facts->MaxChainDepth)); | |
| 5570 | + dinitprintk(ioc, | |
| 5571 | + ioc_info(ioc, "request frame size(%d), reply frame size(%d)\n", | |
| 5572 | + facts->IOCRequestFrameSize * 4, | |
| 5573 | + facts->ReplyFrameSize * 4)); | |
| 5680 | 5574 | return 0; |
| 5681 | 5575 | } |
| 5682 | 5576 | |
| @@ -5696,8 +5590,7 @@ _base_send_ioc_init(struct MPT3SAS_ADAPTER *ioc) · 13 unmodified lines | ||
| 5696 | 5590 | u16 ioc_status; |
| 5697 | 5591 | u32 reply_post_free_array_sz = 0; |
| 5698 | 5592 | |
| 5699 | − dinitprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name, | |
| 5700 | − __func__)); | |
| 5593 | + dinitprintk(ioc, ioc_info(ioc, "%s\n", __func__)); | |
| 5701 | 5594 | |
| 5702 | 5595 | memset(&mpi_request, 0, sizeof(Mpi2IOCInitRequest_t)); |
| 5703 | 5596 | mpi_request.Function = MPI2_FUNCTION_IOC_INIT; |
| @@ -5763,15 +5656,14 @@ _base_send_ioc_init(struct MPT3SAS_ADAPTER *ioc) · 59 unmodified lines | ||
| 5763 | 5656 | sizeof(Mpi2IOCInitReply_t), (u16 *)&mpi_reply, 10); |
| 5764 | 5657 | |
| 5765 | 5658 | if (r != 0) { |
| 5766 | − pr_err(MPT3SAS_FMT "%s: handshake failed (r=%d)\n", | |
| 5767 | − ioc->name, __func__, r); | |
| 5659 | + ioc_err(ioc, "%s: handshake failed (r=%d)\n", __func__, r); | |
| 5768 | 5660 | return r; |
| 5769 | 5661 | } |
| 5770 | 5662 | |
| 5771 | 5663 | ioc_status = le16_to_cpu(mpi_reply.IOCStatus) & MPI2_IOCSTATUS_MASK; |
| 5772 | 5664 | if (ioc_status != MPI2_IOCSTATUS_SUCCESS || |
| 5773 | 5665 | mpi_reply.IOCLogInfo) { |
| 5774 | − pr_err(MPT3SAS_FMT "%s: failed\n", ioc->name, __func__); | |
| 5666 | + ioc_err(ioc, "%s: failed\n", __func__); | |
| 5775 | 5667 | r = -EIO; |
| 5776 | 5668 | } |
| 5777 | 5669 | |
| @@ -5842,18 +5734,16 @@ _base_send_port_enable(struct MPT3SAS_ADAPTER *ioc) · 64 unmodified lines | ||
| 5842 | 5734 | u16 smid; |
| 5843 | 5735 | u16 ioc_status; |
| 5844 | 5736 | |
| 5845 | − pr_info(MPT3SAS_FMT "sending port enable !!\n", ioc->name); | |
| 5737 | + ioc_info(ioc, "sending port enable !!\n"); | |
| 5846 | 5738 | |
| 5847 | 5739 | if (ioc->port_enable_cmds.status & MPT3_CMD_PENDING) { |
| 5848 | − pr_err(MPT3SAS_FMT "%s: internal command already in use\n", | |
| 5849 | − ioc->name, __func__); | |
| 5740 | + ioc_err(ioc, "%s: internal command already in use\n", __func__); | |
| 5850 | 5741 | return -EAGAIN; |
| 5851 | 5742 | } |
| 5852 | 5743 | |
| 5853 | 5744 | smid = mpt3sas_base_get_smid(ioc, ioc->port_enable_cb_idx); |
| 5854 | 5745 | if (!smid) { |
| 5855 | − pr_err(MPT3SAS_FMT "%s: failed obtaining a smid\n", | |
| 5856 | − ioc->name, __func__); | |
| 5746 | + ioc_err(ioc, "%s: failed obtaining a smid\n", __func__); | |
| 5857 | 5747 | return -EAGAIN; |
| 5858 | 5748 | } |
| 5859 | 5749 | |
| @@ -5867,8 +5757,7 @@ _base_send_port_enable(struct MPT3SAS_ADAPTER *ioc) · 7 unmodified lines | ||
| 5867 | 5757 | mpt3sas_base_put_smid_default(ioc, smid); |
| 5868 | 5758 | wait_for_completion_timeout(&ioc->port_enable_cmds.done, 300*HZ); |
| 5869 | 5759 | if (!(ioc->port_enable_cmds.status & MPT3_CMD_COMPLETE)) { |
| 5870 | − pr_err(MPT3SAS_FMT "%s: timeout\n", | |
| 5871 | − ioc->name, __func__); | |
| 5760 | + ioc_err(ioc, "%s: timeout\n", __func__); | |
| 5872 | 5761 | _debug_dump_mf(mpi_request, |
| 5873 | 5762 | sizeof(Mpi2PortEnableRequest_t)/4); |
| 5874 | 5763 | if (ioc->port_enable_cmds.status & MPT3_CMD_RESET) |
| @@ -5881,16 +5770,15 @@ _base_send_port_enable(struct MPT3SAS_ADAPTER *ioc) · 6 unmodified lines | ||
| 5881 | 5770 | mpi_reply = ioc->port_enable_cmds.reply; |
| 5882 | 5771 | ioc_status = le16_to_cpu(mpi_reply->IOCStatus) & MPI2_IOCSTATUS_MASK; |
| 5883 | 5772 | if (ioc_status != MPI2_IOCSTATUS_SUCCESS) { |
| 5884 | − pr_err(MPT3SAS_FMT "%s: failed with (ioc_status=0x%08x)\n", | |
| 5885 | − ioc->name, __func__, ioc_status); | |
| 5773 | + ioc_err(ioc, "%s: failed with (ioc_status=0x%08x)\n", | |
| 5774 | + __func__, ioc_status); | |
| 5886 | 5775 | r = -EFAULT; |
| 5887 | 5776 | goto out; |
| 5888 | 5777 | } |
| 5889 | 5778 | |
| 5890 | 5779 | out: |
| 5891 | 5780 | ioc->port_enable_cmds.status = MPT3_CMD_NOT_USED; |
| 5892 | − pr_info(MPT3SAS_FMT "port enable: %s\n", ioc->name, ((r == 0) ? | |
| 5893 | − "SUCCESS" : "FAILED")); | |
| 5781 | + ioc_info(ioc, "port enable: %s\n", r == 0 ? "SUCCESS" : "FAILED"); | |
| 5894 | 5782 | return r; |
| 5895 | 5783 | } |
| 5896 | 5784 | |
| @@ -5906,18 +5794,16 @@ mpt3sas_port_enable(struct MPT3SAS_ADAPTER *ioc) · 9 unmodified lines | ||
| 5906 | 5794 | Mpi2PortEnableRequest_t *mpi_request; |
| 5907 | 5795 | u16 smid; |
| 5908 | 5796 | |
| 5909 | − pr_info(MPT3SAS_FMT "sending port enable !!\n", ioc->name); | |
| 5797 | + ioc_info(ioc, "sending port enable !!\n"); | |
| 5910 | 5798 | |
| 5911 | 5799 | if (ioc->port_enable_cmds.status & MPT3_CMD_PENDING) { |
| 5912 | − pr_err(MPT3SAS_FMT "%s: internal command already in use\n", | |
| 5913 | − ioc->name, __func__); | |
| 5800 | + ioc_err(ioc, "%s: internal command already in use\n", __func__); | |
| 5914 | 5801 | return -EAGAIN; |
| 5915 | 5802 | } |
| 5916 | 5803 | |
| 5917 | 5804 | smid = mpt3sas_base_get_smid(ioc, ioc->port_enable_cb_idx); |
| 5918 | 5805 | if (!smid) { |
| 5919 | − pr_err(MPT3SAS_FMT "%s: failed obtaining a smid\n", | |
| 5920 | − ioc->name, __func__); | |
| 5806 | + ioc_err(ioc, "%s: failed obtaining a smid\n", __func__); | |
| 5921 | 5807 | return -EAGAIN; |
| 5922 | 5808 | } |
| 5923 | 5809 | |
| @@ -6020,19 +5906,16 @@ _base_event_notification(struct MPT3SAS_ADAPTER *ioc) · 96 unmodified lines | ||
| 6020 | 5906 | int r = 0; |
| 6021 | 5907 | int i; |
| 6022 | 5908 | |
| 6023 | − dinitprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name, | |
| 6024 | − __func__)); | |
| 5909 | + dinitprintk(ioc, ioc_info(ioc, "%s\n", __func__)); | |
| 6025 | 5910 | |
| 6026 | 5911 | if (ioc->base_cmds.status & MPT3_CMD_PENDING) { |
| 6027 | − pr_err(MPT3SAS_FMT "%s: internal command already in use\n", | |
| 6028 | − ioc->name, __func__); | |
| 5912 | + ioc_err(ioc, "%s: internal command already in use\n", __func__); | |
| 6029 | 5913 | return -EAGAIN; |
| 6030 | 5914 | } |
| 6031 | 5915 | |
| 6032 | 5916 | smid = mpt3sas_base_get_smid(ioc, ioc->base_cb_idx); |
| 6033 | 5917 | if (!smid) { |
| 6034 | − pr_err(MPT3SAS_FMT "%s: failed obtaining a smid\n", | |
| 6035 | − ioc->name, __func__); | |
| 5918 | + ioc_err(ioc, "%s: failed obtaining a smid\n", __func__); | |
| 6036 | 5919 | return -EAGAIN; |
| 6037 | 5920 | } |
| 6038 | 5921 | ioc->base_cmds.status = MPT3_CMD_PENDING; |
| @@ -6049,8 +5932,7 @@ _base_event_notification(struct MPT3SAS_ADAPTER *ioc) · 10 unmodified lines | ||
| 6049 | 5932 | mpt3sas_base_put_smid_default(ioc, smid); |
| 6050 | 5933 | wait_for_completion_timeout(&ioc->base_cmds.done, 30*HZ); |
| 6051 | 5934 | if (!(ioc->base_cmds.status & MPT3_CMD_COMPLETE)) { |
| 6052 | − pr_err(MPT3SAS_FMT "%s: timeout\n", | |
| 6053 | − ioc->name, __func__); | |
| 5935 | + ioc_err(ioc, "%s: timeout\n", __func__); | |
| 6054 | 5936 | _debug_dump_mf(mpi_request, |
| 6055 | 5937 | sizeof(Mpi2EventNotificationRequest_t)/4); |
| 6056 | 5938 | if (ioc->base_cmds.status & MPT3_CMD_RESET) |
| @@ -6058,8 +5940,7 @@ _base_event_notification(struct MPT3SAS_ADAPTER *ioc) · 1 unmodified line | ||
| 6058 | 5940 | else |
| 6059 | 5941 | r = -ETIME; |
| 6060 | 5942 | } else |
| 6061 | − dinitprintk(ioc, pr_info(MPT3SAS_FMT "%s: complete\n", | |
| 6062 | − ioc->name, __func__)); | |
| 5943 | + dinitprintk(ioc, ioc_info(ioc, "%s: complete\n", __func__)); | |
| 6063 | 5944 | ioc->base_cmds.status = MPT3_CMD_NOT_USED; |
| 6064 | 5945 | return r; |
| 6065 | 5946 | } |
| @@ -6115,18 +5996,16 @@ _base_diag_reset(struct MPT3SAS_ADAPTER *ioc) · 49 unmodified lines | ||
| 6115 | 5996 | u32 count; |
| 6116 | 5997 | u32 hcb_size; |
| 6117 | 5998 | |
| 6118 | − pr_info(MPT3SAS_FMT "sending diag reset !!\n", ioc->name); | |
| 5999 | + ioc_info(ioc, "sending diag reset !!\n"); | |
| 6119 | 6000 | |
| 6120 | − drsprintk(ioc, pr_info(MPT3SAS_FMT "clear interrupts\n", | |
| 6121 | − ioc->name)); | |
| 6001 | + drsprintk(ioc, ioc_info(ioc, "clear interrupts\n")); | |
| 6122 | 6002 | |
| 6123 | 6003 | count = 0; |
| 6124 | 6004 | do { |
| 6125 | 6005 | /* Write magic sequence to WriteSequence register |
| 6126 | 6006 | * Loop until in diagnostic mode |
| 6127 | 6007 | */ |
| 6128 | − drsprintk(ioc, pr_info(MPT3SAS_FMT | |
| 6129 | − "write magic sequence\n", ioc->name)); | |
| 6008 | + drsprintk(ioc, ioc_info(ioc, "write magic sequence\n")); | |
| 6130 | 6009 | writel(MPI2_WRSEQ_FLUSH_KEY_VALUE, &ioc->chip->WriteSequence); |
| 6131 | 6010 | writel(MPI2_WRSEQ_1ST_KEY_VALUE, &ioc->chip->WriteSequence); |
| 6132 | 6011 | writel(MPI2_WRSEQ_2ND_KEY_VALUE, &ioc->chip->WriteSequence); |
| @@ -6142,16 +6021,15 @@ _base_diag_reset(struct MPT3SAS_ADAPTER *ioc) · 9 unmodified lines | ||
| 6142 | 6021 | goto out; |
| 6143 | 6022 | |
| 6144 | 6023 | host_diagnostic = readl(&ioc->chip->HostDiagnostic); |
| 6145 | − drsprintk(ioc, pr_info(MPT3SAS_FMT | |
| 6146 | − "wrote magic sequence: count(%d), host_diagnostic(0x%08x)\n", | |
| 6147 | − ioc->name, count, host_diagnostic)); | |
| 6024 | + drsprintk(ioc, | |
| 6025 | + ioc_info(ioc, "wrote magic sequence: count(%d), host_diagnostic(0x%08x)\n", | |
| 6026 | + count, host_diagnostic)); | |
| 6148 | 6027 | |
| 6149 | 6028 | } while ((host_diagnostic & MPI2_DIAG_DIAG_WRITE_ENABLE) == 0); |
| 6150 | 6029 | |
| 6151 | 6030 | hcb_size = readl(&ioc->chip->HCBSize); |
| 6152 | 6031 | |
| 6153 | − drsprintk(ioc, pr_info(MPT3SAS_FMT "diag reset: issued\n", | |
| 6154 | − ioc->name)); | |
| 6032 | + drsprintk(ioc, ioc_info(ioc, "diag reset: issued\n")); | |
| 6155 | 6033 | writel(host_diagnostic | MPI2_DIAG_RESET_ADAPTER, |
| 6156 | 6034 | &ioc->chip->HostDiagnostic); |
| 6157 | 6035 | |
| @@ -6174,43 +6052,38 @@ _base_diag_reset(struct MPT3SAS_ADAPTER *ioc) · 16 unmodified lines | ||
| 6174 | 6052 | |
| 6175 | 6053 | if (host_diagnostic & MPI2_DIAG_HCB_MODE) { |
| 6176 | 6054 | |
| 6177 | − drsprintk(ioc, pr_info(MPT3SAS_FMT | |
| 6178 | − "restart the adapter assuming the HCB Address points to good F/W\n", | |
| 6179 | − ioc->name)); | |
| 6055 | + drsprintk(ioc, | |
| 6056 | + ioc_info(ioc, "restart the adapter assuming the HCB Address points to good F/W\n")); | |
| 6180 | 6057 | host_diagnostic &= ~MPI2_DIAG_BOOT_DEVICE_SELECT_MASK; |
| 6181 | 6058 | host_diagnostic |= MPI2_DIAG_BOOT_DEVICE_SELECT_HCDW; |
| 6182 | 6059 | writel(host_diagnostic, &ioc->chip->HostDiagnostic); |
| 6183 | 6060 | |
| 6184 | − drsprintk(ioc, pr_info(MPT3SAS_FMT | |
| 6185 | − "re-enable the HCDW\n", ioc->name)); | |
| 6061 | + drsprintk(ioc, ioc_info(ioc, "re-enable the HCDW\n")); | |
| 6186 | 6062 | writel(hcb_size | MPI2_HCB_SIZE_HCB_ENABLE, |
| 6187 | 6063 | &ioc->chip->HCBSize); |
| 6188 | 6064 | } |
| 6189 | 6065 | |
| 6190 | − drsprintk(ioc, pr_info(MPT3SAS_FMT "restart the adapter\n", | |
| 6191 | − ioc->name)); | |
| 6066 | + drsprintk(ioc, ioc_info(ioc, "restart the adapter\n")); | |
| 6192 | 6067 | writel(host_diagnostic & ~MPI2_DIAG_HOLD_IOC_RESET, |
| 6193 | 6068 | &ioc->chip->HostDiagnostic); |
| 6194 | 6069 | |
| 6195 | − drsprintk(ioc, pr_info(MPT3SAS_FMT | |
| 6196 | − "disable writes to the diagnostic register\n", ioc->name)); | |
| 6070 | + drsprintk(ioc, | |
| 6071 | + ioc_info(ioc, "disable writes to the diagnostic register\n")); | |
| 6197 | 6072 | writel(MPI2_WRSEQ_FLUSH_KEY_VALUE, &ioc->chip->WriteSequence); |
| 6198 | 6073 | |
| 6199 | − drsprintk(ioc, pr_info(MPT3SAS_FMT | |
| 6200 | − "Wait for FW to go to the READY state\n", ioc->name)); | |
| 6074 | + drsprintk(ioc, ioc_info(ioc, "Wait for FW to go to the READY state\n")); | |
| 6201 | 6075 | ioc_state = _base_wait_on_iocstate(ioc, MPI2_IOC_STATE_READY, 20); |
| 6202 | 6076 | if (ioc_state) { |
| 6203 | − pr_err(MPT3SAS_FMT | |
| 6204 | − "%s: failed going to ready state (ioc_state=0x%x)\n", | |
| 6205 | − ioc->name, __func__, ioc_state); | |
| 6077 | + ioc_err(ioc, "%s: failed going to ready state (ioc_state=0x%x)\n", | |
| 6078 | + __func__, ioc_state); | |
| 6206 | 6079 | goto out; |
| 6207 | 6080 | } |
| 6208 | 6081 | |
| 6209 | − pr_info(MPT3SAS_FMT "diag reset: SUCCESS\n", ioc->name); | |
| 6082 | + ioc_info(ioc, "diag reset: SUCCESS\n"); | |
| 6210 | 6083 | return 0; |
| 6211 | 6084 | |
| 6212 | 6085 | out: |
| 6213 | − pr_err(MPT3SAS_FMT "diag reset: FAILED\n", ioc->name); | |
| 6086 | + ioc_err(ioc, "diag reset: FAILED\n"); | |
| 6214 | 6087 | return -EFAULT; |
| 6215 | 6088 | } |
| 6216 | 6089 | |
| @@ -6228,15 +6101,15 @@ _base_make_ioc_ready(struct MPT3SAS_ADAPTER *ioc, enum reset_type type) · 11 unmodified lines | ||
| 6228 | 6101 | int rc; |
| 6229 | 6102 | int count; |
| 6230 | 6103 | |
| 6231 | − dinitprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name, | |
| 6232 | − __func__)); | |
| 6104 | + dinitprintk(ioc, ioc_info(ioc, "%s\n", __func__)); | |
| 6233 | 6105 | |
| 6234 | 6106 | if (ioc->pci_error_recovery) |
| 6235 | 6107 | return 0; |
| 6236 | 6108 | |
| 6237 | 6109 | ioc_state = mpt3sas_base_get_iocstate(ioc, 0); |
| 6238 | − dhsprintk(ioc, pr_info(MPT3SAS_FMT "%s: ioc_state(0x%08x)\n", | |
| 6239 | − ioc->name, __func__, ioc_state)); | |
| 6110 | + dhsprintk(ioc, | |
| 6111 | + ioc_info(ioc, "%s: ioc_state(0x%08x)\n", | |
| 6112 | + __func__, ioc_state)); | |
| 6240 | 6113 | |
| 6241 | 6114 | /* if in RESET state, it should move to READY state shortly */ |
| 6242 | 6115 | count = 0; |
| @@ -6244,9 +6117,8 @@ _base_make_ioc_ready(struct MPT3SAS_ADAPTER *ioc, enum reset_type type) · 1 unmodified line | ||
| 6244 | 6117 | while ((ioc_state & MPI2_IOC_STATE_MASK) != |
| 6245 | 6118 | MPI2_IOC_STATE_READY) { |
| 6246 | 6119 | if (count++ == 10) { |
| 6247 | − pr_err(MPT3SAS_FMT | |
| 6248 | − "%s: failed going to ready state (ioc_state=0x%x)\n", | |
| 6249 | − ioc->name, __func__, ioc_state); | |
| 6120 | + ioc_err(ioc, "%s: failed going to ready state (ioc_state=0x%x)\n", | |
| 6121 | + __func__, ioc_state); | |
| 6250 | 6122 | return -EFAULT; |
| 6251 | 6123 | } |
| 6252 | 6124 | ssleep(1); |
| @@ -6258,9 +6130,7 @@ _base_make_ioc_ready(struct MPT3SAS_ADAPTER *ioc, enum reset_type type) · 5 unmodified lines | ||
| 6258 | 6130 | return 0; |
| 6259 | 6131 | |
| 6260 | 6132 | if (ioc_state & MPI2_DOORBELL_USED) { |
| 6261 | − dhsprintk(ioc, pr_info(MPT3SAS_FMT | |
| 6262 | − "unexpected doorbell active!\n", | |
| 6263 | − ioc->name)); | |
| 6133 | + dhsprintk(ioc, ioc_info(ioc, "unexpected doorbell active!\n")); | |
| 6264 | 6134 | goto issue_diag_reset; |
| 6265 | 6135 | } |
| 6266 | 6136 | |
| @@ -6304,8 +6174,7 @@ _base_make_ioc_operational(struct MPT3SAS_ADAPTER *ioc) · 37 unmodified lines | ||
| 6304 | 6174 | struct adapter_reply_queue *reply_q; |
| 6305 | 6175 | Mpi2ReplyDescriptorsUnion_t *reply_post_free_contig; |
| 6306 | 6176 | |
| 6307 | − dinitprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name, | |
| 6308 | − __func__)); | |
| 6177 | + dinitprintk(ioc, ioc_info(ioc, "%s\n", __func__)); | |
| 6309 | 6178 | |
| 6310 | 6179 | /* clean the delayed target reset list */ |
| 6311 | 6180 | list_for_each_entry_safe(delayed_tr, delayed_tr_next, |
| @@ -6465,8 +6334,7 @@ _base_make_ioc_operational(struct MPT3SAS_ADAPTER *ioc) · 153 unmodified lines | ||
| 6465 | 6334 | void |
| 6466 | 6335 | mpt3sas_base_free_resources(struct MPT3SAS_ADAPTER *ioc) |
| 6467 | 6336 | { |
| 6468 | − dexitprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name, | |
| 6469 | − __func__)); | |
| 6337 | + dexitprintk(ioc, ioc_info(ioc, "%s\n", __func__)); | |
| 6470 | 6338 | |
| 6471 | 6339 | /* synchronizing freeing resource with pci_access_mutex lock */ |
| 6472 | 6340 | mutex_lock(&ioc->pci_access_mutex); |
| @@ -6494,8 +6362,7 @@ mpt3sas_base_attach(struct MPT3SAS_ADAPTER *ioc) · 21 unmodified lines | ||
| 6494 | 6362 | int r, i; |
| 6495 | 6363 | int cpu_id, last_cpu_id = 0; |
| 6496 | 6364 | |
| 6497 | − dinitprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name, | |
| 6498 | − __func__)); | |
| 6365 | + dinitprintk(ioc, ioc_info(ioc, "%s\n", __func__)); | |
| 6499 | 6366 | |
| 6500 | 6367 | /* setup cpu_msix_table */ |
| 6501 | 6368 | ioc->cpu_count = num_online_cpus(); |
| @@ -6505,9 +6372,8 @@ mpt3sas_base_attach(struct MPT3SAS_ADAPTER *ioc) · 3 unmodified lines | ||
| 6505 | 6372 | ioc->cpu_msix_table = kzalloc(ioc->cpu_msix_table_sz, GFP_KERNEL); |
| 6506 | 6373 | ioc->reply_queue_count = 1; |
| 6507 | 6374 | if (!ioc->cpu_msix_table) { |
| 6508 | − dfailprintk(ioc, pr_info(MPT3SAS_FMT | |
| 6509 | − "allocation for cpu_msix_table failed!!!\n", | |
| 6510 | − ioc->name)); | |
| 6375 | + dfailprintk(ioc, | |
| 6376 | + ioc_info(ioc, "allocation for cpu_msix_table failed!!!\n")); | |
| 6511 | 6377 | r = -ENOMEM; |
| 6512 | 6378 | goto out_free_resources; |
| 6513 | 6379 | } |
| @@ -6516,9 +6382,8 @@ mpt3sas_base_attach(struct MPT3SAS_ADAPTER *ioc) · 2 unmodified lines | ||
| 6516 | 6382 | ioc->reply_post_host_index = kcalloc(ioc->cpu_msix_table_sz, |
| 6517 | 6383 | sizeof(resource_size_t *), GFP_KERNEL); |
| 6518 | 6384 | if (!ioc->reply_post_host_index) { |
| 6519 | − dfailprintk(ioc, pr_info(MPT3SAS_FMT "allocation " | |
| 6520 | − "for reply_post_host_index failed!!!\n", | |
| 6521 | − ioc->name)); | |
| 6385 | + dfailprintk(ioc, | |
| 6386 | + ioc_info(ioc, "allocation for reply_post_host_index failed!!!\n")); | |
| 6522 | 6387 | r = -ENOMEM; |
| 6523 | 6388 | goto out_free_resources; |
| 6524 | 6389 | } |
| @@ -6747,8 +6612,7 @@ mpt3sas_base_attach(struct MPT3SAS_ADAPTER *ioc) · 222 unmodified lines | ||
| 6747 | 6612 | void |
| 6748 | 6613 | mpt3sas_base_detach(struct MPT3SAS_ADAPTER *ioc) |
| 6749 | 6614 | { |
| 6750 | − dexitprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name, | |
| 6751 | − __func__)); | |
| 6615 | + dexitprintk(ioc, ioc_info(ioc, "%s\n", __func__)); | |
| 6752 | 6616 | |
| 6753 | 6617 | mpt3sas_base_stop_watchdog(ioc); |
| 6754 | 6618 | mpt3sas_base_free_resources(ioc); |
| @@ -6781,8 +6645,7 @@ static void _base_pre_reset_handler(struct MPT3SAS_ADAPTER *ioc) · 26 unmodified lines | ||
| 6781 | 6645 | { |
| 6782 | 6646 | mpt3sas_scsih_pre_reset_handler(ioc); |
| 6783 | 6647 | mpt3sas_ctl_pre_reset_handler(ioc); |
| 6784 | − dtmprintk(ioc, pr_info(MPT3SAS_FMT | |
| 6785 | − "%s: MPT3_IOC_PRE_RESET\n", ioc->name, __func__)); | |
| 6648 | + dtmprintk(ioc, ioc_info(ioc, "%s: MPT3_IOC_PRE_RESET\n", __func__)); | |
| 6786 | 6649 | } |
| 6787 | 6650 | |
| 6788 | 6651 | /** |
| @@ -6793,8 +6656,7 @@ static void _base_after_reset_handler(struct MPT3SAS_ADAPTER *ioc) · 4 unmodified lines | ||
| 6793 | 6656 | { |
| 6794 | 6657 | mpt3sas_scsih_after_reset_handler(ioc); |
| 6795 | 6658 | mpt3sas_ctl_after_reset_handler(ioc); |
| 6796 | − dtmprintk(ioc, pr_info(MPT3SAS_FMT | |
| 6797 | − "%s: MPT3_IOC_AFTER_RESET\n", ioc->name, __func__)); | |
| 6659 | + dtmprintk(ioc, ioc_info(ioc, "%s: MPT3_IOC_AFTER_RESET\n", __func__)); | |
| 6798 | 6660 | if (ioc->transport_cmds.status & MPT3_CMD_PENDING) { |
| 6799 | 6661 | ioc->transport_cmds.status |= MPT3_CMD_RESET; |
| 6800 | 6662 | mpt3sas_base_free_smid(ioc, ioc->transport_cmds.smid); |
| @@ -6835,8 +6697,7 @@ static void _base_reset_done_handler(struct MPT3SAS_ADAPTER *ioc) · 34 unmodified lines | ||
| 6835 | 6697 | { |
| 6836 | 6698 | mpt3sas_scsih_reset_done_handler(ioc); |
| 6837 | 6699 | mpt3sas_ctl_reset_done_handler(ioc); |
| 6838 | − dtmprintk(ioc, pr_info(MPT3SAS_FMT | |
| 6839 | − "%s: MPT3_IOC_DONE_RESET\n", ioc->name, __func__)); | |
| 6700 | + dtmprintk(ioc, ioc_info(ioc, "%s: MPT3_IOC_DONE_RESET\n", __func__)); | |
| 6840 | 6701 | } |
| 6841 | 6702 | |
| 6842 | 6703 | /** |
| @@ -6883,12 +6744,10 @@ mpt3sas_base_hard_reset_handler(struct MPT3SAS_ADAPTER *ioc, · 40 unmodified lines | ||
| 6883 | 6744 | u32 ioc_state; |
| 6884 | 6745 | u8 is_fault = 0, is_trigger = 0; |
| 6885 | 6746 | |
| 6886 | − dtmprintk(ioc, pr_info(MPT3SAS_FMT "%s: enter\n", ioc->name, | |
| 6887 | − __func__)); | |
| 6747 | + dtmprintk(ioc, ioc_info(ioc, "%s: enter\n", __func__)); | |
| 6888 | 6748 | |
| 6889 | 6749 | if (ioc->pci_error_recovery) { |
| 6890 | − pr_err(MPT3SAS_FMT "%s: pci error recovery reset\n", | |
| 6891 | − ioc->name, __func__); | |
| 6750 | + ioc_err(ioc, "%s: pci error recovery reset\n", __func__); | |
| 6892 | 6751 | r = 0; |
| 6893 | 6752 | goto out_unlocked; |
| 6894 | 6753 | } |
| @@ -6942,8 +6801,9 @@ mpt3sas_base_hard_reset_handler(struct MPT3SAS_ADAPTER *ioc, · 47 unmodified lines | ||
| 6942 | 6801 | _base_reset_done_handler(ioc); |
| 6943 | 6802 | |
| 6944 | 6803 | out: |
| 6945 | − dtmprintk(ioc, pr_info(MPT3SAS_FMT "%s: %s\n", | |
| 6946 | − ioc->name, __func__, ((r == 0) ? "SUCCESS" : "FAILED"))); | |
| 6804 | + dtmprintk(ioc, | |
| 6805 | + ioc_info(ioc, "%s: %s\n", | |
| 6806 | + __func__, r == 0 ? "SUCCESS" : "FAILED")); | |
| 6947 | 6807 | |
| 6948 | 6808 | spin_lock_irqsave(&ioc->ioc_reset_in_progress_lock, flags); |
| 6949 | 6809 | ioc->shost_recovery = 0; |
| @@ -6959,7 +6819,6 @@ mpt3sas_base_hard_reset_handler(struct MPT3SAS_ADAPTER *ioc, · 9 unmodified lines | ||
| 6959 | 6819 | mpt3sas_trigger_master(ioc, |
| 6960 | 6820 | MASTER_TRIGGER_ADAPTER_RESET); |
| 6961 | 6821 | } |
| 6962 | − dtmprintk(ioc, pr_info(MPT3SAS_FMT "%s: exit\n", ioc->name, | |
| 6963 | − __func__)); | |
| 6822 | + dtmprintk(ioc, ioc_info(ioc, "%s: exit\n", __func__)); | |
| 6964 | 6823 | return r; |
| 6965 | 6824 | } |
| @@ -158,7 +158,14 @@ struct mpt3sas_nvme_cmd { · 157 unmodified lines | ||
| 158 | 158 | /* |
| 159 | 159 | * logging format |
| 160 | 160 | */ |
| 161 | −#define MPT3SAS_FMT "%s: " | |
| 161 | +#define ioc_err(ioc, fmt, ...) \ | |
| 162 | + pr_err("%s: " fmt, (ioc)->name, ##__VA_ARGS__) | |
| 163 | +#define ioc_notice(ioc, fmt, ...) \ | |
| 164 | + pr_notice("%s: " fmt, (ioc)->name, ##__VA_ARGS__) | |
| 165 | +#define ioc_warn(ioc, fmt, ...) \ | |
| 166 | + pr_warn("%s: " fmt, (ioc)->name, ##__VA_ARGS__) | |
| 167 | +#define ioc_info(ioc, fmt, ...) \ | |
| 168 | + pr_info("%s: " fmt, (ioc)->name, ##__VA_ARGS__) | |
| 162 | 169 | |
| 163 | 170 | /* |
| 164 | 171 | * WarpDrive Specific Log codes |
| @@ -175,20 +175,18 @@ _config_display_some_debug(struct MPT3SAS_ADAPTER *ioc, u16 smid, · 174 unmodified lines | ||
| 175 | 175 | if (!desc) |
| 176 | 176 | return; |
| 177 | 177 | |
| 178 | − pr_info(MPT3SAS_FMT | |
| 179 | − "%s: %s(%d), action(%d), form(0x%08x), smid(%d)\n", | |
| 180 | − ioc->name, calling_function_name, desc, | |
| 181 | − mpi_request->Header.PageNumber, mpi_request->Action, | |
| 182 | − le32_to_cpu(mpi_request->PageAddress), smid); | |
| 178 | + ioc_info(ioc, "%s: %s(%d), action(%d), form(0x%08x), smid(%d)\n", | |
| 179 | + calling_function_name, desc, | |
| 180 | + mpi_request->Header.PageNumber, mpi_request->Action, | |
| 181 | + le32_to_cpu(mpi_request->PageAddress), smid); | |
| 183 | 182 | |
| 184 | 183 | if (!mpi_reply) |
| 185 | 184 | return; |
| 186 | 185 | |
| 187 | 186 | if (mpi_reply->IOCStatus || mpi_reply->IOCLogInfo) |
| 188 | − pr_info(MPT3SAS_FMT | |
| 189 | − "\tiocstatus(0x%04x), loginfo(0x%08x)\n", | |
| 190 | − ioc->name, le16_to_cpu(mpi_reply->IOCStatus), | |
| 191 | − le32_to_cpu(mpi_reply->IOCLogInfo)); | |
| 187 | + ioc_info(ioc, "\tiocstatus(0x%04x), loginfo(0x%08x)\n", | |
| 188 | + le16_to_cpu(mpi_reply->IOCStatus), | |
| 189 | + le32_to_cpu(mpi_reply->IOCLogInfo)); | |
| 192 | 190 | } |
| 193 | 191 | |
| 194 | 192 | /** |
| @@ -210,9 +208,8 @@ _config_alloc_config_dma_memory(struct MPT3SAS_ADAPTER *ioc, · 15 unmodified lines | ||
| 210 | 208 | mem->page = dma_alloc_coherent(&ioc->pdev->dev, mem->sz, |
| 211 | 209 | &mem->page_dma, GFP_KERNEL); |
| 212 | 210 | if (!mem->page) { |
| 213 | − pr_err(MPT3SAS_FMT | |
| 214 | − "%s: dma_alloc_coherent failed asking for (%d) bytes!!\n", | |
| 215 | − ioc->name, __func__, mem->sz); | |
| 211 | + ioc_err(ioc, "%s: dma_alloc_coherent failed asking for (%d) bytes!!\n", | |
| 212 | + __func__, mem->sz); | |
| 216 | 213 | r = -ENOMEM; |
| 217 | 214 | } |
| 218 | 215 | } else { /* use tmp buffer if less than 512 bytes */ |
| @@ -313,8 +310,7 @@ _config_request(struct MPT3SAS_ADAPTER *ioc, Mpi2ConfigRequest_t · 94 unmodified lines | ||
| 313 | 310 | |
| 314 | 311 | mutex_lock(&ioc->config_cmds.mutex); |
| 315 | 312 | if (ioc->config_cmds.status != MPT3_CMD_NOT_USED) { |
| 316 | − pr_err(MPT3SAS_FMT "%s: config_cmd in use\n", | |
| 317 | − ioc->name, __func__); | |
| 313 | + ioc_err(ioc, "%s: config_cmd in use\n", __func__); | |
| 318 | 314 | mutex_unlock(&ioc->config_cmds.mutex); |
| 319 | 315 | return -EAGAIN; |
| 320 | 316 | } |
| @@ -362,34 +358,30 @@ _config_request(struct MPT3SAS_ADAPTER *ioc, Mpi2ConfigRequest_t · 41 unmodified lines | ||
| 362 | 358 | r = -EFAULT; |
| 363 | 359 | goto free_mem; |
| 364 | 360 | } |
| 365 | − pr_info(MPT3SAS_FMT "%s: attempting retry (%d)\n", | |
| 366 | − ioc->name, __func__, retry_count); | |
| 361 | + ioc_info(ioc, "%s: attempting retry (%d)\n", | |
| 362 | + __func__, retry_count); | |
| 367 | 363 | } |
| 368 | 364 | wait_state_count = 0; |
| 369 | 365 | ioc_state = mpt3sas_base_get_iocstate(ioc, 1); |
| 370 | 366 | while (ioc_state != MPI2_IOC_STATE_OPERATIONAL) { |
| 371 | 367 | if (wait_state_count++ == MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT) { |
| 372 | − pr_err(MPT3SAS_FMT | |
| 373 | − "%s: failed due to ioc not operational\n", | |
| 374 | − ioc->name, __func__); | |
| 368 | + ioc_err(ioc, "%s: failed due to ioc not operational\n", | |
| 369 | + __func__); | |
| 375 | 370 | ioc->config_cmds.status = MPT3_CMD_NOT_USED; |
| 376 | 371 | r = -EFAULT; |
| 377 | 372 | goto free_mem; |
| 378 | 373 | } |
| 379 | 374 | ssleep(1); |
| 380 | 375 | ioc_state = mpt3sas_base_get_iocstate(ioc, 1); |
| 381 | − pr_info(MPT3SAS_FMT | |
| 382 | − "%s: waiting for operational state(count=%d)\n", | |
| 383 | − ioc->name, __func__, wait_state_count); | |
| 376 | + ioc_info(ioc, "%s: waiting for operational state(count=%d)\n", | |
| 377 | + __func__, wait_state_count); | |
| 384 | 378 | } |
| 385 | 379 | if (wait_state_count) |
| 386 | − pr_info(MPT3SAS_FMT "%s: ioc is operational\n", | |
| 387 | − ioc->name, __func__); | |
| 380 | + ioc_info(ioc, "%s: ioc is operational\n", __func__); | |
| 388 | 381 | |
| 389 | 382 | smid = mpt3sas_base_get_smid(ioc, ioc->config_cb_idx); |
| 390 | 383 | if (!smid) { |
| 391 | − pr_err(MPT3SAS_FMT "%s: failed obtaining a smid\n", | |
| 392 | − ioc->name, __func__); | |
| 384 | + ioc_err(ioc, "%s: failed obtaining a smid\n", __func__); | |
| 393 | 385 | ioc->config_cmds.status = MPT3_CMD_NOT_USED; |
| 394 | 386 | r = -EAGAIN; |
| 395 | 387 | goto free_mem; |
| @@ -429,12 +421,10 @@ _config_request(struct MPT3SAS_ADAPTER *ioc, Mpi2ConfigRequest_t · 33 unmodified lines | ||
| 429 | 421 | (mpi_reply->Header.PageType & 0xF)) { |
| 430 | 422 | _debug_dump_mf(mpi_request, ioc->request_sz/4); |
| 431 | 423 | _debug_dump_reply(mpi_reply, ioc->request_sz/4); |
| 432 | − panic(KERN_WARNING MPT3SAS_FMT "%s: Firmware BUG:" \ | |
| 433 | − " mpi_reply mismatch: Requested PageType(0x%02x)" \ | |
| 434 | − " Reply PageType(0x%02x)\n", \ | |
| 435 | − ioc->name, __func__, | |
| 436 | − (mpi_request->Header.PageType & 0xF), | |
| 437 | − (mpi_reply->Header.PageType & 0xF)); | |
| 424 | + panic("%s: %s: Firmware BUG: mpi_reply mismatch: Requested PageType(0x%02x) Reply PageType(0x%02x)\n", | |
| 425 | + ioc->name, __func__, | |
| 426 | + mpi_request->Header.PageType & 0xF, | |
| 427 | + mpi_reply->Header.PageType & 0xF); | |
| 438 | 428 | } |
| 439 | 429 | |
| 440 | 430 | if (((mpi_request->Header.PageType & 0xF) == |
| @@ -442,19 +432,18 @@ _config_request(struct MPT3SAS_ADAPTER *ioc, Mpi2ConfigRequest_t · 1 unmodified line | ||
| 442 | 432 | mpi_request->ExtPageType != mpi_reply->ExtPageType) { |
| 443 | 433 | _debug_dump_mf(mpi_request, ioc->request_sz/4); |
| 444 | 434 | _debug_dump_reply(mpi_reply, ioc->request_sz/4); |
| 445 | − panic(KERN_WARNING MPT3SAS_FMT "%s: Firmware BUG:" \ | |
| 446 | − " mpi_reply mismatch: Requested ExtPageType(0x%02x)" | |
| 447 | − " Reply ExtPageType(0x%02x)\n", | |
| 448 | − ioc->name, __func__, mpi_request->ExtPageType, | |
| 449 | − mpi_reply->ExtPageType); | |
| 435 | + panic("%s: %s: Firmware BUG: mpi_reply mismatch: Requested ExtPageType(0x%02x) Reply ExtPageType(0x%02x)\n", | |
| 436 | + ioc->name, __func__, | |
| 437 | + mpi_request->ExtPageType, | |
| 438 | + mpi_reply->ExtPageType); | |
| 450 | 439 | } |
| 451 | 440 | ioc_status = le16_to_cpu(mpi_reply->IOCStatus) |
| 452 | 441 | & MPI2_IOCSTATUS_MASK; |
| 453 | 442 | } |
| 454 | 443 | |
| 455 | 444 | if (retry_count) |
| 456 | − pr_info(MPT3SAS_FMT "%s: retry (%d) completed!!\n", \ | |
| 457 | − ioc->name, __func__, retry_count); | |
| 445 | + ioc_info(ioc, "%s: retry (%d) completed!!\n", | |
| 446 | + __func__, retry_count); | |
| 458 | 447 | |
| 459 | 448 | if ((ioc_status == MPI2_IOCSTATUS_SUCCESS) && |
| 460 | 449 | config_page && mpi_request->Action == |
| @@ -469,14 +458,10 @@ _config_request(struct MPT3SAS_ADAPTER *ioc, Mpi2ConfigRequest_t · 8 unmodified lines | ||
| 469 | 458 | _debug_dump_reply(mpi_reply, ioc->request_sz/4); |
| 470 | 459 | _debug_dump_config(p, min_t(u16, mem.sz, |
| 471 | 460 | config_page_sz)/4); |
| 472 | − panic(KERN_WARNING MPT3SAS_FMT | |
| 473 | − "%s: Firmware BUG:" \ | |
| 474 | − " config page mismatch:" | |
| 475 | − " Requested PageType(0x%02x)" | |
| 476 | − " Reply PageType(0x%02x)\n", | |
| 477 | − ioc->name, __func__, | |
| 478 | − (mpi_request->Header.PageType & 0xF), | |
| 479 | − (p[3] & 0xF)); | |
| 461 | + panic("%s: %s: Firmware BUG: config page mismatch: Requested PageType(0x%02x) Reply PageType(0x%02x)\n", | |
| 462 | + ioc->name, __func__, | |
| 463 | + mpi_request->Header.PageType & 0xF, | |
| 464 | + p[3] & 0xF); | |
| 480 | 465 | } |
| 481 | 466 | |
| 482 | 467 | if (((mpi_request->Header.PageType & 0xF) == |
| @@ -486,13 +471,9 @@ _config_request(struct MPT3SAS_ADAPTER *ioc, Mpi2ConfigRequest_t · 3 unmodified lines | ||
| 486 | 471 | _debug_dump_reply(mpi_reply, ioc->request_sz/4); |
| 487 | 472 | _debug_dump_config(p, min_t(u16, mem.sz, |
| 488 | 473 | config_page_sz)/4); |
| 489 | − panic(KERN_WARNING MPT3SAS_FMT | |
| 490 | − "%s: Firmware BUG:" \ | |
| 491 | − " config page mismatch:" | |
| 492 | − " Requested ExtPageType(0x%02x)" | |
| 493 | − " Reply ExtPageType(0x%02x)\n", | |
| 494 | − ioc->name, __func__, | |
| 495 | − mpi_request->ExtPageType, p[6]); | |
| 474 | + panic("%s: %s: Firmware BUG: config page mismatch: Requested ExtPageType(0x%02x) Reply ExtPageType(0x%02x)\n", | |
| 475 | + ioc->name, __func__, | |
| 476 | + mpi_request->ExtPageType, p[6]); | |
| 496 | 477 | } |
| 497 | 478 | } |
| 498 | 479 | memcpy(config_page, mem.page, min_t(u16, mem.sz, |
| @@ -185,17 +185,15 @@ _ctl_display_some_debug(struct MPT3SAS_ADAPTER *ioc, u16 smid, · 184 unmodified lines | ||
| 185 | 185 | if (!desc) |
| 186 | 186 | return; |
| 187 | 187 | |
| 188 | − pr_info(MPT3SAS_FMT "%s: %s, smid(%d)\n", | |
| 189 | − ioc->name, calling_function_name, desc, smid); | |
| 188 | + ioc_info(ioc, "%s: %s, smid(%d)\n", calling_function_name, desc, smid); | |
| 190 | 189 | |
| 191 | 190 | if (!mpi_reply) |
| 192 | 191 | return; |
| 193 | 192 | |
| 194 | 193 | if (mpi_reply->IOCStatus || mpi_reply->IOCLogInfo) |
| 195 | − pr_info(MPT3SAS_FMT | |
| 196 | − "\tiocstatus(0x%04x), loginfo(0x%08x)\n", | |
| 197 | − ioc->name, le16_to_cpu(mpi_reply->IOCStatus), | |
| 198 | − le32_to_cpu(mpi_reply->IOCLogInfo)); | |
| 194 | + ioc_info(ioc, "\tiocstatus(0x%04x), loginfo(0x%08x)\n", | |
| 195 | + le16_to_cpu(mpi_reply->IOCStatus), | |
| 196 | + le32_to_cpu(mpi_reply->IOCLogInfo)); | |
| 199 | 197 | |
| 200 | 198 | if (mpi_request->Function == MPI2_FUNCTION_SCSI_IO_REQUEST || |
| 201 | 199 | mpi_request->Function == |
| @@ -208,38 +206,32 @@ _ctl_display_some_debug(struct MPT3SAS_ADAPTER *ioc, u16 smid, · 6 unmodified lines | ||
| 208 | 206 | sas_device = mpt3sas_get_sdev_by_handle(ioc, |
| 209 | 207 | le16_to_cpu(scsi_reply->DevHandle)); |
| 210 | 208 | if (sas_device) { |
| 211 | − pr_warn(MPT3SAS_FMT "\tsas_address(0x%016llx), phy(%d)\n", | |
| 212 | − ioc->name, (unsigned long long) | |
| 213 | − sas_device->sas_address, sas_device->phy); | |
| 214 | − pr_warn(MPT3SAS_FMT | |
| 215 | − "\tenclosure_logical_id(0x%016llx), slot(%d)\n", | |
| 216 | − ioc->name, (unsigned long long) | |
| 217 | − sas_device->enclosure_logical_id, sas_device->slot); | |
| 209 | + ioc_warn(ioc, "\tsas_address(0x%016llx), phy(%d)\n", | |
| 210 | + (u64)sas_device->sas_address, | |
| 211 | + sas_device->phy); | |
| 212 | + ioc_warn(ioc, "\tenclosure_logical_id(0x%016llx), slot(%d)\n", | |
| 213 | + (u64)sas_device->enclosure_logical_id, | |
| 214 | + sas_device->slot); | |
| 218 | 215 | sas_device_put(sas_device); |
| 219 | 216 | } |
| 220 | 217 | if (!sas_device) { |
| 221 | 218 | pcie_device = mpt3sas_get_pdev_by_handle(ioc, |
| 222 | 219 | le16_to_cpu(scsi_reply->DevHandle)); |
| 223 | 220 | if (pcie_device) { |
| 224 | − pr_warn(MPT3SAS_FMT | |
| 225 | − "\tWWID(0x%016llx), port(%d)\n", ioc->name, | |
| 226 | − (unsigned long long)pcie_device->wwid, | |
| 227 | − pcie_device->port_num); | |
| 221 | + ioc_warn(ioc, "\tWWID(0x%016llx), port(%d)\n", | |
| 222 | + (unsigned long long)pcie_device->wwid, | |
| 223 | + pcie_device->port_num); | |
| 228 | 224 | if (pcie_device->enclosure_handle != 0) |
| 229 | − pr_warn(MPT3SAS_FMT | |
| 230 | − "\tenclosure_logical_id(0x%016llx), slot(%d)\n", | |
| 231 | − ioc->name, (unsigned long long) | |
| 232 | − pcie_device->enclosure_logical_id, | |
| 233 | − pcie_device->slot); | |
| 225 | + ioc_warn(ioc, "\tenclosure_logical_id(0x%016llx), slot(%d)\n", | |
| 226 | + (u64)pcie_device->enclosure_logical_id, | |
| 227 | + pcie_device->slot); | |
| 234 | 228 | pcie_device_put(pcie_device); |
| 235 | 229 | } |
| 236 | 230 | } |
| 237 | 231 | if (scsi_reply->SCSIState || scsi_reply->SCSIStatus) |
| 238 | − pr_info(MPT3SAS_FMT | |
| 239 | − "\tscsi_state(0x%02x), scsi_status" | |
| 240 | − "(0x%02x)\n", ioc->name, | |
| 241 | − scsi_reply->SCSIState, | |
| 242 | − scsi_reply->SCSIStatus); | |
| 232 | + ioc_info(ioc, "\tscsi_state(0x%02x), scsi_status(0x%02x)\n", | |
| 233 | + scsi_reply->SCSIState, | |
| 234 | + scsi_reply->SCSIStatus); | |
| 243 | 235 | } |
| 244 | 236 | } |
| 245 | 237 | |
| @@ -466,8 +458,7 @@ void mpt3sas_ctl_pre_reset_handler(struct MPT3SAS_ADAPTER *ioc) · 220 unmodified lines | ||
| 466 | 458 | int i; |
| 467 | 459 | u8 issue_reset; |
| 468 | 460 | |
| 469 | − dtmprintk(ioc, pr_info(MPT3SAS_FMT | |
| 470 | − "%s: MPT3_IOC_PRE_RESET\n", ioc->name, __func__)); | |
| 461 | + dtmprintk(ioc, ioc_info(ioc, "%s: MPT3_IOC_PRE_RESET\n", __func__)); | |
| 471 | 462 | for (i = 0; i < MPI2_DIAG_BUF_TYPE_COUNT; i++) { |
| 472 | 463 | if (!(ioc->diag_buffer_status[i] & |
| 473 | 464 | MPT3_DIAG_BUFFER_IS_REGISTERED)) |
| @@ -487,8 +478,7 @@ void mpt3sas_ctl_pre_reset_handler(struct MPT3SAS_ADAPTER *ioc) · 13 unmodified lines | ||
| 487 | 478 | */ |
| 488 | 479 | void mpt3sas_ctl_after_reset_handler(struct MPT3SAS_ADAPTER *ioc) |
| 489 | 480 | { |
| 490 | − dtmprintk(ioc, pr_info(MPT3SAS_FMT | |
| 491 | − "%s: MPT3_IOC_AFTER_RESET\n", ioc->name, __func__)); | |
| 481 | + dtmprintk(ioc, ioc_info(ioc, "%s: MPT3_IOC_AFTER_RESET\n", __func__)); | |
| 492 | 482 | if (ioc->ctl_cmds.status & MPT3_CMD_PENDING) { |
| 493 | 483 | ioc->ctl_cmds.status |= MPT3_CMD_RESET; |
| 494 | 484 | mpt3sas_base_free_smid(ioc, ioc->ctl_cmds.smid); |
| @@ -506,8 +496,7 @@ void mpt3sas_ctl_reset_done_handler(struct MPT3SAS_ADAPTER *ioc) · 11 unmodified lines | ||
| 506 | 496 | { |
| 507 | 497 | int i; |
| 508 | 498 | |
| 509 | − dtmprintk(ioc, pr_info(MPT3SAS_FMT | |
| 510 | − "%s: MPT3_IOC_DONE_RESET\n", ioc->name, __func__)); | |
| 499 | + dtmprintk(ioc, ioc_info(ioc, "%s: MPT3_IOC_DONE_RESET\n", __func__)); | |
| 511 | 500 | |
| 512 | 501 | for (i = 0; i < MPI2_DIAG_BUF_TYPE_COUNT; i++) { |
| 513 | 502 | if (!(ioc->diag_buffer_status[i] & |
| @@ -612,10 +601,10 @@ _ctl_set_task_mid(struct MPT3SAS_ADAPTER *ioc, struct mpt3_ioctl_command *karg, · 98 unmodified lines | ||
| 612 | 601 | } |
| 613 | 602 | |
| 614 | 603 | if (!found) { |
| 615 | − dctlprintk(ioc, pr_info(MPT3SAS_FMT | |
| 616 | − "%s: handle(0x%04x), lun(%d), no active mid!!\n", | |
| 617 | − ioc->name, | |
| 618 | − desc, le16_to_cpu(tm_request->DevHandle), lun)); | |
| 604 | + dctlprintk(ioc, | |
| 605 | + ioc_info(ioc, "%s: handle(0x%04x), lun(%d), no active mid!!\n", | |
| 606 | + desc, le16_to_cpu(tm_request->DevHandle), | |
| 607 | + lun)); | |
| 619 | 608 | tm_reply = ioc->ctl_cmds.reply; |
| 620 | 609 | tm_reply->DevHandle = tm_request->DevHandle; |
| 621 | 610 | 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, · 9 unmodified lines | ||
| 631 | 620 | return 1; |
| 632 | 621 | } |
| 633 | 622 | |
| 634 | − dctlprintk(ioc, pr_info(MPT3SAS_FMT | |
| 635 | − "%s: handle(0x%04x), lun(%d), task_mid(%d)\n", ioc->name, | |
| 636 | − desc, le16_to_cpu(tm_request->DevHandle), lun, | |
| 637 | − le16_to_cpu(tm_request->TaskMID))); | |
| 623 | + dctlprintk(ioc, | |
| 624 | + ioc_info(ioc, "%s: handle(0x%04x), lun(%d), task_mid(%d)\n", | |
| 625 | + desc, le16_to_cpu(tm_request->DevHandle), lun, | |
| 626 | + le16_to_cpu(tm_request->TaskMID))); | |
| 638 | 627 | return 0; |
| 639 | 628 | } |
| 640 | 629 | |
| @@ -672,8 +661,7 @@ _ctl_do_mpt_command(struct MPT3SAS_ADAPTER *ioc, struct mpt3_ioctl_command karg, · 31 unmodified lines | ||
| 672 | 661 | issue_reset = 0; |
| 673 | 662 | |
| 674 | 663 | if (ioc->ctl_cmds.status != MPT3_CMD_NOT_USED) { |
| 675 | − pr_err(MPT3SAS_FMT "%s: ctl_cmd in use\n", | |
| 676 | − ioc->name, __func__); | |
| 664 | + ioc_err(ioc, "%s: ctl_cmd in use\n", __func__); | |
| 677 | 665 | ret = -EAGAIN; |
| 678 | 666 | goto out; |
| 679 | 667 | } |
| @@ -682,28 +670,23 @@ _ctl_do_mpt_command(struct MPT3SAS_ADAPTER *ioc, struct mpt3_ioctl_command karg, · 2 unmodified lines | ||
| 682 | 670 | ioc_state = mpt3sas_base_get_iocstate(ioc, 1); |
| 683 | 671 | while (ioc_state != MPI2_IOC_STATE_OPERATIONAL) { |
| 684 | 672 | if (wait_state_count++ == 10) { |
| 685 | − pr_err(MPT3SAS_FMT | |
| 686 | − "%s: failed due to ioc not operational\n", | |
| 687 | − ioc->name, __func__); | |
| 673 | + ioc_err(ioc, "%s: failed due to ioc not operational\n", | |
| 674 | + __func__); | |
| 688 | 675 | ret = -EFAULT; |
| 689 | 676 | goto out; |
| 690 | 677 | } |
| 691 | 678 | ssleep(1); |
| 692 | 679 | ioc_state = mpt3sas_base_get_iocstate(ioc, 1); |
| 693 | − pr_info(MPT3SAS_FMT | |
| 694 | − "%s: waiting for operational state(count=%d)\n", | |
| 695 | − ioc->name, | |
| 696 | − __func__, wait_state_count); | |
| 680 | + ioc_info(ioc, "%s: waiting for operational state(count=%d)\n", | |
| 681 | + __func__, wait_state_count); | |
| 697 | 682 | } |
| 698 | 683 | if (wait_state_count) |
| 699 | − pr_info(MPT3SAS_FMT "%s: ioc is operational\n", | |
| 700 | − ioc->name, __func__); | |
| 684 | + ioc_info(ioc, "%s: ioc is operational\n", __func__); | |
| 701 | 685 | |
| 702 | 686 | mpi_request = kzalloc(ioc->request_sz, GFP_KERNEL); |
| 703 | 687 | if (!mpi_request) { |
| 704 | − pr_err(MPT3SAS_FMT | |
| 705 | − "%s: failed obtaining a memory for mpi_request\n", | |
| 706 | − ioc->name, __func__); | |
| 688 | + ioc_err(ioc, "%s: failed obtaining a memory for mpi_request\n", | |
| 689 | + __func__); | |
| 707 | 690 | ret = -ENOMEM; |
| 708 | 691 | goto out; |
| 709 | 692 | } |
| @@ -726,8 +709,7 @@ _ctl_do_mpt_command(struct MPT3SAS_ADAPTER *ioc, struct mpt3_ioctl_command karg, · 16 unmodified lines | ||
| 726 | 709 | if (mpi_request->Function == MPI2_FUNCTION_SCSI_TASK_MGMT) { |
| 727 | 710 | smid = mpt3sas_base_get_smid_hpr(ioc, ioc->ctl_cb_idx); |
| 728 | 711 | if (!smid) { |
| 729 | − pr_err(MPT3SAS_FMT "%s: failed obtaining a smid\n", | |
| 730 | − ioc->name, __func__); | |
| 712 | + ioc_err(ioc, "%s: failed obtaining a smid\n", __func__); | |
| 731 | 713 | ret = -EAGAIN; |
| 732 | 714 | goto out; |
| 733 | 715 | } |
| @@ -762,8 +744,8 @@ _ctl_do_mpt_command(struct MPT3SAS_ADAPTER *ioc, struct mpt3_ioctl_command karg, · 28 unmodified lines | ||
| 762 | 744 | |
| 763 | 745 | /* obtain dma-able memory for data transfer */ |
| 764 | 746 | if (data_out_sz) /* WRITE */ { |
| 765 | − data_out = pci_alloc_consistent(ioc->pdev, data_out_sz, | |
| 766 | − &data_out_dma); | |
| 747 | + data_out = dma_alloc_coherent(&ioc->pdev->dev, data_out_sz, | |
| 748 | + &data_out_dma, GFP_KERNEL); | |
| 767 | 749 | if (!data_out) { |
| 768 | 750 | pr_err("failure at %s:%d/%s()!\n", __FILE__, |
| 769 | 751 | __LINE__, __func__); |
| @@ -782,8 +764,8 @@ _ctl_do_mpt_command(struct MPT3SAS_ADAPTER *ioc, struct mpt3_ioctl_command karg, · 12 unmodified lines | ||
| 782 | 764 | } |
| 783 | 765 | |
| 784 | 766 | if (data_in_sz) /* READ */ { |
| 785 | − data_in = pci_alloc_consistent(ioc->pdev, data_in_sz, | |
| 786 | − &data_in_dma); | |
| 767 | + data_in = dma_alloc_coherent(&ioc->pdev->dev, data_in_sz, | |
| 768 | + &data_in_dma, GFP_KERNEL); | |
| 787 | 769 | if (!data_in) { |
| 788 | 770 | pr_err("failure at %s:%d/%s()!\n", __FILE__, |
| 789 | 771 | __LINE__, __func__); |
| @@ -823,9 +805,9 @@ _ctl_do_mpt_command(struct MPT3SAS_ADAPTER *ioc, struct mpt3_ioctl_command karg, · 33 unmodified lines | ||
| 823 | 805 | ioc->build_nvme_prp(ioc, smid, nvme_encap_request, |
| 824 | 806 | data_out_dma, data_out_sz, data_in_dma, data_in_sz); |
| 825 | 807 | if (test_bit(device_handle, ioc->device_remove_in_progress)) { |
| 826 | − dtmprintk(ioc, pr_info(MPT3SAS_FMT "handle(0x%04x) :" | |
| 827 | − "ioctl failed due to device removal in progress\n", | |
| 828 | − ioc->name, device_handle)); | |
| 808 | + dtmprintk(ioc, | |
| 809 | + ioc_info(ioc, "handle(0x%04x): ioctl failed due to device removal in progress\n", | |
| 810 | + device_handle)); | |
| 829 | 811 | mpt3sas_base_free_smid(ioc, smid); |
| 830 | 812 | ret = -EINVAL; |
| 831 | 813 | goto out; |
| @@ -843,9 +825,9 @@ _ctl_do_mpt_command(struct MPT3SAS_ADAPTER *ioc, struct mpt3_ioctl_command karg, · 11 unmodified lines | ||
| 843 | 825 | mpt3sas_base_get_sense_buffer_dma(ioc, smid); |
| 844 | 826 | memset(ioc->ctl_cmds.sense, 0, SCSI_SENSE_BUFFERSIZE); |
| 845 | 827 | if (test_bit(device_handle, ioc->device_remove_in_progress)) { |
| 846 | − dtmprintk(ioc, pr_info(MPT3SAS_FMT | |
| 847 | − "handle(0x%04x) :ioctl failed due to device removal in progress\n", | |
| 848 | − ioc->name, device_handle)); | |
| 828 | + dtmprintk(ioc, | |
| 829 | + ioc_info(ioc, "handle(0x%04x) :ioctl failed due to device removal in progress\n", | |
| 830 | + device_handle)); | |
| 849 | 831 | mpt3sas_base_free_smid(ioc, smid); |
| 850 | 832 | ret = -EINVAL; |
| 851 | 833 | goto out; |
| @@ -863,10 +845,10 @@ _ctl_do_mpt_command(struct MPT3SAS_ADAPTER *ioc, struct mpt3_ioctl_command karg, · 11 unmodified lines | ||
| 863 | 845 | Mpi2SCSITaskManagementRequest_t *tm_request = |
| 864 | 846 | (Mpi2SCSITaskManagementRequest_t *)request; |
| 865 | 847 | |
| 866 | − dtmprintk(ioc, pr_info(MPT3SAS_FMT | |
| 867 | − "TASK_MGMT: handle(0x%04x), task_type(0x%02x)\n", | |
| 868 | − ioc->name, | |
| 869 | − le16_to_cpu(tm_request->DevHandle), tm_request->TaskType)); | |
| 848 | + dtmprintk(ioc, | |
| 849 | + ioc_info(ioc, "TASK_MGMT: handle(0x%04x), task_type(0x%02x)\n", | |
| 850 | + le16_to_cpu(tm_request->DevHandle), | |
| 851 | + tm_request->TaskType)); | |
| 870 | 852 | ioc->got_task_abort_from_ioctl = 1; |
| 871 | 853 | if (tm_request->TaskType == |
| 872 | 854 | MPI2_SCSITASKMGMT_TASKTYPE_ABORT_TASK || |
| @@ -881,9 +863,9 @@ _ctl_do_mpt_command(struct MPT3SAS_ADAPTER *ioc, struct mpt3_ioctl_command karg, · 8 unmodified lines | ||
| 881 | 863 | ioc->got_task_abort_from_ioctl = 0; |
| 882 | 864 | |
| 883 | 865 | if (test_bit(device_handle, ioc->device_remove_in_progress)) { |
| 884 | − dtmprintk(ioc, pr_info(MPT3SAS_FMT | |
| 885 | − "handle(0x%04x) :ioctl failed due to device removal in progress\n", | |
| 886 | − ioc->name, device_handle)); | |
| 866 | + dtmprintk(ioc, | |
| 867 | + ioc_info(ioc, "handle(0x%04x) :ioctl failed due to device removal in progress\n", | |
| 868 | + device_handle)); | |
| 887 | 869 | mpt3sas_base_free_smid(ioc, smid); |
| 888 | 870 | ret = -EINVAL; |
| 889 | 871 | goto out; |
| @@ -929,9 +911,9 @@ _ctl_do_mpt_command(struct MPT3SAS_ADAPTER *ioc, struct mpt3_ioctl_command karg, · 39 unmodified lines | ||
| 929 | 911 | case MPI2_FUNCTION_SATA_PASSTHROUGH: |
| 930 | 912 | { |
| 931 | 913 | if (test_bit(device_handle, ioc->device_remove_in_progress)) { |
| 932 | − dtmprintk(ioc, pr_info(MPT3SAS_FMT | |
| 933 | − "handle(0x%04x) :ioctl failed due to device removal in progress\n", | |
| 934 | − ioc->name, device_handle)); | |
| 914 | + dtmprintk(ioc, | |
| 915 | + ioc_info(ioc, "handle(0x%04x) :ioctl failed due to device removal in progress\n", | |
| 916 | + device_handle)); | |
| 935 | 917 | mpt3sas_base_free_smid(ioc, smid); |
| 936 | 918 | ret = -EINVAL; |
| 937 | 919 | goto out; |
| @@ -1017,12 +999,10 @@ _ctl_do_mpt_command(struct MPT3SAS_ADAPTER *ioc, struct mpt3_ioctl_command karg, · 79 unmodified lines | ||
| 1017 | 999 | Mpi2SCSITaskManagementReply_t *tm_reply = |
| 1018 | 1000 | (Mpi2SCSITaskManagementReply_t *)mpi_reply; |
| 1019 | 1001 | |
| 1020 | − pr_info(MPT3SAS_FMT "TASK_MGMT: " \ | |
| 1021 | − "IOCStatus(0x%04x), IOCLogInfo(0x%08x), " | |
| 1022 | − "TerminationCount(0x%08x)\n", ioc->name, | |
| 1023 | − le16_to_cpu(tm_reply->IOCStatus), | |
| 1024 | − le32_to_cpu(tm_reply->IOCLogInfo), | |
| 1025 | − le32_to_cpu(tm_reply->TerminationCount)); | |
| 1002 | + ioc_info(ioc, "TASK_MGMT: IOCStatus(0x%04x), IOCLogInfo(0x%08x), TerminationCount(0x%08x)\n", | |
| 1003 | + le16_to_cpu(tm_reply->IOCStatus), | |
| 1004 | + le32_to_cpu(tm_reply->IOCLogInfo), | |
| 1005 | + le32_to_cpu(tm_reply->TerminationCount)); | |
| 1026 | 1006 | } |
| 1027 | 1007 | |
| 1028 | 1008 | /* copy out xdata to user */ |
| @@ -1054,9 +1034,7 @@ _ctl_do_mpt_command(struct MPT3SAS_ADAPTER *ioc, struct mpt3_ioctl_command karg, · 25 unmodified lines | ||
| 1054 | 1034 | MPI2_FUNCTION_RAID_SCSI_IO_PASSTHROUGH || mpi_request->Function == |
| 1055 | 1035 | MPI2_FUNCTION_NVME_ENCAPSULATED)) { |
| 1056 | 1036 | if (karg.sense_data_ptr == NULL) { |
| 1057 | − pr_info(MPT3SAS_FMT "Response buffer provided" | |
| 1058 | − " by application is NULL; Response data will" | |
| 1059 | − " not be returned.\n", ioc->name); | |
| 1037 | + ioc_info(ioc, "Response buffer provided by application is NULL; Response data will not be returned\n"); | |
| 1060 | 1038 | goto out; |
| 1061 | 1039 | } |
| 1062 | 1040 | sz_arg = (mpi_request->Function == |
| @@ -1079,9 +1057,8 @@ _ctl_do_mpt_command(struct MPT3SAS_ADAPTER *ioc, struct mpt3_ioctl_command karg, · 16 unmodified lines | ||
| 1079 | 1057 | mpi_request->Function == |
| 1080 | 1058 | MPI2_FUNCTION_RAID_SCSI_IO_PASSTHROUGH || |
| 1081 | 1059 | mpi_request->Function == MPI2_FUNCTION_SATA_PASSTHROUGH)) { |
| 1082 | − pr_info(MPT3SAS_FMT "issue target reset: handle = (0x%04x)\n", | |
| 1083 | − ioc->name, | |
| 1084 | − le16_to_cpu(mpi_request->FunctionDependent1)); | |
| 1060 | + ioc_info(ioc, "issue target reset: handle = (0x%04x)\n", | |
| 1061 | + le16_to_cpu(mpi_request->FunctionDependent1)); | |
| 1085 | 1062 | mpt3sas_halt_firmware(ioc); |
| 1086 | 1063 | pcie_device = mpt3sas_get_pdev_by_handle(ioc, |
| 1087 | 1064 | le16_to_cpu(mpi_request->FunctionDependent1)); |
| @@ -1106,11 +1083,11 @@ _ctl_do_mpt_command(struct MPT3SAS_ADAPTER *ioc, struct mpt3_ioctl_command karg, · 18 unmodified lines | ||
| 1106 | 1083 | |
| 1107 | 1084 | /* free memory associated with sg buffers */ |
| 1108 | 1085 | if (data_in) |
| 1109 | − pci_free_consistent(ioc->pdev, data_in_sz, data_in, | |
| 1086 | + dma_free_coherent(&ioc->pdev->dev, data_in_sz, data_in, | |
| 1110 | 1087 | data_in_dma); |
| 1111 | 1088 | |
| 1112 | 1089 | if (data_out) |
| 1113 | − pci_free_consistent(ioc->pdev, data_out_sz, data_out, | |
| 1090 | + dma_free_coherent(&ioc->pdev->dev, data_out_sz, data_out, | |
| 1114 | 1091 | data_out_dma); |
| 1115 | 1092 | |
| 1116 | 1093 | kfree(mpi_request); |
| @@ -1128,8 +1105,8 @@ _ctl_getiocinfo(struct MPT3SAS_ADAPTER *ioc, void __user *arg) · 11 unmodified lines | ||
| 1128 | 1105 | { |
| 1129 | 1106 | struct mpt3_ioctl_iocinfo karg; |
| 1130 | 1107 | |
| 1131 | − dctlprintk(ioc, pr_info(MPT3SAS_FMT "%s: enter\n", ioc->name, | |
| 1132 | − __func__)); | |
| 1108 | + dctlprintk(ioc, ioc_info(ioc, "%s: enter\n", | |
| 1109 | + __func__)); | |
| 1133 | 1110 | |
| 1134 | 1111 | memset(&karg, 0 , sizeof(karg)); |
| 1135 | 1112 | if (ioc->pfacts) |
| @@ -1188,8 +1165,8 @@ _ctl_eventquery(struct MPT3SAS_ADAPTER *ioc, void __user *arg) · 52 unmodified lines | ||
| 1188 | 1165 | return -EFAULT; |
| 1189 | 1166 | } |
| 1190 | 1167 | |
| 1191 | − dctlprintk(ioc, pr_info(MPT3SAS_FMT "%s: enter\n", ioc->name, | |
| 1192 | − __func__)); | |
| 1168 | + dctlprintk(ioc, ioc_info(ioc, "%s: enter\n", | |
| 1169 | + __func__)); | |
| 1193 | 1170 | |
| 1194 | 1171 | karg.event_entries = MPT3SAS_CTL_EVENT_LOG_SIZE; |
| 1195 | 1172 | memcpy(karg.event_types, ioc->event_type, |
| @@ -1219,8 +1196,8 @@ _ctl_eventenable(struct MPT3SAS_ADAPTER *ioc, void __user *arg) · 23 unmodified lines | ||
| 1219 | 1196 | return -EFAULT; |
| 1220 | 1197 | } |
| 1221 | 1198 | |
| 1222 | − dctlprintk(ioc, pr_info(MPT3SAS_FMT "%s: enter\n", ioc->name, | |
| 1223 | − __func__)); | |
| 1199 | + dctlprintk(ioc, ioc_info(ioc, "%s: enter\n", | |
| 1200 | + __func__)); | |
| 1224 | 1201 | |
| 1225 | 1202 | memcpy(ioc->event_type, karg.event_types, |
| 1226 | 1203 | MPI2_EVENT_NOTIFY_EVENTMASK_WORDS * sizeof(u32)); |
| @@ -1259,8 +1236,8 @@ _ctl_eventreport(struct MPT3SAS_ADAPTER *ioc, void __user *arg) · 32 unmodified lines | ||
| 1259 | 1236 | return -EFAULT; |
| 1260 | 1237 | } |
| 1261 | 1238 | |
| 1262 | − dctlprintk(ioc, pr_info(MPT3SAS_FMT "%s: enter\n", ioc->name, | |
| 1263 | − __func__)); | |
| 1239 | + dctlprintk(ioc, ioc_info(ioc, "%s: enter\n", | |
| 1240 | + __func__)); | |
| 1264 | 1241 | |
| 1265 | 1242 | number_bytes = karg.hdr.max_data_size - |
| 1266 | 1243 | sizeof(struct mpt3_ioctl_header); |
| @@ -1306,12 +1283,11 @@ _ctl_do_reset(struct MPT3SAS_ADAPTER *ioc, void __user *arg) · 39 unmodified lines | ||
| 1306 | 1283 | ioc->is_driver_loading) |
| 1307 | 1284 | return -EAGAIN; |
| 1308 | 1285 | |
| 1309 | − dctlprintk(ioc, pr_info(MPT3SAS_FMT "%s: enter\n", ioc->name, | |
| 1310 | − __func__)); | |
| 1286 | + dctlprintk(ioc, ioc_info(ioc, "%s: enter\n", | |
| 1287 | + __func__)); | |
| 1311 | 1288 | |
| 1312 | 1289 | retval = mpt3sas_base_hard_reset_handler(ioc, FORCE_BIG_HAMMER); |
| 1313 | − pr_info(MPT3SAS_FMT "host reset: %s\n", | |
| 1314 | − ioc->name, ((!retval) ? "SUCCESS" : "FAILED")); | |
| 1290 | + ioc_info(ioc, "host reset: %s\n", ((!retval) ? "SUCCESS" : "FAILED")); | |
| 1315 | 1291 | return 0; |
| 1316 | 1292 | } |
| 1317 | 1293 | |
| @@ -1440,8 +1416,8 @@ _ctl_btdh_mapping(struct MPT3SAS_ADAPTER *ioc, void __user *arg) · 122 unmodified lines | ||
| 1440 | 1416 | return -EFAULT; |
| 1441 | 1417 | } |
| 1442 | 1418 | |
| 1443 | − dctlprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name, | |
| 1444 | − __func__)); | |
| 1419 | + dctlprintk(ioc, ioc_info(ioc, "%s\n", | |
| 1420 | + __func__)); | |
| 1445 | 1421 | |
| 1446 | 1422 | rc = _ctl_btdh_search_sas_device(ioc, &karg); |
| 1447 | 1423 | if (!rc) |
| @@ -1512,53 +1488,46 @@ _ctl_diag_register_2(struct MPT3SAS_ADAPTER *ioc, · 64 unmodified lines | ||
| 1512 | 1488 | u32 ioc_state; |
| 1513 | 1489 | u8 issue_reset = 0; |
| 1514 | 1490 | |
| 1515 | − dctlprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name, | |
| 1516 | − __func__)); | |
| 1491 | + dctlprintk(ioc, ioc_info(ioc, "%s\n", | |
| 1492 | + __func__)); | |
| 1517 | 1493 | |
| 1518 | 1494 | ioc_state = mpt3sas_base_get_iocstate(ioc, 1); |
| 1519 | 1495 | if (ioc_state != MPI2_IOC_STATE_OPERATIONAL) { |
| 1520 | − pr_err(MPT3SAS_FMT | |
| 1521 | − "%s: failed due to ioc not operational\n", | |
| 1522 | − ioc->name, __func__); | |
| 1496 | + ioc_err(ioc, "%s: failed due to ioc not operational\n", | |
| 1497 | + __func__); | |
| 1523 | 1498 | rc = -EAGAIN; |
| 1524 | 1499 | goto out; |
| 1525 | 1500 | } |
| 1526 | 1501 | |
| 1527 | 1502 | if (ioc->ctl_cmds.status != MPT3_CMD_NOT_USED) { |
| 1528 | − pr_err(MPT3SAS_FMT "%s: ctl_cmd in use\n", | |
| 1529 | − ioc->name, __func__); | |
| 1503 | + ioc_err(ioc, "%s: ctl_cmd in use\n", __func__); | |
| 1530 | 1504 | rc = -EAGAIN; |
| 1531 | 1505 | goto out; |
| 1532 | 1506 | } |
| 1533 | 1507 | |
| 1534 | 1508 | buffer_type = diag_register->buffer_type; |
| 1535 | 1509 | if (!_ctl_diag_capability(ioc, buffer_type)) { |
| 1536 | − pr_err(MPT3SAS_FMT | |
| 1537 | − "%s: doesn't have capability for buffer_type(0x%02x)\n", | |
| 1538 | − ioc->name, __func__, buffer_type); | |
| 1510 | + ioc_err(ioc, "%s: doesn't have capability for buffer_type(0x%02x)\n", | |
| 1511 | + __func__, buffer_type); | |
| 1539 | 1512 | return -EPERM; |
| 1540 | 1513 | } |
| 1541 | 1514 | |
| 1542 | 1515 | if (ioc->diag_buffer_status[buffer_type] & |
| 1543 | 1516 | MPT3_DIAG_BUFFER_IS_REGISTERED) { |
| 1544 | − pr_err(MPT3SAS_FMT | |
| 1545 | − "%s: already has a registered buffer for buffer_type(0x%02x)\n", | |
| 1546 | − ioc->name, __func__, | |
| 1547 | − buffer_type); | |
| 1517 | + ioc_err(ioc, "%s: already has a registered buffer for buffer_type(0x%02x)\n", | |
| 1518 | + __func__, buffer_type); | |
| 1548 | 1519 | return -EINVAL; |
| 1549 | 1520 | } |
| 1550 | 1521 | |
| 1551 | 1522 | if (diag_register->requested_buffer_size % 4) { |
| 1552 | − pr_err(MPT3SAS_FMT | |
| 1553 | − "%s: the requested_buffer_size is not 4 byte aligned\n", | |
| 1554 | − ioc->name, __func__); | |
| 1523 | + ioc_err(ioc, "%s: the requested_buffer_size is not 4 byte aligned\n", | |
| 1524 | + __func__); | |
| 1555 | 1525 | return -EINVAL; |
| 1556 | 1526 | } |
| 1557 | 1527 | |
| 1558 | 1528 | smid = mpt3sas_base_get_smid(ioc, ioc->ctl_cb_idx); |
| 1559 | 1529 | if (!smid) { |
| 1560 | − pr_err(MPT3SAS_FMT "%s: failed obtaining a smid\n", | |
| 1561 | − ioc->name, __func__); | |
| 1530 | + ioc_err(ioc, "%s: failed obtaining a smid\n", __func__); | |
| 1562 | 1531 | rc = -EAGAIN; |
| 1563 | 1532 | goto out; |
| 1564 | 1533 | } |
| @@ -1580,9 +1549,9 @@ _ctl_diag_register_2(struct MPT3SAS_ADAPTER *ioc, · 15 unmodified lines | ||
| 1580 | 1549 | if (request_data) { |
| 1581 | 1550 | request_data_dma = ioc->diag_buffer_dma[buffer_type]; |
| 1582 | 1551 | if (request_data_sz != ioc->diag_buffer_sz[buffer_type]) { |
| 1583 | − pci_free_consistent(ioc->pdev, | |
| 1584 | − ioc->diag_buffer_sz[buffer_type], | |
| 1585 | − request_data, request_data_dma); | |
| 1552 | + dma_free_coherent(&ioc->pdev->dev, | |
| 1553 | + ioc->diag_buffer_sz[buffer_type], | |
| 1554 | + request_data, request_data_dma); | |
| 1586 | 1555 | request_data = NULL; |
| 1587 | 1556 | } |
| 1588 | 1557 | } |
| @@ -1590,12 +1559,11 @@ _ctl_diag_register_2(struct MPT3SAS_ADAPTER *ioc, · 1 unmodified line | ||
| 1590 | 1559 | if (request_data == NULL) { |
| 1591 | 1560 | ioc->diag_buffer_sz[buffer_type] = 0; |
| 1592 | 1561 | ioc->diag_buffer_dma[buffer_type] = 0; |
| 1593 | − request_data = pci_alloc_consistent( | |
| 1594 | − ioc->pdev, request_data_sz, &request_data_dma); | |
| 1562 | + request_data = dma_alloc_coherent(&ioc->pdev->dev, | |
| 1563 | + request_data_sz, &request_data_dma, GFP_KERNEL); | |
| 1595 | 1564 | if (request_data == NULL) { |
| 1596 | − pr_err(MPT3SAS_FMT "%s: failed allocating memory" \ | |
| 1597 | − " for diag buffers, requested size(%d)\n", | |
| 1598 | − ioc->name, __func__, request_data_sz); | |
| 1565 | + ioc_err(ioc, "%s: failed allocating memory for diag buffers, requested size(%d)\n", | |
| 1566 | + __func__, request_data_sz); | |
| 1599 | 1567 | mpt3sas_base_free_smid(ioc, smid); |
| 1600 | 1568 | return -ENOMEM; |
| 1601 | 1569 | } |
| @@ -1612,11 +1580,11 @@ _ctl_diag_register_2(struct MPT3SAS_ADAPTER *ioc, · 10 unmodified lines | ||
| 1612 | 1580 | mpi_request->VF_ID = 0; /* TODO */ |
| 1613 | 1581 | mpi_request->VP_ID = 0; |
| 1614 | 1582 | |
| 1615 | − dctlprintk(ioc, pr_info(MPT3SAS_FMT | |
| 1616 | − "%s: diag_buffer(0x%p), dma(0x%llx), sz(%d)\n", | |
| 1617 | − ioc->name, __func__, request_data, | |
| 1618 | − (unsigned long long)request_data_dma, | |
| 1619 | − le32_to_cpu(mpi_request->BufferLength))); | |
| 1583 | + dctlprintk(ioc, | |
| 1584 | + ioc_info(ioc, "%s: diag_buffer(0x%p), dma(0x%llx), sz(%d)\n", | |
| 1585 | + __func__, request_data, | |
| 1586 | + (unsigned long long)request_data_dma, | |
| 1587 | + le32_to_cpu(mpi_request->BufferLength))); | |
| 1620 | 1588 | |
| 1621 | 1589 | for (i = 0; i < MPT3_PRODUCT_SPECIFIC_DWORDS; i++) |
| 1622 | 1590 | mpi_request->ProductSpecific[i] = |
| @@ -1637,8 +1605,7 @@ _ctl_diag_register_2(struct MPT3SAS_ADAPTER *ioc, · 14 unmodified lines | ||
| 1637 | 1605 | |
| 1638 | 1606 | /* process the completed Reply Message Frame */ |
| 1639 | 1607 | if ((ioc->ctl_cmds.status & MPT3_CMD_REPLY_VALID) == 0) { |
| 1640 | − pr_err(MPT3SAS_FMT "%s: no reply message\n", | |
| 1641 | − ioc->name, __func__); | |
| 1608 | + ioc_err(ioc, "%s: no reply message\n", __func__); | |
| 1642 | 1609 | rc = -EFAULT; |
| 1643 | 1610 | goto out; |
| 1644 | 1611 | } |
| @@ -1649,13 +1616,11 @@ _ctl_diag_register_2(struct MPT3SAS_ADAPTER *ioc, · 4 unmodified lines | ||
| 1649 | 1616 | if (ioc_status == MPI2_IOCSTATUS_SUCCESS) { |
| 1650 | 1617 | ioc->diag_buffer_status[buffer_type] |= |
| 1651 | 1618 | MPT3_DIAG_BUFFER_IS_REGISTERED; |
| 1652 | − dctlprintk(ioc, pr_info(MPT3SAS_FMT "%s: success\n", | |
| 1653 | − ioc->name, __func__)); | |
| 1619 | + dctlprintk(ioc, ioc_info(ioc, "%s: success\n", __func__)); | |
| 1654 | 1620 | } else { |
| 1655 | − pr_info(MPT3SAS_FMT | |
| 1656 | − "%s: ioc_status(0x%04x) log_info(0x%08x)\n", | |
| 1657 | − ioc->name, __func__, | |
| 1658 | − ioc_status, le32_to_cpu(mpi_reply->IOCLogInfo)); | |
| 1621 | + ioc_info(ioc, "%s: ioc_status(0x%04x) log_info(0x%08x)\n", | |
| 1622 | + __func__, | |
| 1623 | + ioc_status, le32_to_cpu(mpi_reply->IOCLogInfo)); | |
| 1659 | 1624 | rc = -EFAULT; |
| 1660 | 1625 | } |
| 1661 | 1626 | |
| @@ -1666,7 +1631,7 @@ _ctl_diag_register_2(struct MPT3SAS_ADAPTER *ioc, · 4 unmodified lines | ||
| 1666 | 1631 | out: |
| 1667 | 1632 | |
| 1668 | 1633 | if (rc && request_data) |
| 1669 | − pci_free_consistent(ioc->pdev, request_data_sz, | |
| 1634 | + dma_free_coherent(&ioc->pdev->dev, request_data_sz, | |
| 1670 | 1635 | request_data, request_data_dma); |
| 1671 | 1636 | |
| 1672 | 1637 | ioc->ctl_cmds.status = MPT3_CMD_NOT_USED; |
| @@ -1689,8 +1654,7 @@ mpt3sas_enable_diag_buffer(struct MPT3SAS_ADAPTER *ioc, u8 bits_to_register) · 16 unmodified lines | ||
| 1689 | 1654 | memset(&diag_register, 0, sizeof(struct mpt3_diag_register)); |
| 1690 | 1655 | |
| 1691 | 1656 | if (bits_to_register & 1) { |
| 1692 | − pr_info(MPT3SAS_FMT "registering trace buffer support\n", | |
| 1693 | − ioc->name); | |
| 1657 | + ioc_info(ioc, "registering trace buffer support\n"); | |
| 1694 | 1658 | ioc->diag_trigger_master.MasterData = |
| 1695 | 1659 | (MASTER_TRIGGER_FW_FAULT + MASTER_TRIGGER_ADAPTER_RESET); |
| 1696 | 1660 | 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) · 4 unmodified lines | ||
| 1701 | 1665 | } |
| 1702 | 1666 | |
| 1703 | 1667 | if (bits_to_register & 2) { |
| 1704 | − pr_info(MPT3SAS_FMT "registering snapshot buffer support\n", | |
| 1705 | − ioc->name); | |
| 1668 | + ioc_info(ioc, "registering snapshot buffer support\n"); | |
| 1706 | 1669 | diag_register.buffer_type = MPI2_DIAG_BUF_TYPE_SNAPSHOT; |
| 1707 | 1670 | /* register for 2MB buffers */ |
| 1708 | 1671 | diag_register.requested_buffer_size = 2 * (1024 * 1024); |
| @@ -1711,8 +1674,7 @@ mpt3sas_enable_diag_buffer(struct MPT3SAS_ADAPTER *ioc, u8 bits_to_register) · 2 unmodified lines | ||
| 1711 | 1674 | } |
| 1712 | 1675 | |
| 1713 | 1676 | if (bits_to_register & 4) { |
| 1714 | − pr_info(MPT3SAS_FMT "registering extended buffer support\n", | |
| 1715 | − ioc->name); | |
| 1677 | + ioc_info(ioc, "registering extended buffer support\n"); | |
| 1716 | 1678 | diag_register.buffer_type = MPI2_DIAG_BUF_TYPE_EXTENDED; |
| 1717 | 1679 | /* register for 2MB buffers */ |
| 1718 | 1680 | diag_register.requested_buffer_size = 2 * (1024 * 1024); |
| @@ -1768,51 +1730,46 @@ _ctl_diag_unregister(struct MPT3SAS_ADAPTER *ioc, void __user *arg) · 49 unmodified lines | ||
| 1768 | 1730 | return -EFAULT; |
| 1769 | 1731 | } |
| 1770 | 1732 | |
| 1771 | − dctlprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name, | |
| 1772 | − __func__)); | |
| 1733 | + dctlprintk(ioc, ioc_info(ioc, "%s\n", | |
| 1734 | + __func__)); | |
| 1773 | 1735 | |
| 1774 | 1736 | buffer_type = karg.unique_id & 0x000000ff; |
| 1775 | 1737 | if (!_ctl_diag_capability(ioc, buffer_type)) { |
| 1776 | − pr_err(MPT3SAS_FMT | |
| 1777 | − "%s: doesn't have capability for buffer_type(0x%02x)\n", | |
| 1778 | − ioc->name, __func__, buffer_type); | |
| 1738 | + ioc_err(ioc, "%s: doesn't have capability for buffer_type(0x%02x)\n", | |
| 1739 | + __func__, buffer_type); | |
| 1779 | 1740 | return -EPERM; |
| 1780 | 1741 | } |
| 1781 | 1742 | |
| 1782 | 1743 | if ((ioc->diag_buffer_status[buffer_type] & |
| 1783 | 1744 | MPT3_DIAG_BUFFER_IS_REGISTERED) == 0) { |
| 1784 | − pr_err(MPT3SAS_FMT | |
| 1785 | − "%s: buffer_type(0x%02x) is not registered\n", | |
| 1786 | − ioc->name, __func__, buffer_type); | |
| 1745 | + ioc_err(ioc, "%s: buffer_type(0x%02x) is not registered\n", | |
| 1746 | + __func__, buffer_type); | |
| 1787 | 1747 | return -EINVAL; |
| 1788 | 1748 | } |
| 1789 | 1749 | if ((ioc->diag_buffer_status[buffer_type] & |
| 1790 | 1750 | MPT3_DIAG_BUFFER_IS_RELEASED) == 0) { |
| 1791 | − pr_err(MPT3SAS_FMT | |
| 1792 | − "%s: buffer_type(0x%02x) has not been released\n", | |
| 1793 | − ioc->name, __func__, buffer_type); | |
| 1751 | + ioc_err(ioc, "%s: buffer_type(0x%02x) has not been released\n", | |
| 1752 | + __func__, buffer_type); | |
| 1794 | 1753 | return -EINVAL; |
| 1795 | 1754 | } |
| 1796 | 1755 | |
| 1797 | 1756 | if (karg.unique_id != ioc->unique_id[buffer_type]) { |
| 1798 | − pr_err(MPT3SAS_FMT | |
| 1799 | − "%s: unique_id(0x%08x) is not registered\n", | |
| 1800 | − ioc->name, __func__, karg.unique_id); | |
| 1757 | + ioc_err(ioc, "%s: unique_id(0x%08x) is not registered\n", | |
| 1758 | + __func__, karg.unique_id); | |
| 1801 | 1759 | return -EINVAL; |
| 1802 | 1760 | } |
| 1803 | 1761 | |
| 1804 | 1762 | request_data = ioc->diag_buffer[buffer_type]; |
| 1805 | 1763 | if (!request_data) { |
| 1806 | − pr_err(MPT3SAS_FMT | |
| 1807 | − "%s: doesn't have memory allocated for buffer_type(0x%02x)\n", | |
| 1808 | − ioc->name, __func__, buffer_type); | |
| 1764 | + ioc_err(ioc, "%s: doesn't have memory allocated for buffer_type(0x%02x)\n", | |
| 1765 | + __func__, buffer_type); | |
| 1809 | 1766 | return -ENOMEM; |
| 1810 | 1767 | } |
| 1811 | 1768 | |
| 1812 | 1769 | request_data_sz = ioc->diag_buffer_sz[buffer_type]; |
| 1813 | 1770 | request_data_dma = ioc->diag_buffer_dma[buffer_type]; |
| 1814 | − pci_free_consistent(ioc->pdev, request_data_sz, | |
| 1815 | − request_data, request_data_dma); | |
| 1771 | + dma_free_coherent(&ioc->pdev->dev, request_data_sz, | |
| 1772 | + request_data, request_data_dma); | |
| 1816 | 1773 | ioc->diag_buffer[buffer_type] = NULL; |
| 1817 | 1774 | ioc->diag_buffer_status[buffer_type] = 0; |
| 1818 | 1775 | return 0; |
| @@ -1841,41 +1798,37 @@ _ctl_diag_query(struct MPT3SAS_ADAPTER *ioc, void __user *arg) · 22 unmodified lines | ||
| 1841 | 1798 | return -EFAULT; |
| 1842 | 1799 | } |
| 1843 | 1800 | |
| 1844 | − dctlprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name, | |
| 1845 | − __func__)); | |
| 1801 | + dctlprintk(ioc, ioc_info(ioc, "%s\n", | |
| 1802 | + __func__)); | |
| 1846 | 1803 | |
| 1847 | 1804 | karg.application_flags = 0; |
| 1848 | 1805 | buffer_type = karg.buffer_type; |
| 1849 | 1806 | |
| 1850 | 1807 | if (!_ctl_diag_capability(ioc, buffer_type)) { |
| 1851 | − pr_err(MPT3SAS_FMT | |
| 1852 | − "%s: doesn't have capability for buffer_type(0x%02x)\n", | |
| 1853 | − ioc->name, __func__, buffer_type); | |
| 1808 | + ioc_err(ioc, "%s: doesn't have capability for buffer_type(0x%02x)\n", | |
| 1809 | + __func__, buffer_type); | |
| 1854 | 1810 | return -EPERM; |
| 1855 | 1811 | } |
| 1856 | 1812 | |
| 1857 | 1813 | if ((ioc->diag_buffer_status[buffer_type] & |
| 1858 | 1814 | MPT3_DIAG_BUFFER_IS_REGISTERED) == 0) { |
| 1859 | − pr_err(MPT3SAS_FMT | |
| 1860 | − "%s: buffer_type(0x%02x) is not registered\n", | |
| 1861 | − ioc->name, __func__, buffer_type); | |
| 1815 | + ioc_err(ioc, "%s: buffer_type(0x%02x) is not registered\n", | |
| 1816 | + __func__, buffer_type); | |
| 1862 | 1817 | return -EINVAL; |
| 1863 | 1818 | } |
| 1864 | 1819 | |
| 1865 | 1820 | if (karg.unique_id & 0xffffff00) { |
| 1866 | 1821 | if (karg.unique_id != ioc->unique_id[buffer_type]) { |
| 1867 | − pr_err(MPT3SAS_FMT | |
| 1868 | − "%s: unique_id(0x%08x) is not registered\n", | |
| 1869 | − ioc->name, __func__, karg.unique_id); | |
| 1822 | + ioc_err(ioc, "%s: unique_id(0x%08x) is not registered\n", | |
| 1823 | + __func__, karg.unique_id); | |
| 1870 | 1824 | return -EINVAL; |
| 1871 | 1825 | } |
| 1872 | 1826 | } |
| 1873 | 1827 | |
| 1874 | 1828 | request_data = ioc->diag_buffer[buffer_type]; |
| 1875 | 1829 | if (!request_data) { |
| 1876 | − pr_err(MPT3SAS_FMT | |
| 1877 | − "%s: doesn't have buffer for buffer_type(0x%02x)\n", | |
| 1878 | − ioc->name, __func__, buffer_type); | |
| 1830 | + ioc_err(ioc, "%s: doesn't have buffer for buffer_type(0x%02x)\n", | |
| 1831 | + __func__, buffer_type); | |
| 1879 | 1832 | return -ENOMEM; |
| 1880 | 1833 | } |
| 1881 | 1834 | |
| @@ -1897,9 +1850,8 @@ _ctl_diag_query(struct MPT3SAS_ADAPTER *ioc, void __user *arg) · 15 unmodified lines | ||
| 1897 | 1850 | karg.diagnostic_flags = ioc->diagnostic_flags[buffer_type]; |
| 1898 | 1851 | |
| 1899 | 1852 | if (copy_to_user(arg, &karg, sizeof(struct mpt3_diag_query))) { |
| 1900 | − pr_err(MPT3SAS_FMT | |
| 1901 | − "%s: unable to write mpt3_diag_query data @ %p\n", | |
| 1902 | − ioc->name, __func__, arg); | |
| 1853 | + ioc_err(ioc, "%s: unable to write mpt3_diag_query data @ %p\n", | |
| 1854 | + __func__, arg); | |
| 1903 | 1855 | return -EFAULT; |
| 1904 | 1856 | } |
| 1905 | 1857 | return 0; |
| @@ -1923,8 +1875,8 @@ mpt3sas_send_diag_release(struct MPT3SAS_ADAPTER *ioc, u8 buffer_type, · 17 unmodified lines | ||
| 1923 | 1875 | u32 ioc_state; |
| 1924 | 1876 | int rc; |
| 1925 | 1877 | |
| 1926 | − dctlprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name, | |
| 1927 | − __func__)); | |
| 1878 | + dctlprintk(ioc, ioc_info(ioc, "%s\n", | |
| 1879 | + __func__)); | |
| 1928 | 1880 | |
| 1929 | 1881 | rc = 0; |
| 1930 | 1882 | *issue_reset = 0; |
| @@ -1935,24 +1887,22 @@ mpt3sas_send_diag_release(struct MPT3SAS_ADAPTER *ioc, u8 buffer_type, · 4 unmodified lines | ||
| 1935 | 1887 | MPT3_DIAG_BUFFER_IS_REGISTERED) |
| 1936 | 1888 | ioc->diag_buffer_status[buffer_type] |= |
| 1937 | 1889 | MPT3_DIAG_BUFFER_IS_RELEASED; |
| 1938 | − dctlprintk(ioc, pr_info(MPT3SAS_FMT | |
| 1939 | − "%s: skipping due to FAULT state\n", ioc->name, | |
| 1940 | − __func__)); | |
| 1890 | + dctlprintk(ioc, | |
| 1891 | + ioc_info(ioc, "%s: skipping due to FAULT state\n", | |
| 1892 | + __func__)); | |
| 1941 | 1893 | rc = -EAGAIN; |
| 1942 | 1894 | goto out; |
| 1943 | 1895 | } |
| 1944 | 1896 | |
| 1945 | 1897 | if (ioc->ctl_cmds.status != MPT3_CMD_NOT_USED) { |
| 1946 | − pr_err(MPT3SAS_FMT "%s: ctl_cmd in use\n", | |
| 1947 | − ioc->name, __func__); | |
| 1898 | + ioc_err(ioc, "%s: ctl_cmd in use\n", __func__); | |
| 1948 | 1899 | rc = -EAGAIN; |
| 1949 | 1900 | goto out; |
| 1950 | 1901 | } |
| 1951 | 1902 | |
| 1952 | 1903 | smid = mpt3sas_base_get_smid(ioc, ioc->ctl_cb_idx); |
| 1953 | 1904 | if (!smid) { |
| 1954 | − pr_err(MPT3SAS_FMT "%s: failed obtaining a smid\n", | |
| 1955 | − ioc->name, __func__); | |
| 1905 | + ioc_err(ioc, "%s: failed obtaining a smid\n", __func__); | |
| 1956 | 1906 | rc = -EAGAIN; |
| 1957 | 1907 | goto out; |
| 1958 | 1908 | } |
| @@ -1982,8 +1932,7 @@ mpt3sas_send_diag_release(struct MPT3SAS_ADAPTER *ioc, u8 buffer_type, · 23 unmodified lines | ||
| 1982 | 1932 | |
| 1983 | 1933 | /* process the completed Reply Message Frame */ |
| 1984 | 1934 | if ((ioc->ctl_cmds.status & MPT3_CMD_REPLY_VALID) == 0) { |
| 1985 | − pr_err(MPT3SAS_FMT "%s: no reply message\n", | |
| 1986 | − ioc->name, __func__); | |
| 1935 | + ioc_err(ioc, "%s: no reply message\n", __func__); | |
| 1987 | 1936 | rc = -EFAULT; |
| 1988 | 1937 | goto out; |
| 1989 | 1938 | } |
| @@ -1994,13 +1943,11 @@ mpt3sas_send_diag_release(struct MPT3SAS_ADAPTER *ioc, u8 buffer_type, · 4 unmodified lines | ||
| 1994 | 1943 | if (ioc_status == MPI2_IOCSTATUS_SUCCESS) { |
| 1995 | 1944 | ioc->diag_buffer_status[buffer_type] |= |
| 1996 | 1945 | MPT3_DIAG_BUFFER_IS_RELEASED; |
| 1997 | − dctlprintk(ioc, pr_info(MPT3SAS_FMT "%s: success\n", | |
| 1998 | − ioc->name, __func__)); | |
| 1946 | + dctlprintk(ioc, ioc_info(ioc, "%s: success\n", __func__)); | |
| 1999 | 1947 | } else { |
| 2000 | − pr_info(MPT3SAS_FMT | |
| 2001 | − "%s: ioc_status(0x%04x) log_info(0x%08x)\n", | |
| 2002 | − ioc->name, __func__, | |
| 2003 | − ioc_status, le32_to_cpu(mpi_reply->IOCLogInfo)); | |
| 1948 | + ioc_info(ioc, "%s: ioc_status(0x%04x) log_info(0x%08x)\n", | |
| 1949 | + __func__, | |
| 1950 | + ioc_status, le32_to_cpu(mpi_reply->IOCLogInfo)); | |
| 2004 | 1951 | rc = -EFAULT; |
| 2005 | 1952 | } |
| 2006 | 1953 | |
| @@ -2033,47 +1980,41 @@ _ctl_diag_release(struct MPT3SAS_ADAPTER *ioc, void __user *arg) · 26 unmodified lines | ||
| 2033 | 1980 | return -EFAULT; |
| 2034 | 1981 | } |
| 2035 | 1982 | |
| 2036 | − dctlprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name, | |
| 2037 | − __func__)); | |
| 1983 | + dctlprintk(ioc, ioc_info(ioc, "%s\n", | |
| 1984 | + __func__)); | |
| 2038 | 1985 | |
| 2039 | 1986 | buffer_type = karg.unique_id & 0x000000ff; |
| 2040 | 1987 | if (!_ctl_diag_capability(ioc, buffer_type)) { |
| 2041 | − pr_err(MPT3SAS_FMT | |
| 2042 | − "%s: doesn't have capability for buffer_type(0x%02x)\n", | |
| 2043 | − ioc->name, __func__, buffer_type); | |
| 1988 | + ioc_err(ioc, "%s: doesn't have capability for buffer_type(0x%02x)\n", | |
| 1989 | + __func__, buffer_type); | |
| 2044 | 1990 | return -EPERM; |
| 2045 | 1991 | } |
| 2046 | 1992 | |
| 2047 | 1993 | if ((ioc->diag_buffer_status[buffer_type] & |
| 2048 | 1994 | MPT3_DIAG_BUFFER_IS_REGISTERED) == 0) { |
| 2049 | − pr_err(MPT3SAS_FMT | |
| 2050 | − "%s: buffer_type(0x%02x) is not registered\n", | |
| 2051 | − ioc->name, __func__, buffer_type); | |
| 1995 | + ioc_err(ioc, "%s: buffer_type(0x%02x) is not registered\n", | |
| 1996 | + __func__, buffer_type); | |
| 2052 | 1997 | return -EINVAL; |
| 2053 | 1998 | } |
| 2054 | 1999 | |
| 2055 | 2000 | if (karg.unique_id != ioc->unique_id[buffer_type]) { |
| 2056 | − pr_err(MPT3SAS_FMT | |
| 2057 | − "%s: unique_id(0x%08x) is not registered\n", | |
| 2058 | − ioc->name, __func__, karg.unique_id); | |
| 2001 | + ioc_err(ioc, "%s: unique_id(0x%08x) is not registered\n", | |
| 2002 | + __func__, karg.unique_id); | |
| 2059 | 2003 | return -EINVAL; |
| 2060 | 2004 | } |
| 2061 | 2005 | |
| 2062 | 2006 | if (ioc->diag_buffer_status[buffer_type] & |
| 2063 | 2007 | MPT3_DIAG_BUFFER_IS_RELEASED) { |
| 2064 | − pr_err(MPT3SAS_FMT | |
| 2065 | − "%s: buffer_type(0x%02x) is already released\n", | |
| 2066 | − ioc->name, __func__, | |
| 2067 | − buffer_type); | |
| 2008 | + ioc_err(ioc, "%s: buffer_type(0x%02x) is already released\n", | |
| 2009 | + __func__, buffer_type); | |
| 2068 | 2010 | return 0; |
| 2069 | 2011 | } |
| 2070 | 2012 | |
| 2071 | 2013 | request_data = ioc->diag_buffer[buffer_type]; |
| 2072 | 2014 | |
| 2073 | 2015 | if (!request_data) { |
| 2074 | − pr_err(MPT3SAS_FMT | |
| 2075 | − "%s: doesn't have memory allocated for buffer_type(0x%02x)\n", | |
| 2076 | − ioc->name, __func__, buffer_type); | |
| 2016 | + ioc_err(ioc, "%s: doesn't have memory allocated for buffer_type(0x%02x)\n", | |
| 2017 | + __func__, buffer_type); | |
| 2077 | 2018 | return -ENOMEM; |
| 2078 | 2019 | } |
| 2079 | 2020 | |
| @@ -2084,9 +2025,8 @@ _ctl_diag_release(struct MPT3SAS_ADAPTER *ioc, void __user *arg) · 4 unmodified lines | ||
| 2084 | 2025 | MPT3_DIAG_BUFFER_IS_RELEASED; |
| 2085 | 2026 | ioc->diag_buffer_status[buffer_type] &= |
| 2086 | 2027 | ~MPT3_DIAG_BUFFER_IS_DIAG_RESET; |
| 2087 | − pr_err(MPT3SAS_FMT | |
| 2088 | − "%s: buffer_type(0x%02x) was released due to host reset\n", | |
| 2089 | − ioc->name, __func__, buffer_type); | |
| 2028 | + ioc_err(ioc, "%s: buffer_type(0x%02x) was released due to host reset\n", | |
| 2029 | + __func__, buffer_type); | |
| 2090 | 2030 | return 0; |
| 2091 | 2031 | } |
| 2092 | 2032 | |
| @@ -2124,38 +2064,34 @@ _ctl_diag_read_buffer(struct MPT3SAS_ADAPTER *ioc, void __user *arg) · 31 unmodified lines | ||
| 2124 | 2064 | return -EFAULT; |
| 2125 | 2065 | } |
| 2126 | 2066 | |
| 2127 | − dctlprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name, | |
| 2128 | − __func__)); | |
| 2067 | + dctlprintk(ioc, ioc_info(ioc, "%s\n", | |
| 2068 | + __func__)); | |
| 2129 | 2069 | |
| 2130 | 2070 | buffer_type = karg.unique_id & 0x000000ff; |
| 2131 | 2071 | if (!_ctl_diag_capability(ioc, buffer_type)) { |
| 2132 | − pr_err(MPT3SAS_FMT | |
| 2133 | − "%s: doesn't have capability for buffer_type(0x%02x)\n", | |
| 2134 | − ioc->name, __func__, buffer_type); | |
| 2072 | + ioc_err(ioc, "%s: doesn't have capability for buffer_type(0x%02x)\n", | |
| 2073 | + __func__, buffer_type); | |
| 2135 | 2074 | return -EPERM; |
| 2136 | 2075 | } |
| 2137 | 2076 | |
| 2138 | 2077 | if (karg.unique_id != ioc->unique_id[buffer_type]) { |
| 2139 | − pr_err(MPT3SAS_FMT | |
| 2140 | − "%s: unique_id(0x%08x) is not registered\n", | |
| 2141 | − ioc->name, __func__, karg.unique_id); | |
| 2078 | + ioc_err(ioc, "%s: unique_id(0x%08x) is not registered\n", | |
| 2079 | + __func__, karg.unique_id); | |
| 2142 | 2080 | return -EINVAL; |
| 2143 | 2081 | } |
| 2144 | 2082 | |
| 2145 | 2083 | request_data = ioc->diag_buffer[buffer_type]; |
| 2146 | 2084 | if (!request_data) { |
| 2147 | − pr_err(MPT3SAS_FMT | |
| 2148 | − "%s: doesn't have buffer for buffer_type(0x%02x)\n", | |
| 2149 | − ioc->name, __func__, buffer_type); | |
| 2085 | + ioc_err(ioc, "%s: doesn't have buffer for buffer_type(0x%02x)\n", | |
| 2086 | + __func__, buffer_type); | |
| 2150 | 2087 | return -ENOMEM; |
| 2151 | 2088 | } |
| 2152 | 2089 | |
| 2153 | 2090 | request_size = ioc->diag_buffer_sz[buffer_type]; |
| 2154 | 2091 | |
| 2155 | 2092 | if ((karg.starting_offset % 4) || (karg.bytes_to_read % 4)) { |
| 2156 | − pr_err(MPT3SAS_FMT "%s: either the starting_offset " \ | |
| 2157 | − "or bytes_to_read are not 4 byte aligned\n", ioc->name, | |
| 2158 | − __func__); | |
| 2093 | + ioc_err(ioc, "%s: either the starting_offset or bytes_to_read are not 4 byte aligned\n", | |
| 2094 | + __func__); | |
| 2159 | 2095 | return -EINVAL; |
| 2160 | 2096 | } |
| 2161 | 2097 | |
| @@ -2163,10 +2099,10 @@ _ctl_diag_read_buffer(struct MPT3SAS_ADAPTER *ioc, void __user *arg) · 1 unmodified line | ||
| 2163 | 2099 | return -EINVAL; |
| 2164 | 2100 | |
| 2165 | 2101 | diag_data = (void *)(request_data + karg.starting_offset); |
| 2166 | − dctlprintk(ioc, pr_info(MPT3SAS_FMT | |
| 2167 | − "%s: diag_buffer(%p), offset(%d), sz(%d)\n", | |
| 2168 | − ioc->name, __func__, | |
| 2169 | − diag_data, karg.starting_offset, karg.bytes_to_read)); | |
| 2102 | + dctlprintk(ioc, | |
| 2103 | + ioc_info(ioc, "%s: diag_buffer(%p), offset(%d), sz(%d)\n", | |
| 2104 | + __func__, diag_data, karg.starting_offset, | |
| 2105 | + karg.bytes_to_read)); | |
| 2170 | 2106 | |
| 2171 | 2107 | /* Truncate data on requests that are too large */ |
| 2172 | 2108 | if ((diag_data + karg.bytes_to_read < diag_data) || |
| @@ -2177,39 +2113,36 @@ _ctl_diag_read_buffer(struct MPT3SAS_ADAPTER *ioc, void __user *arg) · 4 unmodified lines | ||
| 2177 | 2113 | |
| 2178 | 2114 | if (copy_to_user((void __user *)uarg->diagnostic_data, |
| 2179 | 2115 | diag_data, copy_size)) { |
| 2180 | − pr_err(MPT3SAS_FMT | |
| 2181 | − "%s: Unable to write mpt_diag_read_buffer_t data @ %p\n", | |
| 2182 | − ioc->name, __func__, diag_data); | |
| 2116 | + ioc_err(ioc, "%s: Unable to write mpt_diag_read_buffer_t data @ %p\n", | |
| 2117 | + __func__, diag_data); | |
| 2183 | 2118 | return -EFAULT; |
| 2184 | 2119 | } |
| 2185 | 2120 | |
| 2186 | 2121 | if ((karg.flags & MPT3_FLAGS_REREGISTER) == 0) |
| 2187 | 2122 | return 0; |
| 2188 | 2123 | |
| 2189 | − dctlprintk(ioc, pr_info(MPT3SAS_FMT | |
| 2190 | − "%s: Reregister buffer_type(0x%02x)\n", | |
| 2191 | − ioc->name, __func__, buffer_type)); | |
| 2124 | + dctlprintk(ioc, | |
| 2125 | + ioc_info(ioc, "%s: Reregister buffer_type(0x%02x)\n", | |
| 2126 | + __func__, buffer_type)); | |
| 2192 | 2127 | if ((ioc->diag_buffer_status[buffer_type] & |
| 2193 | 2128 | MPT3_DIAG_BUFFER_IS_RELEASED) == 0) { |
| 2194 | − dctlprintk(ioc, pr_info(MPT3SAS_FMT | |
| 2195 | − "%s: buffer_type(0x%02x) is still registered\n", | |
| 2196 | − ioc->name, __func__, buffer_type)); | |
| 2129 | + dctlprintk(ioc, | |
| 2130 | + ioc_info(ioc, "%s: buffer_type(0x%02x) is still registered\n", | |
| 2131 | + __func__, buffer_type)); | |
| 2197 | 2132 | return 0; |
| 2198 | 2133 | } |
| 2199 | 2134 | /* Get a free request frame and save the message context. |
| 2200 | 2135 | */ |
| 2201 | 2136 | |
| 2202 | 2137 | if (ioc->ctl_cmds.status != MPT3_CMD_NOT_USED) { |
| 2203 | − pr_err(MPT3SAS_FMT "%s: ctl_cmd in use\n", | |
| 2204 | − ioc->name, __func__); | |
| 2138 | + ioc_err(ioc, "%s: ctl_cmd in use\n", __func__); | |
| 2205 | 2139 | rc = -EAGAIN; |
| 2206 | 2140 | goto out; |
| 2207 | 2141 | } |
| 2208 | 2142 | |
| 2209 | 2143 | smid = mpt3sas_base_get_smid(ioc, ioc->ctl_cb_idx); |
| 2210 | 2144 | if (!smid) { |
| 2211 | − pr_err(MPT3SAS_FMT "%s: failed obtaining a smid\n", | |
| 2212 | − ioc->name, __func__); | |
| 2145 | + ioc_err(ioc, "%s: failed obtaining a smid\n", __func__); | |
| 2213 | 2146 | rc = -EAGAIN; |
| 2214 | 2147 | goto out; |
| 2215 | 2148 | } |
| @@ -2247,8 +2180,7 @@ _ctl_diag_read_buffer(struct MPT3SAS_ADAPTER *ioc, void __user *arg) · 31 unmodified lines | ||
| 2247 | 2180 | |
| 2248 | 2181 | /* process the completed Reply Message Frame */ |
| 2249 | 2182 | if ((ioc->ctl_cmds.status & MPT3_CMD_REPLY_VALID) == 0) { |
| 2250 | − pr_err(MPT3SAS_FMT "%s: no reply message\n", | |
| 2251 | − ioc->name, __func__); | |
| 2183 | + ioc_err(ioc, "%s: no reply message\n", __func__); | |
| 2252 | 2184 | rc = -EFAULT; |
| 2253 | 2185 | goto out; |
| 2254 | 2186 | } |
| @@ -2259,13 +2191,11 @@ _ctl_diag_read_buffer(struct MPT3SAS_ADAPTER *ioc, void __user *arg) · 4 unmodified lines | ||
| 2259 | 2191 | if (ioc_status == MPI2_IOCSTATUS_SUCCESS) { |
| 2260 | 2192 | ioc->diag_buffer_status[buffer_type] |= |
| 2261 | 2193 | MPT3_DIAG_BUFFER_IS_REGISTERED; |
| 2262 | − dctlprintk(ioc, pr_info(MPT3SAS_FMT "%s: success\n", | |
| 2263 | − ioc->name, __func__)); | |
| 2194 | + dctlprintk(ioc, ioc_info(ioc, "%s: success\n", __func__)); | |
| 2264 | 2195 | } else { |
| 2265 | − pr_info(MPT3SAS_FMT | |
| 2266 | − "%s: ioc_status(0x%04x) log_info(0x%08x)\n", | |
| 2267 | − ioc->name, __func__, | |
| 2268 | − ioc_status, le32_to_cpu(mpi_reply->IOCLogInfo)); | |
| 2196 | + ioc_info(ioc, "%s: ioc_status(0x%04x) log_info(0x%08x)\n", | |
| 2197 | + __func__, ioc_status, | |
| 2198 | + le32_to_cpu(mpi_reply->IOCLogInfo)); | |
| 2269 | 2199 | rc = -EFAULT; |
| 2270 | 2200 | } |
| 2271 | 2201 | |
| @@ -2450,8 +2380,9 @@ _ctl_ioctl_main(struct file *file, unsigned int cmd, void __user *arg, · 178 unmodified lines | ||
| 2450 | 2380 | ret = _ctl_diag_read_buffer(ioc, arg); |
| 2451 | 2381 | break; |
| 2452 | 2382 | default: |
| 2453 | − dctlprintk(ioc, pr_info(MPT3SAS_FMT | |
| 2454 | − "unsupported ioctl opcode(0x%08x)\n", ioc->name, cmd)); | |
| 2383 | + dctlprintk(ioc, | |
| 2384 | + ioc_info(ioc, "unsupported ioctl opcode(0x%08x)\n", | |
| 2385 | + cmd)); | |
| 2455 | 2386 | break; |
| 2456 | 2387 | } |
| 2457 | 2388 | |
| @@ -2840,8 +2771,8 @@ _ctl_logging_level_store(struct device *cdev, struct device_attribute *attr, · 382 unmodified lines | ||
| 2840 | 2771 | return -EINVAL; |
| 2841 | 2772 | |
| 2842 | 2773 | ioc->logging_level = val; |
| 2843 | − pr_info(MPT3SAS_FMT "logging_level=%08xh\n", ioc->name, | |
| 2844 | − ioc->logging_level); | |
| 2774 | + ioc_info(ioc, "logging_level=%08xh\n", | |
| 2775 | + ioc->logging_level); | |
| 2845 | 2776 | return strlen(buf); |
| 2846 | 2777 | } |
| 2847 | 2778 | 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, · 29 unmodified lines | ||
| 2877 | 2808 | return -EINVAL; |
| 2878 | 2809 | |
| 2879 | 2810 | ioc->fwfault_debug = val; |
| 2880 | − pr_info(MPT3SAS_FMT "fwfault_debug=%d\n", ioc->name, | |
| 2881 | − ioc->fwfault_debug); | |
| 2811 | + ioc_info(ioc, "fwfault_debug=%d\n", | |
| 2812 | + ioc->fwfault_debug); | |
| 2882 | 2813 | return strlen(buf); |
| 2883 | 2814 | } |
| 2884 | 2815 | static DEVICE_ATTR(fwfault_debug, S_IRUGO | S_IWUSR, |
| @@ -2958,8 +2889,8 @@ _ctl_BRM_status_show(struct device *cdev, struct device_attribute *attr, · 73 unmodified lines | ||
| 2958 | 2889 | ssize_t rc = 0; |
| 2959 | 2890 | |
| 2960 | 2891 | if (!ioc->is_warpdrive) { |
| 2961 | − pr_err(MPT3SAS_FMT "%s: BRM attribute is only for" | |
| 2962 | − " warpdrive\n", ioc->name, __func__); | |
| 2892 | + ioc_err(ioc, "%s: BRM attribute is only for warpdrive\n", | |
| 2893 | + __func__); | |
| 2963 | 2894 | goto out; |
| 2964 | 2895 | } |
| 2965 | 2896 | /* pci_access_mutex lock acquired by sysfs show path */ |
| @@ -2973,30 +2904,28 @@ _ctl_BRM_status_show(struct device *cdev, struct device_attribute *attr, · 7 unmodified lines | ||
| 2973 | 2904 | sz = offsetof(Mpi2IOUnitPage3_t, GPIOVal) + (sizeof(u16) * 36); |
| 2974 | 2905 | io_unit_pg3 = kzalloc(sz, GFP_KERNEL); |
| 2975 | 2906 | if (!io_unit_pg3) { |
| 2976 | − pr_err(MPT3SAS_FMT "%s: failed allocating memory " | |
| 2977 | − "for iounit_pg3: (%d) bytes\n", ioc->name, __func__, sz); | |
| 2907 | + ioc_err(ioc, "%s: failed allocating memory for iounit_pg3: (%d) bytes\n", | |
| 2908 | + __func__, sz); | |
| 2978 | 2909 | goto out; |
| 2979 | 2910 | } |
| 2980 | 2911 | |
| 2981 | 2912 | if (mpt3sas_config_get_iounit_pg3(ioc, &mpi_reply, io_unit_pg3, sz) != |
| 2982 | 2913 | 0) { |
| 2983 | − pr_err(MPT3SAS_FMT | |
| 2984 | − "%s: failed reading iounit_pg3\n", ioc->name, | |
| 2985 | − __func__); | |
| 2914 | + ioc_err(ioc, "%s: failed reading iounit_pg3\n", | |
| 2915 | + __func__); | |
| 2986 | 2916 | goto out; |
| 2987 | 2917 | } |
| 2988 | 2918 | |
| 2989 | 2919 | ioc_status = le16_to_cpu(mpi_reply.IOCStatus) & MPI2_IOCSTATUS_MASK; |
| 2990 | 2920 | if (ioc_status != MPI2_IOCSTATUS_SUCCESS) { |
| 2991 | − pr_err(MPT3SAS_FMT "%s: iounit_pg3 failed with " | |
| 2992 | − "ioc_status(0x%04x)\n", ioc->name, __func__, ioc_status); | |
| 2921 | + ioc_err(ioc, "%s: iounit_pg3 failed with ioc_status(0x%04x)\n", | |
| 2922 | + __func__, ioc_status); | |
| 2993 | 2923 | goto out; |
| 2994 | 2924 | } |
| 2995 | 2925 | |
| 2996 | 2926 | if (io_unit_pg3->GPIOCount < 25) { |
| 2997 | − pr_err(MPT3SAS_FMT "%s: iounit_pg3->GPIOCount less than " | |
| 2998 | − "25 entries, detected (%d) entries\n", ioc->name, __func__, | |
| 2999 | − io_unit_pg3->GPIOCount); | |
| 2927 | + ioc_err(ioc, "%s: iounit_pg3->GPIOCount less than 25 entries, detected (%d) entries\n", | |
| 2928 | + __func__, io_unit_pg3->GPIOCount); | |
| 3000 | 2929 | goto out; |
| 3001 | 2930 | } |
| 3002 | 2931 | |
| @@ -3039,17 +2968,15 @@ _ctl_host_trace_buffer_size_show(struct device *cdev, · 36 unmodified lines | ||
| 3039 | 2968 | struct DIAG_BUFFER_START *request_data; |
| 3040 | 2969 | |
| 3041 | 2970 | if (!ioc->diag_buffer[MPI2_DIAG_BUF_TYPE_TRACE]) { |
| 3042 | − pr_err(MPT3SAS_FMT | |
| 3043 | − "%s: host_trace_buffer is not registered\n", | |
| 3044 | − ioc->name, __func__); | |
| 2971 | + ioc_err(ioc, "%s: host_trace_buffer is not registered\n", | |
| 2972 | + __func__); | |
| 3045 | 2973 | return 0; |
| 3046 | 2974 | } |
| 3047 | 2975 | |
| 3048 | 2976 | if ((ioc->diag_buffer_status[MPI2_DIAG_BUF_TYPE_TRACE] & |
| 3049 | 2977 | MPT3_DIAG_BUFFER_IS_REGISTERED) == 0) { |
| 3050 | − pr_err(MPT3SAS_FMT | |
| 3051 | − "%s: host_trace_buffer is not registered\n", | |
| 3052 | − ioc->name, __func__); | |
| 2978 | + ioc_err(ioc, "%s: host_trace_buffer is not registered\n", | |
| 2979 | + __func__); | |
| 3053 | 2980 | return 0; |
| 3054 | 2981 | } |
| 3055 | 2982 | |
| @@ -3089,17 +3016,15 @@ _ctl_host_trace_buffer_show(struct device *cdev, struct device_attribute *attr, · 33 unmodified lines | ||
| 3089 | 3016 | u32 size; |
| 3090 | 3017 | |
| 3091 | 3018 | if (!ioc->diag_buffer[MPI2_DIAG_BUF_TYPE_TRACE]) { |
| 3092 | − pr_err(MPT3SAS_FMT | |
| 3093 | − "%s: host_trace_buffer is not registered\n", | |
| 3094 | − ioc->name, __func__); | |
| 3019 | + ioc_err(ioc, "%s: host_trace_buffer is not registered\n", | |
| 3020 | + __func__); | |
| 3095 | 3021 | return 0; |
| 3096 | 3022 | } |
| 3097 | 3023 | |
| 3098 | 3024 | if ((ioc->diag_buffer_status[MPI2_DIAG_BUF_TYPE_TRACE] & |
| 3099 | 3025 | MPT3_DIAG_BUFFER_IS_REGISTERED) == 0) { |
| 3100 | − pr_err(MPT3SAS_FMT | |
| 3101 | − "%s: host_trace_buffer is not registered\n", | |
| 3102 | − ioc->name, __func__); | |
| 3026 | + ioc_err(ioc, "%s: host_trace_buffer is not registered\n", | |
| 3027 | + __func__); | |
| 3103 | 3028 | return 0; |
| 3104 | 3029 | } |
| 3105 | 3030 | |
| @@ -3188,8 +3113,7 @@ _ctl_host_trace_buffer_enable_store(struct device *cdev, · 82 unmodified lines | ||
| 3188 | 3113 | MPT3_DIAG_BUFFER_IS_RELEASED) == 0)) |
| 3189 | 3114 | goto out; |
| 3190 | 3115 | memset(&diag_register, 0, sizeof(struct mpt3_diag_register)); |
| 3191 | − pr_info(MPT3SAS_FMT "posting host trace buffers\n", | |
| 3192 | − ioc->name); | |
| 3116 | + ioc_info(ioc, "posting host trace buffers\n"); | |
| 3193 | 3117 | diag_register.buffer_type = MPI2_DIAG_BUF_TYPE_TRACE; |
| 3194 | 3118 | diag_register.requested_buffer_size = (1024 * 1024); |
| 3195 | 3119 | diag_register.unique_id = 0x7075900; |
| @@ -3205,8 +3129,7 @@ _ctl_host_trace_buffer_enable_store(struct device *cdev, · 9 unmodified lines | ||
| 3205 | 3129 | if ((ioc->diag_buffer_status[MPI2_DIAG_BUF_TYPE_TRACE] & |
| 3206 | 3130 | MPT3_DIAG_BUFFER_IS_RELEASED)) |
| 3207 | 3131 | goto out; |
| 3208 | − pr_info(MPT3SAS_FMT "releasing host trace buffer\n", | |
| 3209 | − ioc->name); | |
| 3132 | + ioc_info(ioc, "releasing host trace buffer\n"); | |
| 3210 | 3133 | mpt3sas_send_diag_release(ioc, MPI2_DIAG_BUF_TYPE_TRACE, |
| 3211 | 3134 | &issue_reset); |
| 3212 | 3135 | } |
| @@ -3658,8 +3581,10 @@ mpt3sas_ctl_exit(ushort hbas_to_enumerate) · 445 unmodified lines | ||
| 3658 | 3581 | if ((ioc->diag_buffer_status[i] & |
| 3659 | 3582 | MPT3_DIAG_BUFFER_IS_RELEASED)) |
| 3660 | 3583 | continue; |
| 3661 | − pci_free_consistent(ioc->pdev, ioc->diag_buffer_sz[i], | |
| 3662 | − ioc->diag_buffer[i], ioc->diag_buffer_dma[i]); | |
| 3584 | + dma_free_coherent(&ioc->pdev->dev, | |
| 3585 | + ioc->diag_buffer_sz[i], | |
| 3586 | + ioc->diag_buffer[i], | |
| 3587 | + ioc->diag_buffer_dma[i]); | |
| 3663 | 3588 | ioc->diag_buffer[i] = NULL; |
| 3664 | 3589 | ioc->diag_buffer_status[i] = 0; |
| 3665 | 3590 | } |
| @@ -418,8 +418,8 @@ _scsih_get_sas_address(struct MPT3SAS_ADAPTER *ioc, u16 handle, · 417 unmodified lines | ||
| 418 | 418 | |
| 419 | 419 | if ((mpt3sas_config_get_sas_device_pg0(ioc, &mpi_reply, &sas_device_pg0, |
| 420 | 420 | MPI2_SAS_DEVICE_PGAD_FORM_HANDLE, handle))) { |
| 421 | − pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", ioc->name, | |
| 422 | − __FILE__, __LINE__, __func__); | |
| 421 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", | |
| 422 | + __FILE__, __LINE__, __func__); | |
| 423 | 423 | return -ENXIO; |
| 424 | 424 | } |
| 425 | 425 | |
| @@ -442,10 +442,8 @@ _scsih_get_sas_address(struct MPT3SAS_ADAPTER *ioc, u16 handle, · 16 unmodified lines | ||
| 442 | 442 | return -ENXIO; |
| 443 | 443 | |
| 444 | 444 | /* else error case */ |
| 445 | − pr_err(MPT3SAS_FMT | |
| 446 | − "handle(0x%04x), ioc_status(0x%04x), failure at %s:%d/%s()!\n", | |
| 447 | − ioc->name, handle, ioc_status, | |
| 448 | − __FILE__, __LINE__, __func__); | |
| 445 | + ioc_err(ioc, "handle(0x%04x), ioc_status(0x%04x), failure at %s:%d/%s()!\n", | |
| 446 | + handle, ioc_status, __FILE__, __LINE__, __func__); | |
| 449 | 447 | return -EIO; |
| 450 | 448 | } |
| 451 | 449 | |
| @@ -508,10 +506,9 @@ _scsih_determine_boot_device(struct MPT3SAS_ADAPTER *ioc, void *device, · 56 unmodified lines | ||
| 508 | 506 | (ioc->bios_pg2.ReqBootDeviceForm & |
| 509 | 507 | MPI2_BIOSPAGE2_FORM_MASK), |
| 510 | 508 | &ioc->bios_pg2.RequestedBootDevice)) { |
| 511 | − dinitprintk(ioc, pr_info(MPT3SAS_FMT | |
| 512 | − "%s: req_boot_device(0x%016llx)\n", | |
| 513 | − ioc->name, __func__, | |
| 514 | − (unsigned long long)sas_address)); | |
| 509 | + dinitprintk(ioc, | |
| 510 | + ioc_info(ioc, "%s: req_boot_device(0x%016llx)\n", | |
| 511 | + __func__, (u64)sas_address)); | |
| 515 | 512 | ioc->req_boot_device.device = device; |
| 516 | 513 | ioc->req_boot_device.channel = channel; |
| 517 | 514 | } |
| @@ -523,10 +520,9 @@ _scsih_determine_boot_device(struct MPT3SAS_ADAPTER *ioc, void *device, · 5 unmodified lines | ||
| 523 | 520 | (ioc->bios_pg2.ReqAltBootDeviceForm & |
| 524 | 521 | MPI2_BIOSPAGE2_FORM_MASK), |
| 525 | 522 | &ioc->bios_pg2.RequestedAltBootDevice)) { |
| 526 | − dinitprintk(ioc, pr_info(MPT3SAS_FMT | |
| 527 | − "%s: req_alt_boot_device(0x%016llx)\n", | |
| 528 | − ioc->name, __func__, | |
| 529 | − (unsigned long long)sas_address)); | |
| 523 | + dinitprintk(ioc, | |
| 524 | + ioc_info(ioc, "%s: req_alt_boot_device(0x%016llx)\n", | |
| 525 | + __func__, (u64)sas_address)); | |
| 530 | 526 | ioc->req_alt_boot_device.device = device; |
| 531 | 527 | ioc->req_alt_boot_device.channel = channel; |
| 532 | 528 | } |
| @@ -538,10 +534,9 @@ _scsih_determine_boot_device(struct MPT3SAS_ADAPTER *ioc, void *device, · 5 unmodified lines | ||
| 538 | 534 | (ioc->bios_pg2.CurrentBootDeviceForm & |
| 539 | 535 | MPI2_BIOSPAGE2_FORM_MASK), |
| 540 | 536 | &ioc->bios_pg2.CurrentBootDevice)) { |
| 541 | − dinitprintk(ioc, pr_info(MPT3SAS_FMT | |
| 542 | − "%s: current_boot_device(0x%016llx)\n", | |
| 543 | − ioc->name, __func__, | |
| 544 | − (unsigned long long)sas_address)); | |
| 537 | + dinitprintk(ioc, | |
| 538 | + ioc_info(ioc, "%s: current_boot_device(0x%016llx)\n", | |
| 539 | + __func__, (u64)sas_address)); | |
| 545 | 540 | ioc->current_boot_device.device = device; |
| 546 | 541 | ioc->current_boot_device.channel = channel; |
| 547 | 542 | } |
| @@ -752,19 +747,16 @@ _scsih_display_enclosure_chassis_info(struct MPT3SAS_ADAPTER *ioc, · 204 unmodified lines | ||
| 752 | 747 | sas_device->chassis_slot); |
| 753 | 748 | } else { |
| 754 | 749 | if (sas_device->enclosure_handle != 0) |
| 755 | − pr_info(MPT3SAS_FMT | |
| 756 | − "enclosure logical id(0x%016llx), slot(%d) \n", | |
| 757 | − ioc->name, (unsigned long long) | |
| 758 | − sas_device->enclosure_logical_id, | |
| 759 | − sas_device->slot); | |
| 750 | + ioc_info(ioc, "enclosure logical id(0x%016llx), slot(%d)\n", | |
| 751 | + (u64)sas_device->enclosure_logical_id, | |
| 752 | + sas_device->slot); | |
| 760 | 753 | if (sas_device->connector_name[0] != '\0') |
| 761 | − pr_info(MPT3SAS_FMT | |
| 762 | − "enclosure level(0x%04x), connector name( %s)\n", | |
| 763 | − ioc->name, sas_device->enclosure_level, | |
| 764 | − sas_device->connector_name); | |
| 754 | + ioc_info(ioc, "enclosure level(0x%04x), connector name( %s)\n", | |
| 755 | + sas_device->enclosure_level, | |
| 756 | + sas_device->connector_name); | |
| 765 | 757 | if (sas_device->is_chassis_slot_valid) |
| 766 | − pr_info(MPT3SAS_FMT "chassis slot(0x%04x)\n", | |
| 767 | − ioc->name, sas_device->chassis_slot); | |
| 758 | + ioc_info(ioc, "chassis slot(0x%04x)\n", | |
| 759 | + sas_device->chassis_slot); | |
| 768 | 760 | } |
| 769 | 761 | } |
| 770 | 762 | |
| @@ -784,10 +776,8 @@ _scsih_sas_device_remove(struct MPT3SAS_ADAPTER *ioc, · 13 unmodified lines | ||
| 784 | 776 | |
| 785 | 777 | if (!sas_device) |
| 786 | 778 | return; |
| 787 | − pr_info(MPT3SAS_FMT | |
| 788 | − "removing handle(0x%04x), sas_addr(0x%016llx)\n", | |
| 789 | − ioc->name, sas_device->handle, | |
| 790 | − (unsigned long long) sas_device->sas_address); | |
| 779 | + ioc_info(ioc, "removing handle(0x%04x), sas_addr(0x%016llx)\n", | |
| 780 | + sas_device->handle, (u64)sas_device->sas_address); | |
| 791 | 781 | |
| 792 | 782 | _scsih_display_enclosure_chassis_info(ioc, sas_device, NULL, NULL); |
| 793 | 783 | |
| @@ -872,10 +862,10 @@ _scsih_sas_device_add(struct MPT3SAS_ADAPTER *ioc, · 78 unmodified lines | ||
| 872 | 862 | { |
| 873 | 863 | unsigned long flags; |
| 874 | 864 | |
| 875 | − dewtprintk(ioc, pr_info(MPT3SAS_FMT | |
| 876 | − "%s: handle(0x%04x), sas_addr(0x%016llx)\n", | |
| 877 | − ioc->name, __func__, sas_device->handle, | |
| 878 | − (unsigned long long)sas_device->sas_address)); | |
| 865 | + dewtprintk(ioc, | |
| 866 | + ioc_info(ioc, "%s: handle(0x%04x), sas_addr(0x%016llx)\n", | |
| 867 | + __func__, sas_device->handle, | |
| 868 | + (u64)sas_device->sas_address)); | |
| 879 | 869 | |
| 880 | 870 | dewtprintk(ioc, _scsih_display_enclosure_chassis_info(ioc, sas_device, |
| 881 | 871 | NULL, NULL)); |
| @@ -923,10 +913,10 @@ _scsih_sas_device_init_add(struct MPT3SAS_ADAPTER *ioc, · 41 unmodified lines | ||
| 923 | 913 | { |
| 924 | 914 | unsigned long flags; |
| 925 | 915 | |
| 926 | − dewtprintk(ioc, pr_info(MPT3SAS_FMT | |
| 927 | − "%s: handle(0x%04x), sas_addr(0x%016llx)\n", ioc->name, | |
| 928 | − __func__, sas_device->handle, | |
| 929 | − (unsigned long long)sas_device->sas_address)); | |
| 916 | + dewtprintk(ioc, | |
| 917 | + ioc_info(ioc, "%s: handle(0x%04x), sas_addr(0x%016llx)\n", | |
| 918 | + __func__, sas_device->handle, | |
| 919 | + (u64)sas_device->sas_address)); | |
| 930 | 920 | |
| 931 | 921 | dewtprintk(ioc, _scsih_display_enclosure_chassis_info(ioc, sas_device, |
| 932 | 922 | NULL, NULL)); |
| @@ -1073,21 +1063,16 @@ _scsih_pcie_device_remove(struct MPT3SAS_ADAPTER *ioc, · 140 unmodified lines | ||
| 1073 | 1063 | |
| 1074 | 1064 | if (!pcie_device) |
| 1075 | 1065 | return; |
| 1076 | − pr_info(MPT3SAS_FMT | |
| 1077 | − "removing handle(0x%04x), wwid(0x%016llx)\n", | |
| 1078 | − ioc->name, pcie_device->handle, | |
| 1079 | − (unsigned long long) pcie_device->wwid); | |
| 1066 | + ioc_info(ioc, "removing handle(0x%04x), wwid(0x%016llx)\n", | |
| 1067 | + pcie_device->handle, (u64)pcie_device->wwid); | |
| 1080 | 1068 | if (pcie_device->enclosure_handle != 0) |
| 1081 | − pr_info(MPT3SAS_FMT | |
| 1082 | − "removing enclosure logical id(0x%016llx), slot(%d)\n", | |
| 1083 | − ioc->name, | |
| 1084 | − (unsigned long long)pcie_device->enclosure_logical_id, | |
| 1085 | − pcie_device->slot); | |
| 1069 | + ioc_info(ioc, "removing enclosure logical id(0x%016llx), slot(%d)\n", | |
| 1070 | + (u64)pcie_device->enclosure_logical_id, | |
| 1071 | + pcie_device->slot); | |
| 1086 | 1072 | if (pcie_device->connector_name[0] != '\0') |
| 1087 | − pr_info(MPT3SAS_FMT | |
| 1088 | − "removing enclosure level(0x%04x), connector name( %s)\n", | |
| 1089 | − ioc->name, pcie_device->enclosure_level, | |
| 1090 | − pcie_device->connector_name); | |
| 1073 | + ioc_info(ioc, "removing enclosure level(0x%04x), connector name( %s)\n", | |
| 1074 | + pcie_device->enclosure_level, | |
| 1075 | + pcie_device->connector_name); | |
| 1091 | 1076 | |
| 1092 | 1077 | spin_lock_irqsave(&ioc->pcie_device_lock, flags); |
| 1093 | 1078 | if (!list_empty(&pcie_device->list)) { |
| @@ -1146,20 +1131,21 @@ _scsih_pcie_device_add(struct MPT3SAS_ADAPTER *ioc, · 52 unmodified lines | ||
| 1146 | 1131 | { |
| 1147 | 1132 | unsigned long flags; |
| 1148 | 1133 | |
| 1149 | − dewtprintk(ioc, pr_info(MPT3SAS_FMT | |
| 1150 | − "%s: handle (0x%04x), wwid(0x%016llx)\n", ioc->name, __func__, | |
| 1151 | − pcie_device->handle, (unsigned long long)pcie_device->wwid)); | |
| 1134 | + dewtprintk(ioc, | |
| 1135 | + ioc_info(ioc, "%s: handle (0x%04x), wwid(0x%016llx)\n", | |
| 1136 | + __func__, | |
| 1137 | + pcie_device->handle, (u64)pcie_device->wwid)); | |
| 1152 | 1138 | if (pcie_device->enclosure_handle != 0) |
| 1153 | − dewtprintk(ioc, pr_info(MPT3SAS_FMT | |
| 1154 | − "%s: enclosure logical id(0x%016llx), slot( %d)\n", | |
| 1155 | − ioc->name, __func__, | |
| 1156 | − (unsigned long long)pcie_device->enclosure_logical_id, | |
| 1157 | − pcie_device->slot)); | |
| 1139 | + dewtprintk(ioc, | |
| 1140 | + ioc_info(ioc, "%s: enclosure logical id(0x%016llx), slot( %d)\n", | |
| 1141 | + __func__, | |
| 1142 | + (u64)pcie_device->enclosure_logical_id, | |
| 1143 | + pcie_device->slot)); | |
| 1158 | 1144 | if (pcie_device->connector_name[0] != '\0') |
| 1159 | − dewtprintk(ioc, pr_info(MPT3SAS_FMT | |
| 1160 | − "%s: enclosure level(0x%04x), connector name( %s)\n", | |
| 1161 | − ioc->name, __func__, pcie_device->enclosure_level, | |
| 1162 | − pcie_device->connector_name)); | |
| 1145 | + dewtprintk(ioc, | |
| 1146 | + ioc_info(ioc, "%s: enclosure level(0x%04x), connector name( %s)\n", | |
| 1147 | + __func__, pcie_device->enclosure_level, | |
| 1148 | + pcie_device->connector_name)); | |
| 1163 | 1149 | |
| 1164 | 1150 | spin_lock_irqsave(&ioc->pcie_device_lock, flags); |
| 1165 | 1151 | pcie_device_get(pcie_device); |
| @@ -1191,20 +1177,21 @@ _scsih_pcie_device_init_add(struct MPT3SAS_ADAPTER *ioc, · 25 unmodified lines | ||
| 1191 | 1177 | { |
| 1192 | 1178 | unsigned long flags; |
| 1193 | 1179 | |
| 1194 | − dewtprintk(ioc, pr_info(MPT3SAS_FMT | |
| 1195 | − "%s: handle (0x%04x), wwid(0x%016llx)\n", ioc->name, __func__, | |
| 1196 | − pcie_device->handle, (unsigned long long)pcie_device->wwid)); | |
| 1180 | + dewtprintk(ioc, | |
| 1181 | + ioc_info(ioc, "%s: handle (0x%04x), wwid(0x%016llx)\n", | |
| 1182 | + __func__, | |
| 1183 | + pcie_device->handle, (u64)pcie_device->wwid)); | |
| 1197 | 1184 | if (pcie_device->enclosure_handle != 0) |
| 1198 | − dewtprintk(ioc, pr_info(MPT3SAS_FMT | |
| 1199 | − "%s: enclosure logical id(0x%016llx), slot( %d)\n", | |
| 1200 | − ioc->name, __func__, | |
| 1201 | − (unsigned long long)pcie_device->enclosure_logical_id, | |
| 1202 | − pcie_device->slot)); | |
| 1185 | + dewtprintk(ioc, | |
| 1186 | + ioc_info(ioc, "%s: enclosure logical id(0x%016llx), slot( %d)\n", | |
| 1187 | + __func__, | |
| 1188 | + (u64)pcie_device->enclosure_logical_id, | |
| 1189 | + pcie_device->slot)); | |
| 1203 | 1190 | if (pcie_device->connector_name[0] != '\0') |
| 1204 | − dewtprintk(ioc, pr_info(MPT3SAS_FMT | |
| 1205 | − "%s: enclosure level(0x%04x), connector name( %s)\n", | |
| 1206 | − ioc->name, __func__, pcie_device->enclosure_level, | |
| 1207 | − pcie_device->connector_name)); | |
| 1191 | + dewtprintk(ioc, | |
| 1192 | + ioc_info(ioc, "%s: enclosure level(0x%04x), connector name( %s)\n", | |
| 1193 | + __func__, pcie_device->enclosure_level, | |
| 1194 | + pcie_device->connector_name)); | |
| 1208 | 1195 | |
| 1209 | 1196 | spin_lock_irqsave(&ioc->pcie_device_lock, flags); |
| 1210 | 1197 | pcie_device_get(pcie_device); |
| @@ -1304,9 +1291,10 @@ _scsih_raid_device_add(struct MPT3SAS_ADAPTER *ioc, · 93 unmodified lines | ||
| 1304 | 1291 | { |
| 1305 | 1292 | unsigned long flags; |
| 1306 | 1293 | |
| 1307 | − dewtprintk(ioc, pr_info(MPT3SAS_FMT | |
| 1308 | − "%s: handle(0x%04x), wwid(0x%016llx)\n", ioc->name, __func__, | |
| 1309 | − raid_device->handle, (unsigned long long)raid_device->wwid)); | |
| 1294 | + dewtprintk(ioc, | |
| 1295 | + ioc_info(ioc, "%s: handle(0x%04x), wwid(0x%016llx)\n", | |
| 1296 | + __func__, | |
| 1297 | + raid_device->handle, (u64)raid_device->wwid)); | |
| 1310 | 1298 | |
| 1311 | 1299 | spin_lock_irqsave(&ioc->raid_device_lock, flags); |
| 1312 | 1300 | list_add_tail(&raid_device->list, &ioc->raid_device_list); |
| @@ -1857,16 +1845,16 @@ _scsih_display_sata_capabilities(struct MPT3SAS_ADAPTER *ioc, · 544 unmodified lines | ||
| 1857 | 1845 | |
| 1858 | 1846 | if ((mpt3sas_config_get_sas_device_pg0(ioc, &mpi_reply, &sas_device_pg0, |
| 1859 | 1847 | MPI2_SAS_DEVICE_PGAD_FORM_HANDLE, handle))) { |
| 1860 | − pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", | |
| 1861 | − ioc->name, __FILE__, __LINE__, __func__); | |
| 1848 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", | |
| 1849 | + __FILE__, __LINE__, __func__); | |
| 1862 | 1850 | return; |
| 1863 | 1851 | } |
| 1864 | 1852 | |
| 1865 | 1853 | ioc_status = le16_to_cpu(mpi_reply.IOCStatus) & |
| 1866 | 1854 | MPI2_IOCSTATUS_MASK; |
| 1867 | 1855 | if (ioc_status != MPI2_IOCSTATUS_SUCCESS) { |
| 1868 | − pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", | |
| 1869 | − ioc->name, __FILE__, __LINE__, __func__); | |
| 1856 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", | |
| 1857 | + __FILE__, __LINE__, __func__); | |
| 1870 | 1858 | return; |
| 1871 | 1859 | } |
| 1872 | 1860 | |
| @@ -1952,8 +1940,8 @@ scsih_get_resync(struct device *dev) · 79 unmodified lines | ||
| 1952 | 1940 | if (mpt3sas_config_get_raid_volume_pg0(ioc, &mpi_reply, &vol_pg0, |
| 1953 | 1941 | MPI2_RAID_VOLUME_PGAD_FORM_HANDLE, handle, |
| 1954 | 1942 | sizeof(Mpi2RaidVolPage0_t))) { |
| 1955 | − pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", | |
| 1956 | − ioc->name, __FILE__, __LINE__, __func__); | |
| 1943 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", | |
| 1944 | + __FILE__, __LINE__, __func__); | |
| 1957 | 1945 | percent_complete = 0; |
| 1958 | 1946 | goto out; |
| 1959 | 1947 | } |
| @@ -2006,8 +1994,8 @@ scsih_get_state(struct device *dev) · 46 unmodified lines | ||
| 2006 | 1994 | if (mpt3sas_config_get_raid_volume_pg0(ioc, &mpi_reply, &vol_pg0, |
| 2007 | 1995 | MPI2_RAID_VOLUME_PGAD_FORM_HANDLE, handle, |
| 2008 | 1996 | sizeof(Mpi2RaidVolPage0_t))) { |
| 2009 | − pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", | |
| 2010 | − ioc->name, __FILE__, __LINE__, __func__); | |
| 1997 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", | |
| 1998 | + __FILE__, __LINE__, __func__); | |
| 2011 | 1999 | goto out; |
| 2012 | 2000 | } |
| 2013 | 2001 | |
| @@ -2103,9 +2091,9 @@ _scsih_get_volume_capabilities(struct MPT3SAS_ADAPTER *ioc, · 89 unmodified lines | ||
| 2103 | 2091 | |
| 2104 | 2092 | if ((mpt3sas_config_get_number_pds(ioc, raid_device->handle, |
| 2105 | 2093 | &num_pds)) || !num_pds) { |
| 2106 | − dfailprintk(ioc, pr_warn(MPT3SAS_FMT | |
| 2107 | − "failure at %s:%d/%s()!\n", ioc->name, __FILE__, __LINE__, | |
| 2108 | − __func__)); | |
| 2094 | + dfailprintk(ioc, | |
| 2095 | + ioc_warn(ioc, "failure at %s:%d/%s()!\n", | |
| 2096 | + __FILE__, __LINE__, __func__)); | |
| 2109 | 2097 | return 1; |
| 2110 | 2098 | } |
| 2111 | 2099 | |
| @@ -2114,17 +2102,17 @@ _scsih_get_volume_capabilities(struct MPT3SAS_ADAPTER *ioc, · 2 unmodified lines | ||
| 2114 | 2102 | sizeof(Mpi2RaidVol0PhysDisk_t)); |
| 2115 | 2103 | vol_pg0 = kzalloc(sz, GFP_KERNEL); |
| 2116 | 2104 | if (!vol_pg0) { |
| 2117 | − dfailprintk(ioc, pr_warn(MPT3SAS_FMT | |
| 2118 | − "failure at %s:%d/%s()!\n", ioc->name, __FILE__, __LINE__, | |
| 2119 | − __func__)); | |
| 2105 | + dfailprintk(ioc, | |
| 2106 | + ioc_warn(ioc, "failure at %s:%d/%s()!\n", | |
| 2107 | + __FILE__, __LINE__, __func__)); | |
| 2120 | 2108 | return 1; |
| 2121 | 2109 | } |
| 2122 | 2110 | |
| 2123 | 2111 | if ((mpt3sas_config_get_raid_volume_pg0(ioc, &mpi_reply, vol_pg0, |
| 2124 | 2112 | MPI2_RAID_VOLUME_PGAD_FORM_HANDLE, raid_device->handle, sz))) { |
| 2125 | − dfailprintk(ioc, pr_warn(MPT3SAS_FMT | |
| 2126 | − "failure at %s:%d/%s()!\n", ioc->name, __FILE__, __LINE__, | |
| 2127 | − __func__)); | |
| 2113 | + dfailprintk(ioc, | |
| 2114 | + ioc_warn(ioc, "failure at %s:%d/%s()!\n", | |
| 2115 | + __FILE__, __LINE__, __func__)); | |
| 2128 | 2116 | kfree(vol_pg0); |
| 2129 | 2117 | return 1; |
| 2130 | 2118 | } |
| @@ -2215,16 +2203,16 @@ scsih_slave_configure(struct scsi_device *sdev) · 84 unmodified lines | ||
| 2215 | 2203 | raid_device = mpt3sas_raid_device_find_by_handle(ioc, handle); |
| 2216 | 2204 | spin_unlock_irqrestore(&ioc->raid_device_lock, flags); |
| 2217 | 2205 | if (!raid_device) { |
| 2218 | − dfailprintk(ioc, pr_warn(MPT3SAS_FMT | |
| 2219 | − "failure at %s:%d/%s()!\n", ioc->name, __FILE__, | |
| 2220 | − __LINE__, __func__)); | |
| 2206 | + dfailprintk(ioc, | |
| 2207 | + ioc_warn(ioc, "failure at %s:%d/%s()!\n", | |
| 2208 | + __FILE__, __LINE__, __func__)); | |
| 2221 | 2209 | return 1; |
| 2222 | 2210 | } |
| 2223 | 2211 | |
| 2224 | 2212 | if (_scsih_get_volume_capabilities(ioc, raid_device)) { |
| 2225 | − dfailprintk(ioc, pr_warn(MPT3SAS_FMT | |
| 2226 | − "failure at %s:%d/%s()!\n", ioc->name, __FILE__, | |
| 2227 | − __LINE__, __func__)); | |
| 2213 | + dfailprintk(ioc, | |
| 2214 | + ioc_warn(ioc, "failure at %s:%d/%s()!\n", | |
| 2215 | + __FILE__, __LINE__, __func__)); | |
| 2228 | 2216 | return 1; |
| 2229 | 2217 | } |
| 2230 | 2218 | |
| @@ -2308,16 +2296,16 @@ scsih_slave_configure(struct scsi_device *sdev) · 77 unmodified lines | ||
| 2308 | 2296 | if (sas_target_priv_data->flags & MPT_TARGET_FLAGS_RAID_COMPONENT) { |
| 2309 | 2297 | if (mpt3sas_config_get_volume_handle(ioc, handle, |
| 2310 | 2298 | &volume_handle)) { |
| 2311 | − dfailprintk(ioc, pr_warn(MPT3SAS_FMT | |
| 2312 | − "failure at %s:%d/%s()!\n", ioc->name, | |
| 2313 | − __FILE__, __LINE__, __func__)); | |
| 2299 | + dfailprintk(ioc, | |
| 2300 | + ioc_warn(ioc, "failure at %s:%d/%s()!\n", | |
| 2301 | + __FILE__, __LINE__, __func__)); | |
| 2314 | 2302 | return 1; |
| 2315 | 2303 | } |
| 2316 | 2304 | if (volume_handle && mpt3sas_config_get_volume_wwid(ioc, |
| 2317 | 2305 | volume_handle, &volume_wwid)) { |
| 2318 | − dfailprintk(ioc, pr_warn(MPT3SAS_FMT | |
| 2319 | − "failure at %s:%d/%s()!\n", ioc->name, | |
| 2320 | − __FILE__, __LINE__, __func__)); | |
| 2306 | + dfailprintk(ioc, | |
| 2307 | + ioc_warn(ioc, "failure at %s:%d/%s()!\n", | |
| 2308 | + __FILE__, __LINE__, __func__)); | |
| 2321 | 2309 | return 1; |
| 2322 | 2310 | } |
| 2323 | 2311 | } |
| @@ -2329,9 +2317,9 @@ scsih_slave_configure(struct scsi_device *sdev) · 5 unmodified lines | ||
| 2329 | 2317 | sas_device_priv_data->sas_target->sas_address); |
| 2330 | 2318 | if (!pcie_device) { |
| 2331 | 2319 | spin_unlock_irqrestore(&ioc->pcie_device_lock, flags); |
| 2332 | − dfailprintk(ioc, pr_warn(MPT3SAS_FMT | |
| 2333 | − "failure at %s:%d/%s()!\n", ioc->name, __FILE__, | |
| 2334 | − __LINE__, __func__)); | |
| 2320 | + dfailprintk(ioc, | |
| 2321 | + ioc_warn(ioc, "failure at %s:%d/%s()!\n", | |
| 2322 | + __FILE__, __LINE__, __func__)); | |
| 2335 | 2323 | return 1; |
| 2336 | 2324 | } |
| 2337 | 2325 | |
| @@ -2377,9 +2365,9 @@ scsih_slave_configure(struct scsi_device *sdev) · 39 unmodified lines | ||
| 2377 | 2365 | sas_device_priv_data->sas_target->sas_address); |
| 2378 | 2366 | if (!sas_device) { |
| 2379 | 2367 | spin_unlock_irqrestore(&ioc->sas_device_lock, flags); |
| 2380 | − dfailprintk(ioc, pr_warn(MPT3SAS_FMT | |
| 2381 | − "failure at %s:%d/%s()!\n", ioc->name, __FILE__, __LINE__, | |
| 2382 | − __func__)); | |
| 2368 | + dfailprintk(ioc, | |
| 2369 | + ioc_warn(ioc, "failure at %s:%d/%s()!\n", | |
| 2370 | + __FILE__, __LINE__, __func__)); | |
| 2383 | 2371 | return 1; |
| 2384 | 2372 | } |
| 2385 | 2373 | |
| @@ -2515,8 +2503,7 @@ _scsih_response_code(struct MPT3SAS_ADAPTER *ioc, u8 response_code) · 129 unmodified lines | ||
| 2515 | 2503 | desc = "unknown"; |
| 2516 | 2504 | break; |
| 2517 | 2505 | } |
| 2518 | − pr_warn(MPT3SAS_FMT "response_code(0x%01x): %s\n", | |
| 2519 | − ioc->name, response_code, desc); | |
| 2506 | + ioc_warn(ioc, "response_code(0x%01x): %s\n", response_code, desc); | |
| 2520 | 2507 | } |
| 2521 | 2508 | |
| 2522 | 2509 | /** |
| @@ -2640,22 +2627,19 @@ mpt3sas_scsih_issue_tm(struct MPT3SAS_ADAPTER *ioc, u16 handle, u64 lun, · 117 unmodified lines | ||
| 2640 | 2627 | lockdep_assert_held(&ioc->tm_cmds.mutex); |
| 2641 | 2628 | |
| 2642 | 2629 | if (ioc->tm_cmds.status != MPT3_CMD_NOT_USED) { |
| 2643 | − pr_info(MPT3SAS_FMT "%s: tm_cmd busy!!!\n", | |
| 2644 | − __func__, ioc->name); | |
| 2630 | + ioc_info(ioc, "%s: tm_cmd busy!!!\n", __func__); | |
| 2645 | 2631 | return FAILED; |
| 2646 | 2632 | } |
| 2647 | 2633 | |
| 2648 | 2634 | if (ioc->shost_recovery || ioc->remove_host || |
| 2649 | 2635 | ioc->pci_error_recovery) { |
| 2650 | − pr_info(MPT3SAS_FMT "%s: host reset in progress!\n", | |
| 2651 | − __func__, ioc->name); | |
| 2636 | + ioc_info(ioc, "%s: host reset in progress!\n", __func__); | |
| 2652 | 2637 | return FAILED; |
| 2653 | 2638 | } |
| 2654 | 2639 | |
| 2655 | 2640 | ioc_state = mpt3sas_base_get_iocstate(ioc, 0); |
| 2656 | 2641 | if (ioc_state & MPI2_DOORBELL_USED) { |
| 2657 | − dhsprintk(ioc, pr_info(MPT3SAS_FMT | |
| 2658 | − "unexpected doorbell active!\n", ioc->name)); | |
| 2642 | + dhsprintk(ioc, ioc_info(ioc, "unexpected doorbell active!\n")); | |
| 2659 | 2643 | rc = mpt3sas_base_hard_reset_handler(ioc, FORCE_BIG_HAMMER); |
| 2660 | 2644 | return (!rc) ? SUCCESS : FAILED; |
| 2661 | 2645 | } |
| @@ -2669,14 +2653,13 @@ mpt3sas_scsih_issue_tm(struct MPT3SAS_ADAPTER *ioc, u16 handle, u64 lun, · 7 unmodified lines | ||
| 2669 | 2653 | |
| 2670 | 2654 | smid = mpt3sas_base_get_smid_hpr(ioc, ioc->tm_cb_idx); |
| 2671 | 2655 | if (!smid) { |
| 2672 | − pr_err(MPT3SAS_FMT "%s: failed obtaining a smid\n", | |
| 2673 | − ioc->name, __func__); | |
| 2656 | + ioc_err(ioc, "%s: failed obtaining a smid\n", __func__); | |
| 2674 | 2657 | return FAILED; |
| 2675 | 2658 | } |
| 2676 | 2659 | |
| 2677 | − dtmprintk(ioc, pr_info(MPT3SAS_FMT | |
| 2678 | − "sending tm: handle(0x%04x), task_type(0x%02x), smid(%d), timeout(%d), tr_method(0x%x)\n", | |
| 2679 | − ioc->name, handle, type, smid_task, timeout, tr_method)); | |
| 2660 | + dtmprintk(ioc, | |
| 2661 | + ioc_info(ioc, "sending tm: handle(0x%04x), task_type(0x%02x), smid(%d), timeout(%d), tr_method(0x%x)\n", | |
| 2662 | + handle, type, smid_task, timeout, tr_method)); | |
| 2680 | 2663 | ioc->tm_cmds.status = MPT3_CMD_PENDING; |
| 2681 | 2664 | mpi_request = mpt3sas_base_get_msg_frame(ioc, smid); |
| 2682 | 2665 | ioc->tm_cmds.smid = smid; |
| @@ -2709,11 +2692,11 @@ mpt3sas_scsih_issue_tm(struct MPT3SAS_ADAPTER *ioc, u16 handle, u64 lun, · 26 unmodified lines | ||
| 2709 | 2692 | if (ioc->tm_cmds.status & MPT3_CMD_REPLY_VALID) { |
| 2710 | 2693 | mpt3sas_trigger_master(ioc, MASTER_TRIGGER_TASK_MANAGMENT); |
| 2711 | 2694 | mpi_reply = ioc->tm_cmds.reply; |
| 2712 | − dtmprintk(ioc, pr_info(MPT3SAS_FMT "complete tm: " \ | |
| 2713 | − "ioc_status(0x%04x), loginfo(0x%08x), term_count(0x%08x)\n", | |
| 2714 | − ioc->name, le16_to_cpu(mpi_reply->IOCStatus), | |
| 2715 | − le32_to_cpu(mpi_reply->IOCLogInfo), | |
| 2716 | − le32_to_cpu(mpi_reply->TerminationCount))); | |
| 2695 | + dtmprintk(ioc, | |
| 2696 | + ioc_info(ioc, "complete tm: ioc_status(0x%04x), loginfo(0x%08x), term_count(0x%08x)\n", | |
| 2697 | + le16_to_cpu(mpi_reply->IOCStatus), | |
| 2698 | + le32_to_cpu(mpi_reply->IOCLogInfo), | |
| 2699 | + le32_to_cpu(mpi_reply->TerminationCount))); | |
| 2717 | 2700 | if (ioc->logging_level & MPT_DEBUG_TM) { |
| 2718 | 2701 | _scsih_response_code(ioc, mpi_reply->ResponseCode); |
| 2719 | 2702 | if (mpi_reply->IOCStatus) |
| @@ -3060,13 +3043,11 @@ scsih_host_reset(struct scsi_cmnd *scmd) · 340 unmodified lines | ||
| 3060 | 3043 | struct MPT3SAS_ADAPTER *ioc = shost_priv(scmd->device->host); |
| 3061 | 3044 | int r, retval; |
| 3062 | 3045 | |
| 3063 | − pr_info(MPT3SAS_FMT "attempting host reset! scmd(%p)\n", | |
| 3064 | − ioc->name, scmd); | |
| 3046 | + ioc_info(ioc, "attempting host reset! scmd(%p)\n", scmd); | |
| 3065 | 3047 | scsi_print_command(scmd); |
| 3066 | 3048 | |
| 3067 | 3049 | if (ioc->is_driver_loading || ioc->remove_host) { |
| 3068 | − pr_info(MPT3SAS_FMT "Blocking the host reset\n", | |
| 3069 | − ioc->name); | |
| 3050 | + ioc_info(ioc, "Blocking the host reset\n"); | |
| 3070 | 3051 | r = FAILED; |
| 3071 | 3052 | goto out; |
| 3072 | 3053 | } |
| @@ -3074,8 +3055,8 @@ scsih_host_reset(struct scsi_cmnd *scmd) · 1 unmodified line | ||
| 3074 | 3055 | retval = mpt3sas_base_hard_reset_handler(ioc, FORCE_BIG_HAMMER); |
| 3075 | 3056 | r = (retval < 0) ? FAILED : SUCCESS; |
| 3076 | 3057 | out: |
| 3077 | − pr_info(MPT3SAS_FMT "host reset: %s scmd(%p)\n", | |
| 3078 | − ioc->name, ((r == SUCCESS) ? "SUCCESS" : "FAILED"), scmd); | |
| 3058 | + ioc_info(ioc, "host reset: %s scmd(%p)\n", | |
| 3059 | + r == SUCCESS ? "SUCCESS" : "FAILED", scmd); | |
| 3079 | 3060 | |
| 3080 | 3061 | return r; |
| 3081 | 3062 | } |
| @@ -3567,18 +3548,16 @@ _scsih_tm_tr_send(struct MPT3SAS_ADAPTER *ioc, u16 handle) · 485 unmodified lines | ||
| 3567 | 3548 | u8 tr_method = 0; |
| 3568 | 3549 | |
| 3569 | 3550 | if (ioc->pci_error_recovery) { |
| 3570 | − dewtprintk(ioc, pr_info(MPT3SAS_FMT | |
| 3571 | − "%s: host in pci error recovery: handle(0x%04x)\n", | |
| 3572 | − __func__, ioc->name, | |
| 3573 | − handle)); | |
| 3551 | + dewtprintk(ioc, | |
| 3552 | + ioc_info(ioc, "%s: host in pci error recovery: handle(0x%04x)\n", | |
| 3553 | + __func__, handle)); | |
| 3574 | 3554 | return; |
| 3575 | 3555 | } |
| 3576 | 3556 | ioc_state = mpt3sas_base_get_iocstate(ioc, 1); |
| 3577 | 3557 | if (ioc_state != MPI2_IOC_STATE_OPERATIONAL) { |
| 3578 | − dewtprintk(ioc, pr_info(MPT3SAS_FMT | |
| 3579 | − "%s: host is not operational: handle(0x%04x)\n", | |
| 3580 | − __func__, ioc->name, | |
| 3581 | − handle)); | |
| 3558 | + dewtprintk(ioc, | |
| 3559 | + ioc_info(ioc, "%s: host is not operational: handle(0x%04x)\n", | |
| 3560 | + __func__, handle)); | |
| 3582 | 3561 | return; |
| 3583 | 3562 | } |
| 3584 | 3563 | |
| @@ -3614,39 +3593,31 @@ _scsih_tm_tr_send(struct MPT3SAS_ADAPTER *ioc, u16 handle) · 29 unmodified lines | ||
| 3614 | 3593 | tr_method = MPI2_SCSITASKMGMT_MSGFLAGS_LINK_RESET; |
| 3615 | 3594 | } |
| 3616 | 3595 | if (sas_target_priv_data) { |
| 3617 | − dewtprintk(ioc, pr_info(MPT3SAS_FMT | |
| 3618 | − "setting delete flag: handle(0x%04x), sas_addr(0x%016llx)\n", | |
| 3619 | − ioc->name, handle, | |
| 3620 | − (unsigned long long)sas_address)); | |
| 3596 | + dewtprintk(ioc, | |
| 3597 | + ioc_info(ioc, "setting delete flag: handle(0x%04x), sas_addr(0x%016llx)\n", | |
| 3598 | + handle, (u64)sas_address)); | |
| 3621 | 3599 | if (sas_device) { |
| 3622 | 3600 | if (sas_device->enclosure_handle != 0) |
| 3623 | − dewtprintk(ioc, pr_info(MPT3SAS_FMT | |
| 3624 | − "setting delete flag:enclosure logical " | |
| 3625 | − "id(0x%016llx), slot(%d)\n", ioc->name, | |
| 3626 | − (unsigned long long) | |
| 3627 | − sas_device->enclosure_logical_id, | |
| 3628 | − sas_device->slot)); | |
| 3601 | + dewtprintk(ioc, | |
| 3602 | + ioc_info(ioc, "setting delete flag:enclosure logical id(0x%016llx), slot(%d)\n", | |
| 3603 | + (u64)sas_device->enclosure_logical_id, | |
| 3604 | + sas_device->slot)); | |
| 3629 | 3605 | if (sas_device->connector_name[0] != '\0') |
| 3630 | − dewtprintk(ioc, pr_info(MPT3SAS_FMT | |
| 3631 | − "setting delete flag: enclosure " | |
| 3632 | − "level(0x%04x), connector name( %s)\n", | |
| 3633 | − ioc->name, sas_device->enclosure_level, | |
| 3634 | − sas_device->connector_name)); | |
| 3606 | + dewtprintk(ioc, | |
| 3607 | + ioc_info(ioc, "setting delete flag: enclosure level(0x%04x), connector name( %s)\n", | |
| 3608 | + sas_device->enclosure_level, | |
| 3609 | + sas_device->connector_name)); | |
| 3635 | 3610 | } else if (pcie_device) { |
| 3636 | 3611 | if (pcie_device->enclosure_handle != 0) |
| 3637 | − dewtprintk(ioc, pr_info(MPT3SAS_FMT | |
| 3638 | − "setting delete flag: logical " | |
| 3639 | − "id(0x%016llx), slot(%d)\n", ioc->name, | |
| 3640 | − (unsigned long long) | |
| 3641 | − pcie_device->enclosure_logical_id, | |
| 3642 | − pcie_device->slot)); | |
| 3612 | + dewtprintk(ioc, | |
| 3613 | + ioc_info(ioc, "setting delete flag: logical id(0x%016llx), slot(%d)\n", | |
| 3614 | + (u64)pcie_device->enclosure_logical_id, | |
| 3615 | + pcie_device->slot)); | |
| 3643 | 3616 | if (pcie_device->connector_name[0] != '\0') |
| 3644 | − dewtprintk(ioc, pr_info(MPT3SAS_FMT | |
| 3645 | − "setting delete flag:, enclosure " | |
| 3646 | − "level(0x%04x), " | |
| 3647 | − "connector name( %s)\n", ioc->name, | |
| 3648 | − pcie_device->enclosure_level, | |
| 3649 | − pcie_device->connector_name)); | |
| 3617 | + dewtprintk(ioc, | |
| 3618 | + ioc_info(ioc, "setting delete flag:, enclosure level(0x%04x), connector name( %s)\n", | |
| 3619 | + pcie_device->enclosure_level, | |
| 3620 | + pcie_device->connector_name)); | |
| 3650 | 3621 | } |
| 3651 | 3622 | _scsih_ublock_io_device(ioc, sas_address); |
| 3652 | 3623 | sas_target_priv_data->handle = MPT3SAS_INVALID_DEVICE_HANDLE; |
| @@ -3660,16 +3631,15 @@ _scsih_tm_tr_send(struct MPT3SAS_ADAPTER *ioc, u16 handle) · 7 unmodified lines | ||
| 3660 | 3631 | INIT_LIST_HEAD(&delayed_tr->list); |
| 3661 | 3632 | delayed_tr->handle = handle; |
| 3662 | 3633 | list_add_tail(&delayed_tr->list, &ioc->delayed_tr_list); |
| 3663 | − dewtprintk(ioc, pr_info(MPT3SAS_FMT | |
| 3664 | − "DELAYED:tr:handle(0x%04x), (open)\n", | |
| 3665 | − ioc->name, handle)); | |
| 3634 | + dewtprintk(ioc, | |
| 3635 | + ioc_info(ioc, "DELAYED:tr:handle(0x%04x), (open)\n", | |
| 3636 | + handle)); | |
| 3666 | 3637 | goto out; |
| 3667 | 3638 | } |
| 3668 | 3639 | |
| 3669 | − dewtprintk(ioc, pr_info(MPT3SAS_FMT | |
| 3670 | − "tr_send:handle(0x%04x), (open), smid(%d), cb(%d)\n", | |
| 3671 | − ioc->name, handle, smid, | |
| 3672 | − ioc->tm_tr_cb_idx)); | |
| 3640 | + dewtprintk(ioc, | |
| 3641 | + ioc_info(ioc, "tr_send:handle(0x%04x), (open), smid(%d), cb(%d)\n", | |
| 3642 | + handle, smid, ioc->tm_tr_cb_idx)); | |
| 3673 | 3643 | mpi_request = mpt3sas_base_get_msg_frame(ioc, smid); |
| 3674 | 3644 | memset(mpi_request, 0, sizeof(Mpi2SCSITaskManagementRequest_t)); |
| 3675 | 3645 | mpi_request->Function = MPI2_FUNCTION_SCSI_TASK_MGMT; |
| @@ -3717,39 +3687,39 @@ _scsih_tm_tr_complete(struct MPT3SAS_ADAPTER *ioc, u16 smid, u8 msix_index, · 41 unmodified lines | ||
| 3717 | 3687 | struct _sc_list *delayed_sc; |
| 3718 | 3688 | |
| 3719 | 3689 | if (ioc->pci_error_recovery) { |
| 3720 | − dewtprintk(ioc, pr_info(MPT3SAS_FMT | |
| 3721 | − "%s: host in pci error recovery\n", __func__, | |
| 3722 | − ioc->name)); | |
| 3690 | + dewtprintk(ioc, | |
| 3691 | + ioc_info(ioc, "%s: host in pci error recovery\n", | |
| 3692 | + __func__)); | |
| 3723 | 3693 | return 1; |
| 3724 | 3694 | } |
| 3725 | 3695 | ioc_state = mpt3sas_base_get_iocstate(ioc, 1); |
| 3726 | 3696 | if (ioc_state != MPI2_IOC_STATE_OPERATIONAL) { |
| 3727 | − dewtprintk(ioc, pr_info(MPT3SAS_FMT | |
| 3728 | − "%s: host is not operational\n", __func__, ioc->name)); | |
| 3697 | + dewtprintk(ioc, | |
| 3698 | + ioc_info(ioc, "%s: host is not operational\n", | |
| 3699 | + __func__)); | |
| 3729 | 3700 | return 1; |
| 3730 | 3701 | } |
| 3731 | 3702 | if (unlikely(!mpi_reply)) { |
| 3732 | − pr_err(MPT3SAS_FMT "mpi_reply not valid at %s:%d/%s()!\n", | |
| 3733 | − ioc->name, __FILE__, __LINE__, __func__); | |
| 3703 | + ioc_err(ioc, "mpi_reply not valid at %s:%d/%s()!\n", | |
| 3704 | + __FILE__, __LINE__, __func__); | |
| 3734 | 3705 | return 1; |
| 3735 | 3706 | } |
| 3736 | 3707 | mpi_request_tm = mpt3sas_base_get_msg_frame(ioc, smid); |
| 3737 | 3708 | handle = le16_to_cpu(mpi_request_tm->DevHandle); |
| 3738 | 3709 | if (handle != le16_to_cpu(mpi_reply->DevHandle)) { |
| 3739 | − dewtprintk(ioc, pr_err(MPT3SAS_FMT | |
| 3740 | − "spurious interrupt: handle(0x%04x:0x%04x), smid(%d)!!!\n", | |
| 3741 | − ioc->name, handle, | |
| 3742 | − le16_to_cpu(mpi_reply->DevHandle), smid)); | |
| 3710 | + dewtprintk(ioc, | |
| 3711 | + ioc_err(ioc, "spurious interrupt: handle(0x%04x:0x%04x), smid(%d)!!!\n", | |
| 3712 | + handle, | |
| 3713 | + le16_to_cpu(mpi_reply->DevHandle), smid)); | |
| 3743 | 3714 | return 0; |
| 3744 | 3715 | } |
| 3745 | 3716 | |
| 3746 | 3717 | mpt3sas_trigger_master(ioc, MASTER_TRIGGER_TASK_MANAGMENT); |
| 3747 | − dewtprintk(ioc, pr_info(MPT3SAS_FMT | |
| 3748 | − "tr_complete:handle(0x%04x), (open) smid(%d), ioc_status(0x%04x), " | |
| 3749 | − "loginfo(0x%08x), completed(%d)\n", ioc->name, | |
| 3750 | − handle, smid, le16_to_cpu(mpi_reply->IOCStatus), | |
| 3751 | − le32_to_cpu(mpi_reply->IOCLogInfo), | |
| 3752 | − le32_to_cpu(mpi_reply->TerminationCount))); | |
| 3718 | + dewtprintk(ioc, | |
| 3719 | + ioc_info(ioc, "tr_complete:handle(0x%04x), (open) smid(%d), ioc_status(0x%04x), loginfo(0x%08x), completed(%d)\n", | |
| 3720 | + handle, smid, le16_to_cpu(mpi_reply->IOCStatus), | |
| 3721 | + le32_to_cpu(mpi_reply->IOCLogInfo), | |
| 3722 | + le32_to_cpu(mpi_reply->TerminationCount))); | |
| 3753 | 3723 | |
| 3754 | 3724 | smid_sas_ctrl = mpt3sas_base_get_smid(ioc, ioc->tm_sas_control_cb_idx); |
| 3755 | 3725 | if (!smid_sas_ctrl) { |
| @@ -3759,16 +3729,15 @@ _scsih_tm_tr_complete(struct MPT3SAS_ADAPTER *ioc, u16 smid, u8 msix_index, · 3 unmodified lines | ||
| 3759 | 3729 | INIT_LIST_HEAD(&delayed_sc->list); |
| 3760 | 3730 | delayed_sc->handle = le16_to_cpu(mpi_request_tm->DevHandle); |
| 3761 | 3731 | list_add_tail(&delayed_sc->list, &ioc->delayed_sc_list); |
| 3762 | − dewtprintk(ioc, pr_info(MPT3SAS_FMT | |
| 3763 | − "DELAYED:sc:handle(0x%04x), (open)\n", | |
| 3764 | − ioc->name, handle)); | |
| 3732 | + dewtprintk(ioc, | |
| 3733 | + ioc_info(ioc, "DELAYED:sc:handle(0x%04x), (open)\n", | |
| 3734 | + handle)); | |
| 3765 | 3735 | return _scsih_check_for_pending_tm(ioc, smid); |
| 3766 | 3736 | } |
| 3767 | 3737 | |
| 3768 | − dewtprintk(ioc, pr_info(MPT3SAS_FMT | |
| 3769 | − "sc_send:handle(0x%04x), (open), smid(%d), cb(%d)\n", | |
| 3770 | − ioc->name, handle, smid_sas_ctrl, | |
| 3771 | − ioc->tm_sas_control_cb_idx)); | |
| 3738 | + dewtprintk(ioc, | |
| 3739 | + ioc_info(ioc, "sc_send:handle(0x%04x), (open), smid(%d), cb(%d)\n", | |
| 3740 | + handle, smid_sas_ctrl, ioc->tm_sas_control_cb_idx)); | |
| 3772 | 3741 | mpi_request = mpt3sas_base_get_msg_frame(ioc, smid_sas_ctrl); |
| 3773 | 3742 | memset(mpi_request, 0, sizeof(Mpi2SasIoUnitControlRequest_t)); |
| 3774 | 3743 | mpi_request->Function = MPI2_FUNCTION_SAS_IO_UNIT_CONTROL; |
| @@ -3803,20 +3772,19 @@ _scsih_sas_control_complete(struct MPT3SAS_ADAPTER *ioc, u16 smid, · 28 unmodified lines | ||
| 3803 | 3772 | mpt3sas_base_get_reply_virt_addr(ioc, reply); |
| 3804 | 3773 | |
| 3805 | 3774 | if (likely(mpi_reply)) { |
| 3806 | − dewtprintk(ioc, pr_info(MPT3SAS_FMT | |
| 3807 | − "sc_complete:handle(0x%04x), (open) " | |
| 3808 | − "smid(%d), ioc_status(0x%04x), loginfo(0x%08x)\n", | |
| 3809 | − ioc->name, le16_to_cpu(mpi_reply->DevHandle), smid, | |
| 3810 | − le16_to_cpu(mpi_reply->IOCStatus), | |
| 3811 | − le32_to_cpu(mpi_reply->IOCLogInfo))); | |
| 3775 | + dewtprintk(ioc, | |
| 3776 | + ioc_info(ioc, "sc_complete:handle(0x%04x), (open) smid(%d), ioc_status(0x%04x), loginfo(0x%08x)\n", | |
| 3777 | + le16_to_cpu(mpi_reply->DevHandle), smid, | |
| 3778 | + le16_to_cpu(mpi_reply->IOCStatus), | |
| 3779 | + le32_to_cpu(mpi_reply->IOCLogInfo))); | |
| 3812 | 3780 | if (le16_to_cpu(mpi_reply->IOCStatus) == |
| 3813 | 3781 | MPI2_IOCSTATUS_SUCCESS) { |
| 3814 | 3782 | clear_bit(le16_to_cpu(mpi_reply->DevHandle), |
| 3815 | 3783 | ioc->device_remove_in_progress); |
| 3816 | 3784 | } |
| 3817 | 3785 | } else { |
| 3818 | − pr_err(MPT3SAS_FMT "mpi_reply not valid at %s:%d/%s()!\n", | |
| 3819 | − ioc->name, __FILE__, __LINE__, __func__); | |
| 3786 | + ioc_err(ioc, "mpi_reply not valid at %s:%d/%s()!\n", | |
| 3787 | + __FILE__, __LINE__, __func__); | |
| 3820 | 3788 | } |
| 3821 | 3789 | return mpt3sas_check_for_pending_internal_cmds(ioc, smid); |
| 3822 | 3790 | } |
| @@ -3839,9 +3807,9 @@ _scsih_tm_tr_volume_send(struct MPT3SAS_ADAPTER *ioc, u16 handle) · 16 unmodified lines | ||
| 3839 | 3807 | struct _tr_list *delayed_tr; |
| 3840 | 3808 | |
| 3841 | 3809 | if (ioc->pci_error_recovery) { |
| 3842 | − dewtprintk(ioc, pr_info(MPT3SAS_FMT | |
| 3843 | − "%s: host reset in progress!\n", | |
| 3844 | − __func__, ioc->name)); | |
| 3810 | + dewtprintk(ioc, | |
| 3811 | + ioc_info(ioc, "%s: host reset in progress!\n", | |
| 3812 | + __func__)); | |
| 3845 | 3813 | return; |
| 3846 | 3814 | } |
| 3847 | 3815 | |
| @@ -3853,16 +3821,15 @@ _scsih_tm_tr_volume_send(struct MPT3SAS_ADAPTER *ioc, u16 handle) · 5 unmodified lines | ||
| 3853 | 3821 | INIT_LIST_HEAD(&delayed_tr->list); |
| 3854 | 3822 | delayed_tr->handle = handle; |
| 3855 | 3823 | list_add_tail(&delayed_tr->list, &ioc->delayed_tr_volume_list); |
| 3856 | − dewtprintk(ioc, pr_info(MPT3SAS_FMT | |
| 3857 | − "DELAYED:tr:handle(0x%04x), (open)\n", | |
| 3858 | − ioc->name, handle)); | |
| 3824 | + dewtprintk(ioc, | |
| 3825 | + ioc_info(ioc, "DELAYED:tr:handle(0x%04x), (open)\n", | |
| 3826 | + handle)); | |
| 3859 | 3827 | return; |
| 3860 | 3828 | } |
| 3861 | 3829 | |
| 3862 | − dewtprintk(ioc, pr_info(MPT3SAS_FMT | |
| 3863 | − "tr_send:handle(0x%04x), (open), smid(%d), cb(%d)\n", | |
| 3864 | − ioc->name, handle, smid, | |
| 3865 | − ioc->tm_tr_volume_cb_idx)); | |
| 3830 | + dewtprintk(ioc, | |
| 3831 | + ioc_info(ioc, "tr_send:handle(0x%04x), (open), smid(%d), cb(%d)\n", | |
| 3832 | + handle, smid, ioc->tm_tr_volume_cb_idx)); | |
| 3866 | 3833 | mpi_request = mpt3sas_base_get_msg_frame(ioc, smid); |
| 3867 | 3834 | memset(mpi_request, 0, sizeof(Mpi2SCSITaskManagementRequest_t)); |
| 3868 | 3835 | mpi_request->Function = MPI2_FUNCTION_SCSI_TASK_MGMT; |
| @@ -3892,33 +3859,32 @@ _scsih_tm_volume_tr_complete(struct MPT3SAS_ADAPTER *ioc, u16 smid, · 23 unmodified lines | ||
| 3892 | 3859 | mpt3sas_base_get_reply_virt_addr(ioc, reply); |
| 3893 | 3860 | |
| 3894 | 3861 | if (ioc->shost_recovery || ioc->pci_error_recovery) { |
| 3895 | − dewtprintk(ioc, pr_info(MPT3SAS_FMT | |
| 3896 | − "%s: host reset in progress!\n", | |
| 3897 | − __func__, ioc->name)); | |
| 3862 | + dewtprintk(ioc, | |
| 3863 | + ioc_info(ioc, "%s: host reset in progress!\n", | |
| 3864 | + __func__)); | |
| 3898 | 3865 | return 1; |
| 3899 | 3866 | } |
| 3900 | 3867 | if (unlikely(!mpi_reply)) { |
| 3901 | − pr_err(MPT3SAS_FMT "mpi_reply not valid at %s:%d/%s()!\n", | |
| 3902 | − ioc->name, __FILE__, __LINE__, __func__); | |
| 3868 | + ioc_err(ioc, "mpi_reply not valid at %s:%d/%s()!\n", | |
| 3869 | + __FILE__, __LINE__, __func__); | |
| 3903 | 3870 | return 1; |
| 3904 | 3871 | } |
| 3905 | 3872 | |
| 3906 | 3873 | mpi_request_tm = mpt3sas_base_get_msg_frame(ioc, smid); |
| 3907 | 3874 | handle = le16_to_cpu(mpi_request_tm->DevHandle); |
| 3908 | 3875 | if (handle != le16_to_cpu(mpi_reply->DevHandle)) { |
| 3909 | − dewtprintk(ioc, pr_err(MPT3SAS_FMT | |
| 3910 | − "spurious interrupt: handle(0x%04x:0x%04x), smid(%d)!!!\n", | |
| 3911 | − ioc->name, handle, | |
| 3912 | − le16_to_cpu(mpi_reply->DevHandle), smid)); | |
| 3876 | + dewtprintk(ioc, | |
| 3877 | + ioc_err(ioc, "spurious interrupt: handle(0x%04x:0x%04x), smid(%d)!!!\n", | |
| 3878 | + handle, le16_to_cpu(mpi_reply->DevHandle), | |
| 3879 | + smid)); | |
| 3913 | 3880 | return 0; |
| 3914 | 3881 | } |
| 3915 | 3882 | |
| 3916 | − dewtprintk(ioc, pr_info(MPT3SAS_FMT | |
| 3917 | − "tr_complete:handle(0x%04x), (open) smid(%d), ioc_status(0x%04x), " | |
| 3918 | − "loginfo(0x%08x), completed(%d)\n", ioc->name, | |
| 3919 | − handle, smid, le16_to_cpu(mpi_reply->IOCStatus), | |
| 3920 | − le32_to_cpu(mpi_reply->IOCLogInfo), | |
| 3921 | − le32_to_cpu(mpi_reply->TerminationCount))); | |
| 3883 | + dewtprintk(ioc, | |
| 3884 | + ioc_info(ioc, "tr_complete:handle(0x%04x), (open) smid(%d), ioc_status(0x%04x), loginfo(0x%08x), completed(%d)\n", | |
| 3885 | + handle, smid, le16_to_cpu(mpi_reply->IOCStatus), | |
| 3886 | + le32_to_cpu(mpi_reply->IOCLogInfo), | |
| 3887 | + le32_to_cpu(mpi_reply->TerminationCount))); | |
| 3922 | 3888 | |
| 3923 | 3889 | return _scsih_check_for_pending_tm(ioc, smid); |
| 3924 | 3890 | } |
| @@ -3948,10 +3914,9 @@ _scsih_issue_delayed_event_ack(struct MPT3SAS_ADAPTER *ioc, u16 smid, U16 event, · 23 unmodified lines | ||
| 3948 | 3914 | ioc->internal_lookup[i].cb_idx = ioc->base_cb_idx; |
| 3949 | 3915 | spin_unlock_irqrestore(&ioc->scsi_lookup_lock, flags); |
| 3950 | 3916 | |
| 3951 | − dewtprintk(ioc, pr_info(MPT3SAS_FMT | |
| 3952 | − "EVENT ACK: event(0x%04x), smid(%d), cb(%d)\n", | |
| 3953 | − ioc->name, le16_to_cpu(event), smid, | |
| 3954 | − ioc->base_cb_idx)); | |
| 3917 | + dewtprintk(ioc, | |
| 3918 | + ioc_info(ioc, "EVENT ACK: event(0x%04x), smid(%d), cb(%d)\n", | |
| 3919 | + le16_to_cpu(event), smid, ioc->base_cb_idx)); | |
| 3955 | 3920 | ack_request = mpt3sas_base_get_msg_frame(ioc, smid); |
| 3956 | 3921 | memset(ack_request, 0, sizeof(Mpi2EventAckRequest_t)); |
| 3957 | 3922 | ack_request->Function = MPI2_FUNCTION_EVENT_ACK; |
| @@ -3981,21 +3946,21 @@ _scsih_issue_delayed_sas_io_unit_ctrl(struct MPT3SAS_ADAPTER *ioc, · 23 unmodified lines | ||
| 3981 | 3946 | unsigned long flags; |
| 3982 | 3947 | |
| 3983 | 3948 | if (ioc->remove_host) { |
| 3984 | − dewtprintk(ioc, pr_info(MPT3SAS_FMT | |
| 3985 | − "%s: host has been removed\n", | |
| 3986 | − __func__, ioc->name)); | |
| 3949 | + dewtprintk(ioc, | |
| 3950 | + ioc_info(ioc, "%s: host has been removed\n", | |
| 3951 | + __func__)); | |
| 3987 | 3952 | return; |
| 3988 | 3953 | } else if (ioc->pci_error_recovery) { |
| 3989 | − dewtprintk(ioc, pr_info(MPT3SAS_FMT | |
| 3990 | − "%s: host in pci error recovery\n", | |
| 3991 | − __func__, ioc->name)); | |
| 3954 | + dewtprintk(ioc, | |
| 3955 | + ioc_info(ioc, "%s: host in pci error recovery\n", | |
| 3956 | + __func__)); | |
| 3992 | 3957 | return; |
| 3993 | 3958 | } |
| 3994 | 3959 | ioc_state = mpt3sas_base_get_iocstate(ioc, 1); |
| 3995 | 3960 | if (ioc_state != MPI2_IOC_STATE_OPERATIONAL) { |
| 3996 | − dewtprintk(ioc, pr_info(MPT3SAS_FMT | |
| 3997 | − "%s: host is not operational\n", | |
| 3998 | − __func__, ioc->name)); | |
| 3961 | + dewtprintk(ioc, | |
| 3962 | + ioc_info(ioc, "%s: host is not operational\n", | |
| 3963 | + __func__)); | |
| 3999 | 3964 | return; |
| 4000 | 3965 | } |
| 4001 | 3966 | |
| @@ -4007,10 +3972,9 @@ _scsih_issue_delayed_sas_io_unit_ctrl(struct MPT3SAS_ADAPTER *ioc, · 5 unmodified lines | ||
| 4007 | 3972 | ioc->internal_lookup[i].cb_idx = ioc->tm_sas_control_cb_idx; |
| 4008 | 3973 | spin_unlock_irqrestore(&ioc->scsi_lookup_lock, flags); |
| 4009 | 3974 | |
| 4010 | − dewtprintk(ioc, pr_info(MPT3SAS_FMT | |
| 4011 | − "sc_send:handle(0x%04x), (open), smid(%d), cb(%d)\n", | |
| 4012 | − ioc->name, handle, smid, | |
| 4013 | − ioc->tm_sas_control_cb_idx)); | |
| 3975 | + dewtprintk(ioc, | |
| 3976 | + ioc_info(ioc, "sc_send:handle(0x%04x), (open), smid(%d), cb(%d)\n", | |
| 3977 | + handle, smid, ioc->tm_sas_control_cb_idx)); | |
| 4014 | 3978 | mpi_request = mpt3sas_base_get_msg_frame(ioc, smid); |
| 4015 | 3979 | memset(mpi_request, 0, sizeof(Mpi2SasIoUnitControlRequest_t)); |
| 4016 | 3980 | mpi_request->Function = MPI2_FUNCTION_SAS_IO_UNIT_CONTROL; |
| @@ -4171,8 +4135,8 @@ _scsih_check_topo_delete_events(struct MPT3SAS_ADAPTER *ioc, · 154 unmodified lines | ||
| 4171 | 4135 | MPI2_EVENT_SAS_TOPO_ES_RESPONDING) { |
| 4172 | 4136 | if (le16_to_cpu(local_event_data->ExpanderDevHandle) == |
| 4173 | 4137 | expander_handle) { |
| 4174 | − dewtprintk(ioc, pr_info(MPT3SAS_FMT | |
| 4175 | − "setting ignoring flag\n", ioc->name)); | |
| 4138 | + dewtprintk(ioc, | |
| 4139 | + ioc_info(ioc, "setting ignoring flag\n")); | |
| 4176 | 4140 | fw_event->ignore = 1; |
| 4177 | 4141 | } |
| 4178 | 4142 | } |
| @@ -4243,9 +4207,8 @@ _scsih_check_pcie_topo_remove_events(struct MPT3SAS_ADAPTER *ioc, · 64 unmodified lines | ||
| 4243 | 4207 | MPI2_EVENT_SAS_TOPO_ES_RESPONDING) { |
| 4244 | 4208 | if (le16_to_cpu(local_event_data->SwitchDevHandle) == |
| 4245 | 4209 | switch_handle) { |
| 4246 | − dewtprintk(ioc, pr_info(MPT3SAS_FMT | |
| 4247 | − "setting ignoring flag for switch event\n", | |
| 4248 | − ioc->name)); | |
| 4210 | + dewtprintk(ioc, | |
| 4211 | + ioc_info(ioc, "setting ignoring flag for switch event\n")); | |
| 4249 | 4212 | fw_event->ignore = 1; |
| 4250 | 4213 | } |
| 4251 | 4214 | } |
| @@ -4274,10 +4237,9 @@ _scsih_set_volume_delete_flag(struct MPT3SAS_ADAPTER *ioc, u16 handle) · 22 unmodified lines | ||
| 4274 | 4237 | sas_target_priv_data = |
| 4275 | 4238 | raid_device->starget->hostdata; |
| 4276 | 4239 | sas_target_priv_data->deleted = 1; |
| 4277 | − dewtprintk(ioc, pr_info(MPT3SAS_FMT | |
| 4278 | − "setting delete flag: handle(0x%04x), " | |
| 4279 | − "wwid(0x%016llx)\n", ioc->name, handle, | |
| 4280 | − (unsigned long long) raid_device->wwid)); | |
| 4240 | + dewtprintk(ioc, | |
| 4241 | + ioc_info(ioc, "setting delete flag: handle(0x%04x), wwid(0x%016llx)\n", | |
| 4242 | + handle, (u64)raid_device->wwid)); | |
| 4281 | 4243 | } |
| 4282 | 4244 | spin_unlock_irqrestore(&ioc->raid_device_lock, flags); |
| 4283 | 4245 | } |
| @@ -4379,9 +4341,9 @@ _scsih_check_ir_config_unhide_events(struct MPT3SAS_ADAPTER *ioc, · 95 unmodified lines | ||
| 4379 | 4341 | INIT_LIST_HEAD(&delayed_tr->list); |
| 4380 | 4342 | delayed_tr->handle = handle; |
| 4381 | 4343 | list_add_tail(&delayed_tr->list, &ioc->delayed_tr_list); |
| 4382 | − dewtprintk(ioc, pr_info(MPT3SAS_FMT | |
| 4383 | − "DELAYED:tr:handle(0x%04x), (open)\n", ioc->name, | |
| 4384 | − handle)); | |
| 4344 | + dewtprintk(ioc, | |
| 4345 | + ioc_info(ioc, "DELAYED:tr:handle(0x%04x), (open)\n", | |
| 4346 | + handle)); | |
| 4385 | 4347 | } else |
| 4386 | 4348 | _scsih_tm_tr_send(ioc, handle); |
| 4387 | 4349 | } |
| @@ -4424,15 +4386,14 @@ _scsih_temp_threshold_events(struct MPT3SAS_ADAPTER *ioc, · 36 unmodified lines | ||
| 4424 | 4386 | Mpi2EventDataTemperature_t *event_data) |
| 4425 | 4387 | { |
| 4426 | 4388 | if (ioc->temp_sensors_count >= event_data->SensorNum) { |
| 4427 | − pr_err(MPT3SAS_FMT "Temperature Threshold flags %s%s%s%s" | |
| 4428 | − " exceeded for Sensor: %d !!!\n", ioc->name, | |
| 4429 | − ((le16_to_cpu(event_data->Status) & 0x1) == 1) ? "0 " : " ", | |
| 4430 | − ((le16_to_cpu(event_data->Status) & 0x2) == 2) ? "1 " : " ", | |
| 4431 | − ((le16_to_cpu(event_data->Status) & 0x4) == 4) ? "2 " : " ", | |
| 4432 | − ((le16_to_cpu(event_data->Status) & 0x8) == 8) ? "3 " : " ", | |
| 4433 | − event_data->SensorNum); | |
| 4434 | − pr_err(MPT3SAS_FMT "Current Temp In Celsius: %d\n", | |
| 4435 | − ioc->name, event_data->CurrentTemperature); | |
| 4389 | + ioc_err(ioc, "Temperature Threshold flags %s%s%s%s exceeded for Sensor: %d !!!\n", | |
| 4390 | + le16_to_cpu(event_data->Status) & 0x1 ? "0 " : " ", | |
| 4391 | + le16_to_cpu(event_data->Status) & 0x2 ? "1 " : " ", | |
| 4392 | + le16_to_cpu(event_data->Status) & 0x4 ? "2 " : " ", | |
| 4393 | + le16_to_cpu(event_data->Status) & 0x8 ? "3 " : " ", | |
| 4394 | + event_data->SensorNum); | |
| 4395 | + ioc_err(ioc, "Current Temp In Celsius: %d\n", | |
| 4396 | + event_data->CurrentTemperature); | |
| 4436 | 4397 | } |
| 4437 | 4398 | } |
| 4438 | 4399 | |
| @@ -4480,8 +4441,7 @@ _scsih_flush_running_cmds(struct MPT3SAS_ADAPTER *ioc) · 41 unmodified lines | ||
| 4480 | 4441 | scmd->result = DID_RESET << 16; |
| 4481 | 4442 | scmd->scsi_done(scmd); |
| 4482 | 4443 | } |
| 4483 | − dtmprintk(ioc, pr_info(MPT3SAS_FMT "completing %d cmds\n", | |
| 4484 | − ioc->name, count)); | |
| 4444 | + dtmprintk(ioc, ioc_info(ioc, "completing %d cmds\n", count)); | |
| 4485 | 4445 | } |
| 4486 | 4446 | |
| 4487 | 4447 | /** |
| @@ -4680,8 +4640,7 @@ scsih_qcmd(struct Scsi_Host *shost, struct scsi_cmnd *scmd) · 192 unmodified lines | ||
| 4680 | 4640 | |
| 4681 | 4641 | smid = mpt3sas_base_get_smid_scsiio(ioc, ioc->scsi_io_cb_idx, scmd); |
| 4682 | 4642 | if (!smid) { |
| 4683 | − pr_err(MPT3SAS_FMT "%s: failed obtaining a smid\n", | |
| 4684 | − ioc->name, __func__); | |
| 4643 | + ioc_err(ioc, "%s: failed obtaining a smid\n", __func__); | |
| 4685 | 4644 | _scsih_set_satl_pending(scmd, false); |
| 4686 | 4645 | goto out; |
| 4687 | 4646 | } |
| @@ -4919,37 +4878,28 @@ _scsih_scsi_ioc_info(struct MPT3SAS_ADAPTER *ioc, struct scsi_cmnd *scmd, · 231 unmodified lines | ||
| 4919 | 4878 | scsi_print_command(scmd); |
| 4920 | 4879 | |
| 4921 | 4880 | if (priv_target->flags & MPT_TARGET_FLAGS_VOLUME) { |
| 4922 | − pr_warn(MPT3SAS_FMT "\t%s wwid(0x%016llx)\n", ioc->name, | |
| 4923 | − device_str, (unsigned long long)priv_target->sas_address); | |
| 4881 | + ioc_warn(ioc, "\t%s wwid(0x%016llx)\n", | |
| 4882 | + device_str, (u64)priv_target->sas_address); | |
| 4924 | 4883 | } else if (priv_target->flags & MPT_TARGET_FLAGS_PCIE_DEVICE) { |
| 4925 | 4884 | pcie_device = mpt3sas_get_pdev_from_target(ioc, priv_target); |
| 4926 | 4885 | if (pcie_device) { |
| 4927 | − pr_info(MPT3SAS_FMT "\twwid(0x%016llx), port(%d)\n", | |
| 4928 | − ioc->name, | |
| 4929 | − (unsigned long long)pcie_device->wwid, | |
| 4930 | − pcie_device->port_num); | |
| 4886 | + ioc_info(ioc, "\twwid(0x%016llx), port(%d)\n", | |
| 4887 | + (u64)pcie_device->wwid, pcie_device->port_num); | |
| 4931 | 4888 | if (pcie_device->enclosure_handle != 0) |
| 4932 | − pr_info(MPT3SAS_FMT | |
| 4933 | − "\tenclosure logical id(0x%016llx), " | |
| 4934 | − "slot(%d)\n", ioc->name, | |
| 4935 | − (unsigned long long) | |
| 4936 | − pcie_device->enclosure_logical_id, | |
| 4937 | − pcie_device->slot); | |
| 4889 | + ioc_info(ioc, "\tenclosure logical id(0x%016llx), slot(%d)\n", | |
| 4890 | + (u64)pcie_device->enclosure_logical_id, | |
| 4891 | + pcie_device->slot); | |
| 4938 | 4892 | if (pcie_device->connector_name[0]) |
| 4939 | − pr_info(MPT3SAS_FMT | |
| 4940 | − "\tenclosure level(0x%04x)," | |
| 4941 | − "connector name( %s)\n", | |
| 4942 | − ioc->name, pcie_device->enclosure_level, | |
| 4943 | − pcie_device->connector_name); | |
| 4893 | + ioc_info(ioc, "\tenclosure level(0x%04x), connector name( %s)\n", | |
| 4894 | + pcie_device->enclosure_level, | |
| 4895 | + pcie_device->connector_name); | |
| 4944 | 4896 | pcie_device_put(pcie_device); |
| 4945 | 4897 | } |
| 4946 | 4898 | } else { |
| 4947 | 4899 | sas_device = mpt3sas_get_sdev_from_target(ioc, priv_target); |
| 4948 | 4900 | if (sas_device) { |
| 4949 | − pr_warn(MPT3SAS_FMT | |
| 4950 | − "\tsas_address(0x%016llx), phy(%d)\n", | |
| 4951 | − ioc->name, (unsigned long long) | |
| 4952 | − sas_device->sas_address, sas_device->phy); | |
| 4901 | + ioc_warn(ioc, "\tsas_address(0x%016llx), phy(%d)\n", | |
| 4902 | + (u64)sas_device->sas_address, sas_device->phy); | |
| 4953 | 4903 | |
| 4954 | 4904 | _scsih_display_enclosure_chassis_info(ioc, sas_device, |
| 4955 | 4905 | NULL, NULL); |
| @@ -4958,30 +4908,23 @@ _scsih_scsi_ioc_info(struct MPT3SAS_ADAPTER *ioc, struct scsi_cmnd *scmd, · 2 unmodified lines | ||
| 4958 | 4908 | } |
| 4959 | 4909 | } |
| 4960 | 4910 | |
| 4961 | − pr_warn(MPT3SAS_FMT | |
| 4962 | − "\thandle(0x%04x), ioc_status(%s)(0x%04x), smid(%d)\n", | |
| 4963 | − ioc->name, le16_to_cpu(mpi_reply->DevHandle), | |
| 4964 | − desc_ioc_state, ioc_status, smid); | |
| 4965 | − pr_warn(MPT3SAS_FMT | |
| 4966 | − "\trequest_len(%d), underflow(%d), resid(%d)\n", | |
| 4967 | − ioc->name, scsi_bufflen(scmd), scmd->underflow, | |
| 4968 | − scsi_get_resid(scmd)); | |
| 4969 | − pr_warn(MPT3SAS_FMT | |
| 4970 | − "\ttag(%d), transfer_count(%d), sc->result(0x%08x)\n", | |
| 4971 | − ioc->name, le16_to_cpu(mpi_reply->TaskTag), | |
| 4972 | − le32_to_cpu(mpi_reply->TransferCount), scmd->result); | |
| 4973 | − pr_warn(MPT3SAS_FMT | |
| 4974 | − "\tscsi_status(%s)(0x%02x), scsi_state(%s)(0x%02x)\n", | |
| 4975 | − ioc->name, desc_scsi_status, | |
| 4976 | − scsi_status, desc_scsi_state, scsi_state); | |
| 4911 | + ioc_warn(ioc, "\thandle(0x%04x), ioc_status(%s)(0x%04x), smid(%d)\n", | |
| 4912 | + le16_to_cpu(mpi_reply->DevHandle), | |
| 4913 | + desc_ioc_state, ioc_status, smid); | |
| 4914 | + ioc_warn(ioc, "\trequest_len(%d), underflow(%d), resid(%d)\n", | |
| 4915 | + scsi_bufflen(scmd), scmd->underflow, scsi_get_resid(scmd)); | |
| 4916 | + ioc_warn(ioc, "\ttag(%d), transfer_count(%d), sc->result(0x%08x)\n", | |
| 4917 | + le16_to_cpu(mpi_reply->TaskTag), | |
| 4918 | + le32_to_cpu(mpi_reply->TransferCount), scmd->result); | |
| 4919 | + ioc_warn(ioc, "\tscsi_status(%s)(0x%02x), scsi_state(%s)(0x%02x)\n", | |
| 4920 | + desc_scsi_status, scsi_status, desc_scsi_state, scsi_state); | |
| 4977 | 4921 | |
| 4978 | 4922 | if (scsi_state & MPI2_SCSI_STATE_AUTOSENSE_VALID) { |
| 4979 | 4923 | struct sense_info data; |
| 4980 | 4924 | _scsih_normalize_sense(scmd->sense_buffer, &data); |
| 4981 | − pr_warn(MPT3SAS_FMT | |
| 4982 | − "\t[sense_key,asc,ascq]: [0x%02x,0x%02x,0x%02x], count(%d)\n", | |
| 4983 | − ioc->name, data.skey, | |
| 4984 | − data.asc, data.ascq, le32_to_cpu(mpi_reply->SenseCount)); | |
| 4925 | + ioc_warn(ioc, "\t[sense_key,asc,ascq]: [0x%02x,0x%02x,0x%02x], count(%d)\n", | |
| 4926 | + data.skey, data.asc, data.ascq, | |
| 4927 | + le32_to_cpu(mpi_reply->SenseCount)); | |
| 4985 | 4928 | } |
| 4986 | 4929 | if (scsi_state & MPI2_SCSI_STATE_RESPONSE_INFO_VALID) { |
| 4987 | 4930 | response_info = le32_to_cpu(mpi_reply->ResponseInfo); |
| @@ -5016,17 +4959,17 @@ _scsih_turn_on_pfa_led(struct MPT3SAS_ADAPTER *ioc, u16 handle) · 28 unmodified lines | ||
| 5016 | 4959 | mpi_request.Flags = MPI2_SEP_REQ_FLAGS_DEVHANDLE_ADDRESS; |
| 5017 | 4960 | if ((mpt3sas_base_scsi_enclosure_processor(ioc, &mpi_reply, |
| 5018 | 4961 | &mpi_request)) != 0) { |
| 5019 | − pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", ioc->name, | |
| 5020 | − __FILE__, __LINE__, __func__); | |
| 4962 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", | |
| 4963 | + __FILE__, __LINE__, __func__); | |
| 5021 | 4964 | goto out; |
| 5022 | 4965 | } |
| 5023 | 4966 | sas_device->pfa_led_on = 1; |
| 5024 | 4967 | |
| 5025 | 4968 | if (mpi_reply.IOCStatus || mpi_reply.IOCLogInfo) { |
| 5026 | − dewtprintk(ioc, pr_info(MPT3SAS_FMT | |
| 5027 | − "enclosure_processor: ioc_status (0x%04x), loginfo(0x%08x)\n", | |
| 5028 | − ioc->name, le16_to_cpu(mpi_reply.IOCStatus), | |
| 5029 | − le32_to_cpu(mpi_reply.IOCLogInfo))); | |
| 4969 | + dewtprintk(ioc, | |
| 4970 | + ioc_info(ioc, "enclosure_processor: ioc_status (0x%04x), loginfo(0x%08x)\n", | |
| 4971 | + le16_to_cpu(mpi_reply.IOCStatus), | |
| 4972 | + le32_to_cpu(mpi_reply.IOCLogInfo))); | |
| 5030 | 4973 | goto out; |
| 5031 | 4974 | } |
| 5032 | 4975 | out: |
| @@ -5056,16 +4999,16 @@ _scsih_turn_off_pfa_led(struct MPT3SAS_ADAPTER *ioc, · 23 unmodified lines | ||
| 5056 | 4999 | mpi_request.Flags = MPI2_SEP_REQ_FLAGS_ENCLOSURE_SLOT_ADDRESS; |
| 5057 | 5000 | if ((mpt3sas_base_scsi_enclosure_processor(ioc, &mpi_reply, |
| 5058 | 5001 | &mpi_request)) != 0) { |
| 5059 | − printk(MPT3SAS_FMT "failure at %s:%d/%s()!\n", ioc->name, | |
| 5060 | − __FILE__, __LINE__, __func__); | |
| 5002 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", | |
| 5003 | + __FILE__, __LINE__, __func__); | |
| 5061 | 5004 | return; |
| 5062 | 5005 | } |
| 5063 | 5006 | |
| 5064 | 5007 | if (mpi_reply.IOCStatus || mpi_reply.IOCLogInfo) { |
| 5065 | − dewtprintk(ioc, printk(MPT3SAS_FMT | |
| 5066 | − "enclosure_processor: ioc_status (0x%04x), loginfo(0x%08x)\n", | |
| 5067 | − ioc->name, le16_to_cpu(mpi_reply.IOCStatus), | |
| 5068 | − le32_to_cpu(mpi_reply.IOCLogInfo))); | |
| 5008 | + dewtprintk(ioc, | |
| 5009 | + ioc_info(ioc, "enclosure_processor: ioc_status (0x%04x), loginfo(0x%08x)\n", | |
| 5010 | + le16_to_cpu(mpi_reply.IOCStatus), | |
| 5011 | + le32_to_cpu(mpi_reply.IOCLogInfo))); | |
| 5069 | 5012 | return; |
| 5070 | 5013 | } |
| 5071 | 5014 | } |
| @@ -5133,8 +5076,8 @@ _scsih_smart_predicted_fault(struct MPT3SAS_ADAPTER *ioc, u16 handle) · 61 unmodified lines | ||
| 5133 | 5076 | sizeof(Mpi2EventDataSasDeviceStatusChange_t); |
| 5134 | 5077 | event_reply = kzalloc(sz, GFP_KERNEL); |
| 5135 | 5078 | if (!event_reply) { |
| 5136 | − pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", | |
| 5137 | − ioc->name, __FILE__, __LINE__, __func__); | |
| 5079 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", | |
| 5080 | + __FILE__, __LINE__, __func__); | |
| 5138 | 5081 | goto out; |
| 5139 | 5082 | } |
| 5140 | 5083 | |
| @@ -5424,16 +5367,16 @@ _scsih_sas_host_refresh(struct MPT3SAS_ADAPTER *ioc) · 283 unmodified lines | ||
| 5424 | 5367 | u16 attached_handle; |
| 5425 | 5368 | u8 link_rate; |
| 5426 | 5369 | |
| 5427 | − dtmprintk(ioc, pr_info(MPT3SAS_FMT | |
| 5428 | − "updating handles for sas_host(0x%016llx)\n", | |
| 5429 | − ioc->name, (unsigned long long)ioc->sas_hba.sas_address)); | |
| 5370 | + dtmprintk(ioc, | |
| 5371 | + ioc_info(ioc, "updating handles for sas_host(0x%016llx)\n", | |
| 5372 | + (u64)ioc->sas_hba.sas_address)); | |
| 5430 | 5373 | |
| 5431 | 5374 | sz = offsetof(Mpi2SasIOUnitPage0_t, PhyData) + (ioc->sas_hba.num_phys |
| 5432 | 5375 | * sizeof(Mpi2SasIOUnit0PhyData_t)); |
| 5433 | 5376 | sas_iounit_pg0 = kzalloc(sz, GFP_KERNEL); |
| 5434 | 5377 | if (!sas_iounit_pg0) { |
| 5435 | − pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", | |
| 5436 | − ioc->name, __FILE__, __LINE__, __func__); | |
| 5378 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", | |
| 5379 | + __FILE__, __LINE__, __func__); | |
| 5437 | 5380 | return; |
| 5438 | 5381 | } |
| 5439 | 5382 | |
| @@ -5483,15 +5426,15 @@ _scsih_sas_host_add(struct MPT3SAS_ADAPTER *ioc) · 43 unmodified lines | ||
| 5483 | 5426 | |
| 5484 | 5427 | mpt3sas_config_get_number_hba_phys(ioc, &num_phys); |
| 5485 | 5428 | if (!num_phys) { |
| 5486 | − pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", | |
| 5487 | − ioc->name, __FILE__, __LINE__, __func__); | |
| 5429 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", | |
| 5430 | + __FILE__, __LINE__, __func__); | |
| 5488 | 5431 | return; |
| 5489 | 5432 | } |
| 5490 | 5433 | ioc->sas_hba.phy = kcalloc(num_phys, |
| 5491 | 5434 | sizeof(struct _sas_phy), GFP_KERNEL); |
| 5492 | 5435 | if (!ioc->sas_hba.phy) { |
| 5493 | − pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", | |
| 5494 | − ioc->name, __FILE__, __LINE__, __func__); | |
| 5436 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", | |
| 5437 | + __FILE__, __LINE__, __func__); | |
| 5495 | 5438 | goto out; |
| 5496 | 5439 | } |
| 5497 | 5440 | ioc->sas_hba.num_phys = num_phys; |
| @@ -5501,21 +5444,21 @@ _scsih_sas_host_add(struct MPT3SAS_ADAPTER *ioc) · 3 unmodified lines | ||
| 5501 | 5444 | sizeof(Mpi2SasIOUnit0PhyData_t)); |
| 5502 | 5445 | sas_iounit_pg0 = kzalloc(sz, GFP_KERNEL); |
| 5503 | 5446 | if (!sas_iounit_pg0) { |
| 5504 | − pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", | |
| 5505 | − ioc->name, __FILE__, __LINE__, __func__); | |
| 5447 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", | |
| 5448 | + __FILE__, __LINE__, __func__); | |
| 5506 | 5449 | return; |
| 5507 | 5450 | } |
| 5508 | 5451 | if ((mpt3sas_config_get_sas_iounit_pg0(ioc, &mpi_reply, |
| 5509 | 5452 | sas_iounit_pg0, sz))) { |
| 5510 | − pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", | |
| 5511 | − ioc->name, __FILE__, __LINE__, __func__); | |
| 5453 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", | |
| 5454 | + __FILE__, __LINE__, __func__); | |
| 5512 | 5455 | goto out; |
| 5513 | 5456 | } |
| 5514 | 5457 | ioc_status = le16_to_cpu(mpi_reply.IOCStatus) & |
| 5515 | 5458 | MPI2_IOCSTATUS_MASK; |
| 5516 | 5459 | if (ioc_status != MPI2_IOCSTATUS_SUCCESS) { |
| 5517 | − pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", | |
| 5518 | − ioc->name, __FILE__, __LINE__, __func__); | |
| 5460 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", | |
| 5461 | + __FILE__, __LINE__, __func__); | |
| 5519 | 5462 | goto out; |
| 5520 | 5463 | } |
| 5521 | 5464 | |
| @@ -5524,21 +5467,21 @@ _scsih_sas_host_add(struct MPT3SAS_ADAPTER *ioc) · 2 unmodified lines | ||
| 5524 | 5467 | sizeof(Mpi2SasIOUnit1PhyData_t)); |
| 5525 | 5468 | sas_iounit_pg1 = kzalloc(sz, GFP_KERNEL); |
| 5526 | 5469 | if (!sas_iounit_pg1) { |
| 5527 | − pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", | |
| 5528 | − ioc->name, __FILE__, __LINE__, __func__); | |
| 5470 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", | |
| 5471 | + __FILE__, __LINE__, __func__); | |
| 5529 | 5472 | goto out; |
| 5530 | 5473 | } |
| 5531 | 5474 | if ((mpt3sas_config_get_sas_iounit_pg1(ioc, &mpi_reply, |
| 5532 | 5475 | sas_iounit_pg1, sz))) { |
| 5533 | − pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", | |
| 5534 | − ioc->name, __FILE__, __LINE__, __func__); | |
| 5476 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", | |
| 5477 | + __FILE__, __LINE__, __func__); | |
| 5535 | 5478 | goto out; |
| 5536 | 5479 | } |
| 5537 | 5480 | ioc_status = le16_to_cpu(mpi_reply.IOCStatus) & |
| 5538 | 5481 | MPI2_IOCSTATUS_MASK; |
| 5539 | 5482 | if (ioc_status != MPI2_IOCSTATUS_SUCCESS) { |
| 5540 | − pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", | |
| 5541 | − ioc->name, __FILE__, __LINE__, __func__); | |
| 5483 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", | |
| 5484 | + __FILE__, __LINE__, __func__); | |
| 5542 | 5485 | goto out; |
| 5543 | 5486 | } |
| 5544 | 5487 | |
| @@ -5557,15 +5500,15 @@ _scsih_sas_host_add(struct MPT3SAS_ADAPTER *ioc) · 12 unmodified lines | ||
| 5557 | 5500 | for (i = 0; i < ioc->sas_hba.num_phys ; i++) { |
| 5558 | 5501 | if ((mpt3sas_config_get_phy_pg0(ioc, &mpi_reply, &phy_pg0, |
| 5559 | 5502 | i))) { |
| 5560 | − pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", | |
| 5561 | − ioc->name, __FILE__, __LINE__, __func__); | |
| 5503 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", | |
| 5504 | + __FILE__, __LINE__, __func__); | |
| 5562 | 5505 | goto out; |
| 5563 | 5506 | } |
| 5564 | 5507 | ioc_status = le16_to_cpu(mpi_reply.IOCStatus) & |
| 5565 | 5508 | MPI2_IOCSTATUS_MASK; |
| 5566 | 5509 | if (ioc_status != MPI2_IOCSTATUS_SUCCESS) { |
| 5567 | − pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", | |
| 5568 | − ioc->name, __FILE__, __LINE__, __func__); | |
| 5510 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", | |
| 5511 | + __FILE__, __LINE__, __func__); | |
| 5569 | 5512 | goto out; |
| 5570 | 5513 | } |
| 5571 | 5514 | |
| @@ -5579,18 +5522,17 @@ _scsih_sas_host_add(struct MPT3SAS_ADAPTER *ioc) · 7 unmodified lines | ||
| 5579 | 5522 | } |
| 5580 | 5523 | if ((mpt3sas_config_get_sas_device_pg0(ioc, &mpi_reply, &sas_device_pg0, |
| 5581 | 5524 | MPI2_SAS_DEVICE_PGAD_FORM_HANDLE, ioc->sas_hba.handle))) { |
| 5582 | − pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", | |
| 5583 | − ioc->name, __FILE__, __LINE__, __func__); | |
| 5525 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", | |
| 5526 | + __FILE__, __LINE__, __func__); | |
| 5584 | 5527 | goto out; |
| 5585 | 5528 | } |
| 5586 | 5529 | ioc->sas_hba.enclosure_handle = |
| 5587 | 5530 | le16_to_cpu(sas_device_pg0.EnclosureHandle); |
| 5588 | 5531 | ioc->sas_hba.sas_address = le64_to_cpu(sas_device_pg0.SASAddress); |
| 5589 | − pr_info(MPT3SAS_FMT | |
| 5590 | − "host_add: handle(0x%04x), sas_addr(0x%016llx), phys(%d)\n", | |
| 5591 | − ioc->name, ioc->sas_hba.handle, | |
| 5592 | − (unsigned long long) ioc->sas_hba.sas_address, | |
| 5593 | − ioc->sas_hba.num_phys) ; | |
| 5532 | + ioc_info(ioc, "host_add: handle(0x%04x), sas_addr(0x%016llx), phys(%d)\n", | |
| 5533 | + ioc->sas_hba.handle, | |
| 5534 | + (u64)ioc->sas_hba.sas_address, | |
| 5535 | + ioc->sas_hba.num_phys); | |
| 5594 | 5536 | |
| 5595 | 5537 | if (ioc->sas_hba.enclosure_handle) { |
| 5596 | 5538 | if (!(mpt3sas_config_get_enclosure_pg0(ioc, &mpi_reply, |
| @@ -5639,16 +5581,16 @@ _scsih_expander_add(struct MPT3SAS_ADAPTER *ioc, u16 handle) · 42 unmodified lines | ||
| 5639 | 5581 | |
| 5640 | 5582 | if ((mpt3sas_config_get_expander_pg0(ioc, &mpi_reply, &expander_pg0, |
| 5641 | 5583 | MPI2_SAS_EXPAND_PGAD_FORM_HNDL, handle))) { |
| 5642 | − pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", | |
| 5643 | − ioc->name, __FILE__, __LINE__, __func__); | |
| 5584 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", | |
| 5585 | + __FILE__, __LINE__, __func__); | |
| 5644 | 5586 | return -1; |
| 5645 | 5587 | } |
| 5646 | 5588 | |
| 5647 | 5589 | ioc_status = le16_to_cpu(mpi_reply.IOCStatus) & |
| 5648 | 5590 | MPI2_IOCSTATUS_MASK; |
| 5649 | 5591 | if (ioc_status != MPI2_IOCSTATUS_SUCCESS) { |
| 5650 | − pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", | |
| 5651 | − ioc->name, __FILE__, __LINE__, __func__); | |
| 5592 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", | |
| 5593 | + __FILE__, __LINE__, __func__); | |
| 5652 | 5594 | return -1; |
| 5653 | 5595 | } |
| 5654 | 5596 | |
| @@ -5656,8 +5598,8 @@ _scsih_expander_add(struct MPT3SAS_ADAPTER *ioc, u16 handle) · 1 unmodified line | ||
| 5656 | 5598 | parent_handle = le16_to_cpu(expander_pg0.ParentDevHandle); |
| 5657 | 5599 | if (_scsih_get_sas_address(ioc, parent_handle, &sas_address_parent) |
| 5658 | 5600 | != 0) { |
| 5659 | − pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", | |
| 5660 | − ioc->name, __FILE__, __LINE__, __func__); | |
| 5601 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", | |
| 5602 | + __FILE__, __LINE__, __func__); | |
| 5661 | 5603 | return -1; |
| 5662 | 5604 | } |
| 5663 | 5605 | if (sas_address_parent != ioc->sas_hba.sas_address) { |
| @@ -5684,8 +5626,8 @@ _scsih_expander_add(struct MPT3SAS_ADAPTER *ioc, u16 handle) · 20 unmodified lines | ||
| 5684 | 5626 | sas_expander = kzalloc(sizeof(struct _sas_node), |
| 5685 | 5627 | GFP_KERNEL); |
| 5686 | 5628 | if (!sas_expander) { |
| 5687 | − pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", | |
| 5688 | − ioc->name, __FILE__, __LINE__, __func__); | |
| 5629 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", | |
| 5630 | + __FILE__, __LINE__, __func__); | |
| 5689 | 5631 | return -1; |
| 5690 | 5632 | } |
| 5691 | 5633 | |
| @@ -5694,18 +5636,17 @@ _scsih_expander_add(struct MPT3SAS_ADAPTER *ioc, u16 handle) · 2 unmodified lines | ||
| 5694 | 5636 | sas_expander->sas_address_parent = sas_address_parent; |
| 5695 | 5637 | sas_expander->sas_address = sas_address; |
| 5696 | 5638 | |
| 5697 | − pr_info(MPT3SAS_FMT "expander_add: handle(0x%04x)," \ | |
| 5698 | − " parent(0x%04x), sas_addr(0x%016llx), phys(%d)\n", ioc->name, | |
| 5699 | − handle, parent_handle, (unsigned long long) | |
| 5700 | − sas_expander->sas_address, sas_expander->num_phys); | |
| 5639 | + ioc_info(ioc, "expander_add: handle(0x%04x), parent(0x%04x), sas_addr(0x%016llx), phys(%d)\n", | |
| 5640 | + handle, parent_handle, | |
| 5641 | + (u64)sas_expander->sas_address, sas_expander->num_phys); | |
| 5701 | 5642 | |
| 5702 | 5643 | if (!sas_expander->num_phys) |
| 5703 | 5644 | goto out_fail; |
| 5704 | 5645 | sas_expander->phy = kcalloc(sas_expander->num_phys, |
| 5705 | 5646 | sizeof(struct _sas_phy), GFP_KERNEL); |
| 5706 | 5647 | if (!sas_expander->phy) { |
| 5707 | − pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", | |
| 5708 | − ioc->name, __FILE__, __LINE__, __func__); | |
| 5648 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", | |
| 5649 | + __FILE__, __LINE__, __func__); | |
| 5709 | 5650 | rc = -1; |
| 5710 | 5651 | goto out_fail; |
| 5711 | 5652 | } |
| @@ -5714,8 +5655,8 @@ _scsih_expander_add(struct MPT3SAS_ADAPTER *ioc, u16 handle) · 2 unmodified lines | ||
| 5714 | 5655 | mpt3sas_port = mpt3sas_transport_port_add(ioc, handle, |
| 5715 | 5656 | sas_address_parent); |
| 5716 | 5657 | if (!mpt3sas_port) { |
| 5717 | − pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", | |
| 5718 | − ioc->name, __FILE__, __LINE__, __func__); | |
| 5658 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", | |
| 5659 | + __FILE__, __LINE__, __func__); | |
| 5719 | 5660 | rc = -1; |
| 5720 | 5661 | goto out_fail; |
| 5721 | 5662 | } |
| @@ -5724,8 +5665,8 @@ _scsih_expander_add(struct MPT3SAS_ADAPTER *ioc, u16 handle) · 2 unmodified lines | ||
| 5724 | 5665 | for (i = 0 ; i < sas_expander->num_phys ; i++) { |
| 5725 | 5666 | if ((mpt3sas_config_get_expander_pg1(ioc, &mpi_reply, |
| 5726 | 5667 | &expander_pg1, i, handle))) { |
| 5727 | − pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", | |
| 5728 | − ioc->name, __FILE__, __LINE__, __func__); | |
| 5668 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", | |
| 5669 | + __FILE__, __LINE__, __func__); | |
| 5729 | 5670 | rc = -1; |
| 5730 | 5671 | goto out_fail; |
| 5731 | 5672 | } |
| @@ -5735,8 +5676,8 @@ _scsih_expander_add(struct MPT3SAS_ADAPTER *ioc, u16 handle) · 3 unmodified lines | ||
| 5735 | 5676 | if ((mpt3sas_transport_add_expander_phy(ioc, |
| 5736 | 5677 | &sas_expander->phy[i], expander_pg1, |
| 5737 | 5678 | sas_expander->parent_dev))) { |
| 5738 | − pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", | |
| 5739 | − ioc->name, __FILE__, __LINE__, __func__); | |
| 5679 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", | |
| 5680 | + __FILE__, __LINE__, __func__); | |
| 5740 | 5681 | rc = -1; |
| 5741 | 5682 | goto out_fail; |
| 5742 | 5683 | } |
| @@ -5883,9 +5824,8 @@ _scsih_check_access_status(struct MPT3SAS_ADAPTER *ioc, u64 sas_address, · 140 unmodified lines | ||
| 5883 | 5824 | if (!rc) |
| 5884 | 5825 | return 0; |
| 5885 | 5826 | |
| 5886 | − pr_err(MPT3SAS_FMT | |
| 5887 | − "discovery errors(%s): sas_address(0x%016llx), handle(0x%04x)\n", | |
| 5888 | − ioc->name, desc, (unsigned long long)sas_address, handle); | |
| 5827 | + ioc_err(ioc, "discovery errors(%s): sas_address(0x%016llx), handle(0x%04x)\n", | |
| 5828 | + desc, (u64)sas_address, handle); | |
| 5889 | 5829 | return rc; |
| 5890 | 5830 | } |
| 5891 | 5831 | |
| @@ -5979,9 +5919,8 @@ _scsih_check_device(struct MPT3SAS_ADAPTER *ioc, · 87 unmodified lines | ||
| 5979 | 5919 | /* check if device is present */ |
| 5980 | 5920 | if (!(le16_to_cpu(sas_device_pg0.Flags) & |
| 5981 | 5921 | MPI2_SAS_DEVICE0_FLAGS_DEVICE_PRESENT)) { |
| 5982 | − pr_err(MPT3SAS_FMT | |
| 5983 | − "device is not present handle(0x%04x), flags!!!\n", | |
| 5984 | − ioc->name, handle); | |
| 5922 | + ioc_err(ioc, "device is not present handle(0x%04x), flags!!!\n", | |
| 5923 | + handle); | |
| 5985 | 5924 | goto out_unlock; |
| 5986 | 5925 | } |
| 5987 | 5926 | |
| @@ -6028,16 +5967,16 @@ _scsih_add_device(struct MPT3SAS_ADAPTER *ioc, u16 handle, u8 phy_num, · 40 unmodified lines | ||
| 6028 | 5967 | |
| 6029 | 5968 | if ((mpt3sas_config_get_sas_device_pg0(ioc, &mpi_reply, &sas_device_pg0, |
| 6030 | 5969 | MPI2_SAS_DEVICE_PGAD_FORM_HANDLE, handle))) { |
| 6031 | − pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", | |
| 6032 | − ioc->name, __FILE__, __LINE__, __func__); | |
| 5970 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", | |
| 5971 | + __FILE__, __LINE__, __func__); | |
| 6033 | 5972 | return -1; |
| 6034 | 5973 | } |
| 6035 | 5974 | |
| 6036 | 5975 | ioc_status = le16_to_cpu(mpi_reply.IOCStatus) & |
| 6037 | 5976 | MPI2_IOCSTATUS_MASK; |
| 6038 | 5977 | if (ioc_status != MPI2_IOCSTATUS_SUCCESS) { |
| 6039 | − pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", | |
| 6040 | − ioc->name, __FILE__, __LINE__, __func__); | |
| 5978 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", | |
| 5979 | + __FILE__, __LINE__, __func__); | |
| 6041 | 5980 | return -1; |
| 6042 | 5981 | } |
| 6043 | 5982 | |
| @@ -6051,8 +5990,8 @@ _scsih_add_device(struct MPT3SAS_ADAPTER *ioc, u16 handle, u8 phy_num, · 7 unmodified lines | ||
| 6051 | 5990 | /* check if device is present */ |
| 6052 | 5991 | if (!(le16_to_cpu(sas_device_pg0.Flags) & |
| 6053 | 5992 | MPI2_SAS_DEVICE0_FLAGS_DEVICE_PRESENT)) { |
| 6054 | − pr_err(MPT3SAS_FMT "device is not present handle(0x04%x)!!!\n", | |
| 6055 | − ioc->name, handle); | |
| 5993 | + ioc_err(ioc, "device is not present handle(0x04%x)!!!\n", | |
| 5994 | + handle); | |
| 6056 | 5995 | return -1; |
| 6057 | 5996 | } |
| 6058 | 5997 | |
| @@ -6074,16 +6013,15 @@ _scsih_add_device(struct MPT3SAS_ADAPTER *ioc, u16 handle, u8 phy_num, · 15 unmodified lines | ||
| 6074 | 6013 | mpt3sas_scsih_enclosure_find_by_handle(ioc, |
| 6075 | 6014 | le16_to_cpu(sas_device_pg0.EnclosureHandle)); |
| 6076 | 6015 | if (enclosure_dev == NULL) |
| 6077 | − pr_info(MPT3SAS_FMT "Enclosure handle(0x%04x)" | |
| 6078 | − "doesn't match with enclosure device!\n", | |
| 6079 | − ioc->name, sas_device_pg0.EnclosureHandle); | |
| 6016 | + ioc_info(ioc, "Enclosure handle(0x%04x) doesn't match with enclosure device!\n", | |
| 6017 | + sas_device_pg0.EnclosureHandle); | |
| 6080 | 6018 | } |
| 6081 | 6019 | |
| 6082 | 6020 | sas_device = kzalloc(sizeof(struct _sas_device), |
| 6083 | 6021 | GFP_KERNEL); |
| 6084 | 6022 | if (!sas_device) { |
| 6085 | − pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", | |
| 6086 | − ioc->name, __FILE__, __LINE__, __func__); | |
| 6023 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", | |
| 6024 | + __FILE__, __LINE__, __func__); | |
| 6087 | 6025 | return 0; |
| 6088 | 6026 | } |
| 6089 | 6027 | |
| @@ -6092,8 +6030,8 @@ _scsih_add_device(struct MPT3SAS_ADAPTER *ioc, u16 handle, u8 phy_num, · 2 unmodified lines | ||
| 6092 | 6030 | if (_scsih_get_sas_address(ioc, |
| 6093 | 6031 | le16_to_cpu(sas_device_pg0.ParentDevHandle), |
| 6094 | 6032 | &sas_device->sas_address_parent) != 0) |
| 6095 | − pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", | |
| 6096 | − ioc->name, __FILE__, __LINE__, __func__); | |
| 6033 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", | |
| 6034 | + __FILE__, __LINE__, __func__); | |
| 6097 | 6035 | sas_device->enclosure_handle = |
| 6098 | 6036 | le16_to_cpu(sas_device_pg0.EnclosureHandle); |
| 6099 | 6037 | if (sas_device->enclosure_handle != 0) |
| @@ -6158,11 +6096,10 @@ _scsih_remove_device(struct MPT3SAS_ADAPTER *ioc, · 58 unmodified lines | ||
| 6158 | 6096 | sas_device->pfa_led_on = 0; |
| 6159 | 6097 | } |
| 6160 | 6098 | |
| 6161 | − dewtprintk(ioc, pr_info(MPT3SAS_FMT | |
| 6162 | − "%s: enter: handle(0x%04x), sas_addr(0x%016llx)\n", | |
| 6163 | − ioc->name, __func__, | |
| 6164 | − sas_device->handle, (unsigned long long) | |
| 6165 | − sas_device->sas_address)); | |
| 6099 | + dewtprintk(ioc, | |
| 6100 | + ioc_info(ioc, "%s: enter: handle(0x%04x), sas_addr(0x%016llx)\n", | |
| 6101 | + __func__, | |
| 6102 | + sas_device->handle, (u64)sas_device->sas_address)); | |
| 6166 | 6103 | |
| 6167 | 6104 | dewtprintk(ioc, _scsih_display_enclosure_chassis_info(ioc, sas_device, |
| 6168 | 6105 | NULL, NULL)); |
| @@ -6180,18 +6117,15 @@ _scsih_remove_device(struct MPT3SAS_ADAPTER *ioc, · 11 unmodified lines | ||
| 6180 | 6117 | sas_device->sas_address, |
| 6181 | 6118 | sas_device->sas_address_parent); |
| 6182 | 6119 | |
| 6183 | − pr_info(MPT3SAS_FMT | |
| 6184 | − "removing handle(0x%04x), sas_addr(0x%016llx)\n", | |
| 6185 | − ioc->name, sas_device->handle, | |
| 6186 | − (unsigned long long) sas_device->sas_address); | |
| 6120 | + ioc_info(ioc, "removing handle(0x%04x), sas_addr(0x%016llx)\n", | |
| 6121 | + sas_device->handle, (u64)sas_device->sas_address); | |
| 6187 | 6122 | |
| 6188 | 6123 | _scsih_display_enclosure_chassis_info(ioc, sas_device, NULL, NULL); |
| 6189 | 6124 | |
| 6190 | − dewtprintk(ioc, pr_info(MPT3SAS_FMT | |
| 6191 | − "%s: exit: handle(0x%04x), sas_addr(0x%016llx)\n", | |
| 6192 | − ioc->name, __func__, | |
| 6193 | − sas_device->handle, (unsigned long long) | |
| 6194 | − sas_device->sas_address)); | |
| 6125 | + dewtprintk(ioc, | |
| 6126 | + ioc_info(ioc, "%s: exit: handle(0x%04x), sas_addr(0x%016llx)\n", | |
| 6127 | + __func__, | |
| 6128 | + sas_device->handle, (u64)sas_device->sas_address)); | |
| 6195 | 6129 | dewtprintk(ioc, _scsih_display_enclosure_chassis_info(ioc, sas_device, |
| 6196 | 6130 | NULL, NULL)); |
| 6197 | 6131 | } |
| @@ -6231,8 +6165,7 @@ _scsih_sas_topology_change_event_debug(struct MPT3SAS_ADAPTER *ioc, · 33 unmodified lines | ||
| 6231 | 6165 | status_str = "unknown status"; |
| 6232 | 6166 | break; |
| 6233 | 6167 | } |
| 6234 | − pr_info(MPT3SAS_FMT "sas topology change: (%s)\n", | |
| 6235 | − ioc->name, status_str); | |
| 6168 | + ioc_info(ioc, "sas topology change: (%s)\n", status_str); | |
| 6236 | 6169 | pr_info("\thandle(0x%04x), enclosure_handle(0x%04x) " \ |
| 6237 | 6170 | "start_phy(%02d), count(%d)\n", |
| 6238 | 6171 | le16_to_cpu(event_data->ExpanderDevHandle), |
| @@ -6309,8 +6242,7 @@ _scsih_sas_topology_change_event(struct MPT3SAS_ADAPTER *ioc, · 70 unmodified lines | ||
| 6309 | 6242 | _scsih_sas_host_refresh(ioc); |
| 6310 | 6243 | |
| 6311 | 6244 | if (fw_event->ignore) { |
| 6312 | − dewtprintk(ioc, pr_info(MPT3SAS_FMT | |
| 6313 | − "ignoring expander event\n", ioc->name)); | |
| 6245 | + dewtprintk(ioc, ioc_info(ioc, "ignoring expander event\n")); | |
| 6314 | 6246 | return 0; |
| 6315 | 6247 | } |
| 6316 | 6248 | |
| @@ -6339,8 +6271,8 @@ _scsih_sas_topology_change_event(struct MPT3SAS_ADAPTER *ioc, · 22 unmodified lines | ||
| 6339 | 6271 | /* handle siblings events */ |
| 6340 | 6272 | for (i = 0; i < event_data->NumEntries; i++) { |
| 6341 | 6273 | if (fw_event->ignore) { |
| 6342 | − dewtprintk(ioc, pr_info(MPT3SAS_FMT | |
| 6343 | − "ignoring expander event\n", ioc->name)); | |
| 6274 | + dewtprintk(ioc, | |
| 6275 | + ioc_info(ioc, "ignoring expander event\n")); | |
| 6344 | 6276 | return 0; |
| 6345 | 6277 | } |
| 6346 | 6278 | if (ioc->remove_host || ioc->pci_error_recovery) |
| @@ -6464,15 +6396,14 @@ _scsih_sas_device_status_change_event_debug(struct MPT3SAS_ADAPTER *ioc, · 117 unmodified lines | ||
| 6464 | 6396 | reason_str = "unknown reason"; |
| 6465 | 6397 | break; |
| 6466 | 6398 | } |
| 6467 | − pr_info(MPT3SAS_FMT "device status change: (%s)\n" | |
| 6468 | − "\thandle(0x%04x), sas address(0x%016llx), tag(%d)", | |
| 6469 | − ioc->name, reason_str, le16_to_cpu(event_data->DevHandle), | |
| 6470 | − (unsigned long long)le64_to_cpu(event_data->SASAddress), | |
| 6471 | − le16_to_cpu(event_data->TaskTag)); | |
| 6399 | + ioc_info(ioc, "device status change: (%s)\thandle(0x%04x), sas address(0x%016llx), tag(%d)", | |
| 6400 | + reason_str, le16_to_cpu(event_data->DevHandle), | |
| 6401 | + (u64)le64_to_cpu(event_data->SASAddress), | |
| 6402 | + le16_to_cpu(event_data->TaskTag)); | |
| 6472 | 6403 | if (event_data->ReasonCode == MPI2_EVENT_SAS_DEV_STAT_RC_SMART_DATA) |
| 6473 | − pr_info(MPT3SAS_FMT ", ASC(0x%x), ASCQ(0x%x)\n", ioc->name, | |
| 6474 | − event_data->ASC, event_data->ASCQ); | |
| 6475 | − pr_info("\n"); | |
| 6404 | + pr_cont(", ASC(0x%x), ASCQ(0x%x)\n", | |
| 6405 | + event_data->ASC, event_data->ASCQ); | |
| 6406 | + pr_cont("\n"); | |
| 6476 | 6407 | } |
| 6477 | 6408 | |
| 6478 | 6409 | /** |
| @@ -6605,20 +6536,16 @@ _scsih_check_pcie_access_status(struct MPT3SAS_ADAPTER *ioc, u64 wwid, · 126 unmodified lines | ||
| 6605 | 6536 | desc = "nvme failure status"; |
| 6606 | 6537 | break; |
| 6607 | 6538 | default: |
| 6608 | − pr_err(MPT3SAS_FMT | |
| 6609 | − " NVMe discovery error(0x%02x): wwid(0x%016llx)," | |
| 6610 | − "handle(0x%04x)\n", ioc->name, access_status, | |
| 6611 | − (unsigned long long)wwid, handle); | |
| 6539 | + ioc_err(ioc, "NVMe discovery error(0x%02x): wwid(0x%016llx), handle(0x%04x)\n", | |
| 6540 | + access_status, (u64)wwid, handle); | |
| 6612 | 6541 | return rc; |
| 6613 | 6542 | } |
| 6614 | 6543 | |
| 6615 | 6544 | if (!rc) |
| 6616 | 6545 | return rc; |
| 6617 | 6546 | |
| 6618 | − pr_info(MPT3SAS_FMT | |
| 6619 | − "NVMe discovery error(%s): wwid(0x%016llx), handle(0x%04x)\n", | |
| 6620 | − ioc->name, desc, | |
| 6621 | − (unsigned long long)wwid, handle); | |
| 6547 | + ioc_info(ioc, "NVMe discovery error(%s): wwid(0x%016llx), handle(0x%04x)\n", | |
| 6548 | + desc, (u64)wwid, handle); | |
| 6622 | 6549 | return rc; |
| 6623 | 6550 | } |
| 6624 | 6551 | |
| @@ -6634,22 +6561,22 @@ _scsih_pcie_device_remove_from_sml(struct MPT3SAS_ADAPTER *ioc, · 9 unmodified lines | ||
| 6634 | 6561 | { |
| 6635 | 6562 | struct MPT3SAS_TARGET *sas_target_priv_data; |
| 6636 | 6563 | |
| 6637 | − dewtprintk(ioc, pr_info(MPT3SAS_FMT | |
| 6638 | − "%s: enter: handle(0x%04x), wwid(0x%016llx)\n", ioc->name, __func__, | |
| 6639 | − pcie_device->handle, (unsigned long long) | |
| 6640 | − pcie_device->wwid)); | |
| 6564 | + dewtprintk(ioc, | |
| 6565 | + ioc_info(ioc, "%s: enter: handle(0x%04x), wwid(0x%016llx)\n", | |
| 6566 | + __func__, | |
| 6567 | + pcie_device->handle, (u64)pcie_device->wwid)); | |
| 6641 | 6568 | if (pcie_device->enclosure_handle != 0) |
| 6642 | − dewtprintk(ioc, pr_info(MPT3SAS_FMT | |
| 6643 | − "%s: enter: enclosure logical id(0x%016llx), slot(%d)\n", | |
| 6644 | − ioc->name, __func__, | |
| 6645 | − (unsigned long long)pcie_device->enclosure_logical_id, | |
| 6646 | − pcie_device->slot)); | |
| 6569 | + dewtprintk(ioc, | |
| 6570 | + ioc_info(ioc, "%s: enter: enclosure logical id(0x%016llx), slot(%d)\n", | |
| 6571 | + __func__, | |
| 6572 | + (u64)pcie_device->enclosure_logical_id, | |
| 6573 | + pcie_device->slot)); | |
| 6647 | 6574 | if (pcie_device->connector_name[0] != '\0') |
| 6648 | − dewtprintk(ioc, pr_info(MPT3SAS_FMT | |
| 6649 | − "%s: enter: enclosure level(0x%04x), connector name( %s)\n", | |
| 6650 | − ioc->name, __func__, | |
| 6651 | − pcie_device->enclosure_level, | |
| 6652 | − pcie_device->connector_name)); | |
| 6575 | + dewtprintk(ioc, | |
| 6576 | + ioc_info(ioc, "%s: enter: enclosure level(0x%04x), connector name(%s)\n", | |
| 6577 | + __func__, | |
| 6578 | + pcie_device->enclosure_level, | |
| 6579 | + pcie_device->connector_name)); | |
| 6653 | 6580 | |
| 6654 | 6581 | if (pcie_device->starget && pcie_device->starget->hostdata) { |
| 6655 | 6582 | sas_target_priv_data = pcie_device->starget->hostdata; |
| @@ -6658,39 +6585,35 @@ _scsih_pcie_device_remove_from_sml(struct MPT3SAS_ADAPTER *ioc, · 2 unmodified lines | ||
| 6658 | 6585 | sas_target_priv_data->handle = MPT3SAS_INVALID_DEVICE_HANDLE; |
| 6659 | 6586 | } |
| 6660 | 6587 | |
| 6661 | − pr_info(MPT3SAS_FMT | |
| 6662 | − "removing handle(0x%04x), wwid (0x%016llx)\n", | |
| 6663 | − ioc->name, pcie_device->handle, | |
| 6664 | − (unsigned long long) pcie_device->wwid); | |
| 6588 | + ioc_info(ioc, "removing handle(0x%04x), wwid(0x%016llx)\n", | |
| 6589 | + pcie_device->handle, (u64)pcie_device->wwid); | |
| 6665 | 6590 | if (pcie_device->enclosure_handle != 0) |
| 6666 | − pr_info(MPT3SAS_FMT | |
| 6667 | − "removing : enclosure logical id(0x%016llx), slot(%d)\n", | |
| 6668 | − ioc->name, | |
| 6669 | − (unsigned long long)pcie_device->enclosure_logical_id, | |
| 6670 | − pcie_device->slot); | |
| 6591 | + ioc_info(ioc, "removing : enclosure logical id(0x%016llx), slot(%d)\n", | |
| 6592 | + (u64)pcie_device->enclosure_logical_id, | |
| 6593 | + pcie_device->slot); | |
| 6671 | 6594 | if (pcie_device->connector_name[0] != '\0') |
| 6672 | − pr_info(MPT3SAS_FMT | |
| 6673 | − "removing: enclosure level(0x%04x), connector name( %s)\n", | |
| 6674 | − ioc->name, pcie_device->enclosure_level, | |
| 6675 | − pcie_device->connector_name); | |
| 6595 | + ioc_info(ioc, "removing: enclosure level(0x%04x), connector name( %s)\n", | |
| 6596 | + pcie_device->enclosure_level, | |
| 6597 | + pcie_device->connector_name); | |
| 6676 | 6598 | |
| 6677 | 6599 | if (pcie_device->starget) |
| 6678 | 6600 | scsi_remove_target(&pcie_device->starget->dev); |
| 6679 | − dewtprintk(ioc, pr_info(MPT3SAS_FMT | |
| 6680 | − "%s: exit: handle(0x%04x), wwid(0x%016llx)\n", ioc->name, __func__, | |
| 6681 | − pcie_device->handle, (unsigned long long) | |
| 6682 | − pcie_device->wwid)); | |
| 6601 | + dewtprintk(ioc, | |
| 6602 | + ioc_info(ioc, "%s: exit: handle(0x%04x), wwid(0x%016llx)\n", | |
| 6603 | + __func__, | |
| 6604 | + pcie_device->handle, (u64)pcie_device->wwid)); | |
| 6683 | 6605 | if (pcie_device->enclosure_handle != 0) |
| 6684 | − dewtprintk(ioc, pr_info(MPT3SAS_FMT | |
| 6685 | − "%s: exit: enclosure logical id(0x%016llx), slot(%d)\n", | |
| 6686 | − ioc->name, __func__, | |
| 6687 | − (unsigned long long)pcie_device->enclosure_logical_id, | |
| 6688 | − pcie_device->slot)); | |
| 6606 | + dewtprintk(ioc, | |
| 6607 | + ioc_info(ioc, "%s: exit: enclosure logical id(0x%016llx), slot(%d)\n", | |
| 6608 | + __func__, | |
| 6609 | + (u64)pcie_device->enclosure_logical_id, | |
| 6610 | + pcie_device->slot)); | |
| 6689 | 6611 | if (pcie_device->connector_name[0] != '\0') |
| 6690 | − dewtprintk(ioc, pr_info(MPT3SAS_FMT | |
| 6691 | − "%s: exit: enclosure level(0x%04x), connector name( %s)\n", | |
| 6692 | − ioc->name, __func__, pcie_device->enclosure_level, | |
| 6693 | − pcie_device->connector_name)); | |
| 6612 | + dewtprintk(ioc, | |
| 6613 | + ioc_info(ioc, "%s: exit: enclosure level(0x%04x), connector name( %s)\n", | |
| 6614 | + __func__, | |
| 6615 | + pcie_device->enclosure_level, | |
| 6616 | + pcie_device->connector_name)); | |
| 6694 | 6617 | |
| 6695 | 6618 | kfree(pcie_device->serial_number); |
| 6696 | 6619 | } |
| @@ -6760,9 +6683,8 @@ _scsih_pcie_check_device(struct MPT3SAS_ADAPTER *ioc, u16 handle) · 63 unmodified lines | ||
| 6760 | 6683 | /* check if device is present */ |
| 6761 | 6684 | if (!(le32_to_cpu(pcie_device_pg0.Flags) & |
| 6762 | 6685 | MPI26_PCIEDEV0_FLAGS_DEVICE_PRESENT)) { |
| 6763 | − pr_info(MPT3SAS_FMT | |
| 6764 | − "device is not present handle(0x%04x), flags!!!\n", | |
| 6765 | − ioc->name, handle); | |
| 6686 | + ioc_info(ioc, "device is not present handle(0x%04x), flags!!!\n", | |
| 6687 | + handle); | |
| 6766 | 6688 | spin_unlock_irqrestore(&ioc->pcie_device_lock, flags); |
| 6767 | 6689 | pcie_device_put(pcie_device); |
| 6768 | 6690 | return; |
| @@ -6806,16 +6728,15 @@ _scsih_pcie_add_device(struct MPT3SAS_ADAPTER *ioc, u16 handle) · 37 unmodified lines | ||
| 6806 | 6728 | |
| 6807 | 6729 | if ((mpt3sas_config_get_pcie_device_pg0(ioc, &mpi_reply, |
| 6808 | 6730 | &pcie_device_pg0, MPI26_PCIE_DEVICE_PGAD_FORM_HANDLE, handle))) { |
| 6809 | − pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", | |
| 6810 | − ioc->name, __FILE__, __LINE__, __func__); | |
| 6731 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", | |
| 6732 | + __FILE__, __LINE__, __func__); | |
| 6811 | 6733 | return 0; |
| 6812 | 6734 | } |
| 6813 | 6735 | ioc_status = le16_to_cpu(mpi_reply.IOCStatus) & |
| 6814 | 6736 | MPI2_IOCSTATUS_MASK; |
| 6815 | 6737 | if (ioc_status != MPI2_IOCSTATUS_SUCCESS) { |
| 6816 | − pr_err(MPT3SAS_FMT | |
| 6817 | − "failure at %s:%d/%s()!\n", | |
| 6818 | − ioc->name, __FILE__, __LINE__, __func__); | |
| 6738 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", | |
| 6739 | + __FILE__, __LINE__, __func__); | |
| 6819 | 6740 | return 0; |
| 6820 | 6741 | } |
| 6821 | 6742 | |
| @@ -6825,9 +6746,8 @@ _scsih_pcie_add_device(struct MPT3SAS_ADAPTER *ioc, u16 handle) · 3 unmodified lines | ||
| 6825 | 6746 | /* check if device is present */ |
| 6826 | 6747 | if (!(le32_to_cpu(pcie_device_pg0.Flags) & |
| 6827 | 6748 | MPI26_PCIEDEV0_FLAGS_DEVICE_PRESENT)) { |
| 6828 | − pr_err(MPT3SAS_FMT | |
| 6829 | − "device is not present handle(0x04%x)!!!\n", | |
| 6830 | − ioc->name, handle); | |
| 6749 | + ioc_err(ioc, "device is not present handle(0x04%x)!!!\n", | |
| 6750 | + handle); | |
| 6831 | 6751 | return 0; |
| 6832 | 6752 | } |
| 6833 | 6753 | |
| @@ -6848,8 +6768,8 @@ _scsih_pcie_add_device(struct MPT3SAS_ADAPTER *ioc, u16 handle) · 14 unmodified lines | ||
| 6848 | 6768 | |
| 6849 | 6769 | pcie_device = kzalloc(sizeof(struct _pcie_device), GFP_KERNEL); |
| 6850 | 6770 | if (!pcie_device) { |
| 6851 | − pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", | |
| 6852 | − ioc->name, __FILE__, __LINE__, __func__); | |
| 6771 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", | |
| 6772 | + __FILE__, __LINE__, __func__); | |
| 6853 | 6773 | return 0; |
| 6854 | 6774 | } |
| 6855 | 6775 | |
| @@ -6890,16 +6810,16 @@ _scsih_pcie_add_device(struct MPT3SAS_ADAPTER *ioc, u16 handle) · 34 unmodified lines | ||
| 6890 | 6810 | /* TODO -- Add device name once FW supports it */ |
| 6891 | 6811 | if (mpt3sas_config_get_pcie_device_pg2(ioc, &mpi_reply, |
| 6892 | 6812 | &pcie_device_pg2, MPI2_SAS_DEVICE_PGAD_FORM_HANDLE, handle)) { |
| 6893 | − pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", | |
| 6894 | − ioc->name, __FILE__, __LINE__, __func__); | |
| 6813 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", | |
| 6814 | + __FILE__, __LINE__, __func__); | |
| 6895 | 6815 | kfree(pcie_device); |
| 6896 | 6816 | return 0; |
| 6897 | 6817 | } |
| 6898 | 6818 | |
| 6899 | 6819 | ioc_status = le16_to_cpu(mpi_reply.IOCStatus) & MPI2_IOCSTATUS_MASK; |
| 6900 | 6820 | if (ioc_status != MPI2_IOCSTATUS_SUCCESS) { |
| 6901 | − pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", | |
| 6902 | − ioc->name, __FILE__, __LINE__, __func__); | |
| 6821 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", | |
| 6822 | + __FILE__, __LINE__, __func__); | |
| 6903 | 6823 | kfree(pcie_device); |
| 6904 | 6824 | return 0; |
| 6905 | 6825 | } |
| @@ -6956,8 +6876,7 @@ _scsih_pcie_topology_change_event_debug(struct MPT3SAS_ADAPTER *ioc, · 50 unmodified lines | ||
| 6956 | 6876 | status_str = "unknown status"; |
| 6957 | 6877 | break; |
| 6958 | 6878 | } |
| 6959 | − pr_info(MPT3SAS_FMT "pcie topology change: (%s)\n", | |
| 6960 | − ioc->name, status_str); | |
| 6879 | + ioc_info(ioc, "pcie topology change: (%s)\n", status_str); | |
| 6961 | 6880 | pr_info("\tswitch_handle(0x%04x), enclosure_handle(0x%04x)" |
| 6962 | 6881 | "start_port(%02d), count(%d)\n", |
| 6963 | 6882 | le16_to_cpu(event_data->SwitchDevHandle), |
| @@ -7030,16 +6949,15 @@ _scsih_pcie_topology_change_event(struct MPT3SAS_ADAPTER *ioc, · 66 unmodified lines | ||
| 7030 | 6949 | return; |
| 7031 | 6950 | |
| 7032 | 6951 | if (fw_event->ignore) { |
| 7033 | − dewtprintk(ioc, pr_info(MPT3SAS_FMT "ignoring switch event\n", | |
| 7034 | − ioc->name)); | |
| 6952 | + dewtprintk(ioc, ioc_info(ioc, "ignoring switch event\n")); | |
| 7035 | 6953 | return; |
| 7036 | 6954 | } |
| 7037 | 6955 | |
| 7038 | 6956 | /* handle siblings events */ |
| 7039 | 6957 | for (i = 0; i < event_data->NumEntries; i++) { |
| 7040 | 6958 | if (fw_event->ignore) { |
| 7041 | − dewtprintk(ioc, pr_info(MPT3SAS_FMT | |
| 7042 | − "ignoring switch event\n", ioc->name)); | |
| 6959 | + dewtprintk(ioc, | |
| 6960 | + ioc_info(ioc, "ignoring switch event\n")); | |
| 7043 | 6961 | return; |
| 7044 | 6962 | } |
| 7045 | 6963 | if (ioc->remove_host || ioc->pci_error_recovery) |
| @@ -7084,9 +7002,9 @@ _scsih_pcie_topology_change_event(struct MPT3SAS_ADAPTER *ioc, · 38 unmodified lines | ||
| 7084 | 7002 | if (!test_bit(handle, ioc->pend_os_device_add)) |
| 7085 | 7003 | break; |
| 7086 | 7004 | |
| 7087 | − dewtprintk(ioc, pr_info(MPT3SAS_FMT | |
| 7088 | − "handle(0x%04x) device not found: convert " | |
| 7089 | − "event to a device add\n", ioc->name, handle)); | |
| 7005 | + dewtprintk(ioc, | |
| 7006 | + ioc_info(ioc, "handle(0x%04x) device not found: convert event to a device add\n", | |
| 7007 | + handle)); | |
| 7090 | 7008 | event_data->PortEntry[i].PortStatus &= 0xF0; |
| 7091 | 7009 | event_data->PortEntry[i].PortStatus |= |
| 7092 | 7010 | MPI26_EVENT_PCIE_TOPO_PS_DEV_ADDED; |
| @@ -7169,15 +7087,15 @@ _scsih_pcie_device_status_change_event_debug(struct MPT3SAS_ADAPTER *ioc, · 76 unmodified lines | ||
| 7169 | 7087 | break; |
| 7170 | 7088 | } |
| 7171 | 7089 | |
| 7172 | − pr_info(MPT3SAS_FMT "PCIE device status change: (%s)\n" | |
| 7173 | − "\thandle(0x%04x), WWID(0x%016llx), tag(%d)", | |
| 7174 | − ioc->name, reason_str, le16_to_cpu(event_data->DevHandle), | |
| 7175 | − (unsigned long long)le64_to_cpu(event_data->WWID), | |
| 7176 | − le16_to_cpu(event_data->TaskTag)); | |
| 7090 | + ioc_info(ioc, "PCIE device status change: (%s)\n" | |
| 7091 | + "\thandle(0x%04x), WWID(0x%016llx), tag(%d)", | |
| 7092 | + reason_str, le16_to_cpu(event_data->DevHandle), | |
| 7093 | + (u64)le64_to_cpu(event_data->WWID), | |
| 7094 | + le16_to_cpu(event_data->TaskTag)); | |
| 7177 | 7095 | if (event_data->ReasonCode == MPI26_EVENT_PCIDEV_STAT_RC_SMART_DATA) |
| 7178 | − pr_info(MPT3SAS_FMT ", ASC(0x%x), ASCQ(0x%x)\n", ioc->name, | |
| 7096 | + pr_cont(", ASC(0x%x), ASCQ(0x%x)\n", | |
| 7179 | 7097 | event_data->ASC, event_data->ASCQ); |
| 7180 | − pr_info("\n"); | |
| 7098 | + pr_cont("\n"); | |
| 7181 | 7099 | } |
| 7182 | 7100 | |
| 7183 | 7101 | /** |
| @@ -7255,12 +7173,12 @@ _scsih_sas_enclosure_dev_status_change_event_debug(struct MPT3SAS_ADAPTER *ioc, · 71 unmodified lines | ||
| 7255 | 7173 | break; |
| 7256 | 7174 | } |
| 7257 | 7175 | |
| 7258 | − pr_info(MPT3SAS_FMT "enclosure status change: (%s)\n" | |
| 7259 | − "\thandle(0x%04x), enclosure logical id(0x%016llx)" | |
| 7260 | − " number slots(%d)\n", ioc->name, reason_str, | |
| 7261 | − le16_to_cpu(event_data->EnclosureHandle), | |
| 7262 | − (unsigned long long)le64_to_cpu(event_data->EnclosureLogicalID), | |
| 7263 | − le16_to_cpu(event_data->StartSlot)); | |
| 7176 | + ioc_info(ioc, "enclosure status change: (%s)\n" | |
| 7177 | + "\thandle(0x%04x), enclosure logical id(0x%016llx) number slots(%d)\n", | |
| 7178 | + reason_str, | |
| 7179 | + le16_to_cpu(event_data->EnclosureHandle), | |
| 7180 | + (u64)le64_to_cpu(event_data->EnclosureLogicalID), | |
| 7181 | + le16_to_cpu(event_data->StartSlot)); | |
| 7264 | 7182 | } |
| 7265 | 7183 | |
| 7266 | 7184 | /** |
| @@ -7298,9 +7216,8 @@ _scsih_sas_enclosure_dev_status_change_event(struct MPT3SAS_ADAPTER *ioc, · 31 unmodified lines | ||
| 7298 | 7216 | kzalloc(sizeof(struct _enclosure_node), |
| 7299 | 7217 | GFP_KERNEL); |
| 7300 | 7218 | if (!enclosure_dev) { |
| 7301 | − pr_info(MPT3SAS_FMT | |
| 7302 | − "failure at %s:%d/%s()!\n", ioc->name, | |
| 7303 | − __FILE__, __LINE__, __func__); | |
| 7219 | + ioc_info(ioc, "failure at %s:%d/%s()!\n", | |
| 7220 | + __FILE__, __LINE__, __func__); | |
| 7304 | 7221 | return; |
| 7305 | 7222 | } |
| 7306 | 7223 | rc = mpt3sas_config_get_enclosure_pg0(ioc, &mpi_reply, |
| @@ -7358,10 +7275,8 @@ _scsih_sas_broadcast_primitive_event(struct MPT3SAS_ADAPTER *ioc, · 51 unmodified lines | ||
| 7358 | 7275 | u8 task_abort_retries; |
| 7359 | 7276 | |
| 7360 | 7277 | mutex_lock(&ioc->tm_cmds.mutex); |
| 7361 | − pr_info(MPT3SAS_FMT | |
| 7362 | − "%s: enter: phy number(%d), width(%d)\n", | |
| 7363 | − ioc->name, __func__, event_data->PhyNum, | |
| 7364 | − event_data->PortWidth); | |
| 7278 | + ioc_info(ioc, "%s: enter: phy number(%d), width(%d)\n", | |
| 7279 | + __func__, event_data->PhyNum, event_data->PortWidth); | |
| 7365 | 7280 | |
| 7366 | 7281 | _scsih_block_io_all_device(ioc); |
| 7367 | 7282 | |
| @@ -7371,12 +7286,12 @@ _scsih_sas_broadcast_primitive_event(struct MPT3SAS_ADAPTER *ioc, · 3 unmodified lines | ||
| 7371 | 7286 | |
| 7372 | 7287 | /* sanity checks for retrying this loop */ |
| 7373 | 7288 | if (max_retries++ == 5) { |
| 7374 | − dewtprintk(ioc, pr_info(MPT3SAS_FMT "%s: giving up\n", | |
| 7375 | − ioc->name, __func__)); | |
| 7289 | + dewtprintk(ioc, ioc_info(ioc, "%s: giving up\n", __func__)); | |
| 7376 | 7290 | goto out; |
| 7377 | 7291 | } else if (max_retries > 1) |
| 7378 | − dewtprintk(ioc, pr_info(MPT3SAS_FMT "%s: %d retry\n", | |
| 7379 | − ioc->name, __func__, max_retries - 1)); | |
| 7292 | + dewtprintk(ioc, | |
| 7293 | + ioc_info(ioc, "%s: %d retry\n", | |
| 7294 | + __func__, max_retries - 1)); | |
| 7380 | 7295 | |
| 7381 | 7296 | termination_count = 0; |
| 7382 | 7297 | query_count = 0; |
| @@ -7443,9 +7358,9 @@ _scsih_sas_broadcast_primitive_event(struct MPT3SAS_ADAPTER *ioc, · 60 unmodified lines | ||
| 7443 | 7358 | task_abort_retries = 0; |
| 7444 | 7359 | tm_retry: |
| 7445 | 7360 | if (task_abort_retries++ == 60) { |
| 7446 | − dewtprintk(ioc, pr_info(MPT3SAS_FMT | |
| 7447 | − "%s: ABORT_TASK: giving up\n", ioc->name, | |
| 7448 | − __func__)); | |
| 7361 | + dewtprintk(ioc, | |
| 7362 | + ioc_info(ioc, "%s: ABORT_TASK: giving up\n", | |
| 7363 | + __func__)); | |
| 7449 | 7364 | spin_lock_irqsave(&ioc->scsi_lookup_lock, flags); |
| 7450 | 7365 | goto broadcast_aen_retry; |
| 7451 | 7366 | } |
| @@ -7474,9 +7389,10 @@ _scsih_sas_broadcast_primitive_event(struct MPT3SAS_ADAPTER *ioc, · 22 unmodified lines | ||
| 7474 | 7389 | } |
| 7475 | 7390 | |
| 7476 | 7391 | if (ioc->broadcast_aen_pending) { |
| 7477 | − dewtprintk(ioc, pr_info(MPT3SAS_FMT | |
| 7478 | − "%s: loop back due to pending AEN\n", | |
| 7479 | − ioc->name, __func__)); | |
| 7392 | + dewtprintk(ioc, | |
| 7393 | + ioc_info(ioc, | |
| 7394 | + "%s: loop back due to pending AEN\n", | |
| 7395 | + __func__)); | |
| 7480 | 7396 | ioc->broadcast_aen_pending = 0; |
| 7481 | 7397 | goto broadcast_aen_retry; |
| 7482 | 7398 | } |
| @@ -7485,9 +7401,9 @@ _scsih_sas_broadcast_primitive_event(struct MPT3SAS_ADAPTER *ioc, · 2 unmodified lines | ||
| 7485 | 7401 | spin_unlock_irqrestore(&ioc->scsi_lookup_lock, flags); |
| 7486 | 7402 | out_no_lock: |
| 7487 | 7403 | |
| 7488 | − dewtprintk(ioc, pr_info(MPT3SAS_FMT | |
| 7489 | − "%s - exit, query_count = %d termination_count = %d\n", | |
| 7490 | − ioc->name, __func__, query_count, termination_count)); | |
| 7404 | + dewtprintk(ioc, | |
| 7405 | + ioc_info(ioc, "%s - exit, query_count = %d termination_count = %d\n", | |
| 7406 | + __func__, query_count, termination_count)); | |
| 7491 | 7407 | |
| 7492 | 7408 | ioc->broadcast_aen_busy = 0; |
| 7493 | 7409 | if (!ioc->shost_recovery) |
| @@ -7509,13 +7425,13 @@ _scsih_sas_discovery_event(struct MPT3SAS_ADAPTER *ioc, · 15 unmodified lines | ||
| 7509 | 7425 | (Mpi2EventDataSasDiscovery_t *) fw_event->event_data; |
| 7510 | 7426 | |
| 7511 | 7427 | if (ioc->logging_level & MPT_DEBUG_EVENT_WORK_TASK) { |
| 7512 | − pr_info(MPT3SAS_FMT "discovery event: (%s)", ioc->name, | |
| 7513 | − (event_data->ReasonCode == MPI2_EVENT_SAS_DISC_RC_STARTED) ? | |
| 7514 | − "start" : "stop"); | |
| 7428 | + ioc_info(ioc, "discovery event: (%s)", | |
| 7429 | + event_data->ReasonCode == MPI2_EVENT_SAS_DISC_RC_STARTED ? | |
| 7430 | + "start" : "stop"); | |
| 7515 | 7431 | if (event_data->DiscoveryStatus) |
| 7516 | − pr_info("discovery_status(0x%08x)", | |
| 7517 | − le32_to_cpu(event_data->DiscoveryStatus)); | |
| 7518 | − pr_info("\n"); | |
| 7432 | + pr_cont("discovery_status(0x%08x)", | |
| 7433 | + le32_to_cpu(event_data->DiscoveryStatus)); | |
| 7434 | + pr_cont("\n"); | |
| 7519 | 7435 | } |
| 7520 | 7436 | |
| 7521 | 7437 | if (event_data->ReasonCode == MPI2_EVENT_SAS_DISC_RC_STARTED && |
| @@ -7545,20 +7461,16 @@ _scsih_sas_device_discovery_error_event(struct MPT3SAS_ADAPTER *ioc, · 23 unmodified lines | ||
| 7545 | 7461 | |
| 7546 | 7462 | switch (event_data->ReasonCode) { |
| 7547 | 7463 | case MPI25_EVENT_SAS_DISC_ERR_SMP_FAILED: |
| 7548 | − pr_warn(MPT3SAS_FMT "SMP command sent to the expander" | |
| 7549 | − "(handle:0x%04x, sas_address:0x%016llx," | |
| 7550 | − "physical_port:0x%02x) has failed", | |
| 7551 | − ioc->name, le16_to_cpu(event_data->DevHandle), | |
| 7552 | − (unsigned long long)le64_to_cpu(event_data->SASAddress), | |
| 7553 | − event_data->PhysicalPort); | |
| 7464 | + ioc_warn(ioc, "SMP command sent to the expander (handle:0x%04x, sas_address:0x%016llx, physical_port:0x%02x) has failed\n", | |
| 7465 | + le16_to_cpu(event_data->DevHandle), | |
| 7466 | + (u64)le64_to_cpu(event_data->SASAddress), | |
| 7467 | + event_data->PhysicalPort); | |
| 7554 | 7468 | break; |
| 7555 | 7469 | case MPI25_EVENT_SAS_DISC_ERR_SMP_TIMEOUT: |
| 7556 | − pr_warn(MPT3SAS_FMT "SMP command sent to the expander" | |
| 7557 | − "(handle:0x%04x, sas_address:0x%016llx," | |
| 7558 | − "physical_port:0x%02x) has timed out", | |
| 7559 | − ioc->name, le16_to_cpu(event_data->DevHandle), | |
| 7560 | − (unsigned long long)le64_to_cpu(event_data->SASAddress), | |
| 7561 | − event_data->PhysicalPort); | |
| 7470 | + ioc_warn(ioc, "SMP command sent to the expander (handle:0x%04x, sas_address:0x%016llx, physical_port:0x%02x) has timed out\n", | |
| 7471 | + le16_to_cpu(event_data->DevHandle), | |
| 7472 | + (u64)le64_to_cpu(event_data->SASAddress), | |
| 7473 | + event_data->PhysicalPort); | |
| 7562 | 7474 | break; |
| 7563 | 7475 | default: |
| 7564 | 7476 | break; |
| @@ -7581,11 +7493,10 @@ _scsih_pcie_enumeration_event(struct MPT3SAS_ADAPTER *ioc, · 16 unmodified lines | ||
| 7581 | 7493 | if (!(ioc->logging_level & MPT_DEBUG_EVENT_WORK_TASK)) |
| 7582 | 7494 | return; |
| 7583 | 7495 | |
| 7584 | − pr_info(MPT3SAS_FMT "pcie enumeration event: (%s) Flag 0x%02x", | |
| 7585 | − ioc->name, | |
| 7586 | − (event_data->ReasonCode == MPI26_EVENT_PCIE_ENUM_RC_STARTED) ? | |
| 7587 | − "started" : "completed", | |
| 7588 | − event_data->Flags); | |
| 7496 | + ioc_info(ioc, "pcie enumeration event: (%s) Flag 0x%02x", | |
| 7497 | + (event_data->ReasonCode == MPI26_EVENT_PCIE_ENUM_RC_STARTED) ? | |
| 7498 | + "started" : "completed", | |
| 7499 | + event_data->Flags); | |
| 7589 | 7500 | if (event_data->EnumerationStatus) |
| 7590 | 7501 | pr_cont("enumeration_status(0x%08x)", |
| 7591 | 7502 | le32_to_cpu(event_data->EnumerationStatus)); |
| @@ -7617,8 +7528,7 @@ _scsih_ir_fastpath(struct MPT3SAS_ADAPTER *ioc, u16 handle, u8 phys_disk_num) · 25 unmodified lines | ||
| 7617 | 7528 | mutex_lock(&ioc->scsih_cmds.mutex); |
| 7618 | 7529 | |
| 7619 | 7530 | if (ioc->scsih_cmds.status != MPT3_CMD_NOT_USED) { |
| 7620 | − pr_err(MPT3SAS_FMT "%s: scsih_cmd in use\n", | |
| 7621 | − ioc->name, __func__); | |
| 7531 | + ioc_err(ioc, "%s: scsih_cmd in use\n", __func__); | |
| 7622 | 7532 | rc = -EAGAIN; |
| 7623 | 7533 | goto out; |
| 7624 | 7534 | } |
| @@ -7626,8 +7536,7 @@ _scsih_ir_fastpath(struct MPT3SAS_ADAPTER *ioc, u16 handle, u8 phys_disk_num) · 1 unmodified line | ||
| 7626 | 7536 | |
| 7627 | 7537 | smid = mpt3sas_base_get_smid(ioc, ioc->scsih_cb_idx); |
| 7628 | 7538 | if (!smid) { |
| 7629 | − pr_err(MPT3SAS_FMT "%s: failed obtaining a smid\n", | |
| 7630 | − ioc->name, __func__); | |
| 7539 | + ioc_err(ioc, "%s: failed obtaining a smid\n", __func__); | |
| 7631 | 7540 | ioc->scsih_cmds.status = MPT3_CMD_NOT_USED; |
| 7632 | 7541 | rc = -EAGAIN; |
| 7633 | 7542 | goto out; |
| @@ -7641,9 +7550,9 @@ _scsih_ir_fastpath(struct MPT3SAS_ADAPTER *ioc, u16 handle, u8 phys_disk_num) · 7 unmodified lines | ||
| 7641 | 7550 | mpi_request->Action = MPI2_RAID_ACTION_PHYSDISK_HIDDEN; |
| 7642 | 7551 | mpi_request->PhysDiskNum = phys_disk_num; |
| 7643 | 7552 | |
| 7644 | − dewtprintk(ioc, pr_info(MPT3SAS_FMT "IR RAID_ACTION: turning fast "\ | |
| 7645 | − "path on for handle(0x%04x), phys_disk_num (0x%02x)\n", ioc->name, | |
| 7646 | − handle, phys_disk_num)); | |
| 7553 | + dewtprintk(ioc, | |
| 7554 | + ioc_info(ioc, "IR RAID_ACTION: turning fast path on for handle(0x%04x), phys_disk_num (0x%02x)\n", | |
| 7555 | + handle, phys_disk_num)); | |
| 7647 | 7556 | |
| 7648 | 7557 | init_completion(&ioc->scsih_cmds.done); |
| 7649 | 7558 | mpt3sas_base_put_smid_default(ioc, smid); |
| @@ -7668,15 +7577,13 @@ _scsih_ir_fastpath(struct MPT3SAS_ADAPTER *ioc, u16 handle, u8 phys_disk_num) · 18 unmodified lines | ||
| 7668 | 7577 | log_info = 0; |
| 7669 | 7578 | ioc_status &= MPI2_IOCSTATUS_MASK; |
| 7670 | 7579 | if (ioc_status != MPI2_IOCSTATUS_SUCCESS) { |
| 7671 | − dewtprintk(ioc, pr_info(MPT3SAS_FMT | |
| 7672 | − "IR RAID_ACTION: failed: ioc_status(0x%04x), " | |
| 7673 | − "loginfo(0x%08x)!!!\n", ioc->name, ioc_status, | |
| 7674 | − log_info)); | |
| 7580 | + dewtprintk(ioc, | |
| 7581 | + ioc_info(ioc, "IR RAID_ACTION: failed: ioc_status(0x%04x), loginfo(0x%08x)!!!\n", | |
| 7582 | + ioc_status, log_info)); | |
| 7675 | 7583 | rc = -EFAULT; |
| 7676 | 7584 | } else |
| 7677 | − dewtprintk(ioc, pr_info(MPT3SAS_FMT | |
| 7678 | − "IR RAID_ACTION: completed successfully\n", | |
| 7679 | − ioc->name)); | |
| 7585 | + dewtprintk(ioc, | |
| 7586 | + ioc_info(ioc, "IR RAID_ACTION: completed successfully\n")); | |
| 7680 | 7587 | } |
| 7681 | 7588 | |
| 7682 | 7589 | out: |
| @@ -7721,9 +7628,8 @@ _scsih_sas_volume_add(struct MPT3SAS_ADAPTER *ioc, · 38 unmodified lines | ||
| 7721 | 7628 | |
| 7722 | 7629 | mpt3sas_config_get_volume_wwid(ioc, handle, &wwid); |
| 7723 | 7630 | if (!wwid) { |
| 7724 | − pr_err(MPT3SAS_FMT | |
| 7725 | − "failure at %s:%d/%s()!\n", ioc->name, | |
| 7726 | − __FILE__, __LINE__, __func__); | |
| 7631 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", | |
| 7632 | + __FILE__, __LINE__, __func__); | |
| 7727 | 7633 | return; |
| 7728 | 7634 | } |
| 7729 | 7635 | |
| @@ -7736,9 +7642,8 @@ _scsih_sas_volume_add(struct MPT3SAS_ADAPTER *ioc, · 6 unmodified lines | ||
| 7736 | 7642 | |
| 7737 | 7643 | raid_device = kzalloc(sizeof(struct _raid_device), GFP_KERNEL); |
| 7738 | 7644 | if (!raid_device) { |
| 7739 | − pr_err(MPT3SAS_FMT | |
| 7740 | − "failure at %s:%d/%s()!\n", ioc->name, | |
| 7741 | − __FILE__, __LINE__, __func__); | |
| 7645 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", | |
| 7646 | + __FILE__, __LINE__, __func__); | |
| 7742 | 7647 | return; |
| 7743 | 7648 | } |
| 7744 | 7649 | |
| @@ -7781,9 +7686,8 @@ _scsih_sas_volume_delete(struct MPT3SAS_ADAPTER *ioc, u16 handle) · 36 unmodified lines | ||
| 7781 | 7686 | sas_target_priv_data = starget->hostdata; |
| 7782 | 7687 | sas_target_priv_data->deleted = 1; |
| 7783 | 7688 | } |
| 7784 | − pr_info(MPT3SAS_FMT "removing handle(0x%04x), wwid(0x%016llx)\n", | |
| 7785 | − ioc->name, raid_device->handle, | |
| 7786 | − (unsigned long long) raid_device->wwid); | |
| 7689 | + ioc_info(ioc, "removing handle(0x%04x), wwid(0x%016llx)\n", | |
| 7690 | + raid_device->handle, (u64)raid_device->wwid); | |
| 7787 | 7691 | list_del(&raid_device->list); |
| 7788 | 7692 | kfree(raid_device); |
| 7789 | 7693 | } |
| @@ -7925,16 +7829,16 @@ _scsih_sas_pd_add(struct MPT3SAS_ADAPTER *ioc, · 135 unmodified lines | ||
| 7925 | 7829 | |
| 7926 | 7830 | if ((mpt3sas_config_get_sas_device_pg0(ioc, &mpi_reply, &sas_device_pg0, |
| 7927 | 7831 | MPI2_SAS_DEVICE_PGAD_FORM_HANDLE, handle))) { |
| 7928 | − pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", | |
| 7929 | − ioc->name, __FILE__, __LINE__, __func__); | |
| 7832 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", | |
| 7833 | + __FILE__, __LINE__, __func__); | |
| 7930 | 7834 | return; |
| 7931 | 7835 | } |
| 7932 | 7836 | |
| 7933 | 7837 | ioc_status = le16_to_cpu(mpi_reply.IOCStatus) & |
| 7934 | 7838 | MPI2_IOCSTATUS_MASK; |
| 7935 | 7839 | if (ioc_status != MPI2_IOCSTATUS_SUCCESS) { |
| 7936 | − pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", | |
| 7937 | − ioc->name, __FILE__, __LINE__, __func__); | |
| 7840 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", | |
| 7841 | + __FILE__, __LINE__, __func__); | |
| 7938 | 7842 | return; |
| 7939 | 7843 | } |
| 7940 | 7844 | |
| @@ -7964,10 +7868,10 @@ _scsih_sas_ir_config_change_event_debug(struct MPT3SAS_ADAPTER *ioc, · 23 unmodified lines | ||
| 7964 | 7868 | |
| 7965 | 7869 | element = (Mpi2EventIrConfigElement_t *)&event_data->ConfigElement[0]; |
| 7966 | 7870 | |
| 7967 | − pr_info(MPT3SAS_FMT "raid config change: (%s), elements(%d)\n", | |
| 7968 | − ioc->name, (le32_to_cpu(event_data->Flags) & | |
| 7969 | − MPI2_EVENT_IR_CHANGE_FLAGS_FOREIGN_CONFIG) ? | |
| 7970 | − "foreign" : "native", event_data->NumElements); | |
| 7871 | + ioc_info(ioc, "raid config change: (%s), elements(%d)\n", | |
| 7872 | + le32_to_cpu(event_data->Flags) & MPI2_EVENT_IR_CHANGE_FLAGS_FOREIGN_CONFIG ? | |
| 7873 | + "foreign" : "native", | |
| 7874 | + event_data->NumElements); | |
| 7971 | 7875 | for (i = 0; i < event_data->NumElements; i++, element++) { |
| 7972 | 7876 | switch (element->ReasonCode) { |
| 7973 | 7877 | case MPI2_EVENT_IR_CHANGE_RC_ADDED: |
| @@ -8123,10 +8027,11 @@ _scsih_sas_ir_volume_event(struct MPT3SAS_ADAPTER *ioc, · 149 unmodified lines | ||
| 8123 | 8027 | handle = le16_to_cpu(event_data->VolDevHandle); |
| 8124 | 8028 | state = le32_to_cpu(event_data->NewValue); |
| 8125 | 8029 | if (!ioc->hide_ir_msg) |
| 8126 | − dewtprintk(ioc, pr_info(MPT3SAS_FMT | |
| 8127 | − "%s: handle(0x%04x), old(0x%08x), new(0x%08x)\n", | |
| 8128 | − ioc->name, __func__, handle, | |
| 8129 | − le32_to_cpu(event_data->PreviousValue), state)); | |
| 8030 | + dewtprintk(ioc, | |
| 8031 | + ioc_info(ioc, "%s: handle(0x%04x), old(0x%08x), new(0x%08x)\n", | |
| 8032 | + __func__, handle, | |
| 8033 | + le32_to_cpu(event_data->PreviousValue), | |
| 8034 | + state)); | |
| 8130 | 8035 | switch (state) { |
| 8131 | 8036 | case MPI2_RAID_VOL_STATE_MISSING: |
| 8132 | 8037 | case MPI2_RAID_VOL_STATE_FAILED: |
| @@ -8146,17 +8051,15 @@ _scsih_sas_ir_volume_event(struct MPT3SAS_ADAPTER *ioc, · 13 unmodified lines | ||
| 8146 | 8051 | |
| 8147 | 8052 | mpt3sas_config_get_volume_wwid(ioc, handle, &wwid); |
| 8148 | 8053 | if (!wwid) { |
| 8149 | − pr_err(MPT3SAS_FMT | |
| 8150 | − "failure at %s:%d/%s()!\n", ioc->name, | |
| 8151 | − __FILE__, __LINE__, __func__); | |
| 8054 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", | |
| 8055 | + __FILE__, __LINE__, __func__); | |
| 8152 | 8056 | break; |
| 8153 | 8057 | } |
| 8154 | 8058 | |
| 8155 | 8059 | raid_device = kzalloc(sizeof(struct _raid_device), GFP_KERNEL); |
| 8156 | 8060 | if (!raid_device) { |
| 8157 | − pr_err(MPT3SAS_FMT | |
| 8158 | − "failure at %s:%d/%s()!\n", ioc->name, | |
| 8159 | − __FILE__, __LINE__, __func__); | |
| 8061 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", | |
| 8062 | + __FILE__, __LINE__, __func__); | |
| 8160 | 8063 | break; |
| 8161 | 8064 | } |
| 8162 | 8065 | |
| @@ -8207,10 +8110,11 @@ _scsih_sas_ir_physical_disk_event(struct MPT3SAS_ADAPTER *ioc, · 44 unmodified lines | ||
| 8207 | 8110 | state = le32_to_cpu(event_data->NewValue); |
| 8208 | 8111 | |
| 8209 | 8112 | if (!ioc->hide_ir_msg) |
| 8210 | − dewtprintk(ioc, pr_info(MPT3SAS_FMT | |
| 8211 | − "%s: handle(0x%04x), old(0x%08x), new(0x%08x)\n", | |
| 8212 | − ioc->name, __func__, handle, | |
| 8213 | − le32_to_cpu(event_data->PreviousValue), state)); | |
| 8113 | + dewtprintk(ioc, | |
| 8114 | + ioc_info(ioc, "%s: handle(0x%04x), old(0x%08x), new(0x%08x)\n", | |
| 8115 | + __func__, handle, | |
| 8116 | + le32_to_cpu(event_data->PreviousValue), | |
| 8117 | + state)); | |
| 8214 | 8118 | |
| 8215 | 8119 | switch (state) { |
| 8216 | 8120 | case MPI2_RAID_PD_STATE_ONLINE: |
| @@ -8231,16 +8135,16 @@ _scsih_sas_ir_physical_disk_event(struct MPT3SAS_ADAPTER *ioc, · 14 unmodified lines | ||
| 8231 | 8135 | if ((mpt3sas_config_get_sas_device_pg0(ioc, &mpi_reply, |
| 8232 | 8136 | &sas_device_pg0, MPI2_SAS_DEVICE_PGAD_FORM_HANDLE, |
| 8233 | 8137 | handle))) { |
| 8234 | − pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", | |
| 8235 | − ioc->name, __FILE__, __LINE__, __func__); | |
| 8138 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", | |
| 8139 | + __FILE__, __LINE__, __func__); | |
| 8236 | 8140 | return; |
| 8237 | 8141 | } |
| 8238 | 8142 | |
| 8239 | 8143 | ioc_status = le16_to_cpu(mpi_reply.IOCStatus) & |
| 8240 | 8144 | MPI2_IOCSTATUS_MASK; |
| 8241 | 8145 | if (ioc_status != MPI2_IOCSTATUS_SUCCESS) { |
| 8242 | − pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", | |
| 8243 | − ioc->name, __FILE__, __LINE__, __func__); | |
| 8146 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", | |
| 8147 | + __FILE__, __LINE__, __func__); | |
| 8244 | 8148 | return; |
| 8245 | 8149 | } |
| 8246 | 8150 | |
| @@ -8294,11 +8198,10 @@ _scsih_sas_ir_operation_status_event_debug(struct MPT3SAS_ADAPTER *ioc, · 47 unmodified lines | ||
| 8294 | 8198 | if (!reason_str) |
| 8295 | 8199 | return; |
| 8296 | 8200 | |
| 8297 | − pr_info(MPT3SAS_FMT "raid operational status: (%s)" \ | |
| 8298 | − "\thandle(0x%04x), percent complete(%d)\n", | |
| 8299 | − ioc->name, reason_str, | |
| 8300 | − le16_to_cpu(event_data->VolDevHandle), | |
| 8301 | − event_data->PercentComplete); | |
| 8201 | + ioc_info(ioc, "raid operational status: (%s)\thandle(0x%04x), percent complete(%d)\n", | |
| 8202 | + reason_str, | |
| 8203 | + le16_to_cpu(event_data->VolDevHandle), | |
| 8204 | + event_data->PercentComplete); | |
| 8302 | 8205 | } |
| 8303 | 8206 | |
| 8304 | 8207 | /** |
| @@ -8379,9 +8282,8 @@ Mpi2SasDevicePage0_t *sas_device_pg0) · 74 unmodified lines | ||
| 8379 | 8282 | mpt3sas_scsih_enclosure_find_by_handle(ioc, |
| 8380 | 8283 | le16_to_cpu(sas_device_pg0->EnclosureHandle)); |
| 8381 | 8284 | if (enclosure_dev == NULL) |
| 8382 | − pr_info(MPT3SAS_FMT "Enclosure handle(0x%04x)" | |
| 8383 | − "doesn't match with enclosure device!\n", | |
| 8384 | − ioc->name, sas_device_pg0->EnclosureHandle); | |
| 8285 | + ioc_info(ioc, "Enclosure handle(0x%04x) doesn't match with enclosure device!\n", | |
| 8286 | + sas_device_pg0->EnclosureHandle); | |
| 8385 | 8287 | } |
| 8386 | 8288 | spin_lock_irqsave(&ioc->sas_device_lock, flags); |
| 8387 | 8289 | list_for_each_entry(sas_device, &ioc->sas_device_list, list) { |
| @@ -8475,8 +8377,7 @@ _scsih_create_enclosure_list_after_reset(struct MPT3SAS_ADAPTER *ioc) · 87 unmodified lines | ||
| 8475 | 8377 | enclosure_dev = |
| 8476 | 8378 | kzalloc(sizeof(struct _enclosure_node), GFP_KERNEL); |
| 8477 | 8379 | if (!enclosure_dev) { |
| 8478 | − pr_err(MPT3SAS_FMT | |
| 8479 | − "failure at %s:%d/%s()!\n", ioc->name, | |
| 8380 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", | |
| 8480 | 8381 | __FILE__, __LINE__, __func__); |
| 8481 | 8382 | return; |
| 8482 | 8383 | } |
| @@ -8513,7 +8414,7 @@ _scsih_search_responding_sas_devices(struct MPT3SAS_ADAPTER *ioc) · 30 unmodified lines | ||
| 8513 | 8414 | u16 handle; |
| 8514 | 8415 | u32 device_info; |
| 8515 | 8416 | |
| 8516 | − pr_info(MPT3SAS_FMT "search for end-devices: start\n", ioc->name); | |
| 8417 | + ioc_info(ioc, "search for end-devices: start\n"); | |
| 8517 | 8418 | |
| 8518 | 8419 | if (list_empty(&ioc->sas_device_list)) |
| 8519 | 8420 | goto out; |
| @@ -8534,8 +8435,7 @@ _scsih_search_responding_sas_devices(struct MPT3SAS_ADAPTER *ioc) · 14 unmodified lines | ||
| 8534 | 8435 | } |
| 8535 | 8436 | |
| 8536 | 8437 | out: |
| 8537 | − pr_info(MPT3SAS_FMT "search for end-devices: complete\n", | |
| 8538 | − ioc->name); | |
| 8438 | + ioc_info(ioc, "search for end-devices: complete\n"); | |
| 8539 | 8439 | } |
| 8540 | 8440 | |
| 8541 | 8441 | /** |
| @@ -8628,7 +8528,7 @@ _scsih_search_responding_pcie_devices(struct MPT3SAS_ADAPTER *ioc) · 86 unmodified lines | ||
| 8628 | 8528 | u16 handle; |
| 8629 | 8529 | u32 device_info; |
| 8630 | 8530 | |
| 8631 | − pr_info(MPT3SAS_FMT "search for end-devices: start\n", ioc->name); | |
| 8531 | + ioc_info(ioc, "search for end-devices: start\n"); | |
| 8632 | 8532 | |
| 8633 | 8533 | if (list_empty(&ioc->pcie_device_list)) |
| 8634 | 8534 | goto out; |
| @@ -8640,10 +8540,9 @@ _scsih_search_responding_pcie_devices(struct MPT3SAS_ADAPTER *ioc) · 5 unmodified lines | ||
| 8640 | 8540 | ioc_status = le16_to_cpu(mpi_reply.IOCStatus) & |
| 8641 | 8541 | MPI2_IOCSTATUS_MASK; |
| 8642 | 8542 | if (ioc_status != MPI2_IOCSTATUS_SUCCESS) { |
| 8643 | − pr_info(MPT3SAS_FMT "\tbreak from %s: " | |
| 8644 | − "ioc_status(0x%04x), loginfo(0x%08x)\n", ioc->name, | |
| 8645 | − __func__, ioc_status, | |
| 8646 | − le32_to_cpu(mpi_reply.IOCLogInfo)); | |
| 8543 | + ioc_info(ioc, "\tbreak from %s: ioc_status(0x%04x), loginfo(0x%08x)\n", | |
| 8544 | + __func__, ioc_status, | |
| 8545 | + le32_to_cpu(mpi_reply.IOCLogInfo)); | |
| 8647 | 8546 | break; |
| 8648 | 8547 | } |
| 8649 | 8548 | handle = le16_to_cpu(pcie_device_pg0.DevHandle); |
| @@ -8653,8 +8552,7 @@ _scsih_search_responding_pcie_devices(struct MPT3SAS_ADAPTER *ioc) · 3 unmodified lines | ||
| 8653 | 8552 | _scsih_mark_responding_pcie_device(ioc, &pcie_device_pg0); |
| 8654 | 8553 | } |
| 8655 | 8554 | out: |
| 8656 | − pr_info(MPT3SAS_FMT "search for PCIe end-devices: complete\n", | |
| 8657 | − ioc->name); | |
| 8555 | + ioc_info(ioc, "search for PCIe end-devices: complete\n"); | |
| 8658 | 8556 | } |
| 8659 | 8557 | |
| 8660 | 8558 | /** |
| @@ -8735,8 +8633,7 @@ _scsih_search_responding_raid_devices(struct MPT3SAS_ADAPTER *ioc) · 74 unmodified lines | ||
| 8735 | 8633 | if (!ioc->ir_firmware) |
| 8736 | 8634 | return; |
| 8737 | 8635 | |
| 8738 | − pr_info(MPT3SAS_FMT "search for raid volumes: start\n", | |
| 8739 | − ioc->name); | |
| 8636 | + ioc_info(ioc, "search for raid volumes: start\n"); | |
| 8740 | 8637 | |
| 8741 | 8638 | if (list_empty(&ioc->raid_device_list)) |
| 8742 | 8639 | goto out; |
| @@ -8779,8 +8676,7 @@ _scsih_search_responding_raid_devices(struct MPT3SAS_ADAPTER *ioc) · 36 unmodified lines | ||
| 8779 | 8676 | } |
| 8780 | 8677 | } |
| 8781 | 8678 | out: |
| 8782 | − pr_info(MPT3SAS_FMT "search for responding raid volumes: complete\n", | |
| 8783 | − ioc->name); | |
| 8679 | + ioc_info(ioc, "search for responding raid volumes: complete\n"); | |
| 8784 | 8680 | } |
| 8785 | 8681 | |
| 8786 | 8682 | /** |
| @@ -8852,7 +8748,7 @@ _scsih_search_responding_expanders(struct MPT3SAS_ADAPTER *ioc) · 65 unmodified lines | ||
| 8852 | 8748 | u64 sas_address; |
| 8853 | 8749 | u16 handle; |
| 8854 | 8750 | |
| 8855 | − pr_info(MPT3SAS_FMT "search for expanders: start\n", ioc->name); | |
| 8751 | + ioc_info(ioc, "search for expanders: start\n"); | |
| 8856 | 8752 | |
| 8857 | 8753 | if (list_empty(&ioc->sas_expander_list)) |
| 8858 | 8754 | goto out; |
| @@ -8875,7 +8771,7 @@ _scsih_search_responding_expanders(struct MPT3SAS_ADAPTER *ioc) · 16 unmodified lines | ||
| 8875 | 8771 | } |
| 8876 | 8772 | |
| 8877 | 8773 | out: |
| 8878 | − pr_info(MPT3SAS_FMT "search for expanders: complete\n", ioc->name); | |
| 8774 | + ioc_info(ioc, "search for expanders: complete\n"); | |
| 8879 | 8775 | } |
| 8880 | 8776 | |
| 8881 | 8777 | /** |
| @@ -8893,12 +8789,10 @@ _scsih_remove_unresponding_devices(struct MPT3SAS_ADAPTER *ioc) · 11 unmodified lines | ||
| 8893 | 8789 | unsigned long flags; |
| 8894 | 8790 | LIST_HEAD(head); |
| 8895 | 8791 | |
| 8896 | − pr_info(MPT3SAS_FMT "removing unresponding devices: start\n", | |
| 8897 | − ioc->name); | |
| 8792 | + ioc_info(ioc, "removing unresponding devices: start\n"); | |
| 8898 | 8793 | |
| 8899 | 8794 | /* removing unresponding end devices */ |
| 8900 | − pr_info(MPT3SAS_FMT "removing unresponding devices: end-devices\n", | |
| 8901 | − ioc->name); | |
| 8795 | + ioc_info(ioc, "removing unresponding devices: end-devices\n"); | |
| 8902 | 8796 | /* |
| 8903 | 8797 | * Iterate, pulling off devices marked as non-responding. We become the |
| 8904 | 8798 | * owner for the reference the list had on any object we prune. |
| @@ -8922,9 +8816,7 @@ _scsih_remove_unresponding_devices(struct MPT3SAS_ADAPTER *ioc) · 17 unmodified lines | ||
| 8922 | 8816 | sas_device_put(sas_device); |
| 8923 | 8817 | } |
| 8924 | 8818 | |
| 8925 | − pr_info(MPT3SAS_FMT | |
| 8926 | − " Removing unresponding devices: pcie end-devices\n" | |
| 8927 | − , ioc->name); | |
| 8819 | + ioc_info(ioc, "Removing unresponding devices: pcie end-devices\n"); | |
| 8928 | 8820 | INIT_LIST_HEAD(&head); |
| 8929 | 8821 | spin_lock_irqsave(&ioc->pcie_device_lock, flags); |
| 8930 | 8822 | list_for_each_entry_safe(pcie_device, pcie_device_next, |
| @@ -8944,8 +8836,7 @@ _scsih_remove_unresponding_devices(struct MPT3SAS_ADAPTER *ioc) · 13 unmodified lines | ||
| 8944 | 8836 | |
| 8945 | 8837 | /* removing unresponding volumes */ |
| 8946 | 8838 | if (ioc->ir_firmware) { |
| 8947 | − pr_info(MPT3SAS_FMT "removing unresponding devices: volumes\n", | |
| 8948 | − ioc->name); | |
| 8839 | + ioc_info(ioc, "removing unresponding devices: volumes\n"); | |
| 8949 | 8840 | list_for_each_entry_safe(raid_device, raid_device_next, |
| 8950 | 8841 | &ioc->raid_device_list, list) { |
| 8951 | 8842 | if (!raid_device->responding) |
| @@ -8957,8 +8848,7 @@ _scsih_remove_unresponding_devices(struct MPT3SAS_ADAPTER *ioc) · 5 unmodified lines | ||
| 8957 | 8848 | } |
| 8958 | 8849 | |
| 8959 | 8850 | /* removing unresponding expanders */ |
| 8960 | − pr_info(MPT3SAS_FMT "removing unresponding devices: expanders\n", | |
| 8961 | − ioc->name); | |
| 8851 | + ioc_info(ioc, "removing unresponding devices: expanders\n"); | |
| 8962 | 8852 | spin_lock_irqsave(&ioc->sas_node_lock, flags); |
| 8963 | 8853 | INIT_LIST_HEAD(&tmp_list); |
| 8964 | 8854 | list_for_each_entry_safe(sas_expander, sas_expander_next, |
| @@ -8974,8 +8864,7 @@ _scsih_remove_unresponding_devices(struct MPT3SAS_ADAPTER *ioc) · 9 unmodified lines | ||
| 8974 | 8864 | _scsih_expander_node_remove(ioc, sas_expander); |
| 8975 | 8865 | } |
| 8976 | 8866 | |
| 8977 | − pr_info(MPT3SAS_FMT "removing unresponding devices: complete\n", | |
| 8978 | − ioc->name); | |
| 8867 | + ioc_info(ioc, "removing unresponding devices: complete\n"); | |
| 8979 | 8868 | |
| 8980 | 8869 | /* unblock devices */ |
| 8981 | 8870 | _scsih_ublock_io_all_device(ioc); |
| @@ -8992,8 +8881,8 @@ _scsih_refresh_expander_links(struct MPT3SAS_ADAPTER *ioc, · 10 unmodified lines | ||
| 8992 | 8881 | for (i = 0 ; i < sas_expander->num_phys ; i++) { |
| 8993 | 8882 | if ((mpt3sas_config_get_expander_pg1(ioc, &mpi_reply, |
| 8994 | 8883 | &expander_pg1, i, handle))) { |
| 8995 | − pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", | |
| 8996 | − ioc->name, __FILE__, __LINE__, __func__); | |
| 8884 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", | |
| 8885 | + __FILE__, __LINE__, __func__); | |
| 8997 | 8886 | return; |
| 8998 | 8887 | } |
| 8999 | 8888 | |
| @@ -9029,11 +8918,11 @@ _scsih_scan_for_devices_after_reset(struct MPT3SAS_ADAPTER *ioc) · 29 unmodified lines | ||
| 9029 | 8918 | u8 retry_count; |
| 9030 | 8919 | unsigned long flags; |
| 9031 | 8920 | |
| 9032 | − pr_info(MPT3SAS_FMT "scan devices: start\n", ioc->name); | |
| 8921 | + ioc_info(ioc, "scan devices: start\n"); | |
| 9033 | 8922 | |
| 9034 | 8923 | _scsih_sas_host_refresh(ioc); |
| 9035 | 8924 | |
| 9036 | − pr_info(MPT3SAS_FMT "\tscan devices: expanders start\n", ioc->name); | |
| 8925 | + ioc_info(ioc, "\tscan devices: expanders start\n"); | |
| 9037 | 8926 | |
| 9038 | 8927 | /* expanders */ |
| 9039 | 8928 | handle = 0xFFFF; |
| @@ -9042,10 +8931,8 @@ _scsih_scan_for_devices_after_reset(struct MPT3SAS_ADAPTER *ioc) · 2 unmodified lines | ||
| 9042 | 8931 | ioc_status = le16_to_cpu(mpi_reply.IOCStatus) & |
| 9043 | 8932 | MPI2_IOCSTATUS_MASK; |
| 9044 | 8933 | if (ioc_status != MPI2_IOCSTATUS_SUCCESS) { |
| 9045 | − pr_info(MPT3SAS_FMT "\tbreak from expander scan: " \ | |
| 9046 | − "ioc_status(0x%04x), loginfo(0x%08x)\n", | |
| 9047 | − ioc->name, ioc_status, | |
| 9048 | − le32_to_cpu(mpi_reply.IOCLogInfo)); | |
| 8934 | + ioc_info(ioc, "\tbreak from expander scan: ioc_status(0x%04x), loginfo(0x%08x)\n", | |
| 8935 | + ioc_status, le32_to_cpu(mpi_reply.IOCLogInfo)); | |
| 9049 | 8936 | break; |
| 9050 | 8937 | } |
| 9051 | 8938 | handle = le16_to_cpu(expander_pg0.DevHandle); |
| @@ -9057,25 +8944,22 @@ _scsih_scan_for_devices_after_reset(struct MPT3SAS_ADAPTER *ioc) · 5 unmodified lines | ||
| 9057 | 8944 | _scsih_refresh_expander_links(ioc, expander_device, |
| 9058 | 8945 | handle); |
| 9059 | 8946 | else { |
| 9060 | − pr_info(MPT3SAS_FMT "\tBEFORE adding expander: " \ | |
| 9061 | − "handle (0x%04x), sas_addr(0x%016llx)\n", ioc->name, | |
| 9062 | − handle, (unsigned long long) | |
| 9063 | − le64_to_cpu(expander_pg0.SASAddress)); | |
| 8947 | + ioc_info(ioc, "\tBEFORE adding expander: handle (0x%04x), sas_addr(0x%016llx)\n", | |
| 8948 | + handle, | |
| 8949 | + (u64)le64_to_cpu(expander_pg0.SASAddress)); | |
| 9064 | 8950 | _scsih_expander_add(ioc, handle); |
| 9065 | − pr_info(MPT3SAS_FMT "\tAFTER adding expander: " \ | |
| 9066 | − "handle (0x%04x), sas_addr(0x%016llx)\n", ioc->name, | |
| 9067 | − handle, (unsigned long long) | |
| 9068 | − le64_to_cpu(expander_pg0.SASAddress)); | |
| 8951 | + ioc_info(ioc, "\tAFTER adding expander: handle (0x%04x), sas_addr(0x%016llx)\n", | |
| 8952 | + handle, | |
| 8953 | + (u64)le64_to_cpu(expander_pg0.SASAddress)); | |
| 9069 | 8954 | } |
| 9070 | 8955 | } |
| 9071 | 8956 | |
| 9072 | − pr_info(MPT3SAS_FMT "\tscan devices: expanders complete\n", | |
| 9073 | − ioc->name); | |
| 8957 | + ioc_info(ioc, "\tscan devices: expanders complete\n"); | |
| 9074 | 8958 | |
| 9075 | 8959 | if (!ioc->ir_firmware) |
| 9076 | 8960 | goto skip_to_sas; |
| 9077 | 8961 | |
| 9078 | − pr_info(MPT3SAS_FMT "\tscan devices: phys disk start\n", ioc->name); | |
| 8962 | + ioc_info(ioc, "\tscan devices: phys disk start\n"); | |
| 9079 | 8963 | |
| 9080 | 8964 | /* phys disk */ |
| 9081 | 8965 | phys_disk_num = 0xFF; |
| @@ -9085,10 +8969,8 @@ _scsih_scan_for_devices_after_reset(struct MPT3SAS_ADAPTER *ioc) · 3 unmodified lines | ||
| 9085 | 8969 | ioc_status = le16_to_cpu(mpi_reply.IOCStatus) & |
| 9086 | 8970 | MPI2_IOCSTATUS_MASK; |
| 9087 | 8971 | if (ioc_status != MPI2_IOCSTATUS_SUCCESS) { |
| 9088 | − pr_info(MPT3SAS_FMT "\tbreak from phys disk scan: "\ | |
| 9089 | − "ioc_status(0x%04x), loginfo(0x%08x)\n", | |
| 9090 | − ioc->name, ioc_status, | |
| 9091 | − le32_to_cpu(mpi_reply.IOCLogInfo)); | |
| 8972 | + ioc_info(ioc, "\tbreak from phys disk scan: ioc_status(0x%04x), loginfo(0x%08x)\n", | |
| 8973 | + ioc_status, le32_to_cpu(mpi_reply.IOCLogInfo)); | |
| 9092 | 8974 | break; |
| 9093 | 8975 | } |
| 9094 | 8976 | phys_disk_num = pd_pg0.PhysDiskNum; |
| @@ -9105,19 +8987,16 @@ _scsih_scan_for_devices_after_reset(struct MPT3SAS_ADAPTER *ioc) · 10 unmodified lines | ||
| 9105 | 8987 | ioc_status = le16_to_cpu(mpi_reply.IOCStatus) & |
| 9106 | 8988 | MPI2_IOCSTATUS_MASK; |
| 9107 | 8989 | if (ioc_status != MPI2_IOCSTATUS_SUCCESS) { |
| 9108 | − pr_info(MPT3SAS_FMT "\tbreak from phys disk scan " \ | |
| 9109 | − "ioc_status(0x%04x), loginfo(0x%08x)\n", | |
| 9110 | − ioc->name, ioc_status, | |
| 9111 | − le32_to_cpu(mpi_reply.IOCLogInfo)); | |
| 8990 | + ioc_info(ioc, "\tbreak from phys disk scan ioc_status(0x%04x), loginfo(0x%08x)\n", | |
| 8991 | + ioc_status, le32_to_cpu(mpi_reply.IOCLogInfo)); | |
| 9112 | 8992 | break; |
| 9113 | 8993 | } |
| 9114 | 8994 | parent_handle = le16_to_cpu(sas_device_pg0.ParentDevHandle); |
| 9115 | 8995 | if (!_scsih_get_sas_address(ioc, parent_handle, |
| 9116 | 8996 | &sas_address)) { |
| 9117 | − pr_info(MPT3SAS_FMT "\tBEFORE adding phys disk: " \ | |
| 9118 | − " handle (0x%04x), sas_addr(0x%016llx)\n", | |
| 9119 | − ioc->name, handle, (unsigned long long) | |
| 9120 | − le64_to_cpu(sas_device_pg0.SASAddress)); | |
| 8997 | + ioc_info(ioc, "\tBEFORE adding phys disk: handle (0x%04x), sas_addr(0x%016llx)\n", | |
| 8998 | + handle, | |
| 8999 | + (u64)le64_to_cpu(sas_device_pg0.SASAddress)); | |
| 9121 | 9000 | mpt3sas_transport_update_links(ioc, sas_address, |
| 9122 | 9001 | handle, sas_device_pg0.PhyNum, |
| 9123 | 9002 | MPI2_SAS_NEG_LINK_RATE_1_5); |
| @@ -9131,17 +9010,15 @@ _scsih_scan_for_devices_after_reset(struct MPT3SAS_ADAPTER *ioc) · 7 unmodified lines | ||
| 9131 | 9010 | 1)) { |
| 9132 | 9011 | ssleep(1); |
| 9133 | 9012 | } |
| 9134 | − pr_info(MPT3SAS_FMT "\tAFTER adding phys disk: " \ | |
| 9135 | − " handle (0x%04x), sas_addr(0x%016llx)\n", | |
| 9136 | − ioc->name, handle, (unsigned long long) | |
| 9137 | − le64_to_cpu(sas_device_pg0.SASAddress)); | |
| 9013 | + ioc_info(ioc, "\tAFTER adding phys disk: handle (0x%04x), sas_addr(0x%016llx)\n", | |
| 9014 | + handle, | |
| 9015 | + (u64)le64_to_cpu(sas_device_pg0.SASAddress)); | |
| 9138 | 9016 | } |
| 9139 | 9017 | } |
| 9140 | 9018 | |
| 9141 | − pr_info(MPT3SAS_FMT "\tscan devices: phys disk complete\n", | |
| 9142 | − ioc->name); | |
| 9019 | + ioc_info(ioc, "\tscan devices: phys disk complete\n"); | |
| 9143 | 9020 | |
| 9144 | − pr_info(MPT3SAS_FMT "\tscan devices: volumes start\n", ioc->name); | |
| 9021 | + ioc_info(ioc, "\tscan devices: volumes start\n"); | |
| 9145 | 9022 | |
| 9146 | 9023 | /* volumes */ |
| 9147 | 9024 | handle = 0xFFFF; |
| @@ -9150,10 +9027,8 @@ _scsih_scan_for_devices_after_reset(struct MPT3SAS_ADAPTER *ioc) · 2 unmodified lines | ||
| 9150 | 9027 | ioc_status = le16_to_cpu(mpi_reply.IOCStatus) & |
| 9151 | 9028 | MPI2_IOCSTATUS_MASK; |
| 9152 | 9029 | if (ioc_status != MPI2_IOCSTATUS_SUCCESS) { |
| 9153 | − pr_info(MPT3SAS_FMT "\tbreak from volume scan: " \ | |
| 9154 | − "ioc_status(0x%04x), loginfo(0x%08x)\n", | |
| 9155 | − ioc->name, ioc_status, | |
| 9156 | − le32_to_cpu(mpi_reply.IOCLogInfo)); | |
| 9030 | + ioc_info(ioc, "\tbreak from volume scan: ioc_status(0x%04x), loginfo(0x%08x)\n", | |
| 9031 | + ioc_status, le32_to_cpu(mpi_reply.IOCLogInfo)); | |
| 9157 | 9032 | break; |
| 9158 | 9033 | } |
| 9159 | 9034 | handle = le16_to_cpu(volume_pg1.DevHandle); |
| @@ -9170,10 +9045,8 @@ _scsih_scan_for_devices_after_reset(struct MPT3SAS_ADAPTER *ioc) · 10 unmodified lines | ||
| 9170 | 9045 | ioc_status = le16_to_cpu(mpi_reply.IOCStatus) & |
| 9171 | 9046 | MPI2_IOCSTATUS_MASK; |
| 9172 | 9047 | if (ioc_status != MPI2_IOCSTATUS_SUCCESS) { |
| 9173 | − pr_info(MPT3SAS_FMT "\tbreak from volume scan: " \ | |
| 9174 | − "ioc_status(0x%04x), loginfo(0x%08x)\n", | |
| 9175 | − ioc->name, ioc_status, | |
| 9176 | − le32_to_cpu(mpi_reply.IOCLogInfo)); | |
| 9048 | + ioc_info(ioc, "\tbreak from volume scan: ioc_status(0x%04x), loginfo(0x%08x)\n", | |
| 9049 | + ioc_status, le32_to_cpu(mpi_reply.IOCLogInfo)); | |
| 9177 | 9050 | break; |
| 9178 | 9051 | } |
| 9179 | 9052 | if (volume_pg0.VolumeState == MPI2_RAID_VOL_STATE_OPTIMAL || |
| @@ -9182,23 +9055,19 @@ _scsih_scan_for_devices_after_reset(struct MPT3SAS_ADAPTER *ioc) · 2 unmodified lines | ||
| 9182 | 9055 | memset(&element, 0, sizeof(Mpi2EventIrConfigElement_t)); |
| 9183 | 9056 | element.ReasonCode = MPI2_EVENT_IR_CHANGE_RC_ADDED; |
| 9184 | 9057 | element.VolDevHandle = volume_pg1.DevHandle; |
| 9185 | − pr_info(MPT3SAS_FMT | |
| 9186 | − "\tBEFORE adding volume: handle (0x%04x)\n", | |
| 9187 | − ioc->name, volume_pg1.DevHandle); | |
| 9058 | + ioc_info(ioc, "\tBEFORE adding volume: handle (0x%04x)\n", | |
| 9059 | + volume_pg1.DevHandle); | |
| 9188 | 9060 | _scsih_sas_volume_add(ioc, &element); |
| 9189 | − pr_info(MPT3SAS_FMT | |
| 9190 | − "\tAFTER adding volume: handle (0x%04x)\n", | |
| 9191 | − ioc->name, volume_pg1.DevHandle); | |
| 9061 | + ioc_info(ioc, "\tAFTER adding volume: handle (0x%04x)\n", | |
| 9062 | + volume_pg1.DevHandle); | |
| 9192 | 9063 | } |
| 9193 | 9064 | } |
| 9194 | 9065 | |
| 9195 | − pr_info(MPT3SAS_FMT "\tscan devices: volumes complete\n", | |
| 9196 | − ioc->name); | |
| 9066 | + ioc_info(ioc, "\tscan devices: volumes complete\n"); | |
| 9197 | 9067 | |
| 9198 | 9068 | skip_to_sas: |
| 9199 | 9069 | |
| 9200 | − pr_info(MPT3SAS_FMT "\tscan devices: end devices start\n", | |
| 9201 | − ioc->name); | |
| 9070 | + ioc_info(ioc, "\tscan devices: end devices start\n"); | |
| 9202 | 9071 | |
| 9203 | 9072 | /* sas devices */ |
| 9204 | 9073 | handle = 0xFFFF; |
| @@ -9208,10 +9077,8 @@ _scsih_scan_for_devices_after_reset(struct MPT3SAS_ADAPTER *ioc) · 3 unmodified lines | ||
| 9208 | 9077 | ioc_status = le16_to_cpu(mpi_reply.IOCStatus) & |
| 9209 | 9078 | MPI2_IOCSTATUS_MASK; |
| 9210 | 9079 | if (ioc_status != MPI2_IOCSTATUS_SUCCESS) { |
| 9211 | − pr_info(MPT3SAS_FMT "\tbreak from end device scan:"\ | |
| 9212 | − " ioc_status(0x%04x), loginfo(0x%08x)\n", | |
| 9213 | − ioc->name, ioc_status, | |
| 9214 | − le32_to_cpu(mpi_reply.IOCLogInfo)); | |
| 9080 | + ioc_info(ioc, "\tbreak from end device scan: ioc_status(0x%04x), loginfo(0x%08x)\n", | |
| 9081 | + ioc_status, le32_to_cpu(mpi_reply.IOCLogInfo)); | |
| 9215 | 9082 | break; |
| 9216 | 9083 | } |
| 9217 | 9084 | handle = le16_to_cpu(sas_device_pg0.DevHandle); |
| @@ -9226,10 +9093,9 @@ _scsih_scan_for_devices_after_reset(struct MPT3SAS_ADAPTER *ioc) · 8 unmodified lines | ||
| 9226 | 9093 | } |
| 9227 | 9094 | parent_handle = le16_to_cpu(sas_device_pg0.ParentDevHandle); |
| 9228 | 9095 | if (!_scsih_get_sas_address(ioc, parent_handle, &sas_address)) { |
| 9229 | − pr_info(MPT3SAS_FMT "\tBEFORE adding end device: " \ | |
| 9230 | − "handle (0x%04x), sas_addr(0x%016llx)\n", ioc->name, | |
| 9231 | − handle, (unsigned long long) | |
| 9232 | − le64_to_cpu(sas_device_pg0.SASAddress)); | |
| 9096 | + ioc_info(ioc, "\tBEFORE adding end device: handle (0x%04x), sas_addr(0x%016llx)\n", | |
| 9097 | + handle, | |
| 9098 | + (u64)le64_to_cpu(sas_device_pg0.SASAddress)); | |
| 9233 | 9099 | mpt3sas_transport_update_links(ioc, sas_address, handle, |
| 9234 | 9100 | sas_device_pg0.PhyNum, MPI2_SAS_NEG_LINK_RATE_1_5); |
| 9235 | 9101 | retry_count = 0; |
| @@ -9241,16 +9107,13 @@ _scsih_scan_for_devices_after_reset(struct MPT3SAS_ADAPTER *ioc) · 5 unmodified lines | ||
| 9241 | 9107 | 0)) { |
| 9242 | 9108 | ssleep(1); |
| 9243 | 9109 | } |
| 9244 | − pr_info(MPT3SAS_FMT "\tAFTER adding end device: " \ | |
| 9245 | − "handle (0x%04x), sas_addr(0x%016llx)\n", ioc->name, | |
| 9246 | − handle, (unsigned long long) | |
| 9247 | − le64_to_cpu(sas_device_pg0.SASAddress)); | |
| 9110 | + ioc_info(ioc, "\tAFTER adding end device: handle (0x%04x), sas_addr(0x%016llx)\n", | |
| 9111 | + handle, | |
| 9112 | + (u64)le64_to_cpu(sas_device_pg0.SASAddress)); | |
| 9248 | 9113 | } |
| 9249 | 9114 | } |
| 9250 | − pr_info(MPT3SAS_FMT "\tscan devices: end devices complete\n", | |
| 9251 | − ioc->name); | |
| 9252 | − pr_info(MPT3SAS_FMT "\tscan devices: pcie end devices start\n", | |
| 9253 | − ioc->name); | |
| 9115 | + ioc_info(ioc, "\tscan devices: end devices complete\n"); | |
| 9116 | + ioc_info(ioc, "\tscan devices: pcie end devices start\n"); | |
| 9254 | 9117 | |
| 9255 | 9118 | /* pcie devices */ |
| 9256 | 9119 | handle = 0xFFFF; |
| @@ -9260,10 +9123,8 @@ _scsih_scan_for_devices_after_reset(struct MPT3SAS_ADAPTER *ioc) · 3 unmodified lines | ||
| 9260 | 9123 | ioc_status = le16_to_cpu(mpi_reply.IOCStatus) |
| 9261 | 9124 | & MPI2_IOCSTATUS_MASK; |
| 9262 | 9125 | if (ioc_status != MPI2_IOCSTATUS_SUCCESS) { |
| 9263 | − pr_info(MPT3SAS_FMT "\tbreak from pcie end device" | |
| 9264 | − " scan: ioc_status(0x%04x), loginfo(0x%08x)\n", | |
| 9265 | − ioc->name, ioc_status, | |
| 9266 | − le32_to_cpu(mpi_reply.IOCLogInfo)); | |
| 9126 | + ioc_info(ioc, "\tbreak from pcie end device scan: ioc_status(0x%04x), loginfo(0x%08x)\n", | |
| 9127 | + ioc_status, le32_to_cpu(mpi_reply.IOCLogInfo)); | |
| 9267 | 9128 | break; |
| 9268 | 9129 | } |
| 9269 | 9130 | handle = le16_to_cpu(pcie_device_pg0.DevHandle); |
| @@ -9280,14 +9141,11 @@ _scsih_scan_for_devices_after_reset(struct MPT3SAS_ADAPTER *ioc) · 10 unmodified lines | ||
| 9280 | 9141 | parent_handle = le16_to_cpu(pcie_device_pg0.ParentDevHandle); |
| 9281 | 9142 | _scsih_pcie_add_device(ioc, handle); |
| 9282 | 9143 | |
| 9283 | − pr_info(MPT3SAS_FMT "\tAFTER adding pcie end device: " | |
| 9284 | − "handle (0x%04x), wwid(0x%016llx)\n", ioc->name, | |
| 9285 | − handle, | |
| 9286 | − (unsigned long long) le64_to_cpu(pcie_device_pg0.WWID)); | |
| 9144 | + ioc_info(ioc, "\tAFTER adding pcie end device: handle (0x%04x), wwid(0x%016llx)\n", | |
| 9145 | + handle, (u64)le64_to_cpu(pcie_device_pg0.WWID)); | |
| 9287 | 9146 | } |
| 9288 | − pr_info(MPT3SAS_FMT "\tpcie devices: pcie end devices complete\n", | |
| 9289 | − ioc->name); | |
| 9290 | − pr_info(MPT3SAS_FMT "scan devices: complete\n", ioc->name); | |
| 9147 | + ioc_info(ioc, "\tpcie devices: pcie end devices complete\n"); | |
| 9148 | + ioc_info(ioc, "scan devices: complete\n"); | |
| 9291 | 9149 | } |
| 9292 | 9150 | |
| 9293 | 9151 | /** |
| @@ -9298,8 +9156,7 @@ _scsih_scan_for_devices_after_reset(struct MPT3SAS_ADAPTER *ioc) · 4 unmodified lines | ||
| 9298 | 9156 | */ |
| 9299 | 9157 | void mpt3sas_scsih_pre_reset_handler(struct MPT3SAS_ADAPTER *ioc) |
| 9300 | 9158 | { |
| 9301 | − dtmprintk(ioc, pr_info(MPT3SAS_FMT | |
| 9302 | − "%s: MPT3_IOC_PRE_RESET\n", ioc->name, __func__)); | |
| 9159 | + dtmprintk(ioc, ioc_info(ioc, "%s: MPT3_IOC_PRE_RESET\n", __func__)); | |
| 9303 | 9160 | } |
| 9304 | 9161 | |
| 9305 | 9162 | /** |
| @@ -9311,8 +9168,7 @@ void mpt3sas_scsih_pre_reset_handler(struct MPT3SAS_ADAPTER *ioc) · 5 unmodified lines | ||
| 9311 | 9168 | void |
| 9312 | 9169 | mpt3sas_scsih_after_reset_handler(struct MPT3SAS_ADAPTER *ioc) |
| 9313 | 9170 | { |
| 9314 | − dtmprintk(ioc, pr_info(MPT3SAS_FMT | |
| 9315 | − "%s: MPT3_IOC_AFTER_RESET\n", ioc->name, __func__)); | |
| 9171 | + dtmprintk(ioc, ioc_info(ioc, "%s: MPT3_IOC_AFTER_RESET\n", __func__)); | |
| 9316 | 9172 | if (ioc->scsih_cmds.status & MPT3_CMD_PENDING) { |
| 9317 | 9173 | ioc->scsih_cmds.status |= MPT3_CMD_RESET; |
| 9318 | 9174 | mpt3sas_base_free_smid(ioc, ioc->scsih_cmds.smid); |
| @@ -9340,8 +9196,7 @@ mpt3sas_scsih_after_reset_handler(struct MPT3SAS_ADAPTER *ioc) · 21 unmodified lines | ||
| 9340 | 9196 | void |
| 9341 | 9197 | mpt3sas_scsih_reset_done_handler(struct MPT3SAS_ADAPTER *ioc) |
| 9342 | 9198 | { |
| 9343 | − dtmprintk(ioc, pr_info(MPT3SAS_FMT | |
| 9344 | − "%s: MPT3_IOC_DONE_RESET\n", ioc->name, __func__)); | |
| 9199 | + dtmprintk(ioc, ioc_info(ioc, "%s: MPT3_IOC_DONE_RESET\n", __func__)); | |
| 9345 | 9200 | if ((!ioc->is_driver_loading) && !(disable_discovery > 0 && |
| 9346 | 9201 | !ioc->sas_hba.num_phys)) { |
| 9347 | 9202 | _scsih_prep_device_scan(ioc); |
| @@ -9396,9 +9251,8 @@ _mpt3sas_fw_work(struct MPT3SAS_ADAPTER *ioc, struct fw_event_work *fw_event) · 48 unmodified lines | ||
| 9396 | 9251 | if (missing_delay[0] != -1 && missing_delay[1] != -1) |
| 9397 | 9252 | mpt3sas_base_update_missing_delay(ioc, missing_delay[0], |
| 9398 | 9253 | missing_delay[1]); |
| 9399 | − dewtprintk(ioc, pr_info(MPT3SAS_FMT | |
| 9400 | − "port enable: complete from worker thread\n", | |
| 9401 | − ioc->name)); | |
| 9254 | + dewtprintk(ioc, | |
| 9255 | + ioc_info(ioc, "port enable: complete from worker thread\n")); | |
| 9402 | 9256 | break; |
| 9403 | 9257 | case MPT3SAS_TURN_ON_PFA_LED: |
| 9404 | 9258 | _scsih_turn_on_pfa_led(ioc, fw_event->device_handle); |
| @@ -9496,8 +9350,8 @@ mpt3sas_scsih_event_callback(struct MPT3SAS_ADAPTER *ioc, u8 msix_index, · 91 unmodified lines | ||
| 9496 | 9350 | mpi_reply = mpt3sas_base_get_reply_virt_addr(ioc, reply); |
| 9497 | 9351 | |
| 9498 | 9352 | if (unlikely(!mpi_reply)) { |
| 9499 | − pr_err(MPT3SAS_FMT "mpi_reply not valid at %s:%d/%s()!\n", | |
| 9500 | − ioc->name, __FILE__, __LINE__, __func__); | |
| 9353 | + ioc_err(ioc, "mpi_reply not valid at %s:%d/%s()!\n", | |
| 9354 | + __FILE__, __LINE__, __func__); | |
| 9501 | 9355 | return 1; |
| 9502 | 9356 | } |
| 9503 | 9357 | |
| @@ -9564,30 +9418,16 @@ mpt3sas_scsih_event_callback(struct MPT3SAS_ADAPTER *ioc, u8 msix_index, · 60 unmodified lines | ||
| 9564 | 9418 | |
| 9565 | 9419 | switch (le32_to_cpu(*log_code)) { |
| 9566 | 9420 | case MPT2_WARPDRIVE_LC_SSDT: |
| 9567 | − pr_warn(MPT3SAS_FMT "WarpDrive Warning: " | |
| 9568 | − "IO Throttling has occurred in the WarpDrive " | |
| 9569 | − "subsystem. Check WarpDrive documentation for " | |
| 9570 | − "additional details.\n", ioc->name); | |
| 9421 | + ioc_warn(ioc, "WarpDrive Warning: IO Throttling has occurred in the WarpDrive subsystem. Check WarpDrive documentation for additional details.\n"); | |
| 9571 | 9422 | break; |
| 9572 | 9423 | case MPT2_WARPDRIVE_LC_SSDLW: |
| 9573 | − pr_warn(MPT3SAS_FMT "WarpDrive Warning: " | |
| 9574 | − "Program/Erase Cycles for the WarpDrive subsystem " | |
| 9575 | − "in degraded range. Check WarpDrive documentation " | |
| 9576 | − "for additional details.\n", ioc->name); | |
| 9424 | + ioc_warn(ioc, "WarpDrive Warning: Program/Erase Cycles for the WarpDrive subsystem in degraded range. Check WarpDrive documentation for additional details.\n"); | |
| 9577 | 9425 | break; |
| 9578 | 9426 | case MPT2_WARPDRIVE_LC_SSDLF: |
| 9579 | − pr_err(MPT3SAS_FMT "WarpDrive Fatal Error: " | |
| 9580 | − "There are no Program/Erase Cycles for the " | |
| 9581 | − "WarpDrive subsystem. The storage device will be " | |
| 9582 | − "in read-only mode. Check WarpDrive documentation " | |
| 9583 | − "for additional details.\n", ioc->name); | |
| 9427 | + ioc_err(ioc, "WarpDrive Fatal Error: There are no Program/Erase Cycles for the WarpDrive subsystem. The storage device will be in read-only mode. Check WarpDrive documentation for additional details.\n"); | |
| 9584 | 9428 | break; |
| 9585 | 9429 | case MPT2_WARPDRIVE_LC_BRMF: |
| 9586 | − pr_err(MPT3SAS_FMT "WarpDrive Fatal Error: " | |
| 9587 | − "The Backup Rail Monitor has failed on the " | |
| 9588 | − "WarpDrive subsystem. Check WarpDrive " | |
| 9589 | − "documentation for additional details.\n", | |
| 9590 | − ioc->name); | |
| 9430 | + ioc_err(ioc, "WarpDrive Fatal Error: The Backup Rail Monitor has failed on the WarpDrive subsystem. Check WarpDrive documentation for additional details.\n"); | |
| 9591 | 9431 | break; |
| 9592 | 9432 | } |
| 9593 | 9433 | |
| @@ -9613,9 +9453,8 @@ mpt3sas_scsih_event_callback(struct MPT3SAS_ADAPTER *ioc, u8 msix_index, · 19 unmodified lines | ||
| 9613 | 9453 | (Mpi26EventDataActiveCableExcept_t *) mpi_reply->EventData; |
| 9614 | 9454 | switch (ActiveCableEventData->ReasonCode) { |
| 9615 | 9455 | case MPI26_EVENT_ACTIVE_CABLE_INSUFFICIENT_POWER: |
| 9616 | − pr_notice(MPT3SAS_FMT | |
| 9617 | − "Currently an active cable with ReceptacleID %d\n", | |
| 9618 | − ioc->name, ActiveCableEventData->ReceptacleID); | |
| 9456 | + ioc_notice(ioc, "Currently an active cable with ReceptacleID %d\n", | |
| 9457 | + ActiveCableEventData->ReceptacleID); | |
| 9619 | 9458 | pr_notice("cannot be powered and devices connected\n"); |
| 9620 | 9459 | pr_notice("to this active cable will not be seen\n"); |
| 9621 | 9460 | pr_notice("This active cable requires %d mW of power\n", |
| @@ -9623,9 +9462,8 @@ mpt3sas_scsih_event_callback(struct MPT3SAS_ADAPTER *ioc, u8 msix_index, · 1 unmodified line | ||
| 9623 | 9462 | break; |
| 9624 | 9463 | |
| 9625 | 9464 | case MPI26_EVENT_ACTIVE_CABLE_DEGRADED: |
| 9626 | − pr_notice(MPT3SAS_FMT | |
| 9627 | − "Currently a cable with ReceptacleID %d\n", | |
| 9628 | − ioc->name, ActiveCableEventData->ReceptacleID); | |
| 9465 | + ioc_notice(ioc, "Currently a cable with ReceptacleID %d\n", | |
| 9466 | + ActiveCableEventData->ReceptacleID); | |
| 9629 | 9467 | pr_notice( |
| 9630 | 9468 | "is not running at optimal speed(12 Gb/s rate)\n"); |
| 9631 | 9469 | break; |
| @@ -9640,8 +9478,8 @@ mpt3sas_scsih_event_callback(struct MPT3SAS_ADAPTER *ioc, u8 msix_index, · 8 unmodified lines | ||
| 9640 | 9478 | sz = le16_to_cpu(mpi_reply->EventDataLength) * 4; |
| 9641 | 9479 | fw_event = alloc_fw_event_work(sz); |
| 9642 | 9480 | if (!fw_event) { |
| 9643 | − pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", | |
| 9644 | − ioc->name, __FILE__, __LINE__, __func__); | |
| 9481 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", | |
| 9482 | + __FILE__, __LINE__, __func__); | |
| 9645 | 9483 | return 1; |
| 9646 | 9484 | } |
| 9647 | 9485 | |
| @@ -9690,11 +9528,9 @@ _scsih_expander_node_remove(struct MPT3SAS_ADAPTER *ioc, · 42 unmodified lines | ||
| 9690 | 9528 | mpt3sas_transport_port_remove(ioc, sas_expander->sas_address, |
| 9691 | 9529 | sas_expander->sas_address_parent); |
| 9692 | 9530 | |
| 9693 | − pr_info(MPT3SAS_FMT | |
| 9694 | − "expander_remove: handle(0x%04x), sas_addr(0x%016llx)\n", | |
| 9695 | − ioc->name, | |
| 9696 | − sas_expander->handle, (unsigned long long) | |
| 9697 | − sas_expander->sas_address); | |
| 9531 | + ioc_info(ioc, "expander_remove: handle(0x%04x), sas_addr(0x%016llx)\n", | |
| 9532 | + sas_expander->handle, (unsigned long long) | |
| 9533 | + sas_expander->sas_address); | |
| 9698 | 9534 | |
| 9699 | 9535 | spin_lock_irqsave(&ioc->sas_node_lock, flags); |
| 9700 | 9536 | list_del(&sas_expander->list); |
| @@ -9729,16 +9565,14 @@ _scsih_ir_shutdown(struct MPT3SAS_ADAPTER *ioc) · 28 unmodified lines | ||
| 9729 | 9565 | mutex_lock(&ioc->scsih_cmds.mutex); |
| 9730 | 9566 | |
| 9731 | 9567 | if (ioc->scsih_cmds.status != MPT3_CMD_NOT_USED) { |
| 9732 | − pr_err(MPT3SAS_FMT "%s: scsih_cmd in use\n", | |
| 9733 | − ioc->name, __func__); | |
| 9568 | + ioc_err(ioc, "%s: scsih_cmd in use\n", __func__); | |
| 9734 | 9569 | goto out; |
| 9735 | 9570 | } |
| 9736 | 9571 | ioc->scsih_cmds.status = MPT3_CMD_PENDING; |
| 9737 | 9572 | |
| 9738 | 9573 | smid = mpt3sas_base_get_smid(ioc, ioc->scsih_cb_idx); |
| 9739 | 9574 | if (!smid) { |
| 9740 | − pr_err(MPT3SAS_FMT "%s: failed obtaining a smid\n", | |
| 9741 | − ioc->name, __func__); | |
| 9575 | + ioc_err(ioc, "%s: failed obtaining a smid\n", __func__); | |
| 9742 | 9576 | ioc->scsih_cmds.status = MPT3_CMD_NOT_USED; |
| 9743 | 9577 | goto out; |
| 9744 | 9578 | } |
| @@ -9751,24 +9585,22 @@ _scsih_ir_shutdown(struct MPT3SAS_ADAPTER *ioc) · 6 unmodified lines | ||
| 9751 | 9585 | mpi_request->Action = MPI2_RAID_ACTION_SYSTEM_SHUTDOWN_INITIATED; |
| 9752 | 9586 | |
| 9753 | 9587 | if (!ioc->hide_ir_msg) |
| 9754 | − pr_info(MPT3SAS_FMT "IR shutdown (sending)\n", ioc->name); | |
| 9588 | + ioc_info(ioc, "IR shutdown (sending)\n"); | |
| 9755 | 9589 | init_completion(&ioc->scsih_cmds.done); |
| 9756 | 9590 | mpt3sas_base_put_smid_default(ioc, smid); |
| 9757 | 9591 | wait_for_completion_timeout(&ioc->scsih_cmds.done, 10*HZ); |
| 9758 | 9592 | |
| 9759 | 9593 | if (!(ioc->scsih_cmds.status & MPT3_CMD_COMPLETE)) { |
| 9760 | − pr_err(MPT3SAS_FMT "%s: timeout\n", | |
| 9761 | − ioc->name, __func__); | |
| 9594 | + ioc_err(ioc, "%s: timeout\n", __func__); | |
| 9762 | 9595 | goto out; |
| 9763 | 9596 | } |
| 9764 | 9597 | |
| 9765 | 9598 | if (ioc->scsih_cmds.status & MPT3_CMD_REPLY_VALID) { |
| 9766 | 9599 | mpi_reply = ioc->scsih_cmds.reply; |
| 9767 | 9600 | if (!ioc->hide_ir_msg) |
| 9768 | − pr_info(MPT3SAS_FMT "IR shutdown " | |
| 9769 | − "(complete): ioc_status(0x%04x), loginfo(0x%08x)\n", | |
| 9770 | − ioc->name, le16_to_cpu(mpi_reply->IOCStatus), | |
| 9771 | − le32_to_cpu(mpi_reply->IOCLogInfo)); | |
| 9601 | + ioc_info(ioc, "IR shutdown (complete): ioc_status(0x%04x), loginfo(0x%08x)\n", | |
| 9602 | + le16_to_cpu(mpi_reply->IOCStatus), | |
| 9603 | + le32_to_cpu(mpi_reply->IOCLogInfo)); | |
| 9772 | 9604 | } |
| 9773 | 9605 | |
| 9774 | 9606 | out: |
| @@ -9817,9 +9649,8 @@ static void scsih_remove(struct pci_dev *pdev) · 42 unmodified lines | ||
| 9817 | 9649 | sas_target_priv_data->deleted = 1; |
| 9818 | 9650 | scsi_remove_target(&raid_device->starget->dev); |
| 9819 | 9651 | } |
| 9820 | − pr_info(MPT3SAS_FMT "removing handle(0x%04x), wwid(0x%016llx)\n", | |
| 9821 | − ioc->name, raid_device->handle, | |
| 9822 | − (unsigned long long) raid_device->wwid); | |
| 9652 | + ioc_info(ioc, "removing handle(0x%04x), wwid(0x%016llx)\n", | |
| 9653 | + raid_device->handle, (u64)raid_device->wwid); | |
| 9823 | 9654 | _scsih_raid_device_remove(ioc, raid_device); |
| 9824 | 9655 | } |
| 9825 | 9656 | list_for_each_entry_safe(pcie_device, pcienext, &ioc->pcie_device_list, |
| @@ -10230,7 +10061,7 @@ scsih_scan_start(struct Scsi_Host *shost) · 404 unmodified lines | ||
| 10230 | 10061 | rc = mpt3sas_port_enable(ioc); |
| 10231 | 10062 | |
| 10232 | 10063 | if (rc != 0) |
| 10233 | − pr_info(MPT3SAS_FMT "port enable: FAILED\n", ioc->name); | |
| 10064 | + ioc_info(ioc, "port enable: FAILED\n"); | |
| 10234 | 10065 | } |
| 10235 | 10066 | |
| 10236 | 10067 | /** |
| @@ -10255,9 +10086,7 @@ scsih_scan_finished(struct Scsi_Host *shost, unsigned long time) · 18 unmodified lines | ||
| 10255 | 10086 | |
| 10256 | 10087 | if (time >= (300 * HZ)) { |
| 10257 | 10088 | ioc->port_enable_cmds.status = MPT3_CMD_NOT_USED; |
| 10258 | − pr_info(MPT3SAS_FMT | |
| 10259 | − "port enable: FAILED with timeout (timeout=300s)\n", | |
| 10260 | − ioc->name); | |
| 10089 | + ioc_info(ioc, "port enable: FAILED with timeout (timeout=300s)\n"); | |
| 10261 | 10090 | ioc->is_driver_loading = 0; |
| 10262 | 10091 | return 1; |
| 10263 | 10092 | } |
| @@ -10266,16 +10095,15 @@ scsih_scan_finished(struct Scsi_Host *shost, unsigned long time) · 2 unmodified lines | ||
| 10266 | 10095 | return 0; |
| 10267 | 10096 | |
| 10268 | 10097 | if (ioc->start_scan_failed) { |
| 10269 | − pr_info(MPT3SAS_FMT | |
| 10270 | − "port enable: FAILED with (ioc_status=0x%08x)\n", | |
| 10271 | − ioc->name, ioc->start_scan_failed); | |
| 10098 | + ioc_info(ioc, "port enable: FAILED with (ioc_status=0x%08x)\n", | |
| 10099 | + ioc->start_scan_failed); | |
| 10272 | 10100 | ioc->is_driver_loading = 0; |
| 10273 | 10101 | ioc->wait_for_discovery_to_complete = 0; |
| 10274 | 10102 | ioc->remove_host = 1; |
| 10275 | 10103 | return 1; |
| 10276 | 10104 | } |
| 10277 | 10105 | |
| 10278 | − pr_info(MPT3SAS_FMT "port enable: SUCCESS\n", ioc->name); | |
| 10106 | + ioc_info(ioc, "port enable: SUCCESS\n"); | |
| 10279 | 10107 | ioc->port_enable_cmds.status = MPT3_CMD_NOT_USED; |
| 10280 | 10108 | |
| 10281 | 10109 | if (ioc->wait_for_discovery_to_complete) { |
| @@ -10586,28 +10414,22 @@ _scsih_probe(struct pci_dev *pdev, const struct pci_device_id *id) · 304 unmodified lines | ||
| 10586 | 10414 | if (ioc->is_mcpu_endpoint) { |
| 10587 | 10415 | /* mCPU MPI support 64K max IO */ |
| 10588 | 10416 | shost->max_sectors = 128; |
| 10589 | − pr_info(MPT3SAS_FMT | |
| 10590 | − "The max_sectors value is set to %d\n", | |
| 10591 | − ioc->name, shost->max_sectors); | |
| 10417 | + ioc_info(ioc, "The max_sectors value is set to %d\n", | |
| 10418 | + shost->max_sectors); | |
| 10592 | 10419 | } else { |
| 10593 | 10420 | if (max_sectors != 0xFFFF) { |
| 10594 | 10421 | if (max_sectors < 64) { |
| 10595 | 10422 | shost->max_sectors = 64; |
| 10596 | − pr_warn(MPT3SAS_FMT "Invalid value %d passed " \ | |
| 10597 | − "for max_sectors, range is 64 to 32767. " \ | |
| 10598 | − "Assigning value of 64.\n", \ | |
| 10599 | − ioc->name, max_sectors); | |
| 10423 | + ioc_warn(ioc, "Invalid value %d passed for max_sectors, range is 64 to 32767. Assigning value of 64.\n", | |
| 10424 | + max_sectors); | |
| 10600 | 10425 | } else if (max_sectors > 32767) { |
| 10601 | 10426 | shost->max_sectors = 32767; |
| 10602 | − pr_warn(MPT3SAS_FMT "Invalid value %d passed " \ | |
| 10603 | − "for max_sectors, range is 64 to 32767." \ | |
| 10604 | − "Assigning default value of 32767.\n", \ | |
| 10605 | − ioc->name, max_sectors); | |
| 10427 | + ioc_warn(ioc, "Invalid value %d passed for max_sectors, range is 64 to 32767.Assigning default value of 32767.\n", | |
| 10428 | + max_sectors); | |
| 10606 | 10429 | } else { |
| 10607 | 10430 | shost->max_sectors = max_sectors & 0xFFFE; |
| 10608 | − pr_info(MPT3SAS_FMT | |
| 10609 | − "The max_sectors value is set to %d\n", | |
| 10610 | − ioc->name, shost->max_sectors); | |
| 10431 | + ioc_info(ioc, "The max_sectors value is set to %d\n", | |
| 10432 | + shost->max_sectors); | |
| 10611 | 10433 | } |
| 10612 | 10434 | } |
| 10613 | 10435 | } |
| @@ -10627,16 +10449,16 @@ _scsih_probe(struct pci_dev *pdev, const struct pci_device_id *id) · 13 unmodified lines | ||
| 10627 | 10449 | ioc->firmware_event_thread = alloc_ordered_workqueue( |
| 10628 | 10450 | ioc->firmware_event_name, 0); |
| 10629 | 10451 | if (!ioc->firmware_event_thread) { |
| 10630 | − pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", | |
| 10631 | − ioc->name, __FILE__, __LINE__, __func__); | |
| 10452 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", | |
| 10453 | + __FILE__, __LINE__, __func__); | |
| 10632 | 10454 | rv = -ENODEV; |
| 10633 | 10455 | goto out_thread_fail; |
| 10634 | 10456 | } |
| 10635 | 10457 | |
| 10636 | 10458 | ioc->is_driver_loading = 1; |
| 10637 | 10459 | if ((mpt3sas_base_attach(ioc))) { |
| 10638 | − pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", | |
| 10639 | − ioc->name, __FILE__, __LINE__, __func__); | |
| 10460 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", | |
| 10461 | + __FILE__, __LINE__, __func__); | |
| 10640 | 10462 | rv = -ENODEV; |
| 10641 | 10463 | goto out_attach_fail; |
| 10642 | 10464 | } |
| @@ -10657,8 +10479,8 @@ _scsih_probe(struct pci_dev *pdev, const struct pci_device_id *id) · 14 unmodified lines | ||
| 10657 | 10479 | |
| 10658 | 10480 | rv = scsi_add_host(shost, &pdev->dev); |
| 10659 | 10481 | if (rv) { |
| 10660 | − pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", | |
| 10661 | − ioc->name, __FILE__, __LINE__, __func__); | |
| 10482 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", | |
| 10483 | + __FILE__, __LINE__, __func__); | |
| 10662 | 10484 | goto out_add_shost_fail; |
| 10663 | 10485 | } |
| 10664 | 10486 | |
| @@ -10695,9 +10517,8 @@ scsih_suspend(struct pci_dev *pdev, pm_message_t state) · 30 unmodified lines | ||
| 10695 | 10517 | flush_scheduled_work(); |
| 10696 | 10518 | scsi_block_requests(shost); |
| 10697 | 10519 | device_state = pci_choose_state(pdev, state); |
| 10698 | − pr_info(MPT3SAS_FMT | |
| 10699 | − "pdev=0x%p, slot=%s, entering operating state [D%d]\n", | |
| 10700 | − ioc->name, pdev, pci_name(pdev), device_state); | |
| 10520 | + ioc_info(ioc, "pdev=0x%p, slot=%s, entering operating state [D%d]\n", | |
| 10521 | + pdev, pci_name(pdev), device_state); | |
| 10701 | 10522 | |
| 10702 | 10523 | pci_save_state(pdev); |
| 10703 | 10524 | mpt3sas_base_free_resources(ioc); |
| @@ -10719,9 +10540,8 @@ scsih_resume(struct pci_dev *pdev) · 15 unmodified lines | ||
| 10719 | 10540 | pci_power_t device_state = pdev->current_state; |
| 10720 | 10541 | int r; |
| 10721 | 10542 | |
| 10722 | − pr_info(MPT3SAS_FMT | |
| 10723 | − "pdev=0x%p, slot=%s, previous operating state [D%d]\n", | |
| 10724 | − ioc->name, pdev, pci_name(pdev), device_state); | |
| 10543 | + ioc_info(ioc, "pdev=0x%p, slot=%s, previous operating state [D%d]\n", | |
| 10544 | + pdev, pci_name(pdev), device_state); | |
| 10725 | 10545 | |
| 10726 | 10546 | pci_set_power_state(pdev, PCI_D0); |
| 10727 | 10547 | pci_enable_wake(pdev, PCI_D0, 0); |
| @@ -10753,8 +10573,7 @@ scsih_pci_error_detected(struct pci_dev *pdev, pci_channel_state_t state) · 25 unmodified lines | ||
| 10753 | 10573 | struct Scsi_Host *shost = pci_get_drvdata(pdev); |
| 10754 | 10574 | struct MPT3SAS_ADAPTER *ioc = shost_priv(shost); |
| 10755 | 10575 | |
| 10756 | − pr_info(MPT3SAS_FMT "PCI error: detected callback, state(%d)!!\n", | |
| 10757 | − ioc->name, state); | |
| 10576 | + ioc_info(ioc, "PCI error: detected callback, state(%d)!!\n", state); | |
| 10758 | 10577 | |
| 10759 | 10578 | switch (state) { |
| 10760 | 10579 | case pci_channel_io_normal: |
| @@ -10791,8 +10610,7 @@ scsih_pci_slot_reset(struct pci_dev *pdev) · 30 unmodified lines | ||
| 10791 | 10610 | struct MPT3SAS_ADAPTER *ioc = shost_priv(shost); |
| 10792 | 10611 | int rc; |
| 10793 | 10612 | |
| 10794 | − pr_info(MPT3SAS_FMT "PCI error: slot reset callback!!\n", | |
| 10795 | − ioc->name); | |
| 10613 | + ioc_info(ioc, "PCI error: slot reset callback!!\n"); | |
| 10796 | 10614 | |
| 10797 | 10615 | ioc->pci_error_recovery = 0; |
| 10798 | 10616 | ioc->pdev = pdev; |
| @@ -10803,8 +10621,8 @@ scsih_pci_slot_reset(struct pci_dev *pdev) · 4 unmodified lines | ||
| 10803 | 10621 | |
| 10804 | 10622 | rc = mpt3sas_base_hard_reset_handler(ioc, FORCE_BIG_HAMMER); |
| 10805 | 10623 | |
| 10806 | − pr_warn(MPT3SAS_FMT "hard reset: %s\n", ioc->name, | |
| 10807 | − (rc == 0) ? "success" : "failed"); | |
| 10624 | + ioc_warn(ioc, "hard reset: %s\n", | |
| 10625 | + (rc == 0) ? "success" : "failed"); | |
| 10808 | 10626 | |
| 10809 | 10627 | if (!rc) |
| 10810 | 10628 | return PCI_ERS_RESULT_RECOVERED; |
| @@ -10826,7 +10644,7 @@ scsih_pci_resume(struct pci_dev *pdev) · 15 unmodified lines | ||
| 10826 | 10644 | struct Scsi_Host *shost = pci_get_drvdata(pdev); |
| 10827 | 10645 | struct MPT3SAS_ADAPTER *ioc = shost_priv(shost); |
| 10828 | 10646 | |
| 10829 | − pr_info(MPT3SAS_FMT "PCI error: resume callback!!\n", ioc->name); | |
| 10647 | + ioc_info(ioc, "PCI error: resume callback!!\n"); | |
| 10830 | 10648 | |
| 10831 | 10649 | mpt3sas_base_start_watchdog(ioc); |
| 10832 | 10650 | scsi_unblock_requests(ioc->shost); |
| @@ -10842,8 +10660,7 @@ scsih_pci_mmio_enabled(struct pci_dev *pdev) · 9 unmodified lines | ||
| 10842 | 10660 | struct Scsi_Host *shost = pci_get_drvdata(pdev); |
| 10843 | 10661 | struct MPT3SAS_ADAPTER *ioc = shost_priv(shost); |
| 10844 | 10662 | |
| 10845 | − pr_info(MPT3SAS_FMT "PCI error: mmio enabled callback!!\n", | |
| 10846 | − ioc->name); | |
| 10663 | + ioc_info(ioc, "PCI error: mmio enabled callback!!\n"); | |
| 10847 | 10664 | |
| 10848 | 10665 | /* TODO - dump whatever for debugging purposes */ |
| 10849 | 10666 | |
| @@ -146,25 +146,22 @@ _transport_set_identify(struct MPT3SAS_ADAPTER *ioc, u16 handle, · 145 unmodified lines | ||
| 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 | |
| @@ -310,16 +307,14 @@ _transport_expander_report_manufacture(struct MPT3SAS_ADAPTER *ioc, · 139 unmodified lines | ||
| 310 | 307 | u16 wait_state_count; |
| 311 | 308 | |
| 312 | 309 | if (ioc->shost_recovery || ioc->pci_error_recovery) { |
| 313 | − pr_info(MPT3SAS_FMT "%s: host reset in progress!\n", | |
| 314 | − __func__, ioc->name); | |
| 310 | + ioc_info(ioc, "%s: host reset in progress!\n", __func__); | |
| 315 | 311 | return -EFAULT; |
| 316 | 312 | } |
| 317 | 313 | |
| 318 | 314 | mutex_lock(&ioc->transport_cmds.mutex); |
| 319 | 315 | |
| 320 | 316 | if (ioc->transport_cmds.status != MPT3_CMD_NOT_USED) { |
| 321 | − pr_err(MPT3SAS_FMT "%s: transport_cmds in use\n", | |
| 322 | − ioc->name, __func__); | |
| 317 | + ioc_err(ioc, "%s: transport_cmds in use\n", __func__); | |
| 323 | 318 | rc = -EAGAIN; |
| 324 | 319 | goto out; |
| 325 | 320 | } |
| @@ -329,26 +324,22 @@ _transport_expander_report_manufacture(struct MPT3SAS_ADAPTER *ioc, · 3 unmodified lines | ||
| 329 | 324 | ioc_state = mpt3sas_base_get_iocstate(ioc, 1); |
| 330 | 325 | while (ioc_state != MPI2_IOC_STATE_OPERATIONAL) { |
| 331 | 326 | if (wait_state_count++ == 10) { |
| 332 | − pr_err(MPT3SAS_FMT | |
| 333 | − "%s: failed due to ioc not operational\n", | |
| 334 | − ioc->name, __func__); | |
| 327 | + ioc_err(ioc, "%s: failed due to ioc not operational\n", | |
| 328 | + __func__); | |
| 335 | 329 | rc = -EFAULT; |
| 336 | 330 | goto out; |
| 337 | 331 | } |
| 338 | 332 | ssleep(1); |
| 339 | 333 | 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); | |
| 334 | + ioc_info(ioc, "%s: waiting for operational state(count=%d)\n", | |
| 335 | + __func__, wait_state_count); | |
| 343 | 336 | } |
| 344 | 337 | if (wait_state_count) |
| 345 | − pr_info(MPT3SAS_FMT "%s: ioc is operational\n", | |
| 346 | − ioc->name, __func__); | |
| 338 | + ioc_info(ioc, "%s: ioc is operational\n", __func__); | |
| 347 | 339 | |
| 348 | 340 | smid = mpt3sas_base_get_smid(ioc, ioc->transport_cb_idx); |
| 349 | 341 | if (!smid) { |
| 350 | − pr_err(MPT3SAS_FMT "%s: failed obtaining a smid\n", | |
| 351 | − ioc->name, __func__); | |
| 342 | + ioc_err(ioc, "%s: failed obtaining a smid\n", __func__); | |
| 352 | 343 | rc = -EAGAIN; |
| 353 | 344 | goto out; |
| 354 | 345 | } |
| @@ -359,9 +350,8 @@ _transport_expander_report_manufacture(struct MPT3SAS_ADAPTER *ioc, · 4 unmodified lines | ||
| 359 | 350 | |
| 360 | 351 | data_out_sz = sizeof(struct rep_manu_request); |
| 361 | 352 | 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 | − | |
| 353 | + data_out = dma_alloc_coherent(&ioc->pdev->dev, data_out_sz + data_in_sz, | |
| 354 | + &data_out_dma, GFP_KERNEL); | |
| 365 | 355 | if (!data_out) { |
| 366 | 356 | pr_err("failure at %s:%d/%s()!\n", __FILE__, |
| 367 | 357 | __LINE__, __func__); |
| @@ -388,16 +378,15 @@ _transport_expander_report_manufacture(struct MPT3SAS_ADAPTER *ioc, · 20 unmodified lines | ||
| 388 | 378 | ioc->build_sg(ioc, psge, data_out_dma, data_out_sz, data_in_dma, |
| 389 | 379 | data_in_sz); |
| 390 | 380 | |
| 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)); | |
| 381 | + dtransportprintk(ioc, | |
| 382 | + ioc_info(ioc, "report_manufacture - send to sas_addr(0x%016llx)\n", | |
| 383 | + (u64)sas_address)); | |
| 394 | 384 | init_completion(&ioc->transport_cmds.done); |
| 395 | 385 | mpt3sas_base_put_smid_default(ioc, smid); |
| 396 | 386 | wait_for_completion_timeout(&ioc->transport_cmds.done, 10*HZ); |
| 397 | 387 | |
| 398 | 388 | if (!(ioc->transport_cmds.status & MPT3_CMD_COMPLETE)) { |
| 399 | − pr_err(MPT3SAS_FMT "%s: timeout\n", | |
| 400 | − ioc->name, __func__); | |
| 389 | + ioc_err(ioc, "%s: timeout\n", __func__); | |
| 401 | 390 | _debug_dump_mf(mpi_request, |
| 402 | 391 | sizeof(Mpi2SmpPassthroughRequest_t)/4); |
| 403 | 392 | if (!(ioc->transport_cmds.status & MPT3_CMD_RESET)) |
| @@ -405,17 +394,16 @@ _transport_expander_report_manufacture(struct MPT3SAS_ADAPTER *ioc, · 1 unmodified line | ||
| 405 | 394 | goto issue_host_reset; |
| 406 | 395 | } |
| 407 | 396 | |
| 408 | − dtransportprintk(ioc, pr_info(MPT3SAS_FMT | |
| 409 | − "report_manufacture - complete\n", ioc->name)); | |
| 397 | + dtransportprintk(ioc, ioc_info(ioc, "report_manufacture - complete\n")); | |
| 410 | 398 | |
| 411 | 399 | if (ioc->transport_cmds.status & MPT3_CMD_REPLY_VALID) { |
| 412 | 400 | u8 *tmp; |
| 413 | 401 | |
| 414 | 402 | mpi_reply = ioc->transport_cmds.reply; |
| 415 | 403 | |
| 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))); | |
| 404 | + dtransportprintk(ioc, | |
| 405 | + ioc_info(ioc, "report_manufacture - reply data transfer size(%d)\n", | |
| 406 | + le16_to_cpu(mpi_reply->ResponseDataLength))); | |
| 419 | 407 | |
| 420 | 408 | if (le16_to_cpu(mpi_reply->ResponseDataLength) != |
| 421 | 409 | sizeof(struct rep_manu_reply)) |
| @@ -439,8 +427,8 @@ _transport_expander_report_manufacture(struct MPT3SAS_ADAPTER *ioc, · 17 unmodified lines | ||
| 439 | 427 | manufacture_reply->component_revision_id; |
| 440 | 428 | } |
| 441 | 429 | } else |
| 442 | − dtransportprintk(ioc, pr_info(MPT3SAS_FMT | |
| 443 | − "report_manufacture - no reply\n", ioc->name)); | |
| 430 | + dtransportprintk(ioc, | |
| 431 | + ioc_info(ioc, "report_manufacture - no reply\n")); | |
| 444 | 432 | |
| 445 | 433 | issue_host_reset: |
| 446 | 434 | if (issue_reset) |
| @@ -448,7 +436,7 @@ _transport_expander_report_manufacture(struct MPT3SAS_ADAPTER *ioc, · 1 unmodified line | ||
| 448 | 436 | out: |
| 449 | 437 | ioc->transport_cmds.status = MPT3_CMD_NOT_USED; |
| 450 | 438 | if (data_out) |
| 451 | − pci_free_consistent(ioc->pdev, data_out_sz + data_in_sz, | |
| 439 | + dma_free_coherent(&ioc->pdev->dev, data_out_sz + data_in_sz, | |
| 452 | 440 | data_out, data_out_dma); |
| 453 | 441 | |
| 454 | 442 | mutex_unlock(&ioc->transport_cmds.mutex); |
| @@ -643,8 +631,8 @@ mpt3sas_transport_port_add(struct MPT3SAS_ADAPTER *ioc, u16 handle, · 188 unmodified lines | ||
| 643 | 631 | mpt3sas_port = kzalloc(sizeof(struct _sas_port), |
| 644 | 632 | GFP_KERNEL); |
| 645 | 633 | if (!mpt3sas_port) { |
| 646 | − pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", | |
| 647 | − ioc->name, __FILE__, __LINE__, __func__); | |
| 634 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", | |
| 635 | + __FILE__, __LINE__, __func__); | |
| 648 | 636 | return NULL; |
| 649 | 637 | } |
| 650 | 638 | |
| @@ -655,22 +643,21 @@ mpt3sas_transport_port_add(struct MPT3SAS_ADAPTER *ioc, u16 handle, · 4 unmodified lines | ||
| 655 | 643 | spin_unlock_irqrestore(&ioc->sas_node_lock, flags); |
| 656 | 644 | |
| 657 | 645 | 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); | |
| 646 | + ioc_err(ioc, "%s: Could not find parent sas_address(0x%016llx)!\n", | |
| 647 | + __func__, (u64)sas_address); | |
| 661 | 648 | goto out_fail; |
| 662 | 649 | } |
| 663 | 650 | |
| 664 | 651 | if ((_transport_set_identify(ioc, handle, |
| 665 | 652 | &mpt3sas_port->remote_identify))) { |
| 666 | − pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", | |
| 667 | − ioc->name, __FILE__, __LINE__, __func__); | |
| 653 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", | |
| 654 | + __FILE__, __LINE__, __func__); | |
| 668 | 655 | goto out_fail; |
| 669 | 656 | } |
| 670 | 657 | |
| 671 | 658 | 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__); | |
| 659 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", | |
| 660 | + __FILE__, __LINE__, __func__); | |
| 674 | 661 | goto out_fail; |
| 675 | 662 | } |
| 676 | 663 | |
| @@ -687,20 +674,20 @@ mpt3sas_transport_port_add(struct MPT3SAS_ADAPTER *ioc, u16 handle, · 10 unmodified lines | ||
| 687 | 674 | } |
| 688 | 675 | |
| 689 | 676 | if (!mpt3sas_port->num_phys) { |
| 690 | − pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", | |
| 691 | − ioc->name, __FILE__, __LINE__, __func__); | |
| 677 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", | |
| 678 | + __FILE__, __LINE__, __func__); | |
| 692 | 679 | goto out_fail; |
| 693 | 680 | } |
| 694 | 681 | |
| 695 | 682 | if (!sas_node->parent_dev) { |
| 696 | − pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", | |
| 697 | − ioc->name, __FILE__, __LINE__, __func__); | |
| 683 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", | |
| 684 | + __FILE__, __LINE__, __func__); | |
| 698 | 685 | goto out_fail; |
| 699 | 686 | } |
| 700 | 687 | port = sas_port_alloc_num(sas_node->parent_dev); |
| 701 | 688 | if ((sas_port_add(port))) { |
| 702 | − pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", | |
| 703 | − ioc->name, __FILE__, __LINE__, __func__); | |
| 689 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", | |
| 690 | + __FILE__, __LINE__, __func__); | |
| 704 | 691 | goto out_fail; |
| 705 | 692 | } |
| 706 | 693 | |
| @@ -729,17 +716,17 @@ mpt3sas_transport_port_add(struct MPT3SAS_ADAPTER *ioc, u16 handle, · 22 unmodified lines | ||
| 729 | 716 | sas_device = mpt3sas_get_sdev_by_addr(ioc, |
| 730 | 717 | mpt3sas_port->remote_identify.sas_address); |
| 731 | 718 | if (!sas_device) { |
| 732 | − dfailprintk(ioc, printk(MPT3SAS_FMT | |
| 733 | − "failure at %s:%d/%s()!\n", | |
| 734 | − ioc->name, __FILE__, __LINE__, __func__)); | |
| 719 | + dfailprintk(ioc, | |
| 720 | + ioc_info(ioc, "failure at %s:%d/%s()!\n", | |
| 721 | + __FILE__, __LINE__, __func__)); | |
| 735 | 722 | goto out_fail; |
| 736 | 723 | } |
| 737 | 724 | sas_device->pend_sas_rphy_add = 1; |
| 738 | 725 | } |
| 739 | 726 | |
| 740 | 727 | if ((sas_rphy_add(rphy))) { |
| 741 | − pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", | |
| 742 | − ioc->name, __FILE__, __LINE__, __func__); | |
| 728 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", | |
| 729 | + __FILE__, __LINE__, __func__); | |
| 743 | 730 | } |
| 744 | 731 | |
| 745 | 732 | if (mpt3sas_port->remote_identify.device_type == SAS_END_DEVICE) { |
| @@ -861,14 +848,14 @@ mpt3sas_transport_add_host_phy(struct MPT3SAS_ADAPTER *ioc, struct _sas_phy · 115 unmodified lines | ||
| 861 | 848 | INIT_LIST_HEAD(&mpt3sas_phy->port_siblings); |
| 862 | 849 | phy = sas_phy_alloc(parent_dev, phy_index); |
| 863 | 850 | if (!phy) { |
| 864 | − pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", | |
| 865 | − ioc->name, __FILE__, __LINE__, __func__); | |
| 851 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", | |
| 852 | + __FILE__, __LINE__, __func__); | |
| 866 | 853 | return -1; |
| 867 | 854 | } |
| 868 | 855 | if ((_transport_set_identify(ioc, mpt3sas_phy->handle, |
| 869 | 856 | &mpt3sas_phy->identify))) { |
| 870 | − pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", | |
| 871 | − ioc->name, __FILE__, __LINE__, __func__); | |
| 857 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", | |
| 858 | + __FILE__, __LINE__, __func__); | |
| 872 | 859 | sas_phy_free(phy); |
| 873 | 860 | return -1; |
| 874 | 861 | } |
| @@ -890,8 +877,8 @@ mpt3sas_transport_add_host_phy(struct MPT3SAS_ADAPTER *ioc, struct _sas_phy · 15 unmodified lines | ||
| 890 | 877 | phy_pg0.ProgrammedLinkRate >> 4); |
| 891 | 878 | |
| 892 | 879 | if ((sas_phy_add(phy))) { |
| 893 | − pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", | |
| 894 | − ioc->name, __FILE__, __LINE__, __func__); | |
| 880 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", | |
| 881 | + __FILE__, __LINE__, __func__); | |
| 895 | 882 | sas_phy_free(phy); |
| 896 | 883 | return -1; |
| 897 | 884 | } |
| @@ -929,14 +916,14 @@ mpt3sas_transport_add_expander_phy(struct MPT3SAS_ADAPTER *ioc, struct _sas_phy · 31 unmodified lines | ||
| 929 | 916 | INIT_LIST_HEAD(&mpt3sas_phy->port_siblings); |
| 930 | 917 | phy = sas_phy_alloc(parent_dev, phy_index); |
| 931 | 918 | if (!phy) { |
| 932 | − pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", | |
| 933 | − ioc->name, __FILE__, __LINE__, __func__); | |
| 919 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", | |
| 920 | + __FILE__, __LINE__, __func__); | |
| 934 | 921 | return -1; |
| 935 | 922 | } |
| 936 | 923 | if ((_transport_set_identify(ioc, mpt3sas_phy->handle, |
| 937 | 924 | &mpt3sas_phy->identify))) { |
| 938 | − pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", | |
| 939 | − ioc->name, __FILE__, __LINE__, __func__); | |
| 925 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", | |
| 926 | + __FILE__, __LINE__, __func__); | |
| 940 | 927 | sas_phy_free(phy); |
| 941 | 928 | return -1; |
| 942 | 929 | } |
| @@ -960,8 +947,8 @@ mpt3sas_transport_add_expander_phy(struct MPT3SAS_ADAPTER *ioc, struct _sas_phy · 17 unmodified lines | ||
| 960 | 947 | expander_pg1.ProgrammedLinkRate >> 4); |
| 961 | 948 | |
| 962 | 949 | if ((sas_phy_add(phy))) { |
| 963 | − pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", | |
| 964 | − ioc->name, __FILE__, __LINE__, __func__); | |
| 950 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", | |
| 951 | + __FILE__, __LINE__, __func__); | |
| 965 | 952 | sas_phy_free(phy); |
| 966 | 953 | return -1; |
| 967 | 954 | } |
| @@ -1098,16 +1085,14 @@ _transport_get_expander_phy_error_log(struct MPT3SAS_ADAPTER *ioc, · 130 unmodified lines | ||
| 1098 | 1085 | u16 wait_state_count; |
| 1099 | 1086 | |
| 1100 | 1087 | if (ioc->shost_recovery || ioc->pci_error_recovery) { |
| 1101 | − pr_info(MPT3SAS_FMT "%s: host reset in progress!\n", | |
| 1102 | − __func__, ioc->name); | |
| 1088 | + ioc_info(ioc, "%s: host reset in progress!\n", __func__); | |
| 1103 | 1089 | return -EFAULT; |
| 1104 | 1090 | } |
| 1105 | 1091 | |
| 1106 | 1092 | mutex_lock(&ioc->transport_cmds.mutex); |
| 1107 | 1093 | |
| 1108 | 1094 | if (ioc->transport_cmds.status != MPT3_CMD_NOT_USED) { |
| 1109 | − pr_err(MPT3SAS_FMT "%s: transport_cmds in use\n", | |
| 1110 | − ioc->name, __func__); | |
| 1095 | + ioc_err(ioc, "%s: transport_cmds in use\n", __func__); | |
| 1111 | 1096 | rc = -EAGAIN; |
| 1112 | 1097 | goto out; |
| 1113 | 1098 | } |
| @@ -1117,26 +1102,22 @@ _transport_get_expander_phy_error_log(struct MPT3SAS_ADAPTER *ioc, · 3 unmodified lines | ||
| 1117 | 1102 | ioc_state = mpt3sas_base_get_iocstate(ioc, 1); |
| 1118 | 1103 | while (ioc_state != MPI2_IOC_STATE_OPERATIONAL) { |
| 1119 | 1104 | if (wait_state_count++ == 10) { |
| 1120 | − pr_err(MPT3SAS_FMT | |
| 1121 | − "%s: failed due to ioc not operational\n", | |
| 1122 | − ioc->name, __func__); | |
| 1105 | + ioc_err(ioc, "%s: failed due to ioc not operational\n", | |
| 1106 | + __func__); | |
| 1123 | 1107 | rc = -EFAULT; |
| 1124 | 1108 | goto out; |
| 1125 | 1109 | } |
| 1126 | 1110 | ssleep(1); |
| 1127 | 1111 | ioc_state = mpt3sas_base_get_iocstate(ioc, 1); |
| 1128 | − pr_info(MPT3SAS_FMT | |
| 1129 | − "%s: waiting for operational state(count=%d)\n", | |
| 1130 | − ioc->name, __func__, wait_state_count); | |
| 1112 | + ioc_info(ioc, "%s: waiting for operational state(count=%d)\n", | |
| 1113 | + __func__, wait_state_count); | |
| 1131 | 1114 | } |
| 1132 | 1115 | if (wait_state_count) |
| 1133 | − pr_info(MPT3SAS_FMT "%s: ioc is operational\n", | |
| 1134 | − ioc->name, __func__); | |
| 1116 | + ioc_info(ioc, "%s: ioc is operational\n", __func__); | |
| 1135 | 1117 | |
| 1136 | 1118 | smid = mpt3sas_base_get_smid(ioc, ioc->transport_cb_idx); |
| 1137 | 1119 | if (!smid) { |
| 1138 | − pr_err(MPT3SAS_FMT "%s: failed obtaining a smid\n", | |
| 1139 | − ioc->name, __func__); | |
| 1120 | + ioc_err(ioc, "%s: failed obtaining a smid\n", __func__); | |
| 1140 | 1121 | rc = -EAGAIN; |
| 1141 | 1122 | goto out; |
| 1142 | 1123 | } |
| @@ -1146,7 +1127,8 @@ _transport_get_expander_phy_error_log(struct MPT3SAS_ADAPTER *ioc, · 3 unmodified lines | ||
| 1146 | 1127 | |
| 1147 | 1128 | sz = sizeof(struct phy_error_log_request) + |
| 1148 | 1129 | sizeof(struct phy_error_log_reply); |
| 1149 | − data_out = pci_alloc_consistent(ioc->pdev, sz, &data_out_dma); | |
| 1130 | + data_out = dma_alloc_coherent(&ioc->pdev->dev, sz, &data_out_dma, | |
| 1131 | + GFP_KERNEL); | |
| 1150 | 1132 | if (!data_out) { |
| 1151 | 1133 | pr_err("failure at %s:%d/%s()!\n", __FILE__, |
| 1152 | 1134 | __LINE__, __func__); |
| @@ -1179,17 +1161,16 @@ _transport_get_expander_phy_error_log(struct MPT3SAS_ADAPTER *ioc, · 26 unmodified lines | ||
| 1179 | 1161 | data_out_dma + sizeof(struct phy_error_log_request), |
| 1180 | 1162 | sizeof(struct phy_error_log_reply)); |
| 1181 | 1163 | |
| 1182 | − dtransportprintk(ioc, pr_info(MPT3SAS_FMT | |
| 1183 | − "phy_error_log - send to sas_addr(0x%016llx), phy(%d)\n", | |
| 1184 | − ioc->name, (unsigned long long)phy->identify.sas_address, | |
| 1185 | − phy->number)); | |
| 1164 | + dtransportprintk(ioc, | |
| 1165 | + ioc_info(ioc, "phy_error_log - send to sas_addr(0x%016llx), phy(%d)\n", | |
| 1166 | + (u64)phy->identify.sas_address, | |
| 1167 | + phy->number)); | |
| 1186 | 1168 | init_completion(&ioc->transport_cmds.done); |
| 1187 | 1169 | mpt3sas_base_put_smid_default(ioc, smid); |
| 1188 | 1170 | wait_for_completion_timeout(&ioc->transport_cmds.done, 10*HZ); |
| 1189 | 1171 | |
| 1190 | 1172 | if (!(ioc->transport_cmds.status & MPT3_CMD_COMPLETE)) { |
| 1191 | − pr_err(MPT3SAS_FMT "%s: timeout\n", | |
| 1192 | − ioc->name, __func__); | |
| 1173 | + ioc_err(ioc, "%s: timeout\n", __func__); | |
| 1193 | 1174 | _debug_dump_mf(mpi_request, |
| 1194 | 1175 | sizeof(Mpi2SmpPassthroughRequest_t)/4); |
| 1195 | 1176 | if (!(ioc->transport_cmds.status & MPT3_CMD_RESET)) |
| @@ -1197,16 +1178,15 @@ _transport_get_expander_phy_error_log(struct MPT3SAS_ADAPTER *ioc, · 1 unmodified line | ||
| 1197 | 1178 | goto issue_host_reset; |
| 1198 | 1179 | } |
| 1199 | 1180 | |
| 1200 | − dtransportprintk(ioc, pr_info(MPT3SAS_FMT | |
| 1201 | − "phy_error_log - complete\n", ioc->name)); | |
| 1181 | + dtransportprintk(ioc, ioc_info(ioc, "phy_error_log - complete\n")); | |
| 1202 | 1182 | |
| 1203 | 1183 | if (ioc->transport_cmds.status & MPT3_CMD_REPLY_VALID) { |
| 1204 | 1184 | |
| 1205 | 1185 | mpi_reply = ioc->transport_cmds.reply; |
| 1206 | 1186 | |
| 1207 | − dtransportprintk(ioc, pr_info(MPT3SAS_FMT | |
| 1208 | − "phy_error_log - reply data transfer size(%d)\n", | |
| 1209 | − ioc->name, le16_to_cpu(mpi_reply->ResponseDataLength))); | |
| 1187 | + dtransportprintk(ioc, | |
| 1188 | + ioc_info(ioc, "phy_error_log - reply data transfer size(%d)\n", | |
| 1189 | + le16_to_cpu(mpi_reply->ResponseDataLength))); | |
| 1210 | 1190 | |
| 1211 | 1191 | if (le16_to_cpu(mpi_reply->ResponseDataLength) != |
| 1212 | 1192 | sizeof(struct phy_error_log_reply)) |
| @@ -1215,9 +1195,9 @@ _transport_get_expander_phy_error_log(struct MPT3SAS_ADAPTER *ioc, · 2 unmodified lines | ||
| 1215 | 1195 | phy_error_log_reply = data_out + |
| 1216 | 1196 | sizeof(struct phy_error_log_request); |
| 1217 | 1197 | |
| 1218 | − dtransportprintk(ioc, pr_info(MPT3SAS_FMT | |
| 1219 | − "phy_error_log - function_result(%d)\n", | |
| 1220 | − ioc->name, phy_error_log_reply->function_result)); | |
| 1198 | + dtransportprintk(ioc, | |
| 1199 | + ioc_info(ioc, "phy_error_log - function_result(%d)\n", | |
| 1200 | + phy_error_log_reply->function_result)); | |
| 1221 | 1201 | |
| 1222 | 1202 | phy->invalid_dword_count = |
| 1223 | 1203 | be32_to_cpu(phy_error_log_reply->invalid_dword); |
| @@ -1229,8 +1209,8 @@ _transport_get_expander_phy_error_log(struct MPT3SAS_ADAPTER *ioc, · 5 unmodified lines | ||
| 1229 | 1209 | be32_to_cpu(phy_error_log_reply->phy_reset_problem); |
| 1230 | 1210 | rc = 0; |
| 1231 | 1211 | } else |
| 1232 | − dtransportprintk(ioc, pr_info(MPT3SAS_FMT | |
| 1233 | − "phy_error_log - no reply\n", ioc->name)); | |
| 1212 | + dtransportprintk(ioc, | |
| 1213 | + ioc_info(ioc, "phy_error_log - no reply\n")); | |
| 1234 | 1214 | |
| 1235 | 1215 | issue_host_reset: |
| 1236 | 1216 | if (issue_reset) |
| @@ -1238,7 +1218,7 @@ _transport_get_expander_phy_error_log(struct MPT3SAS_ADAPTER *ioc, · 1 unmodified line | ||
| 1238 | 1218 | out: |
| 1239 | 1219 | ioc->transport_cmds.status = MPT3_CMD_NOT_USED; |
| 1240 | 1220 | if (data_out) |
| 1241 | − pci_free_consistent(ioc->pdev, sz, data_out, data_out_dma); | |
| 1221 | + dma_free_coherent(&ioc->pdev->dev, sz, data_out, data_out_dma); | |
| 1242 | 1222 | |
| 1243 | 1223 | mutex_unlock(&ioc->transport_cmds.mutex); |
| 1244 | 1224 | return rc; |
| @@ -1273,17 +1253,16 @@ _transport_get_linkerrors(struct sas_phy *phy) · 28 unmodified lines | ||
| 1273 | 1253 | /* get hba phy error logs */ |
| 1274 | 1254 | if ((mpt3sas_config_get_phy_pg1(ioc, &mpi_reply, &phy_pg1, |
| 1275 | 1255 | phy->number))) { |
| 1276 | − pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", | |
| 1277 | − ioc->name, __FILE__, __LINE__, __func__); | |
| 1256 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", | |
| 1257 | + __FILE__, __LINE__, __func__); | |
| 1278 | 1258 | return -ENXIO; |
| 1279 | 1259 | } |
| 1280 | 1260 | |
| 1281 | 1261 | if (mpi_reply.IOCStatus || mpi_reply.IOCLogInfo) |
| 1282 | − pr_info(MPT3SAS_FMT | |
| 1283 | − "phy(%d), ioc_status (0x%04x), loginfo(0x%08x)\n", | |
| 1284 | − ioc->name, phy->number, | |
| 1285 | − le16_to_cpu(mpi_reply.IOCStatus), | |
| 1286 | − le32_to_cpu(mpi_reply.IOCLogInfo)); | |
| 1262 | + ioc_info(ioc, "phy(%d), ioc_status (0x%04x), loginfo(0x%08x)\n", | |
| 1263 | + phy->number, | |
| 1264 | + le16_to_cpu(mpi_reply.IOCStatus), | |
| 1265 | + le32_to_cpu(mpi_reply.IOCLogInfo)); | |
| 1287 | 1266 | |
| 1288 | 1267 | phy->invalid_dword_count = le32_to_cpu(phy_pg1.InvalidDwordCount); |
| 1289 | 1268 | phy->running_disparity_error_count = |
| @@ -1411,16 +1390,14 @@ _transport_expander_phy_control(struct MPT3SAS_ADAPTER *ioc, · 121 unmodified lines | ||
| 1411 | 1390 | u16 wait_state_count; |
| 1412 | 1391 | |
| 1413 | 1392 | if (ioc->shost_recovery || ioc->pci_error_recovery) { |
| 1414 | − pr_info(MPT3SAS_FMT "%s: host reset in progress!\n", | |
| 1415 | − __func__, ioc->name); | |
| 1393 | + ioc_info(ioc, "%s: host reset in progress!\n", __func__); | |
| 1416 | 1394 | return -EFAULT; |
| 1417 | 1395 | } |
| 1418 | 1396 | |
| 1419 | 1397 | mutex_lock(&ioc->transport_cmds.mutex); |
| 1420 | 1398 | |
| 1421 | 1399 | if (ioc->transport_cmds.status != MPT3_CMD_NOT_USED) { |
| 1422 | − pr_err(MPT3SAS_FMT "%s: transport_cmds in use\n", | |
| 1423 | − ioc->name, __func__); | |
| 1400 | + ioc_err(ioc, "%s: transport_cmds in use\n", __func__); | |
| 1424 | 1401 | rc = -EAGAIN; |
| 1425 | 1402 | goto out; |
| 1426 | 1403 | } |
| @@ -1430,26 +1407,22 @@ _transport_expander_phy_control(struct MPT3SAS_ADAPTER *ioc, · 3 unmodified lines | ||
| 1430 | 1407 | ioc_state = mpt3sas_base_get_iocstate(ioc, 1); |
| 1431 | 1408 | while (ioc_state != MPI2_IOC_STATE_OPERATIONAL) { |
| 1432 | 1409 | if (wait_state_count++ == 10) { |
| 1433 | − pr_err(MPT3SAS_FMT | |
| 1434 | − "%s: failed due to ioc not operational\n", | |
| 1435 | − ioc->name, __func__); | |
| 1410 | + ioc_err(ioc, "%s: failed due to ioc not operational\n", | |
| 1411 | + __func__); | |
| 1436 | 1412 | rc = -EFAULT; |
| 1437 | 1413 | goto out; |
| 1438 | 1414 | } |
| 1439 | 1415 | ssleep(1); |
| 1440 | 1416 | ioc_state = mpt3sas_base_get_iocstate(ioc, 1); |
| 1441 | − pr_info(MPT3SAS_FMT | |
| 1442 | − "%s: waiting for operational state(count=%d)\n", | |
| 1443 | − ioc->name, __func__, wait_state_count); | |
| 1417 | + ioc_info(ioc, "%s: waiting for operational state(count=%d)\n", | |
| 1418 | + __func__, wait_state_count); | |
| 1444 | 1419 | } |
| 1445 | 1420 | if (wait_state_count) |
| 1446 | − pr_info(MPT3SAS_FMT "%s: ioc is operational\n", | |
| 1447 | − ioc->name, __func__); | |
| 1421 | + ioc_info(ioc, "%s: ioc is operational\n", __func__); | |
| 1448 | 1422 | |
| 1449 | 1423 | smid = mpt3sas_base_get_smid(ioc, ioc->transport_cb_idx); |
| 1450 | 1424 | if (!smid) { |
| 1451 | − pr_err(MPT3SAS_FMT "%s: failed obtaining a smid\n", | |
| 1452 | − ioc->name, __func__); | |
| 1425 | + ioc_err(ioc, "%s: failed obtaining a smid\n", __func__); | |
| 1453 | 1426 | rc = -EAGAIN; |
| 1454 | 1427 | goto out; |
| 1455 | 1428 | } |
| @@ -1459,7 +1432,8 @@ _transport_expander_phy_control(struct MPT3SAS_ADAPTER *ioc, · 3 unmodified lines | ||
| 1459 | 1432 | |
| 1460 | 1433 | sz = sizeof(struct phy_control_request) + |
| 1461 | 1434 | sizeof(struct phy_control_reply); |
| 1462 | − data_out = pci_alloc_consistent(ioc->pdev, sz, &data_out_dma); | |
| 1435 | + data_out = dma_alloc_coherent(&ioc->pdev->dev, sz, &data_out_dma, | |
| 1436 | + GFP_KERNEL); | |
| 1463 | 1437 | if (!data_out) { |
| 1464 | 1438 | pr_err("failure at %s:%d/%s()!\n", __FILE__, |
| 1465 | 1439 | __LINE__, __func__); |
| @@ -1497,17 +1471,16 @@ _transport_expander_phy_control(struct MPT3SAS_ADAPTER *ioc, · 31 unmodified lines | ||
| 1497 | 1471 | data_out_dma + sizeof(struct phy_control_request), |
| 1498 | 1472 | sizeof(struct phy_control_reply)); |
| 1499 | 1473 | |
| 1500 | − dtransportprintk(ioc, pr_info(MPT3SAS_FMT | |
| 1501 | − "phy_control - send to sas_addr(0x%016llx), phy(%d), opcode(%d)\n", | |
| 1502 | − ioc->name, (unsigned long long)phy->identify.sas_address, | |
| 1503 | − phy->number, phy_operation)); | |
| 1474 | + dtransportprintk(ioc, | |
| 1475 | + ioc_info(ioc, "phy_control - send to sas_addr(0x%016llx), phy(%d), opcode(%d)\n", | |
| 1476 | + (u64)phy->identify.sas_address, | |
| 1477 | + phy->number, phy_operation)); | |
| 1504 | 1478 | init_completion(&ioc->transport_cmds.done); |
| 1505 | 1479 | mpt3sas_base_put_smid_default(ioc, smid); |
| 1506 | 1480 | wait_for_completion_timeout(&ioc->transport_cmds.done, 10*HZ); |
| 1507 | 1481 | |
| 1508 | 1482 | if (!(ioc->transport_cmds.status & MPT3_CMD_COMPLETE)) { |
| 1509 | − pr_err(MPT3SAS_FMT "%s: timeout\n", | |
| 1510 | − ioc->name, __func__); | |
| 1483 | + ioc_err(ioc, "%s: timeout\n", __func__); | |
| 1511 | 1484 | _debug_dump_mf(mpi_request, |
| 1512 | 1485 | sizeof(Mpi2SmpPassthroughRequest_t)/4); |
| 1513 | 1486 | if (!(ioc->transport_cmds.status & MPT3_CMD_RESET)) |
| @@ -1515,16 +1488,15 @@ _transport_expander_phy_control(struct MPT3SAS_ADAPTER *ioc, · 1 unmodified line | ||
| 1515 | 1488 | goto issue_host_reset; |
| 1516 | 1489 | } |
| 1517 | 1490 | |
| 1518 | − dtransportprintk(ioc, pr_info(MPT3SAS_FMT | |
| 1519 | − "phy_control - complete\n", ioc->name)); | |
| 1491 | + dtransportprintk(ioc, ioc_info(ioc, "phy_control - complete\n")); | |
| 1520 | 1492 | |
| 1521 | 1493 | if (ioc->transport_cmds.status & MPT3_CMD_REPLY_VALID) { |
| 1522 | 1494 | |
| 1523 | 1495 | mpi_reply = ioc->transport_cmds.reply; |
| 1524 | 1496 | |
| 1525 | − dtransportprintk(ioc, pr_info(MPT3SAS_FMT | |
| 1526 | − "phy_control - reply data transfer size(%d)\n", | |
| 1527 | − ioc->name, le16_to_cpu(mpi_reply->ResponseDataLength))); | |
| 1497 | + dtransportprintk(ioc, | |
| 1498 | + ioc_info(ioc, "phy_control - reply data transfer size(%d)\n", | |
| 1499 | + le16_to_cpu(mpi_reply->ResponseDataLength))); | |
| 1528 | 1500 | |
| 1529 | 1501 | if (le16_to_cpu(mpi_reply->ResponseDataLength) != |
| 1530 | 1502 | sizeof(struct phy_control_reply)) |
| @@ -1533,14 +1505,14 @@ _transport_expander_phy_control(struct MPT3SAS_ADAPTER *ioc, · 2 unmodified lines | ||
| 1533 | 1505 | phy_control_reply = data_out + |
| 1534 | 1506 | sizeof(struct phy_control_request); |
| 1535 | 1507 | |
| 1536 | − dtransportprintk(ioc, pr_info(MPT3SAS_FMT | |
| 1537 | − "phy_control - function_result(%d)\n", | |
| 1538 | − ioc->name, phy_control_reply->function_result)); | |
| 1508 | + dtransportprintk(ioc, | |
| 1509 | + ioc_info(ioc, "phy_control - function_result(%d)\n", | |
| 1510 | + phy_control_reply->function_result)); | |
| 1539 | 1511 | |
| 1540 | 1512 | rc = 0; |
| 1541 | 1513 | } else |
| 1542 | − dtransportprintk(ioc, pr_info(MPT3SAS_FMT | |
| 1543 | − "phy_control - no reply\n", ioc->name)); | |
| 1514 | + dtransportprintk(ioc, | |
| 1515 | + ioc_info(ioc, "phy_control - no reply\n")); | |
| 1544 | 1516 | |
| 1545 | 1517 | issue_host_reset: |
| 1546 | 1518 | if (issue_reset) |
| @@ -1548,7 +1520,8 @@ _transport_expander_phy_control(struct MPT3SAS_ADAPTER *ioc, · 1 unmodified line | ||
| 1548 | 1520 | out: |
| 1549 | 1521 | ioc->transport_cmds.status = MPT3_CMD_NOT_USED; |
| 1550 | 1522 | if (data_out) |
| 1551 | − pci_free_consistent(ioc->pdev, sz, data_out, data_out_dma); | |
| 1523 | + dma_free_coherent(&ioc->pdev->dev, sz, data_out, | |
| 1524 | + data_out_dma); | |
| 1552 | 1525 | |
| 1553 | 1526 | mutex_unlock(&ioc->transport_cmds.mutex); |
| 1554 | 1527 | return rc; |
| @@ -1591,16 +1564,15 @@ _transport_phy_reset(struct sas_phy *phy, int hard_reset) · 36 unmodified lines | ||
| 1591 | 1564 | mpi_request.PhyNum = phy->number; |
| 1592 | 1565 | |
| 1593 | 1566 | if ((mpt3sas_base_sas_iounit_control(ioc, &mpi_reply, &mpi_request))) { |
| 1594 | − pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", | |
| 1595 | − ioc->name, __FILE__, __LINE__, __func__); | |
| 1567 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", | |
| 1568 | + __FILE__, __LINE__, __func__); | |
| 1596 | 1569 | return -ENXIO; |
| 1597 | 1570 | } |
| 1598 | 1571 | |
| 1599 | 1572 | if (mpi_reply.IOCStatus || mpi_reply.IOCLogInfo) |
| 1600 | − pr_info(MPT3SAS_FMT | |
| 1601 | − "phy(%d), ioc_status(0x%04x), loginfo(0x%08x)\n", | |
| 1602 | − ioc->name, phy->number, le16_to_cpu(mpi_reply.IOCStatus), | |
| 1603 | − le32_to_cpu(mpi_reply.IOCLogInfo)); | |
| 1573 | + ioc_info(ioc, "phy(%d), ioc_status(0x%04x), loginfo(0x%08x)\n", | |
| 1574 | + phy->number, le16_to_cpu(mpi_reply.IOCStatus), | |
| 1575 | + le32_to_cpu(mpi_reply.IOCLogInfo)); | |
| 1604 | 1576 | |
| 1605 | 1577 | return 0; |
| 1606 | 1578 | } |
| @@ -1647,23 +1619,23 @@ _transport_phy_enable(struct sas_phy *phy, int enable) · 40 unmodified lines | ||
| 1647 | 1619 | sizeof(Mpi2SasIOUnit0PhyData_t)); |
| 1648 | 1620 | sas_iounit_pg0 = kzalloc(sz, GFP_KERNEL); |
| 1649 | 1621 | if (!sas_iounit_pg0) { |
| 1650 | − pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", | |
| 1651 | − ioc->name, __FILE__, __LINE__, __func__); | |
| 1622 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", | |
| 1623 | + __FILE__, __LINE__, __func__); | |
| 1652 | 1624 | rc = -ENOMEM; |
| 1653 | 1625 | goto out; |
| 1654 | 1626 | } |
| 1655 | 1627 | if ((mpt3sas_config_get_sas_iounit_pg0(ioc, &mpi_reply, |
| 1656 | 1628 | sas_iounit_pg0, sz))) { |
| 1657 | − pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", | |
| 1658 | − ioc->name, __FILE__, __LINE__, __func__); | |
| 1629 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", | |
| 1630 | + __FILE__, __LINE__, __func__); | |
| 1659 | 1631 | rc = -ENXIO; |
| 1660 | 1632 | goto out; |
| 1661 | 1633 | } |
| 1662 | 1634 | ioc_status = le16_to_cpu(mpi_reply.IOCStatus) & |
| 1663 | 1635 | MPI2_IOCSTATUS_MASK; |
| 1664 | 1636 | if (ioc_status != MPI2_IOCSTATUS_SUCCESS) { |
| 1665 | − pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", | |
| 1666 | − ioc->name, __FILE__, __LINE__, __func__); | |
| 1637 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", | |
| 1638 | + __FILE__, __LINE__, __func__); | |
| 1667 | 1639 | rc = -EIO; |
| 1668 | 1640 | goto out; |
| 1669 | 1641 | } |
| @@ -1672,10 +1644,8 @@ _transport_phy_enable(struct sas_phy *phy, int enable) · 2 unmodified lines | ||
| 1672 | 1644 | for (i = 0, discovery_active = 0; i < ioc->sas_hba.num_phys ; i++) { |
| 1673 | 1645 | if (sas_iounit_pg0->PhyData[i].PortFlags & |
| 1674 | 1646 | MPI2_SASIOUNIT0_PORTFLAGS_DISCOVERY_IN_PROGRESS) { |
| 1675 | − pr_err(MPT3SAS_FMT "discovery is active on " \ | |
| 1676 | − "port = %d, phy = %d: unable to enable/disable " | |
| 1677 | − "phys, try again later!\n", ioc->name, | |
| 1678 | − sas_iounit_pg0->PhyData[i].Port, i); | |
| 1647 | + ioc_err(ioc, "discovery is active on port = %d, phy = %d: unable to enable/disable phys, try again later!\n", | |
| 1648 | + sas_iounit_pg0->PhyData[i].Port, i); | |
| 1679 | 1649 | discovery_active = 1; |
| 1680 | 1650 | } |
| 1681 | 1651 | } |
| @@ -1690,23 +1660,23 @@ _transport_phy_enable(struct sas_phy *phy, int enable) · 8 unmodified lines | ||
| 1690 | 1660 | sizeof(Mpi2SasIOUnit1PhyData_t)); |
| 1691 | 1661 | sas_iounit_pg1 = kzalloc(sz, GFP_KERNEL); |
| 1692 | 1662 | if (!sas_iounit_pg1) { |
| 1693 | − pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", | |
| 1694 | − ioc->name, __FILE__, __LINE__, __func__); | |
| 1663 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", | |
| 1664 | + __FILE__, __LINE__, __func__); | |
| 1695 | 1665 | rc = -ENOMEM; |
| 1696 | 1666 | goto out; |
| 1697 | 1667 | } |
| 1698 | 1668 | if ((mpt3sas_config_get_sas_iounit_pg1(ioc, &mpi_reply, |
| 1699 | 1669 | sas_iounit_pg1, sz))) { |
| 1700 | − pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", | |
| 1701 | − ioc->name, __FILE__, __LINE__, __func__); | |
| 1670 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", | |
| 1671 | + __FILE__, __LINE__, __func__); | |
| 1702 | 1672 | rc = -ENXIO; |
| 1703 | 1673 | goto out; |
| 1704 | 1674 | } |
| 1705 | 1675 | ioc_status = le16_to_cpu(mpi_reply.IOCStatus) & |
| 1706 | 1676 | MPI2_IOCSTATUS_MASK; |
| 1707 | 1677 | if (ioc_status != MPI2_IOCSTATUS_SUCCESS) { |
| 1708 | − pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", | |
| 1709 | − ioc->name, __FILE__, __LINE__, __func__); | |
| 1678 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", | |
| 1679 | + __FILE__, __LINE__, __func__); | |
| 1710 | 1680 | rc = -EIO; |
| 1711 | 1681 | goto out; |
| 1712 | 1682 | } |
| @@ -1798,23 +1768,23 @@ _transport_phy_speed(struct sas_phy *phy, struct sas_phy_linkrates *rates) · 85 unmodified lines | ||
| 1798 | 1768 | sizeof(Mpi2SasIOUnit1PhyData_t)); |
| 1799 | 1769 | sas_iounit_pg1 = kzalloc(sz, GFP_KERNEL); |
| 1800 | 1770 | if (!sas_iounit_pg1) { |
| 1801 | − pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", | |
| 1802 | − ioc->name, __FILE__, __LINE__, __func__); | |
| 1771 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", | |
| 1772 | + __FILE__, __LINE__, __func__); | |
| 1803 | 1773 | rc = -ENOMEM; |
| 1804 | 1774 | goto out; |
| 1805 | 1775 | } |
| 1806 | 1776 | if ((mpt3sas_config_get_sas_iounit_pg1(ioc, &mpi_reply, |
| 1807 | 1777 | sas_iounit_pg1, sz))) { |
| 1808 | − pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", | |
| 1809 | − ioc->name, __FILE__, __LINE__, __func__); | |
| 1778 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", | |
| 1779 | + __FILE__, __LINE__, __func__); | |
| 1810 | 1780 | rc = -ENXIO; |
| 1811 | 1781 | goto out; |
| 1812 | 1782 | } |
| 1813 | 1783 | ioc_status = le16_to_cpu(mpi_reply.IOCStatus) & |
| 1814 | 1784 | MPI2_IOCSTATUS_MASK; |
| 1815 | 1785 | if (ioc_status != MPI2_IOCSTATUS_SUCCESS) { |
| 1816 | − pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", | |
| 1817 | − ioc->name, __FILE__, __LINE__, __func__); | |
| 1786 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", | |
| 1787 | + __FILE__, __LINE__, __func__); | |
| 1818 | 1788 | rc = -EIO; |
| 1819 | 1789 | goto out; |
| 1820 | 1790 | } |
| @@ -1833,8 +1803,8 @@ _transport_phy_speed(struct sas_phy *phy, struct sas_phy_linkrates *rates) · 12 unmodified lines | ||
| 1833 | 1803 | |
| 1834 | 1804 | if (mpt3sas_config_set_sas_iounit_pg1(ioc, &mpi_reply, sas_iounit_pg1, |
| 1835 | 1805 | sz)) { |
| 1836 | − pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", | |
| 1837 | − ioc->name, __FILE__, __LINE__, __func__); | |
| 1806 | + ioc_err(ioc, "failure at %s:%d/%s()!\n", | |
| 1807 | + __FILE__, __LINE__, __func__); | |
| 1838 | 1808 | rc = -ENXIO; |
| 1839 | 1809 | goto out; |
| 1840 | 1810 | } |
| @@ -1922,8 +1892,7 @@ _transport_smp_handler(struct bsg_job *job, struct Scsi_Host *shost, · 81 unmodified lines | ||
| 1922 | 1892 | unsigned int reslen = 0; |
| 1923 | 1893 | |
| 1924 | 1894 | if (ioc->shost_recovery || ioc->pci_error_recovery) { |
| 1925 | − pr_info(MPT3SAS_FMT "%s: host reset in progress!\n", | |
| 1926 | − __func__, ioc->name); | |
| 1895 | + ioc_info(ioc, "%s: host reset in progress!\n", __func__); | |
| 1927 | 1896 | rc = -EFAULT; |
| 1928 | 1897 | goto job_done; |
| 1929 | 1898 | } |
| @@ -1933,8 +1902,8 @@ _transport_smp_handler(struct bsg_job *job, struct Scsi_Host *shost, · 3 unmodified lines | ||
| 1933 | 1902 | goto job_done; |
| 1934 | 1903 | |
| 1935 | 1904 | if (ioc->transport_cmds.status != MPT3_CMD_NOT_USED) { |
| 1936 | − pr_err(MPT3SAS_FMT "%s: transport_cmds in use\n", ioc->name, | |
| 1937 | − __func__); | |
| 1905 | + ioc_err(ioc, "%s: transport_cmds in use\n", | |
| 1906 | + __func__); | |
| 1938 | 1907 | rc = -EAGAIN; |
| 1939 | 1908 | goto out; |
| 1940 | 1909 | } |
| @@ -1959,26 +1928,22 @@ _transport_smp_handler(struct bsg_job *job, struct Scsi_Host *shost, · 18 unmodified lines | ||
| 1959 | 1928 | ioc_state = mpt3sas_base_get_iocstate(ioc, 1); |
| 1960 | 1929 | while (ioc_state != MPI2_IOC_STATE_OPERATIONAL) { |
| 1961 | 1930 | if (wait_state_count++ == 10) { |
| 1962 | − pr_err(MPT3SAS_FMT | |
| 1963 | − "%s: failed due to ioc not operational\n", | |
| 1964 | − ioc->name, __func__); | |
| 1931 | + ioc_err(ioc, "%s: failed due to ioc not operational\n", | |
| 1932 | + __func__); | |
| 1965 | 1933 | rc = -EFAULT; |
| 1966 | 1934 | goto unmap_in; |
| 1967 | 1935 | } |
| 1968 | 1936 | ssleep(1); |
| 1969 | 1937 | ioc_state = mpt3sas_base_get_iocstate(ioc, 1); |
| 1970 | − pr_info(MPT3SAS_FMT | |
| 1971 | − "%s: waiting for operational state(count=%d)\n", | |
| 1972 | − ioc->name, __func__, wait_state_count); | |
| 1938 | + ioc_info(ioc, "%s: waiting for operational state(count=%d)\n", | |
| 1939 | + __func__, wait_state_count); | |
| 1973 | 1940 | } |
| 1974 | 1941 | if (wait_state_count) |
| 1975 | − pr_info(MPT3SAS_FMT "%s: ioc is operational\n", | |
| 1976 | − ioc->name, __func__); | |
| 1942 | + ioc_info(ioc, "%s: ioc is operational\n", __func__); | |
| 1977 | 1943 | |
| 1978 | 1944 | smid = mpt3sas_base_get_smid(ioc, ioc->transport_cb_idx); |
| 1979 | 1945 | if (!smid) { |
| 1980 | − pr_err(MPT3SAS_FMT "%s: failed obtaining a smid\n", | |
| 1981 | − ioc->name, __func__); | |
| 1946 | + ioc_err(ioc, "%s: failed obtaining a smid\n", __func__); | |
| 1982 | 1947 | rc = -EAGAIN; |
| 1983 | 1948 | goto unmap_in; |
| 1984 | 1949 | } |
| @@ -1999,16 +1964,15 @@ _transport_smp_handler(struct bsg_job *job, struct Scsi_Host *shost, · 14 unmodified lines | ||
| 1999 | 1964 | ioc->build_sg(ioc, psge, dma_addr_out, dma_len_out - 4, dma_addr_in, |
| 2000 | 1965 | dma_len_in - 4); |
| 2001 | 1966 | |
| 2002 | − dtransportprintk(ioc, pr_info(MPT3SAS_FMT | |
| 2003 | − "%s - sending smp request\n", ioc->name, __func__)); | |
| 1967 | + dtransportprintk(ioc, | |
| 1968 | + ioc_info(ioc, "%s: sending smp request\n", __func__)); | |
| 2004 | 1969 | |
| 2005 | 1970 | init_completion(&ioc->transport_cmds.done); |
| 2006 | 1971 | mpt3sas_base_put_smid_default(ioc, smid); |
| 2007 | 1972 | wait_for_completion_timeout(&ioc->transport_cmds.done, 10*HZ); |
| 2008 | 1973 | |
| 2009 | 1974 | if (!(ioc->transport_cmds.status & MPT3_CMD_COMPLETE)) { |
| 2010 | − pr_err(MPT3SAS_FMT "%s : timeout\n", | |
| 2011 | − __func__, ioc->name); | |
| 1975 | + ioc_err(ioc, "%s: timeout\n", __func__); | |
| 2012 | 1976 | _debug_dump_mf(mpi_request, |
| 2013 | 1977 | sizeof(Mpi2SmpPassthroughRequest_t)/4); |
| 2014 | 1978 | if (!(ioc->transport_cmds.status & MPT3_CMD_RESET)) { |
| @@ -2018,12 +1982,11 @@ _transport_smp_handler(struct bsg_job *job, struct Scsi_Host *shost, · 3 unmodified lines | ||
| 2018 | 1982 | } |
| 2019 | 1983 | } |
| 2020 | 1984 | |
| 2021 | − dtransportprintk(ioc, pr_info(MPT3SAS_FMT | |
| 2022 | − "%s - complete\n", ioc->name, __func__)); | |
| 1985 | + dtransportprintk(ioc, ioc_info(ioc, "%s - complete\n", __func__)); | |
| 2023 | 1986 | |
| 2024 | 1987 | if (!(ioc->transport_cmds.status & MPT3_CMD_REPLY_VALID)) { |
| 2025 | − dtransportprintk(ioc, pr_info(MPT3SAS_FMT | |
| 2026 | − "%s - no reply\n", ioc->name, __func__)); | |
| 1988 | + dtransportprintk(ioc, | |
| 1989 | + ioc_info(ioc, "%s: no reply\n", __func__)); | |
| 2027 | 1990 | rc = -ENXIO; |
| 2028 | 1991 | goto unmap_in; |
| 2029 | 1992 | } |
| @@ -2031,9 +1994,9 @@ _transport_smp_handler(struct bsg_job *job, struct Scsi_Host *shost, · 1 unmodified line | ||
| 2031 | 1994 | mpi_reply = ioc->transport_cmds.reply; |
| 2032 | 1995 | |
| 2033 | 1996 | dtransportprintk(ioc, |
| 2034 | − pr_info(MPT3SAS_FMT "%s - reply data transfer size(%d)\n", | |
| 2035 | − ioc->name, __func__, | |
| 2036 | − le16_to_cpu(mpi_reply->ResponseDataLength))); | |
| 1997 | + ioc_info(ioc, "%s: reply data transfer size(%d)\n", | |
| 1998 | + __func__, | |
| 1999 | + le16_to_cpu(mpi_reply->ResponseDataLength))); | |
| 2037 | 2000 | |
| 2038 | 2001 | memcpy(job->reply, mpi_reply, sizeof(*mpi_reply)); |
| 2039 | 2002 | job->reply_len = sizeof(*mpi_reply); |
| @@ -72,8 +72,7 @@ _mpt3sas_raise_sigio(struct MPT3SAS_ADAPTER *ioc, · 71 unmodified lines | ||
| 72 | 72 | u16 sz, event_data_sz; |
| 73 | 73 | unsigned long flags; |
| 74 | 74 | |
| 75 | − dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT "%s: enter\n", | |
| 76 | − ioc->name, __func__)); | |
| 75 | + dTriggerDiagPrintk(ioc, ioc_info(ioc, "%s: enter\n", __func__)); | |
| 77 | 76 | |
| 78 | 77 | sz = offsetof(Mpi2EventNotificationReply_t, EventData) + |
| 79 | 78 | sizeof(struct SL_WH_TRIGGERS_EVENT_DATA_T) + 4; |
| @@ -85,23 +84,23 @@ _mpt3sas_raise_sigio(struct MPT3SAS_ADAPTER *ioc, · 5 unmodified lines | ||
| 85 | 84 | mpi_reply->EventDataLength = cpu_to_le16(event_data_sz); |
| 86 | 85 | memcpy(&mpi_reply->EventData, event_data, |
| 87 | 86 | sizeof(struct SL_WH_TRIGGERS_EVENT_DATA_T)); |
| 88 | − dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT | |
| 89 | − "%s: add to driver event log\n", | |
| 90 | − ioc->name, __func__)); | |
| 87 | + dTriggerDiagPrintk(ioc, | |
| 88 | + ioc_info(ioc, "%s: add to driver event log\n", | |
| 89 | + __func__)); | |
| 91 | 90 | mpt3sas_ctl_add_to_event_log(ioc, mpi_reply); |
| 92 | 91 | kfree(mpi_reply); |
| 93 | 92 | out: |
| 94 | 93 | |
| 95 | 94 | /* clearing the diag_trigger_active flag */ |
| 96 | 95 | spin_lock_irqsave(&ioc->diag_trigger_lock, flags); |
| 97 | − dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT | |
| 98 | − "%s: clearing diag_trigger_active flag\n", | |
| 99 | − ioc->name, __func__)); | |
| 96 | + dTriggerDiagPrintk(ioc, | |
| 97 | + ioc_info(ioc, "%s: clearing diag_trigger_active flag\n", | |
| 98 | + __func__)); | |
| 100 | 99 | ioc->diag_trigger_active = 0; |
| 101 | 100 | spin_unlock_irqrestore(&ioc->diag_trigger_lock, flags); |
| 102 | 101 | |
| 103 | − dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT "%s: exit\n", ioc->name, | |
| 104 | − __func__)); | |
| 102 | + dTriggerDiagPrintk(ioc, ioc_info(ioc, "%s: exit\n", | |
| 103 | + __func__)); | |
| 105 | 104 | } |
| 106 | 105 | |
| 107 | 106 | /** |
| @@ -115,22 +114,22 @@ mpt3sas_process_trigger_data(struct MPT3SAS_ADAPTER *ioc, · 7 unmodified lines | ||
| 115 | 114 | { |
| 116 | 115 | u8 issue_reset = 0; |
| 117 | 116 | |
| 118 | − dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT "%s: enter\n", | |
| 119 | − ioc->name, __func__)); | |
| 117 | + dTriggerDiagPrintk(ioc, ioc_info(ioc, "%s: enter\n", __func__)); | |
| 120 | 118 | |
| 121 | 119 | /* release the diag buffer trace */ |
| 122 | 120 | if ((ioc->diag_buffer_status[MPI2_DIAG_BUF_TYPE_TRACE] & |
| 123 | 121 | MPT3_DIAG_BUFFER_IS_RELEASED) == 0) { |
| 124 | − dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT | |
| 125 | − "%s: release trace diag buffer\n", ioc->name, __func__)); | |
| 122 | + dTriggerDiagPrintk(ioc, | |
| 123 | + ioc_info(ioc, "%s: release trace diag buffer\n", | |
| 124 | + __func__)); | |
| 126 | 125 | mpt3sas_send_diag_release(ioc, MPI2_DIAG_BUF_TYPE_TRACE, |
| 127 | 126 | &issue_reset); |
| 128 | 127 | } |
| 129 | 128 | |
| 130 | 129 | _mpt3sas_raise_sigio(ioc, event_data); |
| 131 | 130 | |
| 132 | − dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT "%s: exit\n", ioc->name, | |
| 133 | − __func__)); | |
| 131 | + dTriggerDiagPrintk(ioc, ioc_info(ioc, "%s: exit\n", | |
| 132 | + __func__)); | |
| 134 | 133 | } |
| 135 | 134 | |
| 136 | 135 | /** |
| @@ -168,9 +167,9 @@ mpt3sas_trigger_master(struct MPT3SAS_ADAPTER *ioc, u32 trigger_bitmask) · 31 unmodified lines | ||
| 168 | 167 | |
| 169 | 168 | by_pass_checks: |
| 170 | 169 | |
| 171 | − dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT | |
| 172 | − "%s: enter - trigger_bitmask = 0x%08x\n", | |
| 173 | − ioc->name, __func__, trigger_bitmask)); | |
| 170 | + dTriggerDiagPrintk(ioc, | |
| 171 | + ioc_info(ioc, "%s: enter - trigger_bitmask = 0x%08x\n", | |
| 172 | + __func__, trigger_bitmask)); | |
| 174 | 173 | |
| 175 | 174 | /* don't send trigger if an trigger is currently active */ |
| 176 | 175 | if (ioc->diag_trigger_active) { |
| @@ -182,9 +181,9 @@ mpt3sas_trigger_master(struct MPT3SAS_ADAPTER *ioc, u32 trigger_bitmask) · 5 unmodified lines | ||
| 182 | 181 | if (ioc->diag_trigger_master.MasterData & trigger_bitmask) { |
| 183 | 182 | found_match = 1; |
| 184 | 183 | ioc->diag_trigger_active = 1; |
| 185 | − dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT | |
| 186 | − "%s: setting diag_trigger_active flag\n", | |
| 187 | − ioc->name, __func__)); | |
| 184 | + dTriggerDiagPrintk(ioc, | |
| 185 | + ioc_info(ioc, "%s: setting diag_trigger_active flag\n", | |
| 186 | + __func__)); | |
| 188 | 187 | } |
| 189 | 188 | spin_unlock_irqrestore(&ioc->diag_trigger_lock, flags); |
| 190 | 189 | |
| @@ -202,8 +201,8 @@ mpt3sas_trigger_master(struct MPT3SAS_ADAPTER *ioc, u32 trigger_bitmask) · 11 unmodified lines | ||
| 202 | 201 | mpt3sas_send_trigger_data_event(ioc, &event_data); |
| 203 | 202 | |
| 204 | 203 | out: |
| 205 | − dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT "%s: exit\n", ioc->name, | |
| 206 | − __func__)); | |
| 204 | + dTriggerDiagPrintk(ioc, ioc_info(ioc, "%s: exit\n", | |
| 205 | + __func__)); | |
| 207 | 206 | } |
| 208 | 207 | |
| 209 | 208 | /** |
| @@ -239,9 +238,9 @@ mpt3sas_trigger_event(struct MPT3SAS_ADAPTER *ioc, u16 event, · 29 unmodified lines | ||
| 239 | 238 | return; |
| 240 | 239 | } |
| 241 | 240 | |
| 242 | − dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT | |
| 243 | − "%s: enter - event = 0x%04x, log_entry_qualifier = 0x%04x\n", | |
| 244 | − ioc->name, __func__, event, log_entry_qualifier)); | |
| 241 | + dTriggerDiagPrintk(ioc, | |
| 242 | + ioc_info(ioc, "%s: enter - event = 0x%04x, log_entry_qualifier = 0x%04x\n", | |
| 243 | + __func__, event, log_entry_qualifier)); | |
| 245 | 244 | |
| 246 | 245 | /* don't send trigger if an trigger is currently active */ |
| 247 | 246 | if (ioc->diag_trigger_active) { |
| @@ -263,26 +262,26 @@ mpt3sas_trigger_event(struct MPT3SAS_ADAPTER *ioc, u16 event, · 15 unmodified lines | ||
| 263 | 262 | } |
| 264 | 263 | found_match = 1; |
| 265 | 264 | ioc->diag_trigger_active = 1; |
| 266 | − dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT | |
| 267 | − "%s: setting diag_trigger_active flag\n", | |
| 268 | − ioc->name, __func__)); | |
| 265 | + dTriggerDiagPrintk(ioc, | |
| 266 | + ioc_info(ioc, "%s: setting diag_trigger_active flag\n", | |
| 267 | + __func__)); | |
| 269 | 268 | } |
| 270 | 269 | spin_unlock_irqrestore(&ioc->diag_trigger_lock, flags); |
| 271 | 270 | |
| 272 | 271 | if (!found_match) |
| 273 | 272 | goto out; |
| 274 | 273 | |
| 275 | − dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT | |
| 276 | − "%s: setting diag_trigger_active flag\n", | |
| 277 | − ioc->name, __func__)); | |
| 274 | + dTriggerDiagPrintk(ioc, | |
| 275 | + ioc_info(ioc, "%s: setting diag_trigger_active flag\n", | |
| 276 | + __func__)); | |
| 278 | 277 | memset(&event_data, 0, sizeof(struct SL_WH_TRIGGERS_EVENT_DATA_T)); |
| 279 | 278 | event_data.trigger_type = MPT3SAS_TRIGGER_EVENT; |
| 280 | 279 | event_data.u.event.EventValue = event; |
| 281 | 280 | event_data.u.event.LogEntryQualifier = log_entry_qualifier; |
| 282 | 281 | mpt3sas_send_trigger_data_event(ioc, &event_data); |
| 283 | 282 | out: |
| 284 | − dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT "%s: exit\n", ioc->name, | |
| 285 | − __func__)); | |
| 283 | + dTriggerDiagPrintk(ioc, ioc_info(ioc, "%s: exit\n", | |
| 284 | + __func__)); | |
| 286 | 285 | } |
| 287 | 286 | |
| 288 | 287 | /** |
| @@ -319,9 +318,9 @@ mpt3sas_trigger_scsi(struct MPT3SAS_ADAPTER *ioc, u8 sense_key, u8 asc, · 30 unmodified lines | ||
| 319 | 318 | return; |
| 320 | 319 | } |
| 321 | 320 | |
| 322 | − dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT | |
| 323 | − "%s: enter - sense_key = 0x%02x, asc = 0x%02x, ascq = 0x%02x\n", | |
| 324 | − ioc->name, __func__, sense_key, asc, ascq)); | |
| 321 | + dTriggerDiagPrintk(ioc, | |
| 322 | + ioc_info(ioc, "%s: enter - sense_key = 0x%02x, asc = 0x%02x, ascq = 0x%02x\n", | |
| 323 | + __func__, sense_key, asc, ascq)); | |
| 325 | 324 | |
| 326 | 325 | /* don't send trigger if an trigger is currently active */ |
| 327 | 326 | if (ioc->diag_trigger_active) { |
| @@ -347,9 +346,9 @@ mpt3sas_trigger_scsi(struct MPT3SAS_ADAPTER *ioc, u8 sense_key, u8 asc, · 19 unmodified lines | ||
| 347 | 346 | if (!found_match) |
| 348 | 347 | goto out; |
| 349 | 348 | |
| 350 | − dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT | |
| 351 | − "%s: setting diag_trigger_active flag\n", | |
| 352 | − ioc->name, __func__)); | |
| 349 | + dTriggerDiagPrintk(ioc, | |
| 350 | + ioc_info(ioc, "%s: setting diag_trigger_active flag\n", | |
| 351 | + __func__)); | |
| 353 | 352 | memset(&event_data, 0, sizeof(struct SL_WH_TRIGGERS_EVENT_DATA_T)); |
| 354 | 353 | event_data.trigger_type = MPT3SAS_TRIGGER_SCSI; |
| 355 | 354 | event_data.u.scsi.SenseKey = sense_key; |
| @@ -357,8 +356,8 @@ mpt3sas_trigger_scsi(struct MPT3SAS_ADAPTER *ioc, u8 sense_key, u8 asc, · 1 unmodified line | ||
| 357 | 356 | event_data.u.scsi.ASCQ = ascq; |
| 358 | 357 | mpt3sas_send_trigger_data_event(ioc, &event_data); |
| 359 | 358 | out: |
| 360 | − dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT "%s: exit\n", ioc->name, | |
| 361 | − __func__)); | |
| 359 | + dTriggerDiagPrintk(ioc, ioc_info(ioc, "%s: exit\n", | |
| 360 | + __func__)); | |
| 362 | 361 | } |
| 363 | 362 | |
| 364 | 363 | /** |
| @@ -393,9 +392,9 @@ mpt3sas_trigger_mpi(struct MPT3SAS_ADAPTER *ioc, u16 ioc_status, u32 loginfo) · 28 unmodified lines | ||
| 393 | 392 | return; |
| 394 | 393 | } |
| 395 | 394 | |
| 396 | − dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT | |
| 397 | − "%s: enter - ioc_status = 0x%04x, loginfo = 0x%08x\n", | |
| 398 | − ioc->name, __func__, ioc_status, loginfo)); | |
| 395 | + dTriggerDiagPrintk(ioc, | |
| 396 | + ioc_info(ioc, "%s: enter - ioc_status = 0x%04x, loginfo = 0x%08x\n", | |
| 397 | + __func__, ioc_status, loginfo)); | |
| 399 | 398 | |
| 400 | 399 | /* don't send trigger if an trigger is currently active */ |
| 401 | 400 | if (ioc->diag_trigger_active) { |
| @@ -420,15 +419,15 @@ mpt3sas_trigger_mpi(struct MPT3SAS_ADAPTER *ioc, u16 ioc_status, u32 loginfo) · 18 unmodified lines | ||
| 420 | 419 | if (!found_match) |
| 421 | 420 | goto out; |
| 422 | 421 | |
| 423 | − dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT | |
| 424 | − "%s: setting diag_trigger_active flag\n", | |
| 425 | − ioc->name, __func__)); | |
| 422 | + dTriggerDiagPrintk(ioc, | |
| 423 | + ioc_info(ioc, "%s: setting diag_trigger_active flag\n", | |
| 424 | + __func__)); | |
| 426 | 425 | memset(&event_data, 0, sizeof(struct SL_WH_TRIGGERS_EVENT_DATA_T)); |
| 427 | 426 | event_data.trigger_type = MPT3SAS_TRIGGER_MPI; |
| 428 | 427 | event_data.u.mpi.IOCStatus = ioc_status; |
| 429 | 428 | event_data.u.mpi.IocLogInfo = loginfo; |
| 430 | 429 | mpt3sas_send_trigger_data_event(ioc, &event_data); |
| 431 | 430 | out: |
| 432 | − dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT "%s: exit\n", ioc->name, | |
| 433 | − __func__)); | |
| 431 | + dTriggerDiagPrintk(ioc, ioc_info(ioc, "%s: exit\n", | |
| 432 | + __func__)); | |
| 434 | 433 | } |
| @@ -127,20 +127,17 @@ mpt3sas_init_warpdrive_properties(struct MPT3SAS_ADAPTER *ioc, · 126 unmodified lines | ||
| 127 | 127 | return; |
| 128 | 128 | |
| 129 | 129 | if (ioc->mfg_pg10_hide_flag == MFG_PAGE10_EXPOSE_ALL_DISKS) { |
| 130 | − pr_info(MPT3SAS_FMT "WarpDrive : Direct IO is disabled " | |
| 131 | − "globally as drives are exposed\n", ioc->name); | |
| 130 | + ioc_info(ioc, "WarpDrive : Direct IO is disabled globally as drives are exposed\n"); | |
| 132 | 131 | return; |
| 133 | 132 | } |
| 134 | 133 | if (mpt3sas_get_num_volumes(ioc) > 1) { |
| 135 | 134 | _warpdrive_disable_ddio(ioc); |
| 136 | − pr_info(MPT3SAS_FMT "WarpDrive : Direct IO is disabled " | |
| 137 | − "globally as number of drives > 1\n", ioc->name); | |
| 135 | + ioc_info(ioc, "WarpDrive : Direct IO is disabled globally as number of drives > 1\n"); | |
| 138 | 136 | return; |
| 139 | 137 | } |
| 140 | 138 | if ((mpt3sas_config_get_number_pds(ioc, raid_device->handle, |
| 141 | 139 | &num_pds)) || !num_pds) { |
| 142 | − pr_info(MPT3SAS_FMT "WarpDrive : Direct IO is disabled " | |
| 143 | − "Failure in computing number of drives\n", ioc->name); | |
| 140 | + ioc_info(ioc, "WarpDrive : Direct IO is disabled Failure in computing number of drives\n"); | |
| 144 | 141 | return; |
| 145 | 142 | } |
| 146 | 143 | |
| @@ -148,15 +145,13 @@ mpt3sas_init_warpdrive_properties(struct MPT3SAS_ADAPTER *ioc, · 1 unmodified line | ||
| 148 | 145 | sizeof(Mpi2RaidVol0PhysDisk_t)); |
| 149 | 146 | vol_pg0 = kzalloc(sz, GFP_KERNEL); |
| 150 | 147 | if (!vol_pg0) { |
| 151 | − pr_info(MPT3SAS_FMT "WarpDrive : Direct IO is disabled " | |
| 152 | − "Memory allocation failure for RVPG0\n", ioc->name); | |
| 148 | + ioc_info(ioc, "WarpDrive : Direct IO is disabled Memory allocation failure for RVPG0\n"); | |
| 153 | 149 | return; |
| 154 | 150 | } |
| 155 | 151 | |
| 156 | 152 | if ((mpt3sas_config_get_raid_volume_pg0(ioc, &mpi_reply, vol_pg0, |
| 157 | 153 | MPI2_RAID_VOLUME_PGAD_FORM_HANDLE, raid_device->handle, sz))) { |
| 158 | − pr_info(MPT3SAS_FMT "WarpDrive : Direct IO is disabled " | |
| 159 | − "Failure in retrieving RVPG0\n", ioc->name); | |
| 154 | + ioc_info(ioc, "WarpDrive : Direct IO is disabled Failure in retrieving RVPG0\n"); | |
| 160 | 155 | kfree(vol_pg0); |
| 161 | 156 | return; |
| 162 | 157 | } |
| @@ -166,10 +161,8 @@ mpt3sas_init_warpdrive_properties(struct MPT3SAS_ADAPTER *ioc, · 3 unmodified lines | ||
| 166 | 161 | * assumed for WARPDRIVE, disable direct I/O |
| 167 | 162 | */ |
| 168 | 163 | if (num_pds > MPT_MAX_WARPDRIVE_PDS) { |
| 169 | − pr_warn(MPT3SAS_FMT "WarpDrive : Direct IO is disabled " | |
| 170 | − "for the drive with handle(0x%04x): num_mem=%d, " | |
| 171 | − "max_mem_allowed=%d\n", ioc->name, raid_device->handle, | |
| 172 | − num_pds, MPT_MAX_WARPDRIVE_PDS); | |
| 164 | + ioc_warn(ioc, "WarpDrive : Direct IO is disabled for the drive with handle(0x%04x): num_mem=%d, max_mem_allowed=%d\n", | |
| 165 | + raid_device->handle, num_pds, MPT_MAX_WARPDRIVE_PDS); | |
| 173 | 166 | kfree(vol_pg0); |
| 174 | 167 | return; |
| 175 | 168 | } |
| @@ -179,22 +172,18 @@ mpt3sas_init_warpdrive_properties(struct MPT3SAS_ADAPTER *ioc, · 3 unmodified lines | ||
| 179 | 172 | vol_pg0->PhysDisk[count].PhysDiskNum) || |
| 180 | 173 | le16_to_cpu(pd_pg0.DevHandle) == |
| 181 | 174 | MPT3SAS_INVALID_DEVICE_HANDLE) { |
| 182 | − pr_info(MPT3SAS_FMT "WarpDrive : Direct IO is " | |
| 183 | − "disabled for the drive with handle(0x%04x) member" | |
| 184 | − "handle retrieval failed for member number=%d\n", | |
| 185 | − ioc->name, raid_device->handle, | |
| 186 | − vol_pg0->PhysDisk[count].PhysDiskNum); | |
| 175 | + ioc_info(ioc, "WarpDrive : Direct IO is disabled for the drive with handle(0x%04x) member handle retrieval failed for member number=%d\n", | |
| 176 | + raid_device->handle, | |
| 177 | + vol_pg0->PhysDisk[count].PhysDiskNum); | |
| 187 | 178 | goto out_error; |
| 188 | 179 | } |
| 189 | 180 | /* Disable direct I/O if member drive lba exceeds 4 bytes */ |
| 190 | 181 | dev_max_lba = le64_to_cpu(pd_pg0.DeviceMaxLBA); |
| 191 | 182 | if (dev_max_lba >> 32) { |
| 192 | − pr_info(MPT3SAS_FMT "WarpDrive : Direct IO is " | |
| 193 | − "disabled for the drive with handle(0x%04x) member" | |
| 194 | − " handle (0x%04x) unsupported max lba 0x%016llx\n", | |
| 195 | − ioc->name, raid_device->handle, | |
| 196 | − le16_to_cpu(pd_pg0.DevHandle), | |
| 197 | − (unsigned long long)dev_max_lba); | |
| 183 | + 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", | |
| 184 | + raid_device->handle, | |
| 185 | + le16_to_cpu(pd_pg0.DevHandle), | |
| 186 | + (u64)dev_max_lba); | |
| 198 | 187 | goto out_error; |
| 199 | 188 | } |
| 200 | 189 | |
| @@ -206,41 +195,36 @@ mpt3sas_init_warpdrive_properties(struct MPT3SAS_ADAPTER *ioc, · 5 unmodified lines | ||
| 206 | 195 | * not RAID0 |
| 207 | 196 | */ |
| 208 | 197 | if (raid_device->volume_type != MPI2_RAID_VOL_TYPE_RAID0) { |
| 209 | − pr_info(MPT3SAS_FMT "WarpDrive : Direct IO is disabled " | |
| 210 | − "for the drive with handle(0x%04x): type=%d, " | |
| 211 | − "s_sz=%uK, blk_size=%u\n", ioc->name, | |
| 212 | − raid_device->handle, raid_device->volume_type, | |
| 213 | − (le32_to_cpu(vol_pg0->StripeSize) * | |
| 214 | − le16_to_cpu(vol_pg0->BlockSize)) / 1024, | |
| 215 | − le16_to_cpu(vol_pg0->BlockSize)); | |
| 198 | + ioc_info(ioc, "WarpDrive : Direct IO is disabled for the drive with handle(0x%04x): type=%d, s_sz=%uK, blk_size=%u\n", | |
| 199 | + raid_device->handle, raid_device->volume_type, | |
| 200 | + (le32_to_cpu(vol_pg0->StripeSize) * | |
| 201 | + le16_to_cpu(vol_pg0->BlockSize)) / 1024, | |
| 202 | + le16_to_cpu(vol_pg0->BlockSize)); | |
| 216 | 203 | goto out_error; |
| 217 | 204 | } |
| 218 | 205 | |
| 219 | 206 | stripe_sz = le32_to_cpu(vol_pg0->StripeSize); |
| 220 | 207 | stripe_exp = find_first_bit(&stripe_sz, 32); |
| 221 | 208 | if (stripe_exp == 32) { |
| 222 | − pr_info(MPT3SAS_FMT "WarpDrive : Direct IO is disabled " | |
| 223 | − "for the drive with handle(0x%04x) invalid stripe sz %uK\n", | |
| 224 | − ioc->name, raid_device->handle, | |
| 225 | − (le32_to_cpu(vol_pg0->StripeSize) * | |
| 226 | − le16_to_cpu(vol_pg0->BlockSize)) / 1024); | |
| 209 | + ioc_info(ioc, "WarpDrive : Direct IO is disabled for the drive with handle(0x%04x) invalid stripe sz %uK\n", | |
| 210 | + raid_device->handle, | |
| 211 | + (le32_to_cpu(vol_pg0->StripeSize) * | |
| 212 | + le16_to_cpu(vol_pg0->BlockSize)) / 1024); | |
| 227 | 213 | goto out_error; |
| 228 | 214 | } |
| 229 | 215 | raid_device->stripe_exponent = stripe_exp; |
| 230 | 216 | block_sz = le16_to_cpu(vol_pg0->BlockSize); |
| 231 | 217 | block_exp = find_first_bit(&block_sz, 16); |
| 232 | 218 | if (block_exp == 16) { |
| 233 | − pr_info(MPT3SAS_FMT "WarpDrive : Direct IO is disabled " | |
| 234 | − "for the drive with handle(0x%04x) invalid block sz %u\n", | |
| 235 | − ioc->name, raid_device->handle, | |
| 236 | − le16_to_cpu(vol_pg0->BlockSize)); | |
| 219 | + ioc_info(ioc, "WarpDrive : Direct IO is disabled for the drive with handle(0x%04x) invalid block sz %u\n", | |
| 220 | + raid_device->handle, le16_to_cpu(vol_pg0->BlockSize)); | |
| 237 | 221 | goto out_error; |
| 238 | 222 | } |
| 239 | 223 | raid_device->block_exponent = block_exp; |
| 240 | 224 | raid_device->direct_io_enabled = 1; |
| 241 | 225 | |
| 242 | − pr_info(MPT3SAS_FMT "WarpDrive : Direct IO is Enabled for the drive" | |
| 243 | − " with handle(0x%04x)\n", ioc->name, raid_device->handle); | |
| 226 | + ioc_info(ioc, "WarpDrive : Direct IO is Enabled for the drive with handle(0x%04x)\n", | |
| 227 | + raid_device->handle); | |
| 244 | 228 | /* |
| 245 | 229 | * WARPDRIVE: Though the following fields are not used for direct IO, |
| 246 | 230 | * stored for future purpose: |
| @@ -403,29 +403,14 @@ static int pci_go_64(struct pci_dev *pdev) · 402 unmodified lines | ||
| 403 | 403 | { |
| 404 | 404 | int rc; |
| 405 | 405 | |
| 406 | − if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) { | |
| 407 | − rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64)); | |
| 408 | − if (rc) { | |
| 409 | − rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); | |
| 410 | − if (rc) { | |
| 411 | − dev_printk(KERN_ERR, &pdev->dev, | |
| 412 | − "64-bit DMA enable failed\n"); | |
| 413 | − return rc; | |
| 414 | − } | |
| 415 | − } | |
| 416 | − } else { | |
| 417 | − rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); | |
| 406 | + rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)); | |
| 407 | + if (rc) { | |
| 408 | + rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); | |
| 418 | 409 | if (rc) { |
| 419 | 410 | dev_printk(KERN_ERR, &pdev->dev, |
| 420 | 411 | "32-bit DMA enable failed\n"); |
| 421 | 412 | return rc; |
| 422 | 413 | } |
| 423 | − rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); | |
| 424 | − if (rc) { | |
| 425 | − dev_printk(KERN_ERR, &pdev->dev, | |
| 426 | − "32-bit consistent DMA enable failed\n"); | |
| 427 | − return rc; | |
| 428 | − } | |
| 429 | 414 | } |
| 430 | 415 | |
| 431 | 416 | return rc; |
| @@ -336,13 +336,13 @@ static int mvs_task_prep_smp(struct mvs_info *mvi, · 335 unmodified lines | ||
| 336 | 336 | * DMA-map SMP request, response buffers |
| 337 | 337 | */ |
| 338 | 338 | sg_req = &task->smp_task.smp_req; |
| 339 | − elem = dma_map_sg(mvi->dev, sg_req, 1, PCI_DMA_TODEVICE); | |
| 339 | + elem = dma_map_sg(mvi->dev, sg_req, 1, DMA_TO_DEVICE); | |
| 340 | 340 | if (!elem) |
| 341 | 341 | return -ENOMEM; |
| 342 | 342 | req_len = sg_dma_len(sg_req); |
| 343 | 343 | |
| 344 | 344 | sg_resp = &task->smp_task.smp_resp; |
| 345 | − elem = dma_map_sg(mvi->dev, sg_resp, 1, PCI_DMA_FROMDEVICE); | |
| 345 | + elem = dma_map_sg(mvi->dev, sg_resp, 1, DMA_FROM_DEVICE); | |
| 346 | 346 | if (!elem) { |
| 347 | 347 | rc = -ENOMEM; |
| 348 | 348 | goto err_out; |
| @@ -416,10 +416,10 @@ static int mvs_task_prep_smp(struct mvs_info *mvi, · 67 unmodified lines | ||
| 416 | 416 | |
| 417 | 417 | err_out_2: |
| 418 | 418 | dma_unmap_sg(mvi->dev, &tei->task->smp_task.smp_resp, 1, |
| 419 | − PCI_DMA_FROMDEVICE); | |
| 419 | + DMA_FROM_DEVICE); | |
| 420 | 420 | err_out: |
| 421 | 421 | dma_unmap_sg(mvi->dev, &tei->task->smp_task.smp_req, 1, |
| 422 | − PCI_DMA_TODEVICE); | |
| 422 | + DMA_TO_DEVICE); | |
| 423 | 423 | return rc; |
| 424 | 424 | } |
| 425 | 425 | |
| @@ -904,9 +904,9 @@ static void mvs_slot_task_free(struct mvs_info *mvi, struct sas_task *task, · 478 unmodified lines | ||
| 904 | 904 | switch (task->task_proto) { |
| 905 | 905 | case SAS_PROTOCOL_SMP: |
| 906 | 906 | dma_unmap_sg(mvi->dev, &task->smp_task.smp_resp, 1, |
| 907 | − PCI_DMA_FROMDEVICE); | |
| 907 | + DMA_FROM_DEVICE); | |
| 908 | 908 | dma_unmap_sg(mvi->dev, &task->smp_task.smp_req, 1, |
| 909 | − PCI_DMA_TODEVICE); | |
| 909 | + DMA_TO_DEVICE); | |
| 910 | 910 | break; |
| 911 | 911 | |
| 912 | 912 | case SAS_PROTOCOL_SATA: |
| @@ -143,8 +143,8 @@ static struct mvumi_res *mvumi_alloc_mem_resource(struct mvumi_hba *mhba, · 142 unmodified lines | ||
| 143 | 143 | |
| 144 | 144 | case RESOURCE_UNCACHED_MEMORY: |
| 145 | 145 | size = round_up(size, 8); |
| 146 | − res->virt_addr = pci_zalloc_consistent(mhba->pdev, size, | |
| 147 | − &res->bus_addr); | |
| 146 | + res->virt_addr = dma_zalloc_coherent(&mhba->pdev->dev, size, | |
| 147 | + &res->bus_addr, GFP_KERNEL); | |
| 148 | 148 | if (!res->virt_addr) { |
| 149 | 149 | dev_err(&mhba->pdev->dev, |
| 150 | 150 | "unable to allocate consistent mem," |
| @@ -175,7 +175,7 @@ static void mvumi_release_mem_resource(struct mvumi_hba *mhba) · 24 unmodified lines | ||
| 175 | 175 | list_for_each_entry_safe(res, tmp, &mhba->res_list, entry) { |
| 176 | 176 | switch (res->type) { |
| 177 | 177 | case RESOURCE_UNCACHED_MEMORY: |
| 178 | − pci_free_consistent(mhba->pdev, res->size, | |
| 178 | + dma_free_coherent(&mhba->pdev->dev, res->size, | |
| 179 | 179 | res->virt_addr, res->bus_addr); |
| 180 | 180 | break; |
| 181 | 181 | case RESOURCE_CACHED_MEMORY: |
| @@ -211,14 +211,14 @@ static int mvumi_make_sgl(struct mvumi_hba *mhba, struct scsi_cmnd *scmd, · 29 unmodified lines | ||
| 211 | 211 | dma_addr_t busaddr; |
| 212 | 212 | |
| 213 | 213 | sg = scsi_sglist(scmd); |
| 214 | − *sg_count = pci_map_sg(mhba->pdev, sg, sgnum, | |
| 215 | − (int) scmd->sc_data_direction); | |
| 214 | + *sg_count = dma_map_sg(&mhba->pdev->dev, sg, sgnum, | |
| 215 | + scmd->sc_data_direction); | |
| 216 | 216 | if (*sg_count > mhba->max_sge) { |
| 217 | 217 | dev_err(&mhba->pdev->dev, |
| 218 | 218 | "sg count[0x%x] is bigger than max sg[0x%x].\n", |
| 219 | 219 | *sg_count, mhba->max_sge); |
| 220 | − pci_unmap_sg(mhba->pdev, sg, sgnum, | |
| 221 | − (int) scmd->sc_data_direction); | |
| 220 | + dma_unmap_sg(&mhba->pdev->dev, sg, sgnum, | |
| 221 | + scmd->sc_data_direction); | |
| 222 | 222 | return -1; |
| 223 | 223 | } |
| 224 | 224 | for (i = 0; i < *sg_count; i++) { |
| @@ -246,7 +246,8 @@ static int mvumi_internal_cmd_sgl(struct mvumi_hba *mhba, struct mvumi_cmd *cmd, · 21 unmodified lines | ||
| 246 | 246 | if (size == 0) |
| 247 | 247 | return 0; |
| 248 | 248 | |
| 249 | − virt_addr = pci_zalloc_consistent(mhba->pdev, size, &phy_addr); | |
| 249 | + virt_addr = dma_zalloc_coherent(&mhba->pdev->dev, size, &phy_addr, | |
| 250 | + GFP_KERNEL); | |
| 250 | 251 | if (!virt_addr) |
| 251 | 252 | return -1; |
| 252 | 253 | |
| @@ -274,8 +275,8 @@ static struct mvumi_cmd *mvumi_create_internal_cmd(struct mvumi_hba *mhba, · 21 unmodified lines | ||
| 274 | 275 | } |
| 275 | 276 | INIT_LIST_HEAD(&cmd->queue_pointer); |
| 276 | 277 | |
| 277 | − cmd->frame = pci_alloc_consistent(mhba->pdev, | |
| 278 | − mhba->ib_max_size, &cmd->frame_phys); | |
| 278 | + cmd->frame = dma_alloc_coherent(&mhba->pdev->dev, mhba->ib_max_size, | |
| 279 | + &cmd->frame_phys, GFP_KERNEL); | |
| 279 | 280 | if (!cmd->frame) { |
| 280 | 281 | dev_err(&mhba->pdev->dev, "failed to allocate memory for FW" |
| 281 | 282 | " frame,size = %d.\n", mhba->ib_max_size); |
| @@ -287,7 +288,7 @@ static struct mvumi_cmd *mvumi_create_internal_cmd(struct mvumi_hba *mhba, · 5 unmodified lines | ||
| 287 | 288 | if (mvumi_internal_cmd_sgl(mhba, cmd, buf_size)) { |
| 288 | 289 | dev_err(&mhba->pdev->dev, "failed to allocate memory" |
| 289 | 290 | " for internal frame\n"); |
| 290 | − pci_free_consistent(mhba->pdev, mhba->ib_max_size, | |
| 291 | + dma_free_coherent(&mhba->pdev->dev, mhba->ib_max_size, | |
| 291 | 292 | cmd->frame, cmd->frame_phys); |
| 292 | 293 | kfree(cmd); |
| 293 | 294 | return NULL; |
| @@ -313,10 +314,10 @@ static void mvumi_delete_internal_cmd(struct mvumi_hba *mhba, · 19 unmodified lines | ||
| 313 | 314 | phy_addr = (dma_addr_t) m_sg->baseaddr_l | |
| 314 | 315 | (dma_addr_t) ((m_sg->baseaddr_h << 16) << 16); |
| 315 | 316 | |
| 316 | − pci_free_consistent(mhba->pdev, size, cmd->data_buf, | |
| 317 | + dma_free_coherent(&mhba->pdev->dev, size, cmd->data_buf, | |
| 317 | 318 | phy_addr); |
| 318 | 319 | } |
| 319 | − pci_free_consistent(mhba->pdev, mhba->ib_max_size, | |
| 320 | + dma_free_coherent(&mhba->pdev->dev, mhba->ib_max_size, | |
| 320 | 321 | cmd->frame, cmd->frame_phys); |
| 321 | 322 | kfree(cmd); |
| 322 | 323 | } |
| @@ -663,16 +664,17 @@ static void mvumi_restore_bar_addr(struct mvumi_hba *mhba) · 340 unmodified lines | ||
| 663 | 664 | } |
| 664 | 665 | } |
| 665 | 666 | |
| 666 | −static unsigned int mvumi_pci_set_master(struct pci_dev *pdev) | |
| 667 | +static int mvumi_pci_set_master(struct pci_dev *pdev) | |
| 667 | 668 | { |
| 668 | − unsigned int ret = 0; | |
| 669 | + int ret = 0; | |
| 670 | + | |
| 669 | 671 | pci_set_master(pdev); |
| 670 | 672 | |
| 671 | 673 | if (IS_DMA64) { |
| 672 | − if (pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) | |
| 673 | − ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); | |
| 674 | + if (dma_set_mask(&pdev->dev, DMA_BIT_MASK(64))) | |
| 675 | + ret = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32)); | |
| 674 | 676 | } else |
| 675 | − ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); | |
| 677 | + ret = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32)); | |
| 676 | 678 | |
| 677 | 679 | return ret; |
| 678 | 680 | } |
| @@ -771,7 +773,7 @@ static void mvumi_release_fw(struct mvumi_hba *mhba) · 92 unmodified lines | ||
| 771 | 773 | mvumi_free_cmds(mhba); |
| 772 | 774 | mvumi_release_mem_resource(mhba); |
| 773 | 775 | mvumi_unmap_pci_addr(mhba->pdev, mhba->base_addr); |
| 774 | − pci_free_consistent(mhba->pdev, HSP_MAX_SIZE, | |
| 776 | + dma_free_coherent(&mhba->pdev->dev, HSP_MAX_SIZE, | |
| 775 | 777 | mhba->handshake_page, mhba->handshake_page_phys); |
| 776 | 778 | kfree(mhba->regs); |
| 777 | 779 | pci_release_regions(mhba->pdev); |
| @@ -1339,9 +1341,9 @@ static void mvumi_complete_cmd(struct mvumi_hba *mhba, struct mvumi_cmd *cmd, · 561 unmodified lines | ||
| 1339 | 1341 | } |
| 1340 | 1342 | |
| 1341 | 1343 | if (scsi_bufflen(scmd)) |
| 1342 | − pci_unmap_sg(mhba->pdev, scsi_sglist(scmd), | |
| 1344 | + dma_unmap_sg(&mhba->pdev->dev, scsi_sglist(scmd), | |
| 1343 | 1345 | scsi_sg_count(scmd), |
| 1344 | − (int) scmd->sc_data_direction); | |
| 1346 | + scmd->sc_data_direction); | |
| 1345 | 1347 | cmd->scmd->scsi_done(scmd); |
| 1346 | 1348 | mvumi_return_cmd(mhba, cmd); |
| 1347 | 1349 | } |
| @@ -2148,9 +2150,9 @@ static enum blk_eh_timer_return mvumi_timed_out(struct scsi_cmnd *scmd) · 800 unmodified lines | ||
| 2148 | 2150 | scmd->result = (DRIVER_INVALID << 24) | (DID_ABORT << 16); |
| 2149 | 2151 | scmd->SCp.ptr = NULL; |
| 2150 | 2152 | if (scsi_bufflen(scmd)) { |
| 2151 | − pci_unmap_sg(mhba->pdev, scsi_sglist(scmd), | |
| 2153 | + dma_unmap_sg(&mhba->pdev->dev, scsi_sglist(scmd), | |
| 2152 | 2154 | scsi_sg_count(scmd), |
| 2153 | − (int)scmd->sc_data_direction); | |
| 2155 | + scmd->sc_data_direction); | |
| 2154 | 2156 | } |
| 2155 | 2157 | mvumi_return_cmd(mhba, cmd); |
| 2156 | 2158 | spin_unlock_irqrestore(mhba->shost->host_lock, flags); |
| @@ -2362,8 +2364,8 @@ static int mvumi_init_fw(struct mvumi_hba *mhba) · 205 unmodified lines | ||
| 2362 | 2364 | ret = -ENOMEM; |
| 2363 | 2365 | goto fail_alloc_mem; |
| 2364 | 2366 | } |
| 2365 | − mhba->handshake_page = pci_alloc_consistent(mhba->pdev, HSP_MAX_SIZE, | |
| 2366 | − &mhba->handshake_page_phys); | |
| 2367 | + mhba->handshake_page = dma_alloc_coherent(&mhba->pdev->dev, | |
| 2368 | + HSP_MAX_SIZE, &mhba->handshake_page_phys, GFP_KERNEL); | |
| 2367 | 2369 | if (!mhba->handshake_page) { |
| 2368 | 2370 | dev_err(&mhba->pdev->dev, |
| 2369 | 2371 | "failed to allocate memory for handshake\n"); |
| @@ -2383,7 +2385,7 @@ static int mvumi_init_fw(struct mvumi_hba *mhba) · 13 unmodified lines | ||
| 2383 | 2385 | |
| 2384 | 2386 | fail_ready_state: |
| 2385 | 2387 | mvumi_release_mem_resource(mhba); |
| 2386 | − pci_free_consistent(mhba->pdev, HSP_MAX_SIZE, | |
| 2388 | + dma_free_coherent(&mhba->pdev->dev, HSP_MAX_SIZE, | |
| 2387 | 2389 | mhba->handshake_page, mhba->handshake_page_phys); |
| 2388 | 2390 | fail_alloc_page: |
| 2389 | 2391 | kfree(mhba->regs); |
| @@ -2480,20 +2482,9 @@ static int mvumi_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) · 90 unmodified lines | ||
| 2480 | 2482 | if (ret) |
| 2481 | 2483 | return ret; |
| 2482 | 2484 | |
| 2483 | − pci_set_master(pdev); | |
| 2484 | − | |
| 2485 | − if (IS_DMA64) { | |
| 2486 | − ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(64)); | |
| 2487 | − if (ret) { | |
| 2488 | − ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); | |
| 2489 | − if (ret) | |
| 2490 | − goto fail_set_dma_mask; | |
| 2491 | − } | |
| 2492 | − } else { | |
| 2493 | − ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); | |
| 2494 | − if (ret) | |
| 2495 | − goto fail_set_dma_mask; | |
| 2496 | − } | |
| 2485 | + ret = mvumi_pci_set_master(pdev); | |
| 2486 | + if (ret) | |
| 2487 | + goto fail_set_dma_mask; | |
| 2497 | 2488 | |
| 2498 | 2489 | host = scsi_host_alloc(&mvumi_template, sizeof(*mhba)); |
| 2499 | 2490 | if (!host) { |
| @@ -2627,19 +2618,11 @@ static int __maybe_unused mvumi_resume(struct pci_dev *pdev) · 127 unmodified lines | ||
| 2627 | 2618 | dev_err(&pdev->dev, "enable device failed\n"); |
| 2628 | 2619 | return ret; |
| 2629 | 2620 | } |
| 2630 | − pci_set_master(pdev); | |
| 2631 | − if (IS_DMA64) { | |
| 2632 | − ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(64)); | |
| 2633 | − if (ret) { | |
| 2634 | − ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); | |
| 2635 | − if (ret) | |
| 2636 | − goto fail; | |
| 2637 | − } | |
| 2638 | − } else { | |
| 2639 | − ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); | |
| 2640 | − if (ret) | |
| 2641 | − goto fail; | |
| 2642 | − } | |
| 2621 | + | |
| 2622 | + ret = mvumi_pci_set_master(pdev); | |
| 2623 | + ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); | |
| 2624 | + if (ret) | |
| 2625 | + goto fail; | |
| 2643 | 2626 | ret = pci_request_regions(mhba->pdev, MV_DRIVER_NAME); |
| 2644 | 2627 | if (ret) |
| 2645 | 2628 | goto fail; |
| @@ -0,0 +1,3656 @@ | ||
| 1 | +// SPDX-License-Identifier: GPL-2.0 | |
| 2 | +/* | |
| 3 | + * Linux Driver for Mylex DAC960/AcceleRAID/eXtremeRAID PCI RAID Controllers | |
| 4 | + * | |
| 5 | + * Copyright 2017 Hannes Reinecke, SUSE Linux GmbH <hare@suse.com> | |
| 6 | + * | |
| 7 | + * Based on the original DAC960 driver, | |
| 8 | + * Copyright 1998-2001 by Leonard N. Zubkoff <lnz@dandelion.com> | |
| 9 | + * Portions Copyright 2002 by Mylex (An IBM Business Unit) | |
| 10 | + * | |
| 11 | + */ | |
| 12 | + | |
| 13 | +#include <linux/module.h> | |
| 14 | +#include <linux/types.h> | |
| 15 | +#include <linux/delay.h> | |
| 16 | +#include <linux/interrupt.h> | |
| 17 | +#include <linux/pci.h> | |
| 18 | +#include <linux/raid_class.h> | |
| 19 | +#include <asm/unaligned.h> | |
| 20 | +#include <scsi/scsi.h> | |
| 21 | +#include <scsi/scsi_host.h> | |
| 22 | +#include <scsi/scsi_device.h> | |
| 23 | +#include <scsi/scsi_cmnd.h> | |
| 24 | +#include <scsi/scsi_tcq.h> | |
| 25 | +#include "myrb.h" | |
| 26 | + | |
| 27 | +static struct raid_template *myrb_raid_template; | |
| 28 | + | |
| 29 | +static void myrb_monitor(struct work_struct *work); | |
| 30 | +static inline void myrb_translate_devstate(void *DeviceState); | |
| 31 | + | |
| 32 | +static inline int myrb_logical_channel(struct Scsi_Host *shost) | |
| 33 | +{ | |
| 34 | + return shost->max_channel - 1; | |
| 35 | +} | |
| 36 | + | |
| 37 | +static struct myrb_devstate_name_entry { | |
| 38 | + enum myrb_devstate state; | |
| 39 | + const char *name; | |
| 40 | +} myrb_devstate_name_list[] = { | |
| 41 | + { MYRB_DEVICE_DEAD, "Dead" }, | |
| 42 | + { MYRB_DEVICE_WO, "WriteOnly" }, | |
| 43 | + { MYRB_DEVICE_ONLINE, "Online" }, | |
| 44 | + { MYRB_DEVICE_CRITICAL, "Critical" }, | |
| 45 | + { MYRB_DEVICE_STANDBY, "Standby" }, | |
| 46 | + { MYRB_DEVICE_OFFLINE, "Offline" }, | |
| 47 | +}; | |
| 48 | + | |
| 49 | +static const char *myrb_devstate_name(enum myrb_devstate state) | |
| 50 | +{ | |
| 51 | + struct myrb_devstate_name_entry *entry = myrb_devstate_name_list; | |
| 52 | + int i; | |
| 53 | + | |
| 54 | + for (i = 0; i < ARRAY_SIZE(myrb_devstate_name_list); i++) { | |
| 55 | + if (entry[i].state == state) | |
| 56 | + return entry[i].name; | |
| 57 | + } | |
| 58 | + return "Unknown"; | |
| 59 | +} | |
| 60 | + | |
| 61 | +static struct myrb_raidlevel_name_entry { | |
| 62 | + enum myrb_raidlevel level; | |
| 63 | + const char *name; | |
| 64 | +} myrb_raidlevel_name_list[] = { | |
| 65 | + { MYRB_RAID_LEVEL0, "RAID0" }, | |
| 66 | + { MYRB_RAID_LEVEL1, "RAID1" }, | |
| 67 | + { MYRB_RAID_LEVEL3, "RAID3" }, | |
| 68 | + { MYRB_RAID_LEVEL5, "RAID5" }, | |
| 69 | + { MYRB_RAID_LEVEL6, "RAID6" }, | |
| 70 | + { MYRB_RAID_JBOD, "JBOD" }, | |
| 71 | +}; | |
| 72 | + | |
| 73 | +static const char *myrb_raidlevel_name(enum myrb_raidlevel level) | |
| 74 | +{ | |
| 75 | + struct myrb_raidlevel_name_entry *entry = myrb_raidlevel_name_list; | |
| 76 | + int i; | |
| 77 | + | |
| 78 | + for (i = 0; i < ARRAY_SIZE(myrb_raidlevel_name_list); i++) { | |
| 79 | + if (entry[i].level == level) | |
| 80 | + return entry[i].name; | |
| 81 | + } | |
| 82 | + return NULL; | |
| 83 | +} | |
| 84 | + | |
| 85 | +/** | |
| 86 | + * myrb_create_mempools - allocates auxiliary data structures | |
| 87 | + * | |
| 88 | + * Return: true on success, false otherwise. | |
| 89 | + */ | |
| 90 | +static bool myrb_create_mempools(struct pci_dev *pdev, struct myrb_hba *cb) | |
| 91 | +{ | |
| 92 | + size_t elem_size, elem_align; | |
| 93 | + | |
| 94 | + elem_align = sizeof(struct myrb_sge); | |
| 95 | + elem_size = cb->host->sg_tablesize * elem_align; | |
| 96 | + cb->sg_pool = dma_pool_create("myrb_sg", &pdev->dev, | |
| 97 | + elem_size, elem_align, 0); | |
| 98 | + if (cb->sg_pool == NULL) { | |
| 99 | + shost_printk(KERN_ERR, cb->host, | |
| 100 | + "Failed to allocate SG pool\n"); | |
| 101 | + return false; | |
| 102 | + } | |
| 103 | + | |
| 104 | + cb->dcdb_pool = dma_pool_create("myrb_dcdb", &pdev->dev, | |
| 105 | + sizeof(struct myrb_dcdb), | |
| 106 | + sizeof(unsigned int), 0); | |
| 107 | + if (!cb->dcdb_pool) { | |
| 108 | + dma_pool_destroy(cb->sg_pool); | |
| 109 | + cb->sg_pool = NULL; | |
| 110 | + shost_printk(KERN_ERR, cb->host, | |
| 111 | + "Failed to allocate DCDB pool\n"); | |
| 112 | + return false; | |
| 113 | + } | |
| 114 | + | |
| 115 | + snprintf(cb->work_q_name, sizeof(cb->work_q_name), | |
| 116 | + "myrb_wq_%d", cb->host->host_no); | |
| 117 | + cb->work_q = create_singlethread_workqueue(cb->work_q_name); | |
| 118 | + if (!cb->work_q) { | |
| 119 | + dma_pool_destroy(cb->dcdb_pool); | |
| 120 | + cb->dcdb_pool = NULL; | |
| 121 | + dma_pool_destroy(cb->sg_pool); | |
| 122 | + cb->sg_pool = NULL; | |
| 123 | + shost_printk(KERN_ERR, cb->host, | |
| 124 | + "Failed to create workqueue\n"); | |
| 125 | + return false; | |
| 126 | + } | |
| 127 | + | |
| 128 | + /* | |
| 129 | + * Initialize the Monitoring Timer. | |
| 130 | + */ | |
| 131 | + INIT_DELAYED_WORK(&cb->monitor_work, myrb_monitor); | |
| 132 | + queue_delayed_work(cb->work_q, &cb->monitor_work, 1); | |
| 133 | + | |
| 134 | + return true; | |
| 135 | +} | |
| 136 | + | |
| 137 | +/** | |
| 138 | + * myrb_destroy_mempools - tears down the memory pools for the controller | |
| 139 | + */ | |
| 140 | +static void myrb_destroy_mempools(struct myrb_hba *cb) | |
| 141 | +{ | |
| 142 | + cancel_delayed_work_sync(&cb->monitor_work); | |
| 143 | + destroy_workqueue(cb->work_q); | |
| 144 | + | |
| 145 | + dma_pool_destroy(cb->sg_pool); | |
| 146 | + dma_pool_destroy(cb->dcdb_pool); | |
| 147 | +} | |
| 148 | + | |
| 149 | +/** | |
| 150 | + * myrb_reset_cmd - reset command block | |
| 151 | + */ | |
| 152 | +static inline void myrb_reset_cmd(struct myrb_cmdblk *cmd_blk) | |
| 153 | +{ | |
| 154 | + union myrb_cmd_mbox *mbox = &cmd_blk->mbox; | |
| 155 | + | |
| 156 | + memset(mbox, 0, sizeof(union myrb_cmd_mbox)); | |
| 157 | + cmd_blk->status = 0; | |
| 158 | +} | |
| 159 | + | |
| 160 | +/** | |
| 161 | + * myrb_qcmd - queues command block for execution | |
| 162 | + */ | |
| 163 | +static void myrb_qcmd(struct myrb_hba *cb, struct myrb_cmdblk *cmd_blk) | |
| 164 | +{ | |
| 165 | + void __iomem *base = cb->io_base; | |
| 166 | + union myrb_cmd_mbox *mbox = &cmd_blk->mbox; | |
| 167 | + union myrb_cmd_mbox *next_mbox = cb->next_cmd_mbox; | |
| 168 | + | |
| 169 | + cb->write_cmd_mbox(next_mbox, mbox); | |
| 170 | + if (cb->prev_cmd_mbox1->words[0] == 0 || | |
| 171 | + cb->prev_cmd_mbox2->words[0] == 0) | |
| 172 | + cb->get_cmd_mbox(base); | |
| 173 | + cb->prev_cmd_mbox2 = cb->prev_cmd_mbox1; | |
| 174 | + cb->prev_cmd_mbox1 = next_mbox; | |
| 175 | + if (++next_mbox > cb->last_cmd_mbox) | |
| 176 | + next_mbox = cb->first_cmd_mbox; | |
| 177 | + cb->next_cmd_mbox = next_mbox; | |
| 178 | +} | |
| 179 | + | |
| 180 | +/** | |
| 181 | + * myrb_exec_cmd - executes command block and waits for completion. | |
| 182 | + * | |
| 183 | + * Return: command status | |
| 184 | + */ | |
| 185 | +static unsigned short myrb_exec_cmd(struct myrb_hba *cb, | |
| 186 | + struct myrb_cmdblk *cmd_blk) | |
| 187 | +{ | |
| 188 | + DECLARE_COMPLETION_ONSTACK(cmpl); | |
| 189 | + unsigned long flags; | |
| 190 | + | |
| 191 | + cmd_blk->completion = &cmpl; | |
| 192 | + | |
| 193 | + spin_lock_irqsave(&cb->queue_lock, flags); | |
| 194 | + cb->qcmd(cb, cmd_blk); | |
| 195 | + spin_unlock_irqrestore(&cb->queue_lock, flags); | |
| 196 | + | |
| 197 | + WARN_ON(in_interrupt()); | |
| 198 | + wait_for_completion(&cmpl); | |
| 199 | + return cmd_blk->status; | |
| 200 | +} | |
| 201 | + | |
| 202 | +/** | |
| 203 | + * myrb_exec_type3 - executes a type 3 command and waits for completion. | |
| 204 | + * | |
| 205 | + * Return: command status | |
| 206 | + */ | |
| 207 | +static unsigned short myrb_exec_type3(struct myrb_hba *cb, | |
| 208 | + enum myrb_cmd_opcode op, dma_addr_t addr) | |
| 209 | +{ | |
| 210 | + struct myrb_cmdblk *cmd_blk = &cb->dcmd_blk; | |
| 211 | + union myrb_cmd_mbox *mbox = &cmd_blk->mbox; | |
| 212 | + unsigned short status; | |
| 213 | + | |
| 214 | + mutex_lock(&cb->dcmd_mutex); | |
| 215 | + myrb_reset_cmd(cmd_blk); | |
| 216 | + mbox->type3.id = MYRB_DCMD_TAG; | |
| 217 | + mbox->type3.opcode = op; | |
| 218 | + mbox->type3.addr = addr; | |
| 219 | + status = myrb_exec_cmd(cb, cmd_blk); | |
| 220 | + mutex_unlock(&cb->dcmd_mutex); | |
| 221 | + return status; | |
| 222 | +} | |
| 223 | + | |
| 224 | +/** | |
| 225 | + * myrb_exec_type3D - executes a type 3D command and waits for completion. | |
| 226 | + * | |
| 227 | + * Return: command status | |
| 228 | + */ | |
| 229 | +static unsigned short myrb_exec_type3D(struct myrb_hba *cb, | |
| 230 | + enum myrb_cmd_opcode op, struct scsi_device *sdev, | |
| 231 | + struct myrb_pdev_state *pdev_info) | |
| 232 | +{ | |
| 233 | + struct myrb_cmdblk *cmd_blk = &cb->dcmd_blk; | |
| 234 | + union myrb_cmd_mbox *mbox = &cmd_blk->mbox; | |
| 235 | + unsigned short status; | |
| 236 | + dma_addr_t pdev_info_addr; | |
| 237 | + | |
| 238 | + pdev_info_addr = dma_map_single(&cb->pdev->dev, pdev_info, | |
| 239 | + sizeof(struct myrb_pdev_state), | |
| 240 | + DMA_FROM_DEVICE); | |
| 241 | + if (dma_mapping_error(&cb->pdev->dev, pdev_info_addr)) | |
| 242 | + return MYRB_STATUS_SUBSYS_FAILED; | |
| 243 | + | |
| 244 | + mutex_lock(&cb->dcmd_mutex); | |
| 245 | + myrb_reset_cmd(cmd_blk); | |
| 246 | + mbox->type3D.id = MYRB_DCMD_TAG; | |
| 247 | + mbox->type3D.opcode = op; | |
| 248 | + mbox->type3D.channel = sdev->channel; | |
| 249 | + mbox->type3D.target = sdev->id; | |
| 250 | + mbox->type3D.addr = pdev_info_addr; | |
| 251 | + status = myrb_exec_cmd(cb, cmd_blk); | |
| 252 | + mutex_unlock(&cb->dcmd_mutex); | |
| 253 | + dma_unmap_single(&cb->pdev->dev, pdev_info_addr, | |
| 254 | + sizeof(struct myrb_pdev_state), DMA_FROM_DEVICE); | |
| 255 | + if (status == MYRB_STATUS_SUCCESS && | |
| 256 | + mbox->type3D.opcode == MYRB_CMD_GET_DEVICE_STATE_OLD) | |
| 257 | + myrb_translate_devstate(pdev_info); | |
| 258 | + | |
| 259 | + return status; | |
| 260 | +} | |
| 261 | + | |
| 262 | +static char *myrb_event_msg[] = { | |
| 263 | + "killed because write recovery failed", | |
| 264 | + "killed because of SCSI bus reset failure", | |
| 265 | + "killed because of double check condition", | |
| 266 | + "killed because it was removed", | |
| 267 | + "killed because of gross error on SCSI chip", | |
| 268 | + "killed because of bad tag returned from drive", | |
| 269 | + "killed because of timeout on SCSI command", | |
| 270 | + "killed because of reset SCSI command issued from system", | |
| 271 | + "killed because busy or parity error count exceeded limit", | |
| 272 | + "killed because of 'kill drive' command from system", | |
| 273 | + "killed because of selection timeout", | |
| 274 | + "killed due to SCSI phase sequence error", | |
| 275 | + "killed due to unknown status", | |
| 276 | +}; | |
| 277 | + | |
| 278 | +/** | |
| 279 | + * myrb_get_event - get event log from HBA | |
| 280 | + * @cb: pointer to the hba structure | |
| 281 | + * @event: number of the event | |
| 282 | + * | |
| 283 | + * Execute a type 3E command and logs the event message | |
| 284 | + */ | |
| 285 | +static void myrb_get_event(struct myrb_hba *cb, unsigned int event) | |
| 286 | +{ | |
| 287 | + struct myrb_cmdblk *cmd_blk = &cb->mcmd_blk; | |
| 288 | + union myrb_cmd_mbox *mbox = &cmd_blk->mbox; | |
| 289 | + struct myrb_log_entry *ev_buf; | |
| 290 | + dma_addr_t ev_addr; | |
| 291 | + unsigned short status; | |
| 292 | + | |
| 293 | + ev_buf = dma_alloc_coherent(&cb->pdev->dev, | |
| 294 | + sizeof(struct myrb_log_entry), | |
| 295 | + &ev_addr, GFP_KERNEL); | |
| 296 | + if (!ev_buf) | |
| 297 | + return; | |
| 298 | + | |
| 299 | + myrb_reset_cmd(cmd_blk); | |
| 300 | + mbox->type3E.id = MYRB_MCMD_TAG; | |
| 301 | + mbox->type3E.opcode = MYRB_CMD_EVENT_LOG_OPERATION; | |
| 302 | + mbox->type3E.optype = DAC960_V1_GetEventLogEntry; | |
| 303 | + mbox->type3E.opqual = 1; | |
| 304 | + mbox->type3E.ev_seq = event; | |
| 305 | + mbox->type3E.addr = ev_addr; | |
| 306 | + status = myrb_exec_cmd(cb, cmd_blk); | |
| 307 | + if (status != MYRB_STATUS_SUCCESS) | |
| 308 | + shost_printk(KERN_INFO, cb->host, | |
| 309 | + "Failed to get event log %d, status %04x\n", | |
| 310 | + event, status); | |
| 311 | + | |
| 312 | + else if (ev_buf->seq_num == event) { | |
| 313 | + struct scsi_sense_hdr sshdr; | |
| 314 | + | |
| 315 | + memset(&sshdr, 0, sizeof(sshdr)); | |
| 316 | + scsi_normalize_sense(ev_buf->sense, 32, &sshdr); | |
| 317 | + | |
| 318 | + if (sshdr.sense_key == VENDOR_SPECIFIC && | |
| 319 | + sshdr.asc == 0x80 && | |
| 320 | + sshdr.ascq < ARRAY_SIZE(myrb_event_msg)) | |
| 321 | + shost_printk(KERN_CRIT, cb->host, | |
| 322 | + "Physical drive %d:%d: %s\n", | |
| 323 | + ev_buf->channel, ev_buf->target, | |
| 324 | + myrb_event_msg[sshdr.ascq]); | |
| 325 | + else | |
| 326 | + shost_printk(KERN_CRIT, cb->host, | |
| 327 | + "Physical drive %d:%d: Sense: %X/%02X/%02X\n", | |
| 328 | + ev_buf->channel, ev_buf->target, | |
| 329 | + sshdr.sense_key, sshdr.asc, sshdr.ascq); | |
| 330 | + } | |
| 331 | + | |
| 332 | + dma_free_coherent(&cb->pdev->dev, sizeof(struct myrb_log_entry), | |
| 333 | + ev_buf, ev_addr); | |
| 334 | +} | |
| 335 | + | |
| 336 | +/** | |
| 337 | + * myrb_get_errtable - retrieves the error table from the controller | |
| 338 | + * | |
| 339 | + * Executes a type 3 command and logs the error table from the controller. | |
| 340 | + */ | |
| 341 | +static void myrb_get_errtable(struct myrb_hba *cb) | |
| 342 | +{ | |
| 343 | + struct myrb_cmdblk *cmd_blk = &cb->mcmd_blk; | |
| 344 | + union myrb_cmd_mbox *mbox = &cmd_blk->mbox; | |
| 345 | + unsigned short status; | |
| 346 | + struct myrb_error_entry old_table[MYRB_MAX_CHANNELS * MYRB_MAX_TARGETS]; | |
| 347 | + | |
| 348 | + memcpy(&old_table, cb->err_table, sizeof(old_table)); | |
| 349 | + | |
| 350 | + myrb_reset_cmd(cmd_blk); | |
| 351 | + mbox->type3.id = MYRB_MCMD_TAG; | |
| 352 | + mbox->type3.opcode = MYRB_CMD_GET_ERROR_TABLE; | |
| 353 | + mbox->type3.addr = cb->err_table_addr; | |
| 354 | + status = myrb_exec_cmd(cb, cmd_blk); | |
| 355 | + if (status == MYRB_STATUS_SUCCESS) { | |
| 356 | + struct myrb_error_entry *table = cb->err_table; | |
| 357 | + struct myrb_error_entry *new, *old; | |
| 358 | + size_t err_table_offset; | |
| 359 | + struct scsi_device *sdev; | |
| 360 | + | |
| 361 | + shost_for_each_device(sdev, cb->host) { | |
| 362 | + if (sdev->channel >= myrb_logical_channel(cb->host)) | |
| 363 | + continue; | |
| 364 | + err_table_offset = sdev->channel * MYRB_MAX_TARGETS | |
| 365 | + + sdev->id; | |
| 366 | + new = table + err_table_offset; | |
| 367 | + old = &old_table[err_table_offset]; | |
| 368 | + if (new->parity_err == old->parity_err && | |
| 369 | + new->soft_err == old->soft_err && | |
| 370 | + new->hard_err == old->hard_err && | |
| 371 | + new->misc_err == old->misc_err) | |
| 372 | + continue; | |
| 373 | + sdev_printk(KERN_CRIT, sdev, | |
| 374 | + "Errors: Parity = %d, Soft = %d, Hard = %d, Misc = %d\n", | |
| 375 | + new->parity_err, new->soft_err, | |
| 376 | + new->hard_err, new->misc_err); | |
| 377 | + } | |
| 378 | + } | |
| 379 | +} | |
| 380 | + | |
| 381 | +/** | |
| 382 | + * myrb_get_ldev_info - retrieves the logical device table from the controller | |
| 383 | + * | |
| 384 | + * Executes a type 3 command and updates the logical device table. | |
| 385 | + * | |
| 386 | + * Return: command status | |
| 387 | + */ | |
| 388 | +static unsigned short myrb_get_ldev_info(struct myrb_hba *cb) | |
| 389 | +{ | |
| 390 | + unsigned short status; | |
| 391 | + int ldev_num, ldev_cnt = cb->enquiry->ldev_count; | |
| 392 | + struct Scsi_Host *shost = cb->host; | |
| 393 | + | |
| 394 | + status = myrb_exec_type3(cb, MYRB_CMD_GET_LDEV_INFO, | |
| 395 | + cb->ldev_info_addr); | |
| 396 | + if (status != MYRB_STATUS_SUCCESS) | |
| 397 | + return status; | |
| 398 | + | |
| 399 | + for (ldev_num = 0; ldev_num < ldev_cnt; ldev_num++) { | |
| 400 | + struct myrb_ldev_info *old = NULL; | |
| 401 | + struct myrb_ldev_info *new = cb->ldev_info_buf + ldev_num; | |
| 402 | + struct scsi_device *sdev; | |
| 403 | + | |
| 404 | + sdev = scsi_device_lookup(shost, myrb_logical_channel(shost), | |
| 405 | + ldev_num, 0); | |
| 406 | + if (!sdev) { | |
| 407 | + if (new->state == MYRB_DEVICE_OFFLINE) | |
| 408 | + continue; | |
| 409 | + shost_printk(KERN_INFO, shost, | |
| 410 | + "Adding Logical Drive %d in state %s\n", | |
| 411 | + ldev_num, myrb_devstate_name(new->state)); | |
| 412 | + scsi_add_device(shost, myrb_logical_channel(shost), | |
| 413 | + ldev_num, 0); | |
| 414 | + continue; | |
| 415 | + } | |
| 416 | + old = sdev->hostdata; | |
| 417 | + if (new->state != old->state) | |
| 418 | + shost_printk(KERN_INFO, shost, | |
| 419 | + "Logical Drive %d is now %s\n", | |
| 420 | + ldev_num, myrb_devstate_name(new->state)); | |
| 421 | + if (new->wb_enabled != old->wb_enabled) | |
| 422 | + sdev_printk(KERN_INFO, sdev, | |
| 423 | + "Logical Drive is now WRITE %s\n", | |
| 424 | + (new->wb_enabled ? "BACK" : "THRU")); | |
| 425 | + memcpy(old, new, sizeof(*new)); | |
| 426 | + scsi_device_put(sdev); | |
| 427 | + } | |
| 428 | + return status; | |
| 429 | +} | |
| 430 | + | |
| 431 | +/** | |
| 432 | + * myrb_get_rbld_progress - get rebuild progress information | |
| 433 | + * | |
| 434 | + * Executes a type 3 command and returns the rebuild progress | |
| 435 | + * information. | |
| 436 | + * | |
| 437 | + * Return: command status | |
| 438 | + */ | |
| 439 | +static unsigned short myrb_get_rbld_progress(struct myrb_hba *cb, | |
| 440 | + struct myrb_rbld_progress *rbld) | |
| 441 | +{ | |
| 442 | + struct myrb_cmdblk *cmd_blk = &cb->mcmd_blk; | |
| 443 | + union myrb_cmd_mbox *mbox = &cmd_blk->mbox; | |
| 444 | + struct myrb_rbld_progress *rbld_buf; | |
| 445 | + dma_addr_t rbld_addr; | |
| 446 | + unsigned short status; | |
| 447 | + | |
| 448 | + rbld_buf = dma_alloc_coherent(&cb->pdev->dev, | |
| 449 | + sizeof(struct myrb_rbld_progress), | |
| 450 | + &rbld_addr, GFP_KERNEL); | |
| 451 | + if (!rbld_buf) | |
| 452 | + return MYRB_STATUS_RBLD_NOT_CHECKED; | |
| 453 | + | |
| 454 | + myrb_reset_cmd(cmd_blk); | |
| 455 | + mbox->type3.id = MYRB_MCMD_TAG; | |
| 456 | + mbox->type3.opcode = MYRB_CMD_GET_REBUILD_PROGRESS; | |
| 457 | + mbox->type3.addr = rbld_addr; | |
| 458 | + status = myrb_exec_cmd(cb, cmd_blk); | |
| 459 | + if (rbld) | |
| 460 | + memcpy(rbld, rbld_buf, sizeof(struct myrb_rbld_progress)); | |
| 461 | + dma_free_coherent(&cb->pdev->dev, sizeof(struct myrb_rbld_progress), | |
| 462 | + rbld_buf, rbld_addr); | |
| 463 | + return status; | |
| 464 | +} | |
| 465 | + | |
| 466 | +/** | |
| 467 | + * myrb_update_rbld_progress - updates the rebuild status | |
| 468 | + * | |
| 469 | + * Updates the rebuild status for the attached logical devices. | |
| 470 | + * | |
| 471 | + */ | |
| 472 | +static void myrb_update_rbld_progress(struct myrb_hba *cb) | |
| 473 | +{ | |
| 474 | + struct myrb_rbld_progress rbld_buf; | |
| 475 | + unsigned short status; | |
| 476 | + | |
| 477 | + status = myrb_get_rbld_progress(cb, &rbld_buf); | |
| 478 | + if (status == MYRB_NO_STDBY_RBLD_OR_CHECK_IN_PROGRESS && | |
| 479 | + cb->last_rbld_status == MYRB_STATUS_SUCCESS) | |
| 480 | + status = MYRB_STATUS_RBLD_SUCCESS; | |
| 481 | + if (status != MYRB_NO_STDBY_RBLD_OR_CHECK_IN_PROGRESS) { | |
| 482 | + unsigned int blocks_done = | |
| 483 | + rbld_buf.ldev_size - rbld_buf.blocks_left; | |
| 484 | + struct scsi_device *sdev; | |
| 485 | + | |
| 486 | + sdev = scsi_device_lookup(cb->host, | |
| 487 | + myrb_logical_channel(cb->host), | |
| 488 | + rbld_buf.ldev_num, 0); | |
| 489 | + if (!sdev) | |
| 490 | + return; | |
| 491 | + | |
| 492 | + switch (status) { | |
| 493 | + case MYRB_STATUS_SUCCESS: | |
| 494 | + sdev_printk(KERN_INFO, sdev, | |
| 495 | + "Rebuild in Progress, %d%% completed\n", | |
| 496 | + (100 * (blocks_done >> 7)) | |
| 497 | + / (rbld_buf.ldev_size >> 7)); | |
| 498 | + break; | |
| 499 | + case MYRB_STATUS_RBLD_FAILED_LDEV_FAILURE: | |
| 500 | + sdev_printk(KERN_INFO, sdev, | |
| 501 | + "Rebuild Failed due to Logical Drive Failure\n"); | |
| 502 | + break; | |
| 503 | + case MYRB_STATUS_RBLD_FAILED_BADBLOCKS: | |
| 504 | + sdev_printk(KERN_INFO, sdev, | |
| 505 | + "Rebuild Failed due to Bad Blocks on Other Drives\n"); | |
| 506 | + break; | |
| 507 | + case MYRB_STATUS_RBLD_FAILED_NEW_DRIVE_FAILED: | |
| 508 | + sdev_printk(KERN_INFO, sdev, | |
| 509 | + "Rebuild Failed due to Failure of Drive Being Rebuilt\n"); | |
| 510 | + break; | |
| 511 | + case MYRB_STATUS_RBLD_SUCCESS: | |
| 512 | + sdev_printk(KERN_INFO, sdev, | |
| 513 | + "Rebuild Completed Successfully\n"); | |
| 514 | + break; | |
| 515 | + case MYRB_STATUS_RBLD_SUCCESS_TERMINATED: | |
| 516 | + sdev_printk(KERN_INFO, sdev, | |
| 517 | + "Rebuild Successfully Terminated\n"); | |
| 518 | + break; | |
| 519 | + default: | |
| 520 | + break; | |
| 521 | + } | |
| 522 | + scsi_device_put(sdev); | |
| 523 | + } | |
| 524 | + cb->last_rbld_status = status; | |
| 525 | +} | |
| 526 | + | |
| 527 | +/** | |
| 528 | + * myrb_get_cc_progress - retrieve the rebuild status | |
| 529 | + * | |
| 530 | + * Execute a type 3 Command and fetch the rebuild / consistency check | |
| 531 | + * status. | |
| 532 | + */ | |
| 533 | +static void myrb_get_cc_progress(struct myrb_hba *cb) | |
| 534 | +{ | |
| 535 | + struct myrb_cmdblk *cmd_blk = &cb->mcmd_blk; | |
| 536 | + union myrb_cmd_mbox *mbox = &cmd_blk->mbox; | |
| 537 | + struct myrb_rbld_progress *rbld_buf; | |
| 538 | + dma_addr_t rbld_addr; | |
| 539 | + unsigned short status; | |
| 540 | + | |
| 541 | + rbld_buf = dma_alloc_coherent(&cb->pdev->dev, | |
| 542 | + sizeof(struct myrb_rbld_progress), | |
| 543 | + &rbld_addr, GFP_KERNEL); | |
| 544 | + if (!rbld_buf) { | |
| 545 | + cb->need_cc_status = true; | |
| 546 | + return; | |
| 547 | + } | |
| 548 | + myrb_reset_cmd(cmd_blk); | |
| 549 | + mbox->type3.id = MYRB_MCMD_TAG; | |
| 550 | + mbox->type3.opcode = MYRB_CMD_REBUILD_STAT; | |
| 551 | + mbox->type3.addr = rbld_addr; | |
| 552 | + status = myrb_exec_cmd(cb, cmd_blk); | |
| 553 | + if (status == MYRB_STATUS_SUCCESS) { | |
| 554 | + unsigned int ldev_num = rbld_buf->ldev_num; | |
| 555 | + unsigned int ldev_size = rbld_buf->ldev_size; | |
| 556 | + unsigned int blocks_done = | |
| 557 | + ldev_size - rbld_buf->blocks_left; | |
| 558 | + struct scsi_device *sdev; | |
| 559 | + | |
| 560 | + sdev = scsi_device_lookup(cb->host, | |
| 561 | + myrb_logical_channel(cb->host), | |
| 562 | + ldev_num, 0); | |
| 563 | + if (sdev) { | |
| 564 | + sdev_printk(KERN_INFO, sdev, | |
| 565 | + "Consistency Check in Progress: %d%% completed\n", | |
| 566 | + (100 * (blocks_done >> 7)) | |
| 567 | + / (ldev_size >> 7)); | |
| 568 | + scsi_device_put(sdev); | |
| 569 | + } | |
| 570 | + } | |
| 571 | + dma_free_coherent(&cb->pdev->dev, sizeof(struct myrb_rbld_progress), | |
| 572 | + rbld_buf, rbld_addr); | |
| 573 | +} | |
| 574 | + | |
| 575 | +/** | |
| 576 | + * myrb_bgi_control - updates background initialisation status | |
| 577 | + * | |
| 578 | + * Executes a type 3B command and updates the background initialisation status | |
| 579 | + */ | |
| 580 | +static void myrb_bgi_control(struct myrb_hba *cb) | |
| 581 | +{ | |
| 582 | + struct myrb_cmdblk *cmd_blk = &cb->mcmd_blk; | |
| 583 | + union myrb_cmd_mbox *mbox = &cmd_blk->mbox; | |
| 584 | + struct myrb_bgi_status *bgi, *last_bgi; | |
| 585 | + dma_addr_t bgi_addr; | |
| 586 | + struct scsi_device *sdev = NULL; | |
| 587 | + unsigned short status; | |
| 588 | + | |
| 589 | + bgi = dma_alloc_coherent(&cb->pdev->dev, sizeof(struct myrb_bgi_status), | |
| 590 | + &bgi_addr, GFP_KERNEL); | |
| 591 | + if (!bgi) { | |
| 592 | + shost_printk(KERN_ERR, cb->host, | |
| 593 | + "Failed to allocate bgi memory\n"); | |
| 594 | + return; | |
| 595 | + } | |
| 596 | + myrb_reset_cmd(cmd_blk); | |
| 597 | + mbox->type3B.id = MYRB_DCMD_TAG; | |
| 598 | + mbox->type3B.opcode = MYRB_CMD_BGI_CONTROL; | |
| 599 | + mbox->type3B.optype = 0x20; | |
| 600 | + mbox->type3B.addr = bgi_addr; | |
| 601 | + status = myrb_exec_cmd(cb, cmd_blk); | |
| 602 | + last_bgi = &cb->bgi_status; | |
| 603 | + sdev = scsi_device_lookup(cb->host, | |
| 604 | + myrb_logical_channel(cb->host), | |
| 605 | + bgi->ldev_num, 0); | |
| 606 | + switch (status) { | |
| 607 | + case MYRB_STATUS_SUCCESS: | |
| 608 | + switch (bgi->status) { | |
| 609 | + case MYRB_BGI_INVALID: | |
| 610 | + break; | |
| 611 | + case MYRB_BGI_STARTED: | |
| 612 | + if (!sdev) | |
| 613 | + break; | |
| 614 | + sdev_printk(KERN_INFO, sdev, | |
| 615 | + "Background Initialization Started\n"); | |
| 616 | + break; | |
| 617 | + case MYRB_BGI_INPROGRESS: | |
| 618 | + if (!sdev) | |
| 619 | + break; | |
| 620 | + if (bgi->blocks_done == last_bgi->blocks_done && | |
| 621 | + bgi->ldev_num == last_bgi->ldev_num) | |
| 622 | + break; | |
| 623 | + sdev_printk(KERN_INFO, sdev, | |
| 624 | + "Background Initialization in Progress: %d%% completed\n", | |
| 625 | + (100 * (bgi->blocks_done >> 7)) | |
| 626 | + / (bgi->ldev_size >> 7)); | |
| 627 | + break; | |
| 628 | + case MYRB_BGI_SUSPENDED: | |
| 629 | + if (!sdev) | |
| 630 | + break; | |
| 631 | + sdev_printk(KERN_INFO, sdev, | |
| 632 | + "Background Initialization Suspended\n"); | |
| 633 | + break; | |
| 634 | + case MYRB_BGI_CANCELLED: | |
| 635 | + if (!sdev) | |
| 636 | + break; | |
| 637 | + sdev_printk(KERN_INFO, sdev, | |
| 638 | + "Background Initialization Cancelled\n"); | |
| 639 | + break; | |
| 640 | + } | |
| 641 | + memcpy(&cb->bgi_status, bgi, sizeof(struct myrb_bgi_status)); | |
| 642 | + break; | |
| 643 | + case MYRB_STATUS_BGI_SUCCESS: | |
| 644 | + if (sdev && cb->bgi_status.status == MYRB_BGI_INPROGRESS) | |
| 645 | + sdev_printk(KERN_INFO, sdev, | |
| 646 | + "Background Initialization Completed Successfully\n"); | |
| 647 | + cb->bgi_status.status = MYRB_BGI_INVALID; | |
| 648 | + break; | |
| 649 | + case MYRB_STATUS_BGI_ABORTED: | |
| 650 | + if (sdev && cb->bgi_status.status == MYRB_BGI_INPROGRESS) | |
| 651 | + sdev_printk(KERN_INFO, sdev, | |
| 652 | + "Background Initialization Aborted\n"); | |
| 653 | + /* Fallthrough */ | |
| 654 | + case MYRB_STATUS_NO_BGI_INPROGRESS: | |
| 655 | + cb->bgi_status.status = MYRB_BGI_INVALID; | |
| 656 | + break; | |
| 657 | + } | |
| 658 | + if (sdev) | |
| 659 | + scsi_device_put(sdev); | |
| 660 | + dma_free_coherent(&cb->pdev->dev, sizeof(struct myrb_bgi_status), | |
| 661 | + bgi, bgi_addr); | |
| 662 | +} | |
| 663 | + | |
| 664 | +/** | |
| 665 | + * myrb_hba_enquiry - updates the controller status | |
| 666 | + * | |
| 667 | + * Executes a DAC_V1_Enquiry command and updates the controller status. | |
| 668 | + * | |
| 669 | + * Return: command status | |
| 670 | + */ | |
| 671 | +static unsigned short myrb_hba_enquiry(struct myrb_hba *cb) | |
| 672 | +{ | |
| 673 | + struct myrb_enquiry old, *new; | |
| 674 | + unsigned short status; | |
| 675 | + | |
| 676 | + memcpy(&old, cb->enquiry, sizeof(struct myrb_enquiry)); | |
| 677 | + | |
| 678 | + status = myrb_exec_type3(cb, MYRB_CMD_ENQUIRY, cb->enquiry_addr); | |
| 679 | + if (status != MYRB_STATUS_SUCCESS) | |
| 680 | + return status; | |
| 681 | + | |
| 682 | + new = cb->enquiry; | |
| 683 | + if (new->ldev_count > old.ldev_count) { | |
| 684 | + int ldev_num = old.ldev_count - 1; | |
| 685 | + | |
| 686 | + while (++ldev_num < new->ldev_count) | |
| 687 | + shost_printk(KERN_CRIT, cb->host, | |
| 688 | + "Logical Drive %d Now Exists\n", | |
| 689 | + ldev_num); | |
| 690 | + } | |
| 691 | + if (new->ldev_count < old.ldev_count) { | |
| 692 | + int ldev_num = new->ldev_count - 1; | |
| 693 | + | |
| 694 | + while (++ldev_num < old.ldev_count) | |
| 695 | + shost_printk(KERN_CRIT, cb->host, | |
| 696 | + "Logical Drive %d No Longer Exists\n", | |
| 697 | + ldev_num); | |
| 698 | + } | |
| 699 | + if (new->status.deferred != old.status.deferred) | |
| 700 | + shost_printk(KERN_CRIT, cb->host, | |
| 701 | + "Deferred Write Error Flag is now %s\n", | |
| 702 | + (new->status.deferred ? "TRUE" : "FALSE")); | |
| 703 | + if (new->ev_seq != old.ev_seq) { | |
| 704 | + cb->new_ev_seq = new->ev_seq; | |
| 705 | + cb->need_err_info = true; | |
| 706 | + shost_printk(KERN_INFO, cb->host, | |
| 707 | + "Event log %d/%d (%d/%d) available\n", | |
| 708 | + cb->old_ev_seq, cb->new_ev_seq, | |
| 709 | + old.ev_seq, new->ev_seq); | |
| 710 | + } | |
| 711 | + if ((new->ldev_critical > 0 && | |
| 712 | + new->ldev_critical != old.ldev_critical) || | |
| 713 | + (new->ldev_offline > 0 && | |
| 714 | + new->ldev_offline != old.ldev_offline) || | |
| 715 | + (new->ldev_count != old.ldev_count)) { | |
| 716 | + shost_printk(KERN_INFO, cb->host, | |
| 717 | + "Logical drive count changed (%d/%d/%d)\n", | |
| 718 | + new->ldev_critical, | |
| 719 | + new->ldev_offline, | |
| 720 | + new->ldev_count); | |
| 721 | + cb->need_ldev_info = true; | |
| 722 | + } | |
| 723 | + if (new->pdev_dead > 0 || | |
| 724 | + new->pdev_dead != old.pdev_dead || | |
| 725 | + time_after_eq(jiffies, cb->secondary_monitor_time | |
| 726 | + + MYRB_SECONDARY_MONITOR_INTERVAL)) { | |
| 727 | + cb->need_bgi_status = cb->bgi_status_supported; | |
| 728 | + cb->secondary_monitor_time = jiffies; | |
| 729 | + } | |
| 730 | + if (new->rbld == MYRB_STDBY_RBLD_IN_PROGRESS || | |
| 731 | + new->rbld == MYRB_BG_RBLD_IN_PROGRESS || | |
| 732 | + old.rbld == MYRB_STDBY_RBLD_IN_PROGRESS || | |
| 733 | + old.rbld == MYRB_BG_RBLD_IN_PROGRESS) { | |
| 734 | + cb->need_rbld = true; | |
| 735 | + cb->rbld_first = (new->ldev_critical < old.ldev_critical); | |
| 736 | + } | |
| 737 | + if (old.rbld == MYRB_BG_CHECK_IN_PROGRESS) | |
| 738 | + switch (new->rbld) { | |
| 739 | + case MYRB_NO_STDBY_RBLD_OR_CHECK_IN_PROGRESS: | |
| 740 | + shost_printk(KERN_INFO, cb->host, | |
| 741 | + "Consistency Check Completed Successfully\n"); | |
| 742 | + break; | |
| 743 | + case MYRB_STDBY_RBLD_IN_PROGRESS: | |
| 744 | + case MYRB_BG_RBLD_IN_PROGRESS: | |
| 745 | + break; | |
| 746 | + case MYRB_BG_CHECK_IN_PROGRESS: | |
| 747 | + cb->need_cc_status = true; | |
| 748 | + break; | |
| 749 | + case MYRB_STDBY_RBLD_COMPLETED_WITH_ERROR: | |
| 750 | + shost_printk(KERN_INFO, cb->host, | |
| 751 | + "Consistency Check Completed with Error\n"); | |
| 752 | + break; | |
| 753 | + case MYRB_BG_RBLD_OR_CHECK_FAILED_DRIVE_FAILED: | |
| 754 | + shost_printk(KERN_INFO, cb->host, | |
| 755 | + "Consistency Check Failed - Physical Device Failed\n"); | |
| 756 | + break; | |
| 757 | + case MYRB_BG_RBLD_OR_CHECK_FAILED_LDEV_FAILED: | |
| 758 | + shost_printk(KERN_INFO, cb->host, | |
| 759 | + "Consistency Check Failed - Logical Drive Failed\n"); | |
| 760 | + break; | |
| 761 | + case MYRB_BG_RBLD_OR_CHECK_FAILED_OTHER: | |
| 762 | + shost_printk(KERN_INFO, cb->host, | |
| 763 | + "Consistency Check Failed - Other Causes\n"); | |
| 764 | + break; | |
| 765 | + case MYRB_BG_RBLD_OR_CHECK_SUCCESS_TERMINATED: | |
| 766 | + shost_printk(KERN_INFO, cb->host, | |
| 767 | + "Consistency Check Successfully Terminated\n"); | |
| 768 | + break; | |
| 769 | + } | |
| 770 | + else if (new->rbld == MYRB_BG_CHECK_IN_PROGRESS) | |
| 771 | + cb->need_cc_status = true; | |
| 772 | + | |
| 773 | + return MYRB_STATUS_SUCCESS; | |
| 774 | +} | |
| 775 | + | |
| 776 | +/** | |
| 777 | + * myrb_set_pdev_state - sets the device state for a physical device | |
| 778 | + * | |
| 779 | + * Return: command status | |
| 780 | + */ | |
| 781 | +static unsigned short myrb_set_pdev_state(struct myrb_hba *cb, | |
| 782 | + struct scsi_device *sdev, enum myrb_devstate state) | |
| 783 | +{ | |
| 784 | + struct myrb_cmdblk *cmd_blk = &cb->dcmd_blk; | |
| 785 | + union myrb_cmd_mbox *mbox = &cmd_blk->mbox; | |
| 786 | + unsigned short status; | |
| 787 | + | |
| 788 | + mutex_lock(&cb->dcmd_mutex); | |
| 789 | + mbox->type3D.opcode = MYRB_CMD_START_DEVICE; | |
| 790 | + mbox->type3D.id = MYRB_DCMD_TAG; | |
| 791 | + mbox->type3D.channel = sdev->channel; | |
| 792 | + mbox->type3D.target = sdev->id; | |
| 793 | + mbox->type3D.state = state & 0x1F; | |
| 794 | + status = myrb_exec_cmd(cb, cmd_blk); | |
| 795 | + mutex_unlock(&cb->dcmd_mutex); | |
| 796 | + | |
| 797 | + return status; | |
| 798 | +} | |
| 799 | + | |
| 800 | +/** | |
| 801 | + * myrb_enable_mmio - enables the Memory Mailbox Interface | |
| 802 | + * | |
| 803 | + * PD and P controller types have no memory mailbox, but still need the | |
| 804 | + * other dma mapped memory. | |
| 805 | + * | |
| 806 | + * Return: true on success, false otherwise. | |
| 807 | + */ | |
| 808 | +static bool myrb_enable_mmio(struct myrb_hba *cb, mbox_mmio_init_t mmio_init_fn) | |
| 809 | +{ | |
| 810 | + void __iomem *base = cb->io_base; | |
| 811 | + struct pci_dev *pdev = cb->pdev; | |
| 812 | + size_t err_table_size; | |
| 813 | + size_t ldev_info_size; | |
| 814 | + union myrb_cmd_mbox *cmd_mbox_mem; | |
| 815 | + struct myrb_stat_mbox *stat_mbox_mem; | |
| 816 | + union myrb_cmd_mbox mbox; | |
| 817 | + unsigned short status; | |
| 818 | + | |
| 819 | + memset(&mbox, 0, sizeof(union myrb_cmd_mbox)); | |
| 820 | + | |
| 821 | + if (dma_set_mask(&pdev->dev, DMA_BIT_MASK(32))) { | |
| 822 | + dev_err(&pdev->dev, "DMA mask out of range\n"); | |
| 823 | + return false; | |
| 824 | + } | |
| 825 | + | |
| 826 | + cb->enquiry = dma_alloc_coherent(&pdev->dev, | |
| 827 | + sizeof(struct myrb_enquiry), | |
| 828 | + &cb->enquiry_addr, GFP_KERNEL); | |
| 829 | + if (!cb->enquiry) | |
| 830 | + return false; | |
| 831 | + | |
| 832 | + err_table_size = sizeof(struct myrb_error_entry) * | |
| 833 | + MYRB_MAX_CHANNELS * MYRB_MAX_TARGETS; | |
| 834 | + cb->err_table = dma_alloc_coherent(&pdev->dev, err_table_size, | |
| 835 | + &cb->err_table_addr, GFP_KERNEL); | |
| 836 | + if (!cb->err_table) | |
| 837 | + return false; | |
| 838 | + | |
| 839 | + ldev_info_size = sizeof(struct myrb_ldev_info) * MYRB_MAX_LDEVS; | |
| 840 | + cb->ldev_info_buf = dma_alloc_coherent(&pdev->dev, ldev_info_size, | |
| 841 | + &cb->ldev_info_addr, GFP_KERNEL); | |
| 842 | + if (!cb->ldev_info_buf) | |
| 843 | + return false; | |
| 844 | + | |
| 845 | + /* | |
| 846 | + * Skip mailbox initialisation for PD and P Controllers | |
| 847 | + */ | |
| 848 | + if (!mmio_init_fn) | |
| 849 | + return true; | |
| 850 | + | |
| 851 | + /* These are the base addresses for the command memory mailbox array */ | |
| 852 | + cb->cmd_mbox_size = MYRB_CMD_MBOX_COUNT * sizeof(union myrb_cmd_mbox); | |
| 853 | + cb->first_cmd_mbox = dma_alloc_coherent(&pdev->dev, | |
| 854 | + cb->cmd_mbox_size, | |
| 855 | + &cb->cmd_mbox_addr, | |
| 856 | + GFP_KERNEL); | |
| 857 | + if (!cb->first_cmd_mbox) | |
| 858 | + return false; | |
| 859 | + | |
| 860 | + cmd_mbox_mem = cb->first_cmd_mbox; | |
| 861 | + cmd_mbox_mem += MYRB_CMD_MBOX_COUNT - 1; | |
| 862 | + cb->last_cmd_mbox = cmd_mbox_mem; | |
| 863 | + cb->next_cmd_mbox = cb->first_cmd_mbox; | |
| 864 | + cb->prev_cmd_mbox1 = cb->last_cmd_mbox; | |
| 865 | + cb->prev_cmd_mbox2 = cb->last_cmd_mbox - 1; | |
| 866 | + | |
| 867 | + /* These are the base addresses for the status memory mailbox array */ | |
| 868 | + cb->stat_mbox_size = MYRB_STAT_MBOX_COUNT * | |
| 869 | + sizeof(struct myrb_stat_mbox); | |
| 870 | + cb->first_stat_mbox = dma_alloc_coherent(&pdev->dev, | |
| 871 | + cb->stat_mbox_size, | |
| 872 | + &cb->stat_mbox_addr, | |
| 873 | + GFP_KERNEL); | |
| 874 | + if (!cb->first_stat_mbox) | |
| 875 | + return false; | |
| 876 | + | |
| 877 | + stat_mbox_mem = cb->first_stat_mbox; | |
| 878 | + stat_mbox_mem += MYRB_STAT_MBOX_COUNT - 1; | |
| 879 | + cb->last_stat_mbox = stat_mbox_mem; | |
| 880 | + cb->next_stat_mbox = cb->first_stat_mbox; | |
| 881 | + | |
| 882 | + /* Enable the Memory Mailbox Interface. */ | |
| 883 | + cb->dual_mode_interface = true; | |
| 884 | + mbox.typeX.opcode = 0x2B; | |
| 885 | + mbox.typeX.id = 0; | |
| 886 | + mbox.typeX.opcode2 = 0x14; | |
| 887 | + mbox.typeX.cmd_mbox_addr = cb->cmd_mbox_addr; | |
| 888 | + mbox.typeX.stat_mbox_addr = cb->stat_mbox_addr; | |
| 889 | + | |
| 890 | + status = mmio_init_fn(pdev, base, &mbox); | |
| 891 | + if (status != MYRB_STATUS_SUCCESS) { | |
| 892 | + cb->dual_mode_interface = false; | |
| 893 | + mbox.typeX.opcode2 = 0x10; | |
| 894 | + status = mmio_init_fn(pdev, base, &mbox); | |
| 895 | + if (status != MYRB_STATUS_SUCCESS) { | |
| 896 | + dev_err(&pdev->dev, | |
| 897 | + "Failed to enable mailbox, statux %02X\n", | |
| 898 | + status); | |
| 899 | + return false; | |
| 900 | + } | |
| 901 | + } | |
| 902 | + return true; | |
| 903 | +} | |
| 904 | + | |
| 905 | +/** | |
| 906 | + * myrb_get_hba_config - reads the configuration information | |
| 907 | + * | |
| 908 | + * Reads the configuration information from the controller and | |
| 909 | + * initializes the controller structure. | |
| 910 | + * | |
| 911 | + * Return: 0 on success, errno otherwise | |
| 912 | + */ | |
| 913 | +static int myrb_get_hba_config(struct myrb_hba *cb) | |
| 914 | +{ | |
| 915 | + struct myrb_enquiry2 *enquiry2; | |
| 916 | + dma_addr_t enquiry2_addr; | |
| 917 | + struct myrb_config2 *config2; | |
| 918 | + dma_addr_t config2_addr; | |
| 919 | + struct Scsi_Host *shost = cb->host; | |
| 920 | + struct pci_dev *pdev = cb->pdev; | |
| 921 | + int pchan_max = 0, pchan_cur = 0; | |
| 922 | + unsigned short status; | |
| 923 | + int ret = -ENODEV, memsize = 0; | |
| 924 | + | |
| 925 | + enquiry2 = dma_alloc_coherent(&pdev->dev, sizeof(struct myrb_enquiry2), | |
| 926 | + &enquiry2_addr, GFP_KERNEL); | |
| 927 | + if (!enquiry2) { | |
| 928 | + shost_printk(KERN_ERR, cb->host, | |
| 929 | + "Failed to allocate V1 enquiry2 memory\n"); | |
| 930 | + return -ENOMEM; | |
| 931 | + } | |
| 932 | + config2 = dma_alloc_coherent(&pdev->dev, sizeof(struct myrb_config2), | |
| 933 | + &config2_addr, GFP_KERNEL); | |
| 934 | + if (!config2) { | |
| 935 | + shost_printk(KERN_ERR, cb->host, | |
| 936 | + "Failed to allocate V1 config2 memory\n"); | |
| 937 | + dma_free_coherent(&pdev->dev, sizeof(struct myrb_enquiry2), | |
| 938 | + enquiry2, enquiry2_addr); | |
| 939 | + return -ENOMEM; | |
| 940 | + } | |
| 941 | + mutex_lock(&cb->dma_mutex); | |
| 942 | + status = myrb_hba_enquiry(cb); | |
| 943 | + mutex_unlock(&cb->dma_mutex); | |
| 944 | + if (status != MYRB_STATUS_SUCCESS) { | |
| 945 | + shost_printk(KERN_WARNING, cb->host, | |
| 946 | + "Failed it issue V1 Enquiry\n"); | |
| 947 | + goto out_free; | |
| 948 | + } | |
| 949 | + | |
| 950 | + status = myrb_exec_type3(cb, MYRB_CMD_ENQUIRY2, enquiry2_addr); | |
| 951 | + if (status != MYRB_STATUS_SUCCESS) { | |
| 952 | + shost_printk(KERN_WARNING, cb->host, | |
| 953 | + "Failed to issue V1 Enquiry2\n"); | |
| 954 | + goto out_free; | |
| 955 | + } | |
| 956 | + | |
| 957 | + status = myrb_exec_type3(cb, MYRB_CMD_READ_CONFIG2, config2_addr); | |
| 958 | + if (status != MYRB_STATUS_SUCCESS) { | |
| 959 | + shost_printk(KERN_WARNING, cb->host, | |
| 960 | + "Failed to issue ReadConfig2\n"); | |
| 961 | + goto out_free; | |
| 962 | + } | |
| 963 | + | |
| 964 | + status = myrb_get_ldev_info(cb); | |
| 965 | + if (status != MYRB_STATUS_SUCCESS) { | |
| 966 | + shost_printk(KERN_WARNING, cb->host, | |
| 967 | + "Failed to get logical drive information\n"); | |
| 968 | + goto out_free; | |
| 969 | + } | |
| 970 | + | |
| 971 | + /* | |
| 972 | + * Initialize the Controller Model Name and Full Model Name fields. | |
| 973 | + */ | |
| 974 | + switch (enquiry2->hw.sub_model) { | |
| 975 | + case DAC960_V1_P_PD_PU: | |
| 976 | + if (enquiry2->scsi_cap.bus_speed == MYRB_SCSI_SPEED_ULTRA) | |
| 977 | + strcpy(cb->model_name, "DAC960PU"); | |
| 978 | + else | |
| 979 | + strcpy(cb->model_name, "DAC960PD"); | |
| 980 | + break; | |
| 981 | + case DAC960_V1_PL: | |
| 982 | + strcpy(cb->model_name, "DAC960PL"); | |
| 983 | + break; | |
| 984 | + case DAC960_V1_PG: | |
| 985 | + strcpy(cb->model_name, "DAC960PG"); | |
| 986 | + break; | |
| 987 | + case DAC960_V1_PJ: | |
| 988 | + strcpy(cb->model_name, "DAC960PJ"); | |
| 989 | + break; | |
| 990 | + case DAC960_V1_PR: | |
| 991 | + strcpy(cb->model_name, "DAC960PR"); | |
| 992 | + break; | |
| 993 | + case DAC960_V1_PT: | |
| 994 | + strcpy(cb->model_name, "DAC960PT"); | |
| 995 | + break; | |
| 996 | + case DAC960_V1_PTL0: | |
| 997 | + strcpy(cb->model_name, "DAC960PTL0"); | |
| 998 | + break; | |
| 999 | + case DAC960_V1_PRL: | |
| 1000 | + strcpy(cb->model_name, "DAC960PRL"); | |
| 1001 | + break; | |
| 1002 | + case DAC960_V1_PTL1: | |
| 1003 | + strcpy(cb->model_name, "DAC960PTL1"); | |
| 1004 | + break; | |
| 1005 | + case DAC960_V1_1164P: | |
| 1006 | + strcpy(cb->model_name, "eXtremeRAID 1100"); | |
| 1007 | + break; | |
| 1008 | + default: | |
| 1009 | + shost_printk(KERN_WARNING, cb->host, | |
| 1010 | + "Unknown Model %X\n", | |
| 1011 | + enquiry2->hw.sub_model); | |
| 1012 | + goto out; | |
| 1013 | + } | |
| 1014 | + /* | |
| 1015 | + * Initialize the Controller Firmware Version field and verify that it | |
| 1016 | + * is a supported firmware version. | |
| 1017 | + * The supported firmware versions are: | |
| 1018 | + * | |
| 1019 | + * DAC1164P 5.06 and above | |
| 1020 | + * DAC960PTL/PRL/PJ/PG 4.06 and above | |
| 1021 | + * DAC960PU/PD/PL 3.51 and above | |
| 1022 | + * DAC960PU/PD/PL/P 2.73 and above | |
| 1023 | + */ | |
| 1024 | +#if defined(CONFIG_ALPHA) | |
| 1025 | + /* | |
| 1026 | + * DEC Alpha machines were often equipped with DAC960 cards that were | |
| 1027 | + * OEMed from Mylex, and had their own custom firmware. Version 2.70, | |
| 1028 | + * the last custom FW revision to be released by DEC for these older | |
| 1029 | + * controllers, appears to work quite well with this driver. | |
| 1030 | + * | |
| 1031 | + * Cards tested successfully were several versions each of the PD and | |
| 1032 | + * PU, called by DEC the KZPSC and KZPAC, respectively, and having | |
| 1033 | + * the Manufacturer Numbers (from Mylex), usually on a sticker on the | |
| 1034 | + * back of the board, of: | |
| 1035 | + * | |
| 1036 | + * KZPSC: D040347 (1-channel) or D040348 (2-channel) | |
| 1037 | + * or D040349 (3-channel) | |
| 1038 | + * KZPAC: D040395 (1-channel) or D040396 (2-channel) | |
| 1039 | + * or D040397 (3-channel) | |
| 1040 | + */ | |
| 1041 | +# define FIRMWARE_27X "2.70" | |
| 1042 | +#else | |
| 1043 | +# define FIRMWARE_27X "2.73" | |
| 1044 | +#endif | |
| 1045 | + | |
| 1046 | + if (enquiry2->fw.major_version == 0) { | |
| 1047 | + enquiry2->fw.major_version = cb->enquiry->fw_major_version; | |
| 1048 | + enquiry2->fw.minor_version = cb->enquiry->fw_minor_version; | |
| 1049 | + enquiry2->fw.firmware_type = '0'; | |
| 1050 | + enquiry2->fw.turn_id = 0; | |
| 1051 | + } | |
| 1052 | + sprintf(cb->fw_version, "%d.%02d-%c-%02d", | |
| 1053 | + enquiry2->fw.major_version, | |
| 1054 | + enquiry2->fw.minor_version, | |
| 1055 | + enquiry2->fw.firmware_type, | |
| 1056 | + enquiry2->fw.turn_id); | |
| 1057 | + if (!((enquiry2->fw.major_version == 5 && | |
| 1058 | + enquiry2->fw.minor_version >= 6) || | |
| 1059 | + (enquiry2->fw.major_version == 4 && | |
| 1060 | + enquiry2->fw.minor_version >= 6) || | |
| 1061 | + (enquiry2->fw.major_version == 3 && | |
| 1062 | + enquiry2->fw.minor_version >= 51) || | |
| 1063 | + (enquiry2->fw.major_version == 2 && | |
| 1064 | + strcmp(cb->fw_version, FIRMWARE_27X) >= 0))) { | |
| 1065 | + shost_printk(KERN_WARNING, cb->host, | |
| 1066 | + "Firmware Version '%s' unsupported\n", | |
| 1067 | + cb->fw_version); | |
| 1068 | + goto out; | |
| 1069 | + } | |
| 1070 | + /* | |
| 1071 | + * Initialize the Channels, Targets, Memory Size, and SAF-TE | |
| 1072 | + * Enclosure Management Enabled fields. | |
| 1073 | + */ | |
| 1074 | + switch (enquiry2->hw.model) { | |
| 1075 | + case MYRB_5_CHANNEL_BOARD: | |
| 1076 | + pchan_max = 5; | |
| 1077 | + break; | |
| 1078 | + case MYRB_3_CHANNEL_BOARD: | |
| 1079 | + case MYRB_3_CHANNEL_ASIC_DAC: | |
| 1080 | + pchan_max = 3; | |
| 1081 | + break; | |
| 1082 | + case MYRB_2_CHANNEL_BOARD: | |
| 1083 | + pchan_max = 2; | |
| 1084 | + break; | |
| 1085 | + default: | |
| 1086 | + pchan_max = enquiry2->cfg_chan; | |
| 1087 | + break; | |
| 1088 | + } | |
| 1089 | + pchan_cur = enquiry2->cur_chan; | |
| 1090 | + if (enquiry2->scsi_cap.bus_width == MYRB_WIDTH_WIDE_32BIT) | |
| 1091 | + cb->bus_width = 32; | |
| 1092 | + else if (enquiry2->scsi_cap.bus_width == MYRB_WIDTH_WIDE_16BIT) | |
| 1093 | + cb->bus_width = 16; | |
| 1094 | + else | |
| 1095 | + cb->bus_width = 8; | |
| 1096 | + cb->ldev_block_size = enquiry2->ldev_block_size; | |
| 1097 | + shost->max_channel = pchan_cur; | |
| 1098 | + shost->max_id = enquiry2->max_targets; | |
| 1099 | + memsize = enquiry2->mem_size >> 20; | |
| 1100 | + cb->safte_enabled = (enquiry2->fault_mgmt == MYRB_FAULT_SAFTE); | |
| 1101 | + /* | |
| 1102 | + * Initialize the Controller Queue Depth, Driver Queue Depth, | |
| 1103 | + * Logical Drive Count, Maximum Blocks per Command, Controller | |
| 1104 | + * Scatter/Gather Limit, and Driver Scatter/Gather Limit. | |
| 1105 | + * The Driver Queue Depth must be at most one less than the | |
| 1106 | + * Controller Queue Depth to allow for an automatic drive | |
| 1107 | + * rebuild operation. | |
| 1108 | + */ | |
| 1109 | + shost->can_queue = cb->enquiry->max_tcq; | |
| 1110 | + if (shost->can_queue < 3) | |
| 1111 | + shost->can_queue = enquiry2->max_cmds; | |
| 1112 | + if (shost->can_queue < 3) | |
| 1113 | + /* Play safe and disable TCQ */ | |
| 1114 | + shost->can_queue = 1; | |
| 1115 | + | |
| 1116 | + if (shost->can_queue > MYRB_CMD_MBOX_COUNT - 2) | |
| 1117 | + shost->can_queue = MYRB_CMD_MBOX_COUNT - 2; | |
| 1118 | + shost->max_sectors = enquiry2->max_sectors; | |
| 1119 | + shost->sg_tablesize = enquiry2->max_sge; | |
| 1120 | + if (shost->sg_tablesize > MYRB_SCATTER_GATHER_LIMIT) | |
| 1121 | + shost->sg_tablesize = MYRB_SCATTER_GATHER_LIMIT; | |
| 1122 | + /* | |
| 1123 | + * Initialize the Stripe Size, Segment Size, and Geometry Translation. | |
| 1124 | + */ | |
| 1125 | + cb->stripe_size = config2->blocks_per_stripe * config2->block_factor | |
| 1126 | + >> (10 - MYRB_BLKSIZE_BITS); | |
| 1127 | + cb->segment_size = config2->blocks_per_cacheline * config2->block_factor | |
| 1128 | + >> (10 - MYRB_BLKSIZE_BITS); | |
| 1129 | + /* Assume 255/63 translation */ | |
| 1130 | + cb->ldev_geom_heads = 255; | |
| 1131 | + cb->ldev_geom_sectors = 63; | |
| 1132 | + if (config2->drive_geometry) { | |
| 1133 | + cb->ldev_geom_heads = 128; | |
| 1134 | + cb->ldev_geom_sectors = 32; | |
| 1135 | + } | |
| 1136 | + | |
| 1137 | + /* | |
| 1138 | + * Initialize the Background Initialization Status. | |
| 1139 | + */ | |
| 1140 | + if ((cb->fw_version[0] == '4' && | |
| 1141 | + strcmp(cb->fw_version, "4.08") >= 0) || | |
| 1142 | + (cb->fw_version[0] == '5' && | |
| 1143 | + strcmp(cb->fw_version, "5.08") >= 0)) { | |
| 1144 | + cb->bgi_status_supported = true; | |
| 1145 | + myrb_bgi_control(cb); | |
| 1146 | + } | |
| 1147 | + cb->last_rbld_status = MYRB_NO_STDBY_RBLD_OR_CHECK_IN_PROGRESS; | |
| 1148 | + ret = 0; | |
| 1149 | + | |
| 1150 | +out: | |
| 1151 | + shost_printk(KERN_INFO, cb->host, | |
| 1152 | + "Configuring %s PCI RAID Controller\n", cb->model_name); | |
| 1153 | + shost_printk(KERN_INFO, cb->host, | |
| 1154 | + " Firmware Version: %s, Memory Size: %dMB\n", | |
| 1155 | + cb->fw_version, memsize); | |
| 1156 | + if (cb->io_addr == 0) | |
| 1157 | + shost_printk(KERN_INFO, cb->host, | |
| 1158 | + " I/O Address: n/a, PCI Address: 0x%lX, IRQ Channel: %d\n", | |
| 1159 | + (unsigned long)cb->pci_addr, cb->irq); | |
| 1160 | + else | |
| 1161 | + shost_printk(KERN_INFO, cb->host, | |
| 1162 | + " I/O Address: 0x%lX, PCI Address: 0x%lX, IRQ Channel: %d\n", | |
| 1163 | + (unsigned long)cb->io_addr, (unsigned long)cb->pci_addr, | |
| 1164 | + cb->irq); | |
| 1165 | + shost_printk(KERN_INFO, cb->host, | |
| 1166 | + " Controller Queue Depth: %d, Maximum Blocks per Command: %d\n", | |
| 1167 | + cb->host->can_queue, cb->host->max_sectors); | |
| 1168 | + shost_printk(KERN_INFO, cb->host, | |
| 1169 | + " Driver Queue Depth: %d, Scatter/Gather Limit: %d of %d Segments\n", | |
| 1170 | + cb->host->can_queue, cb->host->sg_tablesize, | |
| 1171 | + MYRB_SCATTER_GATHER_LIMIT); | |
| 1172 | + shost_printk(KERN_INFO, cb->host, | |
| 1173 | + " Stripe Size: %dKB, Segment Size: %dKB, BIOS Geometry: %d/%d%s\n", | |
| 1174 | + cb->stripe_size, cb->segment_size, | |
| 1175 | + cb->ldev_geom_heads, cb->ldev_geom_sectors, | |
| 1176 | + cb->safte_enabled ? | |
| 1177 | + " SAF-TE Enclosure Management Enabled" : ""); | |
| 1178 | + shost_printk(KERN_INFO, cb->host, | |
| 1179 | + " Physical: %d/%d channels %d/%d/%d devices\n", | |
| 1180 | + pchan_cur, pchan_max, 0, cb->enquiry->pdev_dead, | |
| 1181 | + cb->host->max_id); | |
| 1182 | + | |
| 1183 | + shost_printk(KERN_INFO, cb->host, | |
| 1184 | + " Logical: 1/1 channels, %d/%d disks\n", | |
| 1185 | + cb->enquiry->ldev_count, MYRB_MAX_LDEVS); | |
| 1186 | + | |
| 1187 | +out_free: | |
| 1188 | + dma_free_coherent(&pdev->dev, sizeof(struct myrb_enquiry2), | |
| 1189 | + enquiry2, enquiry2_addr); | |
| 1190 | + dma_free_coherent(&pdev->dev, sizeof(struct myrb_config2), | |
| 1191 | + config2, config2_addr); | |
| 1192 | + | |
| 1193 | + return ret; | |
| 1194 | +} | |
| 1195 | + | |
| 1196 | +/** | |
| 1197 | + * myrb_unmap - unmaps controller structures | |
| 1198 | + */ | |
| 1199 | +static void myrb_unmap(struct myrb_hba *cb) | |
| 1200 | +{ | |
| 1201 | + if (cb->ldev_info_buf) { | |
| 1202 | + size_t ldev_info_size = sizeof(struct myrb_ldev_info) * | |
| 1203 | + MYRB_MAX_LDEVS; | |
| 1204 | + dma_free_coherent(&cb->pdev->dev, ldev_info_size, | |
| 1205 | + cb->ldev_info_buf, cb->ldev_info_addr); | |
| 1206 | + cb->ldev_info_buf = NULL; | |
| 1207 | + } | |
| 1208 | + if (cb->err_table) { | |
| 1209 | + size_t err_table_size = sizeof(struct myrb_error_entry) * | |
| 1210 | + MYRB_MAX_CHANNELS * MYRB_MAX_TARGETS; | |
| 1211 | + dma_free_coherent(&cb->pdev->dev, err_table_size, | |
| 1212 | + cb->err_table, cb->err_table_addr); | |
| 1213 | + cb->err_table = NULL; | |
| 1214 | + } | |
| 1215 | + if (cb->enquiry) { | |
| 1216 | + dma_free_coherent(&cb->pdev->dev, sizeof(struct myrb_enquiry), | |
| 1217 | + cb->enquiry, cb->enquiry_addr); | |
| 1218 | + cb->enquiry = NULL; | |
| 1219 | + } | |
| 1220 | + if (cb->first_stat_mbox) { | |
| 1221 | + dma_free_coherent(&cb->pdev->dev, cb->stat_mbox_size, | |
| 1222 | + cb->first_stat_mbox, cb->stat_mbox_addr); | |
| 1223 | + cb->first_stat_mbox = NULL; | |
| 1224 | + } | |
| 1225 | + if (cb->first_cmd_mbox) { | |
| 1226 | + dma_free_coherent(&cb->pdev->dev, cb->cmd_mbox_size, | |
| 1227 | + cb->first_cmd_mbox, cb->cmd_mbox_addr); | |
| 1228 | + cb->first_cmd_mbox = NULL; | |
| 1229 | + } | |
| 1230 | +} | |
| 1231 | + | |
| 1232 | +/** | |
| 1233 | + * myrb_cleanup - cleanup controller structures | |
| 1234 | + */ | |
| 1235 | +static void myrb_cleanup(struct myrb_hba *cb) | |
| 1236 | +{ | |
| 1237 | + struct pci_dev *pdev = cb->pdev; | |
| 1238 | + | |
| 1239 | + /* Free the memory mailbox, status, and related structures */ | |
| 1240 | + myrb_unmap(cb); | |
| 1241 | + | |
| 1242 | + if (cb->mmio_base) { | |
| 1243 | + cb->disable_intr(cb->io_base); | |
| 1244 | + iounmap(cb->mmio_base); | |
| 1245 | + } | |
| 1246 | + if (cb->irq) | |
| 1247 | + free_irq(cb->irq, cb); | |
| 1248 | + if (cb->io_addr) | |
| 1249 | + release_region(cb->io_addr, 0x80); | |
| 1250 | + pci_set_drvdata(pdev, NULL); | |
| 1251 | + pci_disable_device(pdev); | |
| 1252 | + scsi_host_put(cb->host); | |
| 1253 | +} | |
| 1254 | + | |
| 1255 | +static int myrb_host_reset(struct scsi_cmnd *scmd) | |
| 1256 | +{ | |
| 1257 | + struct Scsi_Host *shost = scmd->device->host; | |
| 1258 | + struct myrb_hba *cb = shost_priv(shost); | |
| 1259 | + | |
| 1260 | + cb->reset(cb->io_base); | |
| 1261 | + return SUCCESS; | |
| 1262 | +} | |
| 1263 | + | |
| 1264 | +static int myrb_pthru_queuecommand(struct Scsi_Host *shost, | |
| 1265 | + struct scsi_cmnd *scmd) | |
| 1266 | +{ | |
| 1267 | + struct myrb_hba *cb = shost_priv(shost); | |
| 1268 | + struct myrb_cmdblk *cmd_blk = scsi_cmd_priv(scmd); | |
| 1269 | + union myrb_cmd_mbox *mbox = &cmd_blk->mbox; | |
| 1270 | + struct myrb_dcdb *dcdb; | |
| 1271 | + dma_addr_t dcdb_addr; | |
| 1272 | + struct scsi_device *sdev = scmd->device; | |
| 1273 | + struct scatterlist *sgl; | |
| 1274 | + unsigned long flags; | |
| 1275 | + int nsge; | |
| 1276 | + | |
| 1277 | + myrb_reset_cmd(cmd_blk); | |
| 1278 | + dcdb = dma_pool_alloc(cb->dcdb_pool, GFP_ATOMIC, &dcdb_addr); | |
| 1279 | + if (!dcdb) | |
| 1280 | + return SCSI_MLQUEUE_HOST_BUSY; | |
| 1281 | + nsge = scsi_dma_map(scmd); | |
| 1282 | + if (nsge > 1) { | |
| 1283 | + dma_pool_free(cb->dcdb_pool, dcdb, dcdb_addr); | |
| 1284 | + scmd->result = (DID_ERROR << 16); | |
| 1285 | + scmd->scsi_done(scmd); | |
| 1286 | + return 0; | |
| 1287 | + } | |
| 1288 | + | |
| 1289 | + mbox->type3.opcode = MYRB_CMD_DCDB; | |
| 1290 | + mbox->type3.id = scmd->request->tag + 3; | |
| 1291 | + mbox->type3.addr = dcdb_addr; | |
| 1292 | + dcdb->channel = sdev->channel; | |
| 1293 | + dcdb->target = sdev->id; | |
| 1294 | + switch (scmd->sc_data_direction) { | |
| 1295 | + case DMA_NONE: | |
| 1296 | + dcdb->data_xfer = MYRB_DCDB_XFER_NONE; | |
| 1297 | + break; | |
| 1298 | + case DMA_TO_DEVICE: | |
| 1299 | + dcdb->data_xfer = MYRB_DCDB_XFER_SYSTEM_TO_DEVICE; | |
| 1300 | + break; | |
| 1301 | + case DMA_FROM_DEVICE: | |
| 1302 | + dcdb->data_xfer = MYRB_DCDB_XFER_DEVICE_TO_SYSTEM; | |
| 1303 | + break; | |
| 1304 | + default: | |
| 1305 | + dcdb->data_xfer = MYRB_DCDB_XFER_ILLEGAL; | |
| 1306 | + break; | |
| 1307 | + } | |
| 1308 | + dcdb->early_status = false; | |
| 1309 | + if (scmd->request->timeout <= 10) | |
| 1310 | + dcdb->timeout = MYRB_DCDB_TMO_10_SECS; | |
| 1311 | + else if (scmd->request->timeout <= 60) | |
| 1312 | + dcdb->timeout = MYRB_DCDB_TMO_60_SECS; | |
| 1313 | + else if (scmd->request->timeout <= 600) | |
| 1314 | + dcdb->timeout = MYRB_DCDB_TMO_10_MINS; | |
| 1315 | + else | |
| 1316 | + dcdb->timeout = MYRB_DCDB_TMO_24_HRS; | |
| 1317 | + dcdb->no_autosense = false; | |
| 1318 | + dcdb->allow_disconnect = true; | |
| 1319 | + sgl = scsi_sglist(scmd); | |
| 1320 | + dcdb->dma_addr = sg_dma_address(sgl); | |
| 1321 | + if (sg_dma_len(sgl) > USHRT_MAX) { | |
| 1322 | + dcdb->xfer_len_lo = sg_dma_len(sgl) & 0xffff; | |
| 1323 | + dcdb->xfer_len_hi4 = sg_dma_len(sgl) >> 16; | |
| 1324 | + } else { | |
| 1325 | + dcdb->xfer_len_lo = sg_dma_len(sgl); | |
| 1326 | + dcdb->xfer_len_hi4 = 0; | |
| 1327 | + } | |
| 1328 | + dcdb->cdb_len = scmd->cmd_len; | |
| 1329 | + dcdb->sense_len = sizeof(dcdb->sense); | |
| 1330 | + memcpy(&dcdb->cdb, scmd->cmnd, scmd->cmd_len); | |
| 1331 | + | |
| 1332 | + spin_lock_irqsave(&cb->queue_lock, flags); | |
| 1333 | + cb->qcmd(cb, cmd_blk); | |
| 1334 | + spin_unlock_irqrestore(&cb->queue_lock, flags); | |
| 1335 | + return 0; | |
| 1336 | +} | |
| 1337 | + | |
| 1338 | +static void myrb_inquiry(struct myrb_hba *cb, | |
| 1339 | + struct scsi_cmnd *scmd) | |
| 1340 | +{ | |
| 1341 | + unsigned char inq[36] = { | |
| 1342 | + 0x00, 0x00, 0x03, 0x02, 0x20, 0x00, 0x01, 0x00, | |
| 1343 | + 0x4d, 0x59, 0x4c, 0x45, 0x58, 0x20, 0x20, 0x20, | |
| 1344 | + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, | |
| 1345 | + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, | |
| 1346 | + 0x20, 0x20, 0x20, 0x20, | |
| 1347 | + }; | |
| 1348 | + | |
| 1349 | + if (cb->bus_width > 16) | |
| 1350 | + inq[7] |= 1 << 6; | |
| 1351 | + if (cb->bus_width > 8) | |
| 1352 | + inq[7] |= 1 << 5; | |
| 1353 | + memcpy(&inq[16], cb->model_name, 16); | |
| 1354 | + memcpy(&inq[32], cb->fw_version, 1); | |
| 1355 | + memcpy(&inq[33], &cb->fw_version[2], 2); | |
| 1356 | + memcpy(&inq[35], &cb->fw_version[7], 1); | |
| 1357 | + | |
| 1358 | + scsi_sg_copy_from_buffer(scmd, (void *)inq, 36); | |
| 1359 | +} | |
| 1360 | + | |
| 1361 | +static void | |
| 1362 | +myrb_mode_sense(struct myrb_hba *cb, struct scsi_cmnd *scmd, | |
| 1363 | + struct myrb_ldev_info *ldev_info) | |
| 1364 | +{ | |
| 1365 | + unsigned char modes[32], *mode_pg; | |
| 1366 | + bool dbd; | |
| 1367 | + size_t mode_len; | |
| 1368 | + | |
| 1369 | + dbd = (scmd->cmnd[1] & 0x08) == 0x08; | |
| 1370 | + if (dbd) { | |
| 1371 | + mode_len = 24; | |
| 1372 | + mode_pg = &modes[4]; | |
| 1373 | + } else { | |
| 1374 | + mode_len = 32; | |
| 1375 | + mode_pg = &modes[12]; | |
| 1376 | + } | |
| 1377 | + memset(modes, 0, sizeof(modes)); | |
| 1378 | + modes[0] = mode_len - 1; | |
| 1379 | + if (!dbd) { | |
| 1380 | + unsigned char *block_desc = &modes[4]; | |
| 1381 | + | |
| 1382 | + modes[3] = 8; | |
| 1383 | + put_unaligned_be32(ldev_info->size, &block_desc[0]); | |
| 1384 | + put_unaligned_be32(cb->ldev_block_size, &block_desc[5]); | |
| 1385 | + } | |
| 1386 | + mode_pg[0] = 0x08; | |
| 1387 | + mode_pg[1] = 0x12; | |
| 1388 | + if (ldev_info->wb_enabled) | |
| 1389 | + mode_pg[2] |= 0x04; | |
| 1390 | + if (cb->segment_size) { | |
| 1391 | + mode_pg[2] |= 0x08; | |
| 1392 | + put_unaligned_be16(cb->segment_size, &mode_pg[14]); | |
| 1393 | + } | |
| 1394 | + | |
| 1395 | + scsi_sg_copy_from_buffer(scmd, modes, mode_len); | |
| 1396 | +} | |
| 1397 | + | |
| 1398 | +static void myrb_request_sense(struct myrb_hba *cb, | |
| 1399 | + struct scsi_cmnd *scmd) | |
| 1400 | +{ | |
| 1401 | + scsi_build_sense_buffer(0, scmd->sense_buffer, | |
| 1402 | + NO_SENSE, 0, 0); | |
| 1403 | + scsi_sg_copy_from_buffer(scmd, scmd->sense_buffer, | |
| 1404 | + SCSI_SENSE_BUFFERSIZE); | |
| 1405 | +} | |
| 1406 | + | |
| 1407 | +static void myrb_read_capacity(struct myrb_hba *cb, struct scsi_cmnd *scmd, | |
| 1408 | + struct myrb_ldev_info *ldev_info) | |
| 1409 | +{ | |
| 1410 | + unsigned char data[8]; | |
| 1411 | + | |
| 1412 | + dev_dbg(&scmd->device->sdev_gendev, | |
| 1413 | + "Capacity %u, blocksize %u\n", | |
| 1414 | + ldev_info->size, cb->ldev_block_size); | |
| 1415 | + put_unaligned_be32(ldev_info->size - 1, &data[0]); | |
| 1416 | + put_unaligned_be32(cb->ldev_block_size, &data[4]); | |
| 1417 | + scsi_sg_copy_from_buffer(scmd, data, 8); | |
| 1418 | +} | |
| 1419 | + | |
| 1420 | +static int myrb_ldev_queuecommand(struct Scsi_Host *shost, | |
| 1421 | + struct scsi_cmnd *scmd) | |
| 1422 | +{ | |
| 1423 | + struct myrb_hba *cb = shost_priv(shost); | |
| 1424 | + struct myrb_cmdblk *cmd_blk = scsi_cmd_priv(scmd); | |
| 1425 | + union myrb_cmd_mbox *mbox = &cmd_blk->mbox; | |
| 1426 | + struct myrb_ldev_info *ldev_info; | |
| 1427 | + struct scsi_device *sdev = scmd->device; | |
| 1428 | + struct scatterlist *sgl; | |
| 1429 | + unsigned long flags; | |
| 1430 | + u64 lba; | |
| 1431 | + u32 block_cnt; | |
| 1432 | + int nsge; | |
| 1433 | + | |
| 1434 | + ldev_info = sdev->hostdata; | |
| 1435 | + if (ldev_info->state != MYRB_DEVICE_ONLINE && | |
| 1436 | + ldev_info->state != MYRB_DEVICE_WO) { | |
| 1437 | + dev_dbg(&shost->shost_gendev, "ldev %u in state %x, skip\n", | |
| 1438 | + sdev->id, ldev_info ? ldev_info->state : 0xff); | |
| 1439 | + scmd->result = (DID_BAD_TARGET << 16); | |
| 1440 | + scmd->scsi_done(scmd); | |
| 1441 | + return 0; | |
| 1442 | + } | |
| 1443 | + switch (scmd->cmnd[0]) { | |
| 1444 | + case TEST_UNIT_READY: | |
| 1445 | + scmd->result = (DID_OK << 16); | |
| 1446 | + scmd->scsi_done(scmd); | |
| 1447 | + return 0; | |
| 1448 | + case INQUIRY: | |
| 1449 | + if (scmd->cmnd[1] & 1) { | |
| 1450 | + /* Illegal request, invalid field in CDB */ | |
| 1451 | + scsi_build_sense_buffer(0, scmd->sense_buffer, | |
| 1452 | + ILLEGAL_REQUEST, 0x24, 0); | |
| 1453 | + scmd->result = (DRIVER_SENSE << 24) | | |
| 1454 | + SAM_STAT_CHECK_CONDITION; | |
| 1455 | + } else { | |
| 1456 | + myrb_inquiry(cb, scmd); | |
| 1457 | + scmd->result = (DID_OK << 16); | |
| 1458 | + } | |
| 1459 | + scmd->scsi_done(scmd); | |
| 1460 | + return 0; | |
| 1461 | + case SYNCHRONIZE_CACHE: | |
| 1462 | + scmd->result = (DID_OK << 16); | |
| 1463 | + scmd->scsi_done(scmd); | |
| 1464 | + return 0; | |
| 1465 | + case MODE_SENSE: | |
| 1466 | + if ((scmd->cmnd[2] & 0x3F) != 0x3F && | |
| 1467 | + (scmd->cmnd[2] & 0x3F) != 0x08) { | |
| 1468 | + /* Illegal request, invalid field in CDB */ | |
| 1469 | + scsi_build_sense_buffer(0, scmd->sense_buffer, | |
| 1470 | + ILLEGAL_REQUEST, 0x24, 0); | |
| 1471 | + scmd->result = (DRIVER_SENSE << 24) | | |
| 1472 | + SAM_STAT_CHECK_CONDITION; | |
| 1473 | + } else { | |
| 1474 | + myrb_mode_sense(cb, scmd, ldev_info); | |
| 1475 | + scmd->result = (DID_OK << 16); | |
| 1476 | + } | |
| 1477 | + scmd->scsi_done(scmd); | |
| 1478 | + return 0; | |
| 1479 | + case READ_CAPACITY: | |
| 1480 | + if ((scmd->cmnd[1] & 1) || | |
| 1481 | + (scmd->cmnd[8] & 1)) { | |
| 1482 | + /* Illegal request, invalid field in CDB */ | |
| 1483 | + scsi_build_sense_buffer(0, scmd->sense_buffer, | |
| 1484 | + ILLEGAL_REQUEST, 0x24, 0); | |
| 1485 | + scmd->result = (DRIVER_SENSE << 24) | | |
| 1486 | + SAM_STAT_CHECK_CONDITION; | |
| 1487 | + scmd->scsi_done(scmd); | |
| 1488 | + return 0; | |
| 1489 | + } | |
| 1490 | + lba = get_unaligned_be32(&scmd->cmnd[2]); | |
| 1491 | + if (lba) { | |
| 1492 | + /* Illegal request, invalid field in CDB */ | |
| 1493 | + scsi_build_sense_buffer(0, scmd->sense_buffer, | |
| 1494 | + ILLEGAL_REQUEST, 0x24, 0); | |
| 1495 | + scmd->result = (DRIVER_SENSE << 24) | | |
| 1496 | + SAM_STAT_CHECK_CONDITION; | |
| 1497 | + scmd->scsi_done(scmd); | |
| 1498 | + return 0; | |
| 1499 | + } | |
| 1500 | + myrb_read_capacity(cb, scmd, ldev_info); | |
| 1501 | + scmd->scsi_done(scmd); | |
| 1502 | + return 0; | |
| 1503 | + case REQUEST_SENSE: | |
| 1504 | + myrb_request_sense(cb, scmd); | |
| 1505 | + scmd->result = (DID_OK << 16); | |
| 1506 | + return 0; | |
| 1507 | + case SEND_DIAGNOSTIC: | |
| 1508 | + if (scmd->cmnd[1] != 0x04) { | |
| 1509 | + /* Illegal request, invalid field in CDB */ | |
| 1510 | + scsi_build_sense_buffer(0, scmd->sense_buffer, | |
| 1511 | + ILLEGAL_REQUEST, 0x24, 0); | |
| 1512 | + scmd->result = (DRIVER_SENSE << 24) | | |
| 1513 | + SAM_STAT_CHECK_CONDITION; | |
| 1514 | + } else { | |
| 1515 | + /* Assume good status */ | |
| 1516 | + scmd->result = (DID_OK << 16); | |
| 1517 | + } | |
| 1518 | + scmd->scsi_done(scmd); | |
| 1519 | + return 0; | |
| 1520 | + case READ_6: | |
| 1521 | + if (ldev_info->state == MYRB_DEVICE_WO) { | |
| 1522 | + /* Data protect, attempt to read invalid data */ | |
| 1523 | + scsi_build_sense_buffer(0, scmd->sense_buffer, | |
| 1524 | + DATA_PROTECT, 0x21, 0x06); | |
| 1525 | + scmd->result = (DRIVER_SENSE << 24) | | |
| 1526 | + SAM_STAT_CHECK_CONDITION; | |
| 1527 | + scmd->scsi_done(scmd); | |
| 1528 | + return 0; | |
| 1529 | + } | |
| 1530 | + case WRITE_6: | |
| 1531 | + lba = (((scmd->cmnd[1] & 0x1F) << 16) | | |
| 1532 | + (scmd->cmnd[2] << 8) | | |
| 1533 | + scmd->cmnd[3]); | |
| 1534 | + block_cnt = scmd->cmnd[4]; | |
| 1535 | + break; | |
| 1536 | + case READ_10: | |
| 1537 | + if (ldev_info->state == MYRB_DEVICE_WO) { | |
| 1538 | + /* Data protect, attempt to read invalid data */ | |
| 1539 | + scsi_build_sense_buffer(0, scmd->sense_buffer, | |
| 1540 | + DATA_PROTECT, 0x21, 0x06); | |
| 1541 | + scmd->result = (DRIVER_SENSE << 24) | | |
| 1542 | + SAM_STAT_CHECK_CONDITION; | |
| 1543 | + scmd->scsi_done(scmd); | |
| 1544 | + return 0; | |
| 1545 | + } | |
| 1546 | + case WRITE_10: | |
| 1547 | + case VERIFY: /* 0x2F */ | |
| 1548 | + case WRITE_VERIFY: /* 0x2E */ | |
| 1549 | + lba = get_unaligned_be32(&scmd->cmnd[2]); | |
| 1550 | + block_cnt = get_unaligned_be16(&scmd->cmnd[7]); | |
| 1551 | + break; | |
| 1552 | + case READ_12: | |
| 1553 | + if (ldev_info->state == MYRB_DEVICE_WO) { | |
| 1554 | + /* Data protect, attempt to read invalid data */ | |
| 1555 | + scsi_build_sense_buffer(0, scmd->sense_buffer, | |
| 1556 | + DATA_PROTECT, 0x21, 0x06); | |
| 1557 | + scmd->result = (DRIVER_SENSE << 24) | | |
| 1558 | + SAM_STAT_CHECK_CONDITION; | |
| 1559 | + scmd->scsi_done(scmd); | |
| 1560 | + return 0; | |
| 1561 | + } | |
| 1562 | + case WRITE_12: | |
| 1563 | + case VERIFY_12: /* 0xAF */ | |
| 1564 | + case WRITE_VERIFY_12: /* 0xAE */ | |
| 1565 | + lba = get_unaligned_be32(&scmd->cmnd[2]); | |
| 1566 | + block_cnt = get_unaligned_be32(&scmd->cmnd[6]); | |
| 1567 | + break; | |
| 1568 | + default: | |
| 1569 | + /* Illegal request, invalid opcode */ | |
| 1570 | + scsi_build_sense_buffer(0, scmd->sense_buffer, | |
| 1571 | + ILLEGAL_REQUEST, 0x20, 0); | |
| 1572 | + scmd->result = (DRIVER_SENSE << 24) | SAM_STAT_CHECK_CONDITION; | |
| 1573 | + scmd->scsi_done(scmd); | |
| 1574 | + return 0; | |
| 1575 | + } | |
| 1576 | + | |
| 1577 | + myrb_reset_cmd(cmd_blk); | |
| 1578 | + mbox->type5.id = scmd->request->tag + 3; | |
| 1579 | + if (scmd->sc_data_direction == DMA_NONE) | |
| 1580 | + goto submit; | |
| 1581 | + nsge = scsi_dma_map(scmd); | |
| 1582 | + if (nsge == 1) { | |
| 1583 | + sgl = scsi_sglist(scmd); | |
| 1584 | + if (scmd->sc_data_direction == DMA_FROM_DEVICE) | |
| 1585 | + mbox->type5.opcode = MYRB_CMD_READ; | |
| 1586 | + else | |
| 1587 | + mbox->type5.opcode = MYRB_CMD_WRITE; | |
| 1588 | + | |
| 1589 | + mbox->type5.ld.xfer_len = block_cnt; | |
| 1590 | + mbox->type5.ld.ldev_num = sdev->id; | |
| 1591 | + mbox->type5.lba = lba; | |
| 1592 | + mbox->type5.addr = (u32)sg_dma_address(sgl); | |
| 1593 | + } else { | |
| 1594 | + struct myrb_sge *hw_sgl; | |
| 1595 | + dma_addr_t hw_sgl_addr; | |
| 1596 | + int i; | |
| 1597 | + | |
| 1598 | + hw_sgl = dma_pool_alloc(cb->sg_pool, GFP_ATOMIC, &hw_sgl_addr); | |
| 1599 | + if (!hw_sgl) | |
| 1600 | + return SCSI_MLQUEUE_HOST_BUSY; | |
| 1601 | + | |
| 1602 | + cmd_blk->sgl = hw_sgl; | |
| 1603 | + cmd_blk->sgl_addr = hw_sgl_addr; | |
| 1604 | + | |
| 1605 | + if (scmd->sc_data_direction == DMA_FROM_DEVICE) | |
| 1606 | + mbox->type5.opcode = MYRB_CMD_READ_SG; | |
| 1607 | + else | |
| 1608 | + mbox->type5.opcode = MYRB_CMD_WRITE_SG; | |
| 1609 | + | |
| 1610 | + mbox->type5.ld.xfer_len = block_cnt; | |
| 1611 | + mbox->type5.ld.ldev_num = sdev->id; | |
| 1612 | + mbox->type5.lba = lba; | |
| 1613 | + mbox->type5.addr = hw_sgl_addr; | |
| 1614 | + mbox->type5.sg_count = nsge; | |
| 1615 | + | |
| 1616 | + scsi_for_each_sg(scmd, sgl, nsge, i) { | |
| 1617 | + hw_sgl->sge_addr = (u32)sg_dma_address(sgl); | |
| 1618 | + hw_sgl->sge_count = (u32)sg_dma_len(sgl); | |
| 1619 | + hw_sgl++; | |
| 1620 | + } | |
| 1621 | + } | |
| 1622 | +submit: | |
| 1623 | + spin_lock_irqsave(&cb->queue_lock, flags); | |
| 1624 | + cb->qcmd(cb, cmd_blk); | |
| 1625 | + spin_unlock_irqrestore(&cb->queue_lock, flags); | |
| 1626 | + | |
| 1627 | + return 0; | |
| 1628 | +} | |
| 1629 | + | |
| 1630 | +static int myrb_queuecommand(struct Scsi_Host *shost, | |
| 1631 | + struct scsi_cmnd *scmd) | |
| 1632 | +{ | |
| 1633 | + struct scsi_device *sdev = scmd->device; | |
| 1634 | + | |
| 1635 | + if (sdev->channel > myrb_logical_channel(shost)) { | |
| 1636 | + scmd->result = (DID_BAD_TARGET << 16); | |
| 1637 | + scmd->scsi_done(scmd); | |
| 1638 | + return 0; | |
| 1639 | + } | |
| 1640 | + if (sdev->channel == myrb_logical_channel(shost)) | |
| 1641 | + return myrb_ldev_queuecommand(shost, scmd); | |
| 1642 | + | |
| 1643 | + return myrb_pthru_queuecommand(shost, scmd); | |
| 1644 | +} | |
| 1645 | + | |
| 1646 | +static int myrb_ldev_slave_alloc(struct scsi_device *sdev) | |
| 1647 | +{ | |
| 1648 | + struct myrb_hba *cb = shost_priv(sdev->host); | |
| 1649 | + struct myrb_ldev_info *ldev_info; | |
| 1650 | + unsigned short ldev_num = sdev->id; | |
| 1651 | + enum raid_level level; | |
| 1652 | + | |
| 1653 | + ldev_info = cb->ldev_info_buf + ldev_num; | |
| 1654 | + if (!ldev_info) | |
| 1655 | + return -ENXIO; | |
| 1656 | + | |
| 1657 | + sdev->hostdata = kzalloc(sizeof(*ldev_info), GFP_KERNEL); | |
| 1658 | + if (!sdev->hostdata) | |
| 1659 | + return -ENOMEM; | |
| 1660 | + dev_dbg(&sdev->sdev_gendev, | |
| 1661 | + "slave alloc ldev %d state %x\n", | |
| 1662 | + ldev_num, ldev_info->state); | |
| 1663 | + memcpy(sdev->hostdata, ldev_info, | |
| 1664 | + sizeof(*ldev_info)); | |
| 1665 | + switch (ldev_info->raid_level) { | |
| 1666 | + case MYRB_RAID_LEVEL0: | |
| 1667 | + level = RAID_LEVEL_LINEAR; | |
| 1668 | + break; | |
| 1669 | + case MYRB_RAID_LEVEL1: | |
| 1670 | + level = RAID_LEVEL_1; | |
| 1671 | + break; | |
| 1672 | + case MYRB_RAID_LEVEL3: | |
| 1673 | + level = RAID_LEVEL_3; | |
| 1674 | + break; | |
| 1675 | + case MYRB_RAID_LEVEL5: | |
| 1676 | + level = RAID_LEVEL_5; | |
| 1677 | + break; | |
| 1678 | + case MYRB_RAID_LEVEL6: | |
| 1679 | + level = RAID_LEVEL_6; | |
| 1680 | + break; | |
| 1681 | + case MYRB_RAID_JBOD: | |
| 1682 | + level = RAID_LEVEL_JBOD; | |
| 1683 | + break; | |
| 1684 | + default: | |
| 1685 | + level = RAID_LEVEL_UNKNOWN; | |
| 1686 | + break; | |
| 1687 | + } | |
| 1688 | + raid_set_level(myrb_raid_template, &sdev->sdev_gendev, level); | |
| 1689 | + return 0; | |
| 1690 | +} | |
| 1691 | + | |
| 1692 | +static int myrb_pdev_slave_alloc(struct scsi_device *sdev) | |
| 1693 | +{ | |
| 1694 | + struct myrb_hba *cb = shost_priv(sdev->host); | |
| 1695 | + struct myrb_pdev_state *pdev_info; | |
| 1696 | + unsigned short status; | |
| 1697 | + | |
| 1698 | + if (sdev->id > MYRB_MAX_TARGETS) | |
| 1699 | + return -ENXIO; | |
| 1700 | + | |
| 1701 | + pdev_info = kzalloc(sizeof(*pdev_info), GFP_KERNEL|GFP_DMA); | |
| 1702 | + if (!pdev_info) | |
| 1703 | + return -ENOMEM; | |
| 1704 | + | |
| 1705 | + status = myrb_exec_type3D(cb, MYRB_CMD_GET_DEVICE_STATE, | |
| 1706 | + sdev, pdev_info); | |
| 1707 | + if (status != MYRB_STATUS_SUCCESS) { | |
| 1708 | + dev_dbg(&sdev->sdev_gendev, | |
| 1709 | + "Failed to get device state, status %x\n", | |
| 1710 | + status); | |
| 1711 | + kfree(pdev_info); | |
| 1712 | + return -ENXIO; | |
| 1713 | + } | |
| 1714 | + if (!pdev_info->present) { | |
| 1715 | + dev_dbg(&sdev->sdev_gendev, | |
| 1716 | + "device not present, skip\n"); | |
| 1717 | + kfree(pdev_info); | |
| 1718 | + return -ENXIO; | |
| 1719 | + } | |
| 1720 | + dev_dbg(&sdev->sdev_gendev, | |
| 1721 | + "slave alloc pdev %d:%d state %x\n", | |
| 1722 | + sdev->channel, sdev->id, pdev_info->state); | |
| 1723 | + sdev->hostdata = pdev_info; | |
| 1724 | + | |
| 1725 | + return 0; | |
| 1726 | +} | |
| 1727 | + | |
| 1728 | +static int myrb_slave_alloc(struct scsi_device *sdev) | |
| 1729 | +{ | |
| 1730 | + if (sdev->channel > myrb_logical_channel(sdev->host)) | |
| 1731 | + return -ENXIO; | |
| 1732 | + | |
| 1733 | + if (sdev->lun > 0) | |
| 1734 | + return -ENXIO; | |
| 1735 | + | |
| 1736 | + if (sdev->channel == myrb_logical_channel(sdev->host)) | |
| 1737 | + return myrb_ldev_slave_alloc(sdev); | |
| 1738 | + | |
| 1739 | + return myrb_pdev_slave_alloc(sdev); | |
| 1740 | +} | |
| 1741 | + | |
| 1742 | +static int myrb_slave_configure(struct scsi_device *sdev) | |
| 1743 | +{ | |
| 1744 | + struct myrb_ldev_info *ldev_info; | |
| 1745 | + | |
| 1746 | + if (sdev->channel > myrb_logical_channel(sdev->host)) | |
| 1747 | + return -ENXIO; | |
| 1748 | + | |
| 1749 | + if (sdev->channel < myrb_logical_channel(sdev->host)) { | |
| 1750 | + sdev->no_uld_attach = 1; | |
| 1751 | + return 0; | |
| 1752 | + } | |
| 1753 | + if (sdev->lun != 0) | |
| 1754 | + return -ENXIO; | |
| 1755 | + | |
| 1756 | + ldev_info = sdev->hostdata; | |
| 1757 | + if (!ldev_info) | |
| 1758 | + return -ENXIO; | |
| 1759 | + if (ldev_info->state != MYRB_DEVICE_ONLINE) | |
| 1760 | + sdev_printk(KERN_INFO, sdev, | |
| 1761 | + "Logical drive is %s\n", | |
| 1762 | + myrb_devstate_name(ldev_info->state)); | |
| 1763 | + | |
| 1764 | + sdev->tagged_supported = 1; | |
| 1765 | + return 0; | |
| 1766 | +} | |
| 1767 | + | |
| 1768 | +static void myrb_slave_destroy(struct scsi_device *sdev) | |
| 1769 | +{ | |
| 1770 | + kfree(sdev->hostdata); | |
| 1771 | +} | |
| 1772 | + | |
| 1773 | +static int myrb_biosparam(struct scsi_device *sdev, struct block_device *bdev, | |
| 1774 | + sector_t capacity, int geom[]) | |
| 1775 | +{ | |
| 1776 | + struct myrb_hba *cb = shost_priv(sdev->host); | |
| 1777 | + | |
| 1778 | + geom[0] = cb->ldev_geom_heads; | |
| 1779 | + geom[1] = cb->ldev_geom_sectors; | |
| 1780 | + geom[2] = sector_div(capacity, geom[0] * geom[1]); | |
| 1781 | + | |
| 1782 | + return 0; | |
| 1783 | +} | |
| 1784 | + | |
| 1785 | +static ssize_t raid_state_show(struct device *dev, | |
| 1786 | + struct device_attribute *attr, char *buf) | |
| 1787 | +{ | |
| 1788 | + struct scsi_device *sdev = to_scsi_device(dev); | |
| 1789 | + struct myrb_hba *cb = shost_priv(sdev->host); | |
| 1790 | + int ret; | |
| 1791 | + | |
| 1792 | + if (!sdev->hostdata) | |
| 1793 | + return snprintf(buf, 16, "Unknown\n"); | |
| 1794 | + | |
| 1795 | + if (sdev->channel == myrb_logical_channel(sdev->host)) { | |
| 1796 | + struct myrb_ldev_info *ldev_info = sdev->hostdata; | |
| 1797 | + const char *name; | |
| 1798 | + | |
| 1799 | + name = myrb_devstate_name(ldev_info->state); | |
| 1800 | + if (name) | |
| 1801 | + ret = snprintf(buf, 32, "%s\n", name); | |
| 1802 | + else | |
| 1803 | + ret = snprintf(buf, 32, "Invalid (%02X)\n", | |
| 1804 | + ldev_info->state); | |
| 1805 | + } else { | |
| 1806 | + struct myrb_pdev_state *pdev_info = sdev->hostdata; | |
| 1807 | + unsigned short status; | |
| 1808 | + const char *name; | |
| 1809 | + | |
| 1810 | + status = myrb_exec_type3D(cb, MYRB_CMD_GET_DEVICE_STATE, | |
| 1811 | + sdev, pdev_info); | |
| 1812 | + if (status != MYRB_STATUS_SUCCESS) | |
| 1813 | + sdev_printk(KERN_INFO, sdev, | |
| 1814 | + "Failed to get device state, status %x\n", | |
| 1815 | + status); | |
| 1816 | + | |
| 1817 | + if (!pdev_info->present) | |
| 1818 | + name = "Removed"; | |
| 1819 | + else | |
| 1820 | + name = myrb_devstate_name(pdev_info->state); | |
| 1821 | + if (name) | |
| 1822 | + ret = snprintf(buf, 32, "%s\n", name); | |
| 1823 | + else | |
| 1824 | + ret = snprintf(buf, 32, "Invalid (%02X)\n", | |
| 1825 | + pdev_info->state); | |
| 1826 | + } | |
| 1827 | + return ret; | |
| 1828 | +} | |
| 1829 | + | |
| 1830 | +static ssize_t raid_state_store(struct device *dev, | |
| 1831 | + struct device_attribute *attr, const char *buf, size_t count) | |
| 1832 | +{ | |
| 1833 | + struct scsi_device *sdev = to_scsi_device(dev); | |
| 1834 | + struct myrb_hba *cb = shost_priv(sdev->host); | |
| 1835 | + struct myrb_pdev_state *pdev_info; | |
| 1836 | + enum myrb_devstate new_state; | |
| 1837 | + unsigned short status; | |
| 1838 | + | |
| 1839 | + if (!strncmp(buf, "kill", 4) || | |
| 1840 | + !strncmp(buf, "offline", 7)) | |
| 1841 | + new_state = MYRB_DEVICE_DEAD; | |
| 1842 | + else if (!strncmp(buf, "online", 6)) | |
| 1843 | + new_state = MYRB_DEVICE_ONLINE; | |
| 1844 | + else if (!strncmp(buf, "standby", 7)) | |
| 1845 | + new_state = MYRB_DEVICE_STANDBY; | |
| 1846 | + else | |
| 1847 | + return -EINVAL; | |
| 1848 | + | |
| 1849 | + pdev_info = sdev->hostdata; | |
| 1850 | + if (!pdev_info) { | |
| 1851 | + sdev_printk(KERN_INFO, sdev, | |
| 1852 | + "Failed - no physical device information\n"); | |
| 1853 | + return -ENXIO; | |
| 1854 | + } | |
| 1855 | + if (!pdev_info->present) { | |
| 1856 | + sdev_printk(KERN_INFO, sdev, | |
| 1857 | + "Failed - device not present\n"); | |
| 1858 | + return -ENXIO; | |
| 1859 | + } | |
| 1860 | + | |
| 1861 | + if (pdev_info->state == new_state) | |
| 1862 | + return count; | |
| 1863 | + | |
| 1864 | + status = myrb_set_pdev_state(cb, sdev, new_state); | |
| 1865 | + switch (status) { | |
| 1866 | + case MYRB_STATUS_SUCCESS: | |
| 1867 | + break; | |
| 1868 | + case MYRB_STATUS_START_DEVICE_FAILED: | |
| 1869 | + sdev_printk(KERN_INFO, sdev, | |
| 1870 | + "Failed - Unable to Start Device\n"); | |
| 1871 | + count = -EAGAIN; | |
| 1872 | + break; | |
| 1873 | + case MYRB_STATUS_NO_DEVICE: | |
| 1874 | + sdev_printk(KERN_INFO, sdev, | |
| 1875 | + "Failed - No Device at Address\n"); | |
| 1876 | + count = -ENODEV; | |
| 1877 | + break; | |
| 1878 | + case MYRB_STATUS_INVALID_CHANNEL_OR_TARGET: | |
| 1879 | + sdev_printk(KERN_INFO, sdev, | |
| 1880 | + "Failed - Invalid Channel or Target or Modifier\n"); | |
| 1881 | + count = -EINVAL; | |
| 1882 | + break; | |
| 1883 | + case MYRB_STATUS_CHANNEL_BUSY: | |
| 1884 | + sdev_printk(KERN_INFO, sdev, | |
| 1885 | + "Failed - Channel Busy\n"); | |
| 1886 | + count = -EBUSY; | |
| 1887 | + break; | |
| 1888 | + default: | |
| 1889 | + sdev_printk(KERN_INFO, sdev, | |
| 1890 | + "Failed - Unexpected Status %04X\n", status); | |
| 1891 | + count = -EIO; | |
| 1892 | + break; | |
| 1893 | + } | |
| 1894 | + return count; | |
| 1895 | +} | |
| 1896 | +static DEVICE_ATTR_RW(raid_state); | |
| 1897 | + | |
| 1898 | +static ssize_t raid_level_show(struct device *dev, | |
| 1899 | + struct device_attribute *attr, char *buf) | |
| 1900 | +{ | |
| 1901 | + struct scsi_device *sdev = to_scsi_device(dev); | |
| 1902 | + | |
| 1903 | + if (sdev->channel == myrb_logical_channel(sdev->host)) { | |
| 1904 | + struct myrb_ldev_info *ldev_info = sdev->hostdata; | |
| 1905 | + const char *name; | |
| 1906 | + | |
| 1907 | + if (!ldev_info) | |
| 1908 | + return -ENXIO; | |
| 1909 | + | |
| 1910 | + name = myrb_raidlevel_name(ldev_info->raid_level); | |
| 1911 | + if (!name) | |
| 1912 | + return snprintf(buf, 32, "Invalid (%02X)\n", | |
| 1913 | + ldev_info->state); | |
| 1914 | + return snprintf(buf, 32, "%s\n", name); | |
| 1915 | + } | |
| 1916 | + return snprintf(buf, 32, "Physical Drive\n"); | |
| 1917 | +} | |
| 1918 | +static DEVICE_ATTR_RO(raid_level); | |
| 1919 | + | |
| 1920 | +static ssize_t rebuild_show(struct device *dev, | |
| 1921 | + struct device_attribute *attr, char *buf) | |
| 1922 | +{ | |
| 1923 | + struct scsi_device *sdev = to_scsi_device(dev); | |
| 1924 | + struct myrb_hba *cb = shost_priv(sdev->host); | |
| 1925 | + struct myrb_rbld_progress rbld_buf; | |
| 1926 | + unsigned char status; | |
| 1927 | + | |
| 1928 | + if (sdev->channel < myrb_logical_channel(sdev->host)) | |
| 1929 | + return snprintf(buf, 32, "physical device - not rebuilding\n"); | |
| 1930 | + | |
| 1931 | + status = myrb_get_rbld_progress(cb, &rbld_buf); | |
| 1932 | + | |
| 1933 | + if (rbld_buf.ldev_num != sdev->id || | |
| 1934 | + status != MYRB_STATUS_SUCCESS) | |
| 1935 | + return snprintf(buf, 32, "not rebuilding\n"); | |
| 1936 | + | |
| 1937 | + return snprintf(buf, 32, "rebuilding block %u of %u\n", | |
| 1938 | + rbld_buf.ldev_size - rbld_buf.blocks_left, | |
| 1939 | + rbld_buf.ldev_size); | |
| 1940 | +} | |
| 1941 | + | |
| 1942 | +static ssize_t rebuild_store(struct device *dev, | |
| 1943 | + struct device_attribute *attr, const char *buf, size_t count) | |
| 1944 | +{ | |
| 1945 | + struct scsi_device *sdev = to_scsi_device(dev); | |
| 1946 | + struct myrb_hba *cb = shost_priv(sdev->host); | |
| 1947 | + struct myrb_cmdblk *cmd_blk; | |
| 1948 | + union myrb_cmd_mbox *mbox; | |
| 1949 | + unsigned short status; | |
| 1950 | + int rc, start; | |
| 1951 | + const char *msg; | |
| 1952 | + | |
| 1953 | + rc = kstrtoint(buf, 0, &start); | |
| 1954 | + if (rc) | |
| 1955 | + return rc; | |
| 1956 | + | |
| 1957 | + if (sdev->channel >= myrb_logical_channel(sdev->host)) | |
| 1958 | + return -ENXIO; | |
| 1959 | + | |
| 1960 | + status = myrb_get_rbld_progress(cb, NULL); | |
| 1961 | + if (start) { | |
| 1962 | + if (status == MYRB_STATUS_SUCCESS) { | |
| 1963 | + sdev_printk(KERN_INFO, sdev, | |
| 1964 | + "Rebuild Not Initiated; already in progress\n"); | |
| 1965 | + return -EALREADY; | |
| 1966 | + } | |
| 1967 | + mutex_lock(&cb->dcmd_mutex); | |
| 1968 | + cmd_blk = &cb->dcmd_blk; | |
| 1969 | + myrb_reset_cmd(cmd_blk); | |
| 1970 | + mbox = &cmd_blk->mbox; | |
| 1971 | + mbox->type3D.opcode = MYRB_CMD_REBUILD_ASYNC; | |
| 1972 | + mbox->type3D.id = MYRB_DCMD_TAG; | |
| 1973 | + mbox->type3D.channel = sdev->channel; | |
| 1974 | + mbox->type3D.target = sdev->id; | |
| 1975 | + status = myrb_exec_cmd(cb, cmd_blk); | |
| 1976 | + mutex_unlock(&cb->dcmd_mutex); | |
| 1977 | + } else { | |
| 1978 | + struct pci_dev *pdev = cb->pdev; | |
| 1979 | + unsigned char *rate; | |
| 1980 | + dma_addr_t rate_addr; | |
| 1981 | + | |
| 1982 | + if (status != MYRB_STATUS_SUCCESS) { | |
| 1983 | + sdev_printk(KERN_INFO, sdev, | |
| 1984 | + "Rebuild Not Cancelled; not in progress\n"); | |
| 1985 | + return 0; | |
| 1986 | + } | |
| 1987 | + | |
| 1988 | + rate = dma_alloc_coherent(&pdev->dev, sizeof(char), | |
| 1989 | + &rate_addr, GFP_KERNEL); | |
| 1990 | + if (rate == NULL) { | |
| 1991 | + sdev_printk(KERN_INFO, sdev, | |
| 1992 | + "Cancellation of Rebuild Failed - Out of Memory\n"); | |
| 1993 | + return -ENOMEM; | |
| 1994 | + } | |
| 1995 | + mutex_lock(&cb->dcmd_mutex); | |
| 1996 | + cmd_blk = &cb->dcmd_blk; | |
| 1997 | + myrb_reset_cmd(cmd_blk); | |
| 1998 | + mbox = &cmd_blk->mbox; | |
| 1999 | + mbox->type3R.opcode = MYRB_CMD_REBUILD_CONTROL; | |
| 2000 | + mbox->type3R.id = MYRB_DCMD_TAG; | |
| 2001 | + mbox->type3R.rbld_rate = 0xFF; | |
| 2002 | + mbox->type3R.addr = rate_addr; | |
| 2003 | + status = myrb_exec_cmd(cb, cmd_blk); | |
| 2004 | + dma_free_coherent(&pdev->dev, sizeof(char), rate, rate_addr); | |
| 2005 | + mutex_unlock(&cb->dcmd_mutex); | |
| 2006 | + } | |
| 2007 | + if (status == MYRB_STATUS_SUCCESS) { | |
| 2008 | + sdev_printk(KERN_INFO, sdev, "Rebuild %s\n", | |
| 2009 | + start ? "Initiated" : "Cancelled"); | |
| 2010 | + return count; | |
| 2011 | + } | |
| 2012 | + if (!start) { | |
| 2013 | + sdev_printk(KERN_INFO, sdev, | |
| 2014 | + "Rebuild Not Cancelled, status 0x%x\n", | |
| 2015 | + status); | |
| 2016 | + return -EIO; | |
| 2017 | + } | |
| 2018 | + | |
| 2019 | + switch (status) { | |
| 2020 | + case MYRB_STATUS_ATTEMPT_TO_RBLD_ONLINE_DRIVE: | |
| 2021 | + msg = "Attempt to Rebuild Online or Unresponsive Drive"; | |
| 2022 | + break; | |
| 2023 | + case MYRB_STATUS_RBLD_NEW_DISK_FAILED: | |
| 2024 | + msg = "New Disk Failed During Rebuild"; | |
| 2025 | + break; | |
| 2026 | + case MYRB_STATUS_INVALID_ADDRESS: | |
| 2027 | + msg = "Invalid Device Address"; | |
| 2028 | + break; | |
| 2029 | + case MYRB_STATUS_RBLD_OR_CHECK_INPROGRESS: | |
| 2030 | + msg = "Already in Progress"; | |
| 2031 | + break; | |
| 2032 | + default: | |
| 2033 | + msg = NULL; | |
| 2034 | + break; | |
| 2035 | + } | |
| 2036 | + if (msg) | |
| 2037 | + sdev_printk(KERN_INFO, sdev, | |
| 2038 | + "Rebuild Failed - %s\n", msg); | |
| 2039 | + else | |
| 2040 | + sdev_printk(KERN_INFO, sdev, | |
| 2041 | + "Rebuild Failed, status 0x%x\n", status); | |
| 2042 | + | |
| 2043 | + return -EIO; | |
| 2044 | +} | |
| 2045 | +static DEVICE_ATTR_RW(rebuild); | |
| 2046 | + | |
| 2047 | +static ssize_t consistency_check_store(struct device *dev, | |
| 2048 | + struct device_attribute *attr, const char *buf, size_t count) | |
| 2049 | +{ | |
| 2050 | + struct scsi_device *sdev = to_scsi_device(dev); | |
| 2051 | + struct myrb_hba *cb = shost_priv(sdev->host); | |
| 2052 | + struct myrb_rbld_progress rbld_buf; | |
| 2053 | + struct myrb_cmdblk *cmd_blk; | |
| 2054 | + union myrb_cmd_mbox *mbox; | |
| 2055 | + unsigned short ldev_num = 0xFFFF; | |
| 2056 | + unsigned short status; | |
| 2057 | + int rc, start; | |
| 2058 | + const char *msg; | |
| 2059 | + | |
| 2060 | + rc = kstrtoint(buf, 0, &start); | |
| 2061 | + if (rc) | |
| 2062 | + return rc; | |
| 2063 | + | |
| 2064 | + if (sdev->channel < myrb_logical_channel(sdev->host)) | |
| 2065 | + return -ENXIO; | |
| 2066 | + | |
| 2067 | + status = myrb_get_rbld_progress(cb, &rbld_buf); | |
| 2068 | + if (start) { | |
| 2069 | + if (status == MYRB_STATUS_SUCCESS) { | |
| 2070 | + sdev_printk(KERN_INFO, sdev, | |
| 2071 | + "Check Consistency Not Initiated; already in progress\n"); | |
| 2072 | + return -EALREADY; | |
| 2073 | + } | |
| 2074 | + mutex_lock(&cb->dcmd_mutex); | |
| 2075 | + cmd_blk = &cb->dcmd_blk; | |
| 2076 | + myrb_reset_cmd(cmd_blk); | |
| 2077 | + mbox = &cmd_blk->mbox; | |
| 2078 | + mbox->type3C.opcode = MYRB_CMD_CHECK_CONSISTENCY_ASYNC; | |
| 2079 | + mbox->type3C.id = MYRB_DCMD_TAG; | |
| 2080 | + mbox->type3C.ldev_num = sdev->id; | |
| 2081 | + mbox->type3C.auto_restore = true; | |
| 2082 | + | |
| 2083 | + status = myrb_exec_cmd(cb, cmd_blk); | |
| 2084 | + mutex_unlock(&cb->dcmd_mutex); | |
| 2085 | + } else { | |
| 2086 | + struct pci_dev *pdev = cb->pdev; | |
| 2087 | + unsigned char *rate; | |
| 2088 | + dma_addr_t rate_addr; | |
| 2089 | + | |
| 2090 | + if (ldev_num != sdev->id) { | |
| 2091 | + sdev_printk(KERN_INFO, sdev, | |
| 2092 | + "Check Consistency Not Cancelled; not in progress\n"); | |
| 2093 | + return 0; | |
| 2094 | + } | |
| 2095 | + rate = dma_alloc_coherent(&pdev->dev, sizeof(char), | |
| 2096 | + &rate_addr, GFP_KERNEL); | |
| 2097 | + if (rate == NULL) { | |
| 2098 | + sdev_printk(KERN_INFO, sdev, | |
| 2099 | + "Cancellation of Check Consistency Failed - Out of Memory\n"); | |
| 2100 | + return -ENOMEM; | |
| 2101 | + } | |
| 2102 | + mutex_lock(&cb->dcmd_mutex); | |
| 2103 | + cmd_blk = &cb->dcmd_blk; | |
| 2104 | + myrb_reset_cmd(cmd_blk); | |
| 2105 | + mbox = &cmd_blk->mbox; | |
| 2106 | + mbox->type3R.opcode = MYRB_CMD_REBUILD_CONTROL; | |
| 2107 | + mbox->type3R.id = MYRB_DCMD_TAG; | |
| 2108 | + mbox->type3R.rbld_rate = 0xFF; | |
| 2109 | + mbox->type3R.addr = rate_addr; | |
| 2110 | + status = myrb_exec_cmd(cb, cmd_blk); | |
| 2111 | + dma_free_coherent(&pdev->dev, sizeof(char), rate, rate_addr); | |
| 2112 | + mutex_unlock(&cb->dcmd_mutex); | |
| 2113 | + } | |
| 2114 | + if (status == MYRB_STATUS_SUCCESS) { | |
| 2115 | + sdev_printk(KERN_INFO, sdev, "Check Consistency %s\n", | |
| 2116 | + start ? "Initiated" : "Cancelled"); | |
| 2117 | + return count; | |
| 2118 | + } | |
| 2119 | + if (!start) { | |
| 2120 | + sdev_printk(KERN_INFO, sdev, | |
| 2121 | + "Check Consistency Not Cancelled, status 0x%x\n", | |
| 2122 | + status); | |
| 2123 | + return -EIO; | |
| 2124 | + } | |
| 2125 | + | |
| 2126 | + switch (status) { | |
| 2127 | + case MYRB_STATUS_ATTEMPT_TO_RBLD_ONLINE_DRIVE: | |
| 2128 | + msg = "Dependent Physical Device is DEAD"; | |
| 2129 | + break; | |
| 2130 | + case MYRB_STATUS_RBLD_NEW_DISK_FAILED: | |
| 2131 | + msg = "New Disk Failed During Rebuild"; | |
| 2132 | + break; | |
| 2133 | + case MYRB_STATUS_INVALID_ADDRESS: | |
| 2134 | + msg = "Invalid or Nonredundant Logical Drive"; | |
| 2135 | + break; | |
| 2136 | + case MYRB_STATUS_RBLD_OR_CHECK_INPROGRESS: | |
| 2137 | + msg = "Already in Progress"; | |
| 2138 | + break; | |
| 2139 | + default: | |
| 2140 | + msg = NULL; | |
| 2141 | + break; | |
| 2142 | + } | |
| 2143 | + if (msg) | |
| 2144 | + sdev_printk(KERN_INFO, sdev, | |
| 2145 | + "Check Consistency Failed - %s\n", msg); | |
| 2146 | + else | |
| 2147 | + sdev_printk(KERN_INFO, sdev, | |
| 2148 | + "Check Consistency Failed, status 0x%x\n", status); | |
| 2149 | + | |
| 2150 | + return -EIO; | |
| 2151 | +} | |
| 2152 | + | |
| 2153 | +static ssize_t consistency_check_show(struct device *dev, | |
| 2154 | + struct device_attribute *attr, char *buf) | |
| 2155 | +{ | |
| 2156 | + return rebuild_show(dev, attr, buf); | |
| 2157 | +} | |
| 2158 | +static DEVICE_ATTR_RW(consistency_check); | |
| 2159 | + | |
| 2160 | +static ssize_t ctlr_num_show(struct device *dev, | |
| 2161 | + struct device_attribute *attr, char *buf) | |
| 2162 | +{ | |
| 2163 | + struct Scsi_Host *shost = class_to_shost(dev); | |
| 2164 | + struct myrb_hba *cb = shost_priv(shost); | |
| 2165 | + | |
| 2166 | + return snprintf(buf, 20, "%d\n", cb->ctlr_num); | |
| 2167 | +} | |
| 2168 | +static DEVICE_ATTR_RO(ctlr_num); | |
| 2169 | + | |
| 2170 | +static ssize_t firmware_show(struct device *dev, | |
| 2171 | + struct device_attribute *attr, char *buf) | |
| 2172 | +{ | |
| 2173 | + struct Scsi_Host *shost = class_to_shost(dev); | |
| 2174 | + struct myrb_hba *cb = shost_priv(shost); | |
| 2175 | + | |
| 2176 | + return snprintf(buf, 16, "%s\n", cb->fw_version); | |
| 2177 | +} | |
| 2178 | +static DEVICE_ATTR_RO(firmware); | |
| 2179 | + | |
| 2180 | +static ssize_t model_show(struct device *dev, | |
| 2181 | + struct device_attribute *attr, char *buf) | |
| 2182 | +{ | |
| 2183 | + struct Scsi_Host *shost = class_to_shost(dev); | |
| 2184 | + struct myrb_hba *cb = shost_priv(shost); | |
| 2185 | + | |
| 2186 | + return snprintf(buf, 16, "%s\n", cb->model_name); | |
| 2187 | +} | |
| 2188 | +static DEVICE_ATTR_RO(model); | |
| 2189 | + | |
| 2190 | +static ssize_t flush_cache_store(struct device *dev, | |
| 2191 | + struct device_attribute *attr, const char *buf, size_t count) | |
| 2192 | +{ | |
| 2193 | + struct Scsi_Host *shost = class_to_shost(dev); | |
| 2194 | + struct myrb_hba *cb = shost_priv(shost); | |
| 2195 | + unsigned short status; | |
| 2196 | + | |
| 2197 | + status = myrb_exec_type3(cb, MYRB_CMD_FLUSH, 0); | |
| 2198 | + if (status == MYRB_STATUS_SUCCESS) { | |
| 2199 | + shost_printk(KERN_INFO, shost, | |
| 2200 | + "Cache Flush Completed\n"); | |
| 2201 | + return count; | |
| 2202 | + } | |
| 2203 | + shost_printk(KERN_INFO, shost, | |
| 2204 | + "Cache Flush Failed, status %x\n", status); | |
| 2205 | + return -EIO; | |
| 2206 | +} | |
| 2207 | +static DEVICE_ATTR_WO(flush_cache); | |
| 2208 | + | |
| 2209 | +static struct device_attribute *myrb_sdev_attrs[] = { | |
| 2210 | + &dev_attr_rebuild, | |
| 2211 | + &dev_attr_consistency_check, | |
| 2212 | + &dev_attr_raid_state, | |
| 2213 | + &dev_attr_raid_level, | |
| 2214 | + NULL, | |
| 2215 | +}; | |
| 2216 | + | |
| 2217 | +static struct device_attribute *myrb_shost_attrs[] = { | |
| 2218 | + &dev_attr_ctlr_num, | |
| 2219 | + &dev_attr_model, | |
| 2220 | + &dev_attr_firmware, | |
| 2221 | + &dev_attr_flush_cache, | |
| 2222 | + NULL, | |
| 2223 | +}; | |
| 2224 | + | |
| 2225 | +struct scsi_host_template myrb_template = { | |
| 2226 | + .module = THIS_MODULE, | |
| 2227 | + .name = "DAC960", | |
| 2228 | + .proc_name = "myrb", | |
| 2229 | + .queuecommand = myrb_queuecommand, | |
| 2230 | + .eh_host_reset_handler = myrb_host_reset, | |
| 2231 | + .slave_alloc = myrb_slave_alloc, | |
| 2232 | + .slave_configure = myrb_slave_configure, | |
| 2233 | + .slave_destroy = myrb_slave_destroy, | |
| 2234 | + .bios_param = myrb_biosparam, | |
| 2235 | + .cmd_size = sizeof(struct myrb_cmdblk), | |
| 2236 | + .shost_attrs = myrb_shost_attrs, | |
| 2237 | + .sdev_attrs = myrb_sdev_attrs, | |
| 2238 | + .this_id = -1, | |
| 2239 | +}; | |
| 2240 | + | |
| 2241 | +/** | |
| 2242 | + * myrb_is_raid - return boolean indicating device is raid volume | |
| 2243 | + * @dev the device struct object | |
| 2244 | + */ | |
| 2245 | +static int myrb_is_raid(struct device *dev) | |
| 2246 | +{ | |
| 2247 | + struct scsi_device *sdev = to_scsi_device(dev); | |
| 2248 | + | |
| 2249 | + return sdev->channel == myrb_logical_channel(sdev->host); | |
| 2250 | +} | |
| 2251 | + | |
| 2252 | +/** | |
| 2253 | + * myrb_get_resync - get raid volume resync percent complete | |
| 2254 | + * @dev the device struct object | |
| 2255 | + */ | |
| 2256 | +static void myrb_get_resync(struct device *dev) | |
| 2257 | +{ | |
| 2258 | + struct scsi_device *sdev = to_scsi_device(dev); | |
| 2259 | + struct myrb_hba *cb = shost_priv(sdev->host); | |
| 2260 | + struct myrb_rbld_progress rbld_buf; | |
| 2261 | + unsigned int percent_complete = 0; | |
| 2262 | + unsigned short status; | |
| 2263 | + unsigned int ldev_size = 0, remaining = 0; | |
| 2264 | + | |
| 2265 | + if (sdev->channel < myrb_logical_channel(sdev->host)) | |
| 2266 | + return; | |
| 2267 | + status = myrb_get_rbld_progress(cb, &rbld_buf); | |
| 2268 | + if (status == MYRB_STATUS_SUCCESS) { | |
| 2269 | + if (rbld_buf.ldev_num == sdev->id) { | |
| 2270 | + ldev_size = rbld_buf.ldev_size; | |
| 2271 | + remaining = rbld_buf.blocks_left; | |
| 2272 | + } | |
| 2273 | + } | |
| 2274 | + if (remaining && ldev_size) | |
| 2275 | + percent_complete = (ldev_size - remaining) * 100 / ldev_size; | |
| 2276 | + raid_set_resync(myrb_raid_template, dev, percent_complete); | |
| 2277 | +} | |
| 2278 | + | |
| 2279 | +/** | |
| 2280 | + * myrb_get_state - get raid volume status | |
| 2281 | + * @dev the device struct object | |
| 2282 | + */ | |
| 2283 | +static void myrb_get_state(struct device *dev) | |
| 2284 | +{ | |
| 2285 | + struct scsi_device *sdev = to_scsi_device(dev); | |
| 2286 | + struct myrb_hba *cb = shost_priv(sdev->host); | |
| 2287 | + struct myrb_ldev_info *ldev_info = sdev->hostdata; | |
| 2288 | + enum raid_state state = RAID_STATE_UNKNOWN; | |
| 2289 | + unsigned short status; | |
| 2290 | + | |
| 2291 | + if (sdev->channel < myrb_logical_channel(sdev->host) || !ldev_info) | |
| 2292 | + state = RAID_STATE_UNKNOWN; | |
| 2293 | + else { | |
| 2294 | + status = myrb_get_rbld_progress(cb, NULL); | |
| 2295 | + if (status == MYRB_STATUS_SUCCESS) | |
| 2296 | + state = RAID_STATE_RESYNCING; | |
| 2297 | + else { | |
| 2298 | + switch (ldev_info->state) { | |
| 2299 | + case MYRB_DEVICE_ONLINE: | |
| 2300 | + state = RAID_STATE_ACTIVE; | |
| 2301 | + break; | |
| 2302 | + case MYRB_DEVICE_WO: | |
| 2303 | + case MYRB_DEVICE_CRITICAL: | |
| 2304 | + state = RAID_STATE_DEGRADED; | |
| 2305 | + break; | |
| 2306 | + default: | |
| 2307 | + state = RAID_STATE_OFFLINE; | |
| 2308 | + } | |
| 2309 | + } | |
| 2310 | + } | |
| 2311 | + raid_set_state(myrb_raid_template, dev, state); | |
| 2312 | +} | |
| 2313 | + | |
| 2314 | +struct raid_function_template myrb_raid_functions = { | |
| 2315 | + .cookie = &myrb_template, | |
| 2316 | + .is_raid = myrb_is_raid, | |
| 2317 | + .get_resync = myrb_get_resync, | |
| 2318 | + .get_state = myrb_get_state, | |
| 2319 | +}; | |
| 2320 | + | |
| 2321 | +static void myrb_handle_scsi(struct myrb_hba *cb, struct myrb_cmdblk *cmd_blk, | |
| 2322 | + struct scsi_cmnd *scmd) | |
| 2323 | +{ | |
| 2324 | + unsigned short status; | |
| 2325 | + | |
| 2326 | + if (!cmd_blk) | |
| 2327 | + return; | |
| 2328 | + | |
| 2329 | + scsi_dma_unmap(scmd); | |
| 2330 | + | |
| 2331 | + if (cmd_blk->dcdb) { | |
| 2332 | + memcpy(scmd->sense_buffer, &cmd_blk->dcdb->sense, 64); | |
| 2333 | + dma_pool_free(cb->dcdb_pool, cmd_blk->dcdb, | |
| 2334 | + cmd_blk->dcdb_addr); | |
| 2335 | + cmd_blk->dcdb = NULL; | |
| 2336 | + } | |
| 2337 | + if (cmd_blk->sgl) { | |
| 2338 | + dma_pool_free(cb->sg_pool, cmd_blk->sgl, cmd_blk->sgl_addr); | |
| 2339 | + cmd_blk->sgl = NULL; | |
| 2340 | + cmd_blk->sgl_addr = 0; | |
| 2341 | + } | |
| 2342 | + status = cmd_blk->status; | |
| 2343 | + switch (status) { | |
| 2344 | + case MYRB_STATUS_SUCCESS: | |
| 2345 | + case MYRB_STATUS_DEVICE_BUSY: | |
| 2346 | + scmd->result = (DID_OK << 16) | status; | |
| 2347 | + break; | |
| 2348 | + case MYRB_STATUS_BAD_DATA: | |
| 2349 | + dev_dbg(&scmd->device->sdev_gendev, | |
| 2350 | + "Bad Data Encountered\n"); | |
| 2351 | + if (scmd->sc_data_direction == DMA_FROM_DEVICE) | |
| 2352 | + /* Unrecovered read error */ | |
| 2353 | + scsi_build_sense_buffer(0, scmd->sense_buffer, | |
| 2354 | + MEDIUM_ERROR, 0x11, 0); | |
| 2355 | + else | |
| 2356 | + /* Write error */ | |
| 2357 | + scsi_build_sense_buffer(0, scmd->sense_buffer, | |
| 2358 | + MEDIUM_ERROR, 0x0C, 0); | |
| 2359 | + scmd->result = (DID_OK << 16) | SAM_STAT_CHECK_CONDITION; | |
| 2360 | + break; | |
| 2361 | + case MYRB_STATUS_IRRECOVERABLE_DATA_ERROR: | |
| 2362 | + scmd_printk(KERN_ERR, scmd, "Irrecoverable Data Error\n"); | |
| 2363 | + if (scmd->sc_data_direction == DMA_FROM_DEVICE) | |
| 2364 | + /* Unrecovered read error, auto-reallocation failed */ | |
| 2365 | + scsi_build_sense_buffer(0, scmd->sense_buffer, | |
| 2366 | + MEDIUM_ERROR, 0x11, 0x04); | |
| 2367 | + else | |
| 2368 | + /* Write error, auto-reallocation failed */ | |
| 2369 | + scsi_build_sense_buffer(0, scmd->sense_buffer, | |
| 2370 | + MEDIUM_ERROR, 0x0C, 0x02); | |
| 2371 | + scmd->result = (DID_OK << 16) | SAM_STAT_CHECK_CONDITION; | |
| 2372 | + break; | |
| 2373 | + case MYRB_STATUS_LDRV_NONEXISTENT_OR_OFFLINE: | |
| 2374 | + dev_dbg(&scmd->device->sdev_gendev, | |
| 2375 | + "Logical Drive Nonexistent or Offline"); | |
| 2376 | + scmd->result = (DID_BAD_TARGET << 16); | |
| 2377 | + break; | |
| 2378 | + case MYRB_STATUS_ACCESS_BEYOND_END_OF_LDRV: | |
| 2379 | + dev_dbg(&scmd->device->sdev_gendev, | |
| 2380 | + "Attempt to Access Beyond End of Logical Drive"); | |
| 2381 | + /* Logical block address out of range */ | |
| 2382 | + scsi_build_sense_buffer(0, scmd->sense_buffer, | |
| 2383 | + NOT_READY, 0x21, 0); | |
| 2384 | + break; | |
| 2385 | + case MYRB_STATUS_DEVICE_NONRESPONSIVE: | |
| 2386 | + dev_dbg(&scmd->device->sdev_gendev, "Device nonresponsive\n"); | |
| 2387 | + scmd->result = (DID_BAD_TARGET << 16); | |
| 2388 | + break; | |
| 2389 | + default: | |
| 2390 | + scmd_printk(KERN_ERR, scmd, | |
| 2391 | + "Unexpected Error Status %04X", status); | |
| 2392 | + scmd->result = (DID_ERROR << 16); | |
| 2393 | + break; | |
| 2394 | + } | |
| 2395 | + scmd->scsi_done(scmd); | |
| 2396 | +} | |
| 2397 | + | |
| 2398 | +static void myrb_handle_cmdblk(struct myrb_hba *cb, struct myrb_cmdblk *cmd_blk) | |
| 2399 | +{ | |
| 2400 | + if (!cmd_blk) | |
| 2401 | + return; | |
| 2402 | + | |
| 2403 | + if (cmd_blk->completion) { | |
| 2404 | + complete(cmd_blk->completion); | |
| 2405 | + cmd_blk->completion = NULL; | |
| 2406 | + } | |
| 2407 | +} | |
| 2408 | + | |
| 2409 | +static void myrb_monitor(struct work_struct *work) | |
| 2410 | +{ | |
| 2411 | + struct myrb_hba *cb = container_of(work, | |
| 2412 | + struct myrb_hba, monitor_work.work); | |
| 2413 | + struct Scsi_Host *shost = cb->host; | |
| 2414 | + unsigned long interval = MYRB_PRIMARY_MONITOR_INTERVAL; | |
| 2415 | + | |
| 2416 | + dev_dbg(&shost->shost_gendev, "monitor tick\n"); | |
| 2417 | + | |
| 2418 | + if (cb->new_ev_seq > cb->old_ev_seq) { | |
| 2419 | + int event = cb->old_ev_seq; | |
| 2420 | + | |
| 2421 | + dev_dbg(&shost->shost_gendev, | |
| 2422 | + "get event log no %d/%d\n", | |
| 2423 | + cb->new_ev_seq, event); | |
| 2424 | + myrb_get_event(cb, event); | |
| 2425 | + cb->old_ev_seq = event + 1; | |
| 2426 | + interval = 10; | |
| 2427 | + } else if (cb->need_err_info) { | |
| 2428 | + cb->need_err_info = false; | |
| 2429 | + dev_dbg(&shost->shost_gendev, "get error table\n"); | |
| 2430 | + myrb_get_errtable(cb); | |
| 2431 | + interval = 10; | |
| 2432 | + } else if (cb->need_rbld && cb->rbld_first) { | |
| 2433 | + cb->need_rbld = false; | |
| 2434 | + dev_dbg(&shost->shost_gendev, | |
| 2435 | + "get rebuild progress\n"); | |
| 2436 | + myrb_update_rbld_progress(cb); | |
| 2437 | + interval = 10; | |
| 2438 | + } else if (cb->need_ldev_info) { | |
| 2439 | + cb->need_ldev_info = false; | |
| 2440 | + dev_dbg(&shost->shost_gendev, | |
| 2441 | + "get logical drive info\n"); | |
| 2442 | + myrb_get_ldev_info(cb); | |
| 2443 | + interval = 10; | |
| 2444 | + } else if (cb->need_rbld) { | |
| 2445 | + cb->need_rbld = false; | |
| 2446 | + dev_dbg(&shost->shost_gendev, | |
| 2447 | + "get rebuild progress\n"); | |
| 2448 | + myrb_update_rbld_progress(cb); | |
| 2449 | + interval = 10; | |
| 2450 | + } else if (cb->need_cc_status) { | |
| 2451 | + cb->need_cc_status = false; | |
| 2452 | + dev_dbg(&shost->shost_gendev, | |
| 2453 | + "get consistency check progress\n"); | |
| 2454 | + myrb_get_cc_progress(cb); | |
| 2455 | + interval = 10; | |
| 2456 | + } else if (cb->need_bgi_status) { | |
| 2457 | + cb->need_bgi_status = false; | |
| 2458 | + dev_dbg(&shost->shost_gendev, "get background init status\n"); | |
| 2459 | + myrb_bgi_control(cb); | |
| 2460 | + interval = 10; | |
| 2461 | + } else { | |
| 2462 | + dev_dbg(&shost->shost_gendev, "new enquiry\n"); | |
| 2463 | + mutex_lock(&cb->dma_mutex); | |
| 2464 | + myrb_hba_enquiry(cb); | |
| 2465 | + mutex_unlock(&cb->dma_mutex); | |
| 2466 | + if ((cb->new_ev_seq - cb->old_ev_seq > 0) || | |
| 2467 | + cb->need_err_info || cb->need_rbld || | |
| 2468 | + cb->need_ldev_info || cb->need_cc_status || | |
| 2469 | + cb->need_bgi_status) { | |
| 2470 | + dev_dbg(&shost->shost_gendev, | |
| 2471 | + "reschedule monitor\n"); | |
| 2472 | + interval = 0; | |
| 2473 | + } | |
| 2474 | + } | |
| 2475 | + if (interval > 1) | |
| 2476 | + cb->primary_monitor_time = jiffies; | |
| 2477 | + queue_delayed_work(cb->work_q, &cb->monitor_work, interval); | |
| 2478 | +} | |
| 2479 | + | |
| 2480 | +/** | |
| 2481 | + * myrb_err_status - reports controller BIOS messages | |
| 2482 | + * | |
| 2483 | + * Controller BIOS messages are passed through the Error Status Register | |
| 2484 | + * when the driver performs the BIOS handshaking. | |
| 2485 | + * | |
| 2486 | + * Return: true for fatal errors and false otherwise. | |
| 2487 | + */ | |
| 2488 | +bool myrb_err_status(struct myrb_hba *cb, unsigned char error, | |
| 2489 | + unsigned char parm0, unsigned char parm1) | |
| 2490 | +{ | |
| 2491 | + struct pci_dev *pdev = cb->pdev; | |
| 2492 | + | |
| 2493 | + switch (error) { | |
| 2494 | + case 0x00: | |
| 2495 | + dev_info(&pdev->dev, | |
| 2496 | + "Physical Device %d:%d Not Responding\n", | |
| 2497 | + parm1, parm0); | |
| 2498 | + break; | |
| 2499 | + case 0x08: | |
| 2500 | + dev_notice(&pdev->dev, "Spinning Up Drives\n"); | |
| 2501 | + break; | |
| 2502 | + case 0x30: | |
| 2503 | + dev_notice(&pdev->dev, "Configuration Checksum Error\n"); | |
| 2504 | + break; | |
| 2505 | + case 0x60: | |
| 2506 | + dev_notice(&pdev->dev, "Mirror Race Recovery Failed\n"); | |
| 2507 | + break; | |
| 2508 | + case 0x70: | |
| 2509 | + dev_notice(&pdev->dev, "Mirror Race Recovery In Progress\n"); | |
| 2510 | + break; | |
| 2511 | + case 0x90: | |
| 2512 | + dev_notice(&pdev->dev, "Physical Device %d:%d COD Mismatch\n", | |
| 2513 | + parm1, parm0); | |
| 2514 | + break; | |
| 2515 | + case 0xA0: | |
| 2516 | + dev_notice(&pdev->dev, "Logical Drive Installation Aborted\n"); | |
| 2517 | + break; | |
| 2518 | + case 0xB0: | |
| 2519 | + dev_notice(&pdev->dev, "Mirror Race On A Critical Logical Drive\n"); | |
| 2520 | + break; | |
| 2521 | + case 0xD0: | |
| 2522 | + dev_notice(&pdev->dev, "New Controller Configuration Found\n"); | |
| 2523 | + break; | |
| 2524 | + case 0xF0: | |
| 2525 | + dev_err(&pdev->dev, "Fatal Memory Parity Error\n"); | |
| 2526 | + return true; | |
| 2527 | + default: | |
| 2528 | + dev_err(&pdev->dev, "Unknown Initialization Error %02X\n", | |
| 2529 | + error); | |
| 2530 | + return true; | |
| 2531 | + } | |
| 2532 | + return false; | |
| 2533 | +} | |
| 2534 | + | |
| 2535 | +/* | |
| 2536 | + * Hardware-specific functions | |
| 2537 | + */ | |
| 2538 | + | |
| 2539 | +/* | |
| 2540 | + * DAC960 LA Series Controllers | |
| 2541 | + */ | |
| 2542 | + | |
| 2543 | +static inline void DAC960_LA_hw_mbox_new_cmd(void __iomem *base) | |
| 2544 | +{ | |
| 2545 | + writeb(DAC960_LA_IDB_HWMBOX_NEW_CMD, base + DAC960_LA_IDB_OFFSET); | |
| 2546 | +} | |
| 2547 | + | |
| 2548 | +static inline void DAC960_LA_ack_hw_mbox_status(void __iomem *base) | |
| 2549 | +{ | |
| 2550 | + writeb(DAC960_LA_IDB_HWMBOX_ACK_STS, base + DAC960_LA_IDB_OFFSET); | |
| 2551 | +} | |
| 2552 | + | |
| 2553 | +static inline void DAC960_LA_gen_intr(void __iomem *base) | |
| 2554 | +{ | |
| 2555 | + writeb(DAC960_LA_IDB_GEN_IRQ, base + DAC960_LA_IDB_OFFSET); | |
| 2556 | +} | |
| 2557 | + | |
| 2558 | +static inline void DAC960_LA_reset_ctrl(void __iomem *base) | |
| 2559 | +{ | |
| 2560 | + writeb(DAC960_LA_IDB_CTRL_RESET, base + DAC960_LA_IDB_OFFSET); | |
| 2561 | +} | |
| 2562 | + | |
| 2563 | +static inline void DAC960_LA_mem_mbox_new_cmd(void __iomem *base) | |
| 2564 | +{ | |
| 2565 | + writeb(DAC960_LA_IDB_MMBOX_NEW_CMD, base + DAC960_LA_IDB_OFFSET); | |
| 2566 | +} | |
| 2567 | + | |
| 2568 | +static inline bool DAC960_LA_hw_mbox_is_full(void __iomem *base) | |
| 2569 | +{ | |
| 2570 | + unsigned char idb = readb(base + DAC960_LA_IDB_OFFSET); | |
| 2571 | + | |
| 2572 | + return !(idb & DAC960_LA_IDB_HWMBOX_EMPTY); | |
| 2573 | +} | |
| 2574 | + | |
| 2575 | +static inline bool DAC960_LA_init_in_progress(void __iomem *base) | |
| 2576 | +{ | |
| 2577 | + unsigned char idb = readb(base + DAC960_LA_IDB_OFFSET); | |
| 2578 | + | |
| 2579 | + return !(idb & DAC960_LA_IDB_INIT_DONE); | |
| 2580 | +} | |
| 2581 | + | |
| 2582 | +static inline void DAC960_LA_ack_hw_mbox_intr(void __iomem *base) | |
| 2583 | +{ | |
| 2584 | + writeb(DAC960_LA_ODB_HWMBOX_ACK_IRQ, base + DAC960_LA_ODB_OFFSET); | |
| 2585 | +} | |
| 2586 | + | |
| 2587 | +static inline void DAC960_LA_ack_mem_mbox_intr(void __iomem *base) | |
| 2588 | +{ | |
| 2589 | + writeb(DAC960_LA_ODB_MMBOX_ACK_IRQ, base + DAC960_LA_ODB_OFFSET); | |
| 2590 | +} | |
| 2591 | + | |
| 2592 | +static inline void DAC960_LA_ack_intr(void __iomem *base) | |
| 2593 | +{ | |
| 2594 | + writeb(DAC960_LA_ODB_HWMBOX_ACK_IRQ | DAC960_LA_ODB_MMBOX_ACK_IRQ, | |
| 2595 | + base + DAC960_LA_ODB_OFFSET); | |
| 2596 | +} | |
| 2597 | + | |
| 2598 | +static inline bool DAC960_LA_hw_mbox_status_available(void __iomem *base) | |
| 2599 | +{ | |
| 2600 | + unsigned char odb = readb(base + DAC960_LA_ODB_OFFSET); | |
| 2601 | + | |
| 2602 | + return odb & DAC960_LA_ODB_HWMBOX_STS_AVAIL; | |
| 2603 | +} | |
| 2604 | + | |
| 2605 | +static inline bool DAC960_LA_mem_mbox_status_available(void __iomem *base) | |
| 2606 | +{ | |
| 2607 | + unsigned char odb = readb(base + DAC960_LA_ODB_OFFSET); | |
| 2608 | + | |
| 2609 | + return odb & DAC960_LA_ODB_MMBOX_STS_AVAIL; | |
| 2610 | +} | |
| 2611 | + | |
| 2612 | +static inline void DAC960_LA_enable_intr(void __iomem *base) | |
| 2613 | +{ | |
| 2614 | + unsigned char odb = 0xFF; | |
| 2615 | + | |
| 2616 | + odb &= ~DAC960_LA_IRQMASK_DISABLE_IRQ; | |
| 2617 | + writeb(odb, base + DAC960_LA_IRQMASK_OFFSET); | |
| 2618 | +} | |
| 2619 | + | |
| 2620 | +static inline void DAC960_LA_disable_intr(void __iomem *base) | |
| 2621 | +{ | |
| 2622 | + unsigned char odb = 0xFF; | |
| 2623 | + | |
| 2624 | + odb |= DAC960_LA_IRQMASK_DISABLE_IRQ; | |
| 2625 | + writeb(odb, base + DAC960_LA_IRQMASK_OFFSET); | |
| 2626 | +} | |
| 2627 | + | |
| 2628 | +static inline bool DAC960_LA_intr_enabled(void __iomem *base) | |
| 2629 | +{ | |
| 2630 | + unsigned char imask = readb(base + DAC960_LA_IRQMASK_OFFSET); | |
| 2631 | + | |
| 2632 | + return !(imask & DAC960_LA_IRQMASK_DISABLE_IRQ); | |
| 2633 | +} | |
| 2634 | + | |
| 2635 | +static inline void DAC960_LA_write_cmd_mbox(union myrb_cmd_mbox *mem_mbox, | |
| 2636 | + union myrb_cmd_mbox *mbox) | |
| 2637 | +{ | |
| 2638 | + mem_mbox->words[1] = mbox->words[1]; | |
| 2639 | + mem_mbox->words[2] = mbox->words[2]; | |
| 2640 | + mem_mbox->words[3] = mbox->words[3]; | |
| 2641 | + /* Memory barrier to prevent reordering */ | |
| 2642 | + wmb(); | |
| 2643 | + mem_mbox->words[0] = mbox->words[0]; | |
| 2644 | + /* Memory barrier to force PCI access */ | |
| 2645 | + mb(); | |
| 2646 | +} | |
| 2647 | + | |
| 2648 | +static inline void DAC960_LA_write_hw_mbox(void __iomem *base, | |
| 2649 | + union myrb_cmd_mbox *mbox) | |
| 2650 | +{ | |
| 2651 | + writel(mbox->words[0], base + DAC960_LA_CMDOP_OFFSET); | |
| 2652 | + writel(mbox->words[1], base + DAC960_LA_MBOX4_OFFSET); | |
| 2653 | + writel(mbox->words[2], base + DAC960_LA_MBOX8_OFFSET); | |
| 2654 | + writeb(mbox->bytes[12], base + DAC960_LA_MBOX12_OFFSET); | |
| 2655 | +} | |
| 2656 | + | |
| 2657 | +static inline unsigned char DAC960_LA_read_status_cmd_ident(void __iomem *base) | |
| 2658 | +{ | |
| 2659 | + return readb(base + DAC960_LA_STSID_OFFSET); | |
| 2660 | +} | |
| 2661 | + | |
| 2662 | +static inline unsigned short DAC960_LA_read_status(void __iomem *base) | |
| 2663 | +{ | |
| 2664 | + return readw(base + DAC960_LA_STS_OFFSET); | |
| 2665 | +} | |
| 2666 | + | |
| 2667 | +static inline bool | |
| 2668 | +DAC960_LA_read_error_status(void __iomem *base, unsigned char *error, | |
| 2669 | + unsigned char *param0, unsigned char *param1) | |
| 2670 | +{ | |
| 2671 | + unsigned char errsts = readb(base + DAC960_LA_ERRSTS_OFFSET); | |
| 2672 | + | |
| 2673 | + if (!(errsts & DAC960_LA_ERRSTS_PENDING)) | |
| 2674 | + return false; | |
| 2675 | + errsts &= ~DAC960_LA_ERRSTS_PENDING; | |
| 2676 | + | |
| 2677 | + *error = errsts; | |
| 2678 | + *param0 = readb(base + DAC960_LA_CMDOP_OFFSET); | |
| 2679 | + *param1 = readb(base + DAC960_LA_CMDID_OFFSET); | |
| 2680 | + writeb(0xFF, base + DAC960_LA_ERRSTS_OFFSET); | |
| 2681 | + return true; | |
| 2682 | +} | |
| 2683 | + | |
| 2684 | +static inline unsigned short | |
| 2685 | +DAC960_LA_mbox_init(struct pci_dev *pdev, void __iomem *base, | |
| 2686 | + union myrb_cmd_mbox *mbox) | |
| 2687 | +{ | |
| 2688 | + unsigned short status; | |
| 2689 | + int timeout = 0; | |
| 2690 | + | |
| 2691 | + while (timeout < MYRB_MAILBOX_TIMEOUT) { | |
| 2692 | + if (!DAC960_LA_hw_mbox_is_full(base)) | |
| 2693 | + break; | |
| 2694 | + udelay(10); | |
| 2695 | + timeout++; | |
| 2696 | + } | |
| 2697 | + if (DAC960_LA_hw_mbox_is_full(base)) { | |
| 2698 | + dev_err(&pdev->dev, | |
| 2699 | + "Timeout waiting for empty mailbox\n"); | |
| 2700 | + return MYRB_STATUS_SUBSYS_TIMEOUT; | |
| 2701 | + } | |
| 2702 | + DAC960_LA_write_hw_mbox(base, mbox); | |
| 2703 | + DAC960_LA_hw_mbox_new_cmd(base); | |
| 2704 | + timeout = 0; | |
| 2705 | + while (timeout < MYRB_MAILBOX_TIMEOUT) { | |
| 2706 | + if (DAC960_LA_hw_mbox_status_available(base)) | |
| 2707 | + break; | |
| 2708 | + udelay(10); | |
| 2709 | + timeout++; | |
| 2710 | + } | |
| 2711 | + if (!DAC960_LA_hw_mbox_status_available(base)) { | |
| 2712 | + dev_err(&pdev->dev, "Timeout waiting for mailbox status\n"); | |
| 2713 | + return MYRB_STATUS_SUBSYS_TIMEOUT; | |
| 2714 | + } | |
| 2715 | + status = DAC960_LA_read_status(base); | |
| 2716 | + DAC960_LA_ack_hw_mbox_intr(base); | |
| 2717 | + DAC960_LA_ack_hw_mbox_status(base); | |
| 2718 | + | |
| 2719 | + return status; | |
| 2720 | +} | |
| 2721 | + | |
| 2722 | +static int DAC960_LA_hw_init(struct pci_dev *pdev, | |
| 2723 | + struct myrb_hba *cb, void __iomem *base) | |
| 2724 | +{ | |
| 2725 | + int timeout = 0; | |
| 2726 | + unsigned char error, parm0, parm1; | |
| 2727 | + | |
| 2728 | + DAC960_LA_disable_intr(base); | |
| 2729 | + DAC960_LA_ack_hw_mbox_status(base); | |
| 2730 | + udelay(1000); | |
| 2731 | + timeout = 0; | |
| 2732 | + while (DAC960_LA_init_in_progress(base) && | |
| 2733 | + timeout < MYRB_MAILBOX_TIMEOUT) { | |
| 2734 | + if (DAC960_LA_read_error_status(base, &error, | |
| 2735 | + &parm0, &parm1) && | |
| 2736 | + myrb_err_status(cb, error, parm0, parm1)) | |
| 2737 | + return -ENODEV; | |
| 2738 | + udelay(10); | |
| 2739 | + timeout++; | |
| 2740 | + } | |
| 2741 | + if (timeout == MYRB_MAILBOX_TIMEOUT) { | |
| 2742 | + dev_err(&pdev->dev, | |
| 2743 | + "Timeout waiting for Controller Initialisation\n"); | |
| 2744 | + return -ETIMEDOUT; | |
| 2745 | + } | |
| 2746 | + if (!myrb_enable_mmio(cb, DAC960_LA_mbox_init)) { | |
| 2747 | + dev_err(&pdev->dev, | |
| 2748 | + "Unable to Enable Memory Mailbox Interface\n"); | |
| 2749 | + DAC960_LA_reset_ctrl(base); | |
| 2750 | + return -ENODEV; | |
| 2751 | + } | |
| 2752 | + DAC960_LA_enable_intr(base); | |
| 2753 | + cb->qcmd = myrb_qcmd; | |
| 2754 | + cb->write_cmd_mbox = DAC960_LA_write_cmd_mbox; | |
| 2755 | + if (cb->dual_mode_interface) | |
| 2756 | + cb->get_cmd_mbox = DAC960_LA_mem_mbox_new_cmd; | |
| 2757 | + else | |
| 2758 | + cb->get_cmd_mbox = DAC960_LA_hw_mbox_new_cmd; | |
| 2759 | + cb->disable_intr = DAC960_LA_disable_intr; | |
| 2760 | + cb->reset = DAC960_LA_reset_ctrl; | |
| 2761 | + | |
| 2762 | + return 0; | |
| 2763 | +} | |
| 2764 | + | |
| 2765 | +static irqreturn_t DAC960_LA_intr_handler(int irq, void *arg) | |
| 2766 | +{ | |
| 2767 | + struct myrb_hba *cb = arg; | |
| 2768 | + void __iomem *base = cb->io_base; | |
| 2769 | + struct myrb_stat_mbox *next_stat_mbox; | |
| 2770 | + unsigned long flags; | |
| 2771 | + | |
| 2772 | + spin_lock_irqsave(&cb->queue_lock, flags); | |
| 2773 | + DAC960_LA_ack_intr(base); | |
| 2774 | + next_stat_mbox = cb->next_stat_mbox; | |
| 2775 | + while (next_stat_mbox->valid) { | |
| 2776 | + unsigned char id = next_stat_mbox->id; | |
| 2777 | + struct scsi_cmnd *scmd = NULL; | |
| 2778 | + struct myrb_cmdblk *cmd_blk = NULL; | |
| 2779 | + | |
| 2780 | + if (id == MYRB_DCMD_TAG) | |
| 2781 | + cmd_blk = &cb->dcmd_blk; | |
| 2782 | + else if (id == MYRB_MCMD_TAG) | |
| 2783 | + cmd_blk = &cb->mcmd_blk; | |
| 2784 | + else { | |
| 2785 | + scmd = scsi_host_find_tag(cb->host, id - 3); | |
| 2786 | + if (scmd) | |
| 2787 | + cmd_blk = scsi_cmd_priv(scmd); | |
| 2788 | + } | |
| 2789 | + if (cmd_blk) | |
| 2790 | + cmd_blk->status = next_stat_mbox->status; | |
| 2791 | + else | |
| 2792 | + dev_err(&cb->pdev->dev, | |
| 2793 | + "Unhandled command completion %d\n", id); | |
| 2794 | + | |
| 2795 | + memset(next_stat_mbox, 0, sizeof(struct myrb_stat_mbox)); | |
| 2796 | + if (++next_stat_mbox > cb->last_stat_mbox) | |
| 2797 | + next_stat_mbox = cb->first_stat_mbox; | |
| 2798 | + | |
| 2799 | + if (cmd_blk) { | |
| 2800 | + if (id < 3) | |
| 2801 | + myrb_handle_cmdblk(cb, cmd_blk); | |
| 2802 | + else | |
| 2803 | + myrb_handle_scsi(cb, cmd_blk, scmd); | |
| 2804 | + } | |
| 2805 | + } | |
| 2806 | + cb->next_stat_mbox = next_stat_mbox; | |
| 2807 | + spin_unlock_irqrestore(&cb->queue_lock, flags); | |
| 2808 | + return IRQ_HANDLED; | |
| 2809 | +} | |
| 2810 | + | |
| 2811 | +struct myrb_privdata DAC960_LA_privdata = { | |
| 2812 | + .hw_init = DAC960_LA_hw_init, | |
| 2813 | + .irq_handler = DAC960_LA_intr_handler, | |
| 2814 | + .mmio_size = DAC960_LA_mmio_size, | |
| 2815 | +}; | |
| 2816 | + | |
| 2817 | +/* | |
| 2818 | + * DAC960 PG Series Controllers | |
| 2819 | + */ | |
| 2820 | +static inline void DAC960_PG_hw_mbox_new_cmd(void __iomem *base) | |
| 2821 | +{ | |
| 2822 | + writel(DAC960_PG_IDB_HWMBOX_NEW_CMD, base + DAC960_PG_IDB_OFFSET); | |
| 2823 | +} | |
| 2824 | + | |
| 2825 | +static inline void DAC960_PG_ack_hw_mbox_status(void __iomem *base) | |
| 2826 | +{ | |
| 2827 | + writel(DAC960_PG_IDB_HWMBOX_ACK_STS, base + DAC960_PG_IDB_OFFSET); | |
| 2828 | +} | |
| 2829 | + | |
| 2830 | +static inline void DAC960_PG_gen_intr(void __iomem *base) | |
| 2831 | +{ | |
| 2832 | + writel(DAC960_PG_IDB_GEN_IRQ, base + DAC960_PG_IDB_OFFSET); | |
| 2833 | +} | |
| 2834 | + | |
| 2835 | +static inline void DAC960_PG_reset_ctrl(void __iomem *base) | |
| 2836 | +{ | |
| 2837 | + writel(DAC960_PG_IDB_CTRL_RESET, base + DAC960_PG_IDB_OFFSET); | |
| 2838 | +} | |
| 2839 | + | |
| 2840 | +static inline void DAC960_PG_mem_mbox_new_cmd(void __iomem *base) | |
| 2841 | +{ | |
| 2842 | + writel(DAC960_PG_IDB_MMBOX_NEW_CMD, base + DAC960_PG_IDB_OFFSET); | |
| 2843 | +} | |
| 2844 | + | |
| 2845 | +static inline bool DAC960_PG_hw_mbox_is_full(void __iomem *base) | |
| 2846 | +{ | |
| 2847 | + unsigned char idb = readl(base + DAC960_PG_IDB_OFFSET); | |
| 2848 | + | |
| 2849 | + return idb & DAC960_PG_IDB_HWMBOX_FULL; | |
| 2850 | +} | |
| 2851 | + | |
| 2852 | +static inline bool DAC960_PG_init_in_progress(void __iomem *base) | |
| 2853 | +{ | |
| 2854 | + unsigned char idb = readl(base + DAC960_PG_IDB_OFFSET); | |
| 2855 | + | |
| 2856 | + return idb & DAC960_PG_IDB_INIT_IN_PROGRESS; | |
| 2857 | +} | |
| 2858 | + | |
| 2859 | +static inline void DAC960_PG_ack_hw_mbox_intr(void __iomem *base) | |
| 2860 | +{ | |
| 2861 | + writel(DAC960_PG_ODB_HWMBOX_ACK_IRQ, base + DAC960_PG_ODB_OFFSET); | |
| 2862 | +} | |
| 2863 | + | |
| 2864 | +static inline void DAC960_PG_ack_mem_mbox_intr(void __iomem *base) | |
| 2865 | +{ | |
| 2866 | + writel(DAC960_PG_ODB_MMBOX_ACK_IRQ, base + DAC960_PG_ODB_OFFSET); | |
| 2867 | +} | |
| 2868 | + | |
| 2869 | +static inline void DAC960_PG_ack_intr(void __iomem *base) | |
| 2870 | +{ | |
| 2871 | + writel(DAC960_PG_ODB_HWMBOX_ACK_IRQ | DAC960_PG_ODB_MMBOX_ACK_IRQ, | |
| 2872 | + base + DAC960_PG_ODB_OFFSET); | |
| 2873 | +} | |
| 2874 | + | |
| 2875 | +static inline bool DAC960_PG_hw_mbox_status_available(void __iomem *base) | |
| 2876 | +{ | |
| 2877 | + unsigned char odb = readl(base + DAC960_PG_ODB_OFFSET); | |
| 2878 | + | |
| 2879 | + return odb & DAC960_PG_ODB_HWMBOX_STS_AVAIL; | |
| 2880 | +} | |
| 2881 | + | |
| 2882 | +static inline bool DAC960_PG_mem_mbox_status_available(void __iomem *base) | |
| 2883 | +{ | |
| 2884 | + unsigned char odb = readl(base + DAC960_PG_ODB_OFFSET); | |
| 2885 | + | |
| 2886 | + return odb & DAC960_PG_ODB_MMBOX_STS_AVAIL; | |
| 2887 | +} | |
| 2888 | + | |
| 2889 | +static inline void DAC960_PG_enable_intr(void __iomem *base) | |
| 2890 | +{ | |
| 2891 | + unsigned int imask = (unsigned int)-1; | |
| 2892 | + | |
| 2893 | + imask &= ~DAC960_PG_IRQMASK_DISABLE_IRQ; | |
| 2894 | + writel(imask, base + DAC960_PG_IRQMASK_OFFSET); | |
| 2895 | +} | |
| 2896 | + | |
| 2897 | +static inline void DAC960_PG_disable_intr(void __iomem *base) | |
| 2898 | +{ | |
| 2899 | + unsigned int imask = (unsigned int)-1; | |
| 2900 | + | |
| 2901 | + writel(imask, base + DAC960_PG_IRQMASK_OFFSET); | |
| 2902 | +} | |
| 2903 | + | |
| 2904 | +static inline bool DAC960_PG_intr_enabled(void __iomem *base) | |
| 2905 | +{ | |
| 2906 | + unsigned int imask = readl(base + DAC960_PG_IRQMASK_OFFSET); | |
| 2907 | + | |
| 2908 | + return !(imask & DAC960_PG_IRQMASK_DISABLE_IRQ); | |
| 2909 | +} | |
| 2910 | + | |
| 2911 | +static inline void DAC960_PG_write_cmd_mbox(union myrb_cmd_mbox *mem_mbox, | |
| 2912 | + union myrb_cmd_mbox *mbox) | |
| 2913 | +{ | |
| 2914 | + mem_mbox->words[1] = mbox->words[1]; | |
| 2915 | + mem_mbox->words[2] = mbox->words[2]; | |
| 2916 | + mem_mbox->words[3] = mbox->words[3]; | |
| 2917 | + /* Memory barrier to prevent reordering */ | |
| 2918 | + wmb(); | |
| 2919 | + mem_mbox->words[0] = mbox->words[0]; | |
| 2920 | + /* Memory barrier to force PCI access */ | |
| 2921 | + mb(); | |
| 2922 | +} | |
| 2923 | + | |
| 2924 | +static inline void DAC960_PG_write_hw_mbox(void __iomem *base, | |
| 2925 | + union myrb_cmd_mbox *mbox) | |
| 2926 | +{ | |
| 2927 | + writel(mbox->words[0], base + DAC960_PG_CMDOP_OFFSET); | |
| 2928 | + writel(mbox->words[1], base + DAC960_PG_MBOX4_OFFSET); | |
| 2929 | + writel(mbox->words[2], base + DAC960_PG_MBOX8_OFFSET); | |
| 2930 | + writeb(mbox->bytes[12], base + DAC960_PG_MBOX12_OFFSET); | |
| 2931 | +} | |
| 2932 | + | |
| 2933 | +static inline unsigned char | |
| 2934 | +DAC960_PG_read_status_cmd_ident(void __iomem *base) | |
| 2935 | +{ | |
| 2936 | + return readb(base + DAC960_PG_STSID_OFFSET); | |
| 2937 | +} | |
| 2938 | + | |
| 2939 | +static inline unsigned short | |
| 2940 | +DAC960_PG_read_status(void __iomem *base) | |
| 2941 | +{ | |
| 2942 | + return readw(base + DAC960_PG_STS_OFFSET); | |
| 2943 | +} | |
| 2944 | + | |
| 2945 | +static inline bool | |
| 2946 | +DAC960_PG_read_error_status(void __iomem *base, unsigned char *error, | |
| 2947 | + unsigned char *param0, unsigned char *param1) | |
| 2948 | +{ | |
| 2949 | + unsigned char errsts = readb(base + DAC960_PG_ERRSTS_OFFSET); | |
| 2950 | + | |
| 2951 | + if (!(errsts & DAC960_PG_ERRSTS_PENDING)) | |
| 2952 | + return false; | |
| 2953 | + errsts &= ~DAC960_PG_ERRSTS_PENDING; | |
| 2954 | + *error = errsts; | |
| 2955 | + *param0 = readb(base + DAC960_PG_CMDOP_OFFSET); | |
| 2956 | + *param1 = readb(base + DAC960_PG_CMDID_OFFSET); | |
| 2957 | + writeb(0, base + DAC960_PG_ERRSTS_OFFSET); | |
| 2958 | + return true; | |
| 2959 | +} | |
| 2960 | + | |
| 2961 | +static inline unsigned short | |
| 2962 | +DAC960_PG_mbox_init(struct pci_dev *pdev, void __iomem *base, | |
| 2963 | + union myrb_cmd_mbox *mbox) | |
| 2964 | +{ | |
| 2965 | + unsigned short status; | |
| 2966 | + int timeout = 0; | |
| 2967 | + | |
| 2968 | + while (timeout < MYRB_MAILBOX_TIMEOUT) { | |
| 2969 | + if (!DAC960_PG_hw_mbox_is_full(base)) | |
| 2970 | + break; | |
| 2971 | + udelay(10); | |
| 2972 | + timeout++; | |
| 2973 | + } | |
| 2974 | + if (DAC960_PG_hw_mbox_is_full(base)) { | |
| 2975 | + dev_err(&pdev->dev, | |
| 2976 | + "Timeout waiting for empty mailbox\n"); | |
| 2977 | + return MYRB_STATUS_SUBSYS_TIMEOUT; | |
| 2978 | + } | |
| 2979 | + DAC960_PG_write_hw_mbox(base, mbox); | |
| 2980 | + DAC960_PG_hw_mbox_new_cmd(base); | |
| 2981 | + | |
| 2982 | + timeout = 0; | |
| 2983 | + while (timeout < MYRB_MAILBOX_TIMEOUT) { | |
| 2984 | + if (DAC960_PG_hw_mbox_status_available(base)) | |
| 2985 | + break; | |
| 2986 | + udelay(10); | |
| 2987 | + timeout++; | |
| 2988 | + } | |
| 2989 | + if (!DAC960_PG_hw_mbox_status_available(base)) { | |
| 2990 | + dev_err(&pdev->dev, | |
| 2991 | + "Timeout waiting for mailbox status\n"); | |
| 2992 | + return MYRB_STATUS_SUBSYS_TIMEOUT; | |
| 2993 | + } | |
| 2994 | + status = DAC960_PG_read_status(base); | |
| 2995 | + DAC960_PG_ack_hw_mbox_intr(base); | |
| 2996 | + DAC960_PG_ack_hw_mbox_status(base); | |
| 2997 | + | |
| 2998 | + return status; | |
| 2999 | +} | |
| 3000 | + | |
| 3001 | +static int DAC960_PG_hw_init(struct pci_dev *pdev, | |
| 3002 | + struct myrb_hba *cb, void __iomem *base) | |
| 3003 | +{ | |
| 3004 | + int timeout = 0; | |
| 3005 | + unsigned char error, parm0, parm1; | |
| 3006 | + | |
| 3007 | + DAC960_PG_disable_intr(base); | |
| 3008 | + DAC960_PG_ack_hw_mbox_status(base); | |
| 3009 | + udelay(1000); | |
| 3010 | + while (DAC960_PG_init_in_progress(base) && | |
| 3011 | + timeout < MYRB_MAILBOX_TIMEOUT) { | |
| 3012 | + if (DAC960_PG_read_error_status(base, &error, | |
| 3013 | + &parm0, &parm1) && | |
| 3014 | + myrb_err_status(cb, error, parm0, parm1)) | |
| 3015 | + return -EIO; | |
| 3016 | + udelay(10); | |
| 3017 | + timeout++; | |
| 3018 | + } | |
| 3019 | + if (timeout == MYRB_MAILBOX_TIMEOUT) { | |
| 3020 | + dev_err(&pdev->dev, | |
| 3021 | + "Timeout waiting for Controller Initialisation\n"); | |
| 3022 | + return -ETIMEDOUT; | |
| 3023 | + } | |
| 3024 | + if (!myrb_enable_mmio(cb, DAC960_PG_mbox_init)) { | |
| 3025 | + dev_err(&pdev->dev, | |
| 3026 | + "Unable to Enable Memory Mailbox Interface\n"); | |
| 3027 | + DAC960_PG_reset_ctrl(base); | |
| 3028 | + return -ENODEV; | |
| 3029 | + } | |
| 3030 | + DAC960_PG_enable_intr(base); | |
| 3031 | + cb->qcmd = myrb_qcmd; | |
| 3032 | + cb->write_cmd_mbox = DAC960_PG_write_cmd_mbox; | |
| 3033 | + if (cb->dual_mode_interface) | |
| 3034 | + cb->get_cmd_mbox = DAC960_PG_mem_mbox_new_cmd; | |
| 3035 | + else | |
| 3036 | + cb->get_cmd_mbox = DAC960_PG_hw_mbox_new_cmd; | |
| 3037 | + cb->disable_intr = DAC960_PG_disable_intr; | |
| 3038 | + cb->reset = DAC960_PG_reset_ctrl; | |
| 3039 | + | |
| 3040 | + return 0; | |
| 3041 | +} | |
| 3042 | + | |
| 3043 | +static irqreturn_t DAC960_PG_intr_handler(int irq, void *arg) | |
| 3044 | +{ | |
| 3045 | + struct myrb_hba *cb = arg; | |
| 3046 | + void __iomem *base = cb->io_base; | |
| 3047 | + struct myrb_stat_mbox *next_stat_mbox; | |
| 3048 | + unsigned long flags; | |
| 3049 | + | |
| 3050 | + spin_lock_irqsave(&cb->queue_lock, flags); | |
| 3051 | + DAC960_PG_ack_intr(base); | |
| 3052 | + next_stat_mbox = cb->next_stat_mbox; | |
| 3053 | + while (next_stat_mbox->valid) { | |
| 3054 | + unsigned char id = next_stat_mbox->id; | |
| 3055 | + struct scsi_cmnd *scmd = NULL; | |
| 3056 | + struct myrb_cmdblk *cmd_blk = NULL; | |
| 3057 | + | |
| 3058 | + if (id == MYRB_DCMD_TAG) | |
| 3059 | + cmd_blk = &cb->dcmd_blk; | |
| 3060 | + else if (id == MYRB_MCMD_TAG) | |
| 3061 | + cmd_blk = &cb->mcmd_blk; | |
| 3062 | + else { | |
| 3063 | + scmd = scsi_host_find_tag(cb->host, id - 3); | |
| 3064 | + if (scmd) | |
| 3065 | + cmd_blk = scsi_cmd_priv(scmd); | |
| 3066 | + } | |
| 3067 | + if (cmd_blk) | |
| 3068 | + cmd_blk->status = next_stat_mbox->status; | |
| 3069 | + else | |
| 3070 | + dev_err(&cb->pdev->dev, | |
| 3071 | + "Unhandled command completion %d\n", id); | |
| 3072 | + | |
| 3073 | + memset(next_stat_mbox, 0, sizeof(struct myrb_stat_mbox)); | |
| 3074 | + if (++next_stat_mbox > cb->last_stat_mbox) | |
| 3075 | + next_stat_mbox = cb->first_stat_mbox; | |
| 3076 | + | |
580 more lines aren’t shown here.
This diff is large: its 959 lines aren’t shown here.
This diff is large: its 3269 lines aren’t shown here.
This diff is large: its 1135 lines aren’t shown here.
This diff is large: its 60 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 88 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 61 lines aren’t shown here.
This diff is large: its 142 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 235 lines aren’t shown here.
This diff is large: its 30 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 24 lines aren’t shown here.
This diff is large: its 87 lines aren’t shown here.
This diff is large: its 783 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 132 lines aren’t shown here.
This diff is large: its 86 lines aren’t shown here.
This diff is large: its 792 lines aren’t shown here.
This diff is large: its 857 lines aren’t shown here.
This diff is large: its 70 lines aren’t shown here.
This diff is large: its 119 lines aren’t shown here.
This diff is large: its 174 lines aren’t shown here.
This diff is large: its 184 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 595 lines aren’t shown here.
This diff is large: its 918 lines aren’t shown here.
This diff is large: its 38 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 108 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 50 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 334 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 79 lines aren’t shown here.
This diff is large: its 40 lines aren’t shown here.
This diff is large: its 47 lines aren’t shown here.
This diff is large: its 84 lines aren’t shown here.
This diff is large: its 51 lines aren’t shown here.
This diff is large: its 152 lines aren’t shown here.
This diff is large: its 50 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 112 lines aren’t shown here.
This diff is large: its 123 lines aren’t shown here.
This diff is large: its 211 lines aren’t shown here.
This diff is large: its 24 lines aren’t shown here.
This diff is large: its 611 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 37 lines aren’t shown here.
This diff is large: its 182 lines aren’t shown here.
This diff is large: its 501 lines aren’t shown here.
This diff is large: its 76 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 35 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 65 lines aren’t shown here.
This diff is large: its 7 lines aren’t shown here.
This diff is large: its 141 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 63 lines aren’t shown here.
This diff is large: its 61 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 35 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 107 lines aren’t shown here.