diff options
Diffstat (limited to 'drivers/scsi/pmcraid.c')
| -rw-r--r-- | drivers/scsi/pmcraid.c | 79 |
1 files changed, 36 insertions, 43 deletions
diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c index 401e543f1723..707d766c1ee9 100644 --- a/drivers/scsi/pmcraid.c +++ b/drivers/scsi/pmcraid.c | |||
| @@ -3514,7 +3514,7 @@ static int pmcraid_build_passthrough_ioadls( | |||
| 3514 | return -ENOMEM; | 3514 | return -ENOMEM; |
| 3515 | } | 3515 | } |
| 3516 | 3516 | ||
| 3517 | sglist->num_dma_sg = pci_map_sg(cmd->drv_inst->pdev, | 3517 | sglist->num_dma_sg = dma_map_sg(&cmd->drv_inst->pdev->dev, |
| 3518 | sglist->scatterlist, | 3518 | sglist->scatterlist, |
| 3519 | sglist->num_sg, direction); | 3519 | sglist->num_sg, direction); |
| 3520 | 3520 | ||
| @@ -3563,7 +3563,7 @@ static void pmcraid_release_passthrough_ioadls( | |||
| 3563 | struct pmcraid_sglist *sglist = cmd->sglist; | 3563 | struct pmcraid_sglist *sglist = cmd->sglist; |
| 3564 | 3564 | ||
| 3565 | if (buflen > 0) { | 3565 | if (buflen > 0) { |
| 3566 | pci_unmap_sg(cmd->drv_inst->pdev, | 3566 | dma_unmap_sg(&cmd->drv_inst->pdev->dev, |
| 3567 | sglist->scatterlist, | 3567 | sglist->scatterlist, |
| 3568 | sglist->num_sg, | 3568 | sglist->num_sg, |
| 3569 | direction); | 3569 | direction); |
| @@ -4699,9 +4699,9 @@ static void | |||
| 4699 | pmcraid_release_host_rrqs(struct pmcraid_instance *pinstance, int maxindex) | 4699 | pmcraid_release_host_rrqs(struct pmcraid_instance *pinstance, int maxindex) |
| 4700 | { | 4700 | { |
| 4701 | int i; | 4701 | int i; |
| 4702 | for (i = 0; i < maxindex; i++) { | ||
| 4703 | 4702 | ||
| 4704 | pci_free_consistent(pinstance->pdev, | 4703 | for (i = 0; i < maxindex; i++) { |
| 4704 | dma_free_coherent(&pinstance->pdev->dev, | ||
| 4705 | HRRQ_ENTRY_SIZE * PMCRAID_MAX_CMD, | 4705 | HRRQ_ENTRY_SIZE * PMCRAID_MAX_CMD, |
| 4706 | pinstance->hrrq_start[i], | 4706 | pinstance->hrrq_start[i], |
| 4707 | pinstance->hrrq_start_bus_addr[i]); | 4707 | pinstance->hrrq_start_bus_addr[i]); |
| @@ -4728,11 +4728,9 @@ static int pmcraid_allocate_host_rrqs(struct pmcraid_instance *pinstance) | |||
| 4728 | 4728 | ||
| 4729 | for (i = 0; i < pinstance->num_hrrq; i++) { | 4729 | for (i = 0; i < pinstance->num_hrrq; i++) { |
| 4730 | pinstance->hrrq_start[i] = | 4730 | pinstance->hrrq_start[i] = |
| 4731 | pci_alloc_consistent( | 4731 | dma_alloc_coherent(&pinstance->pdev->dev, buffer_size, |
| 4732 | pinstance->pdev, | 4732 | &pinstance->hrrq_start_bus_addr[i], |
| 4733 | buffer_size, | 4733 | GFP_KERNEL); |
| 4734 | &(pinstance->hrrq_start_bus_addr[i])); | ||
| 4735 | |||
| 4736 | if (!pinstance->hrrq_start[i]) { | 4734 | if (!pinstance->hrrq_start[i]) { |
| 4737 | pmcraid_err("pci_alloc failed for hrrq vector : %d\n", | 4735 | pmcraid_err("pci_alloc failed for hrrq vector : %d\n", |
| 4738 | i); | 4736 | i); |
| @@ -4761,7 +4759,7 @@ static int pmcraid_allocate_host_rrqs(struct pmcraid_instance *pinstance) | |||
| 4761 | static void pmcraid_release_hcams(struct pmcraid_instance *pinstance) | 4759 | static void pmcraid_release_hcams(struct pmcraid_instance *pinstance) |
| 4762 | { | 4760 | { |
| 4763 | if (pinstance->ccn.msg != NULL) { | 4761 | if (pinstance->ccn.msg != NULL) { |
| 4764 | pci_free_consistent(pinstance->pdev, | 4762 | dma_free_coherent(&pinstance->pdev->dev, |
| 4765 | PMCRAID_AEN_HDR_SIZE + | 4763 | PMCRAID_AEN_HDR_SIZE + |
| 4766 | sizeof(struct pmcraid_hcam_ccn_ext), | 4764 | sizeof(struct pmcraid_hcam_ccn_ext), |
| 4767 | pinstance->ccn.msg, | 4765 | pinstance->ccn.msg, |
| @@ -4773,7 +4771,7 @@ static void pmcraid_release_hcams(struct pmcraid_instance *pinstance) | |||
| 4773 | } | 4771 | } |
| 4774 | 4772 | ||
| 4775 | if (pinstance->ldn.msg != NULL) { | 4773 | if (pinstance->ldn.msg != NULL) { |
| 4776 | pci_free_consistent(pinstance->pdev, | 4774 | dma_free_coherent(&pinstance->pdev->dev, |
| 4777 | PMCRAID_AEN_HDR_SIZE + | 4775 | PMCRAID_AEN_HDR_SIZE + |
| 4778 | sizeof(struct pmcraid_hcam_ldn), | 4776 | sizeof(struct pmcraid_hcam_ldn), |
| 4779 | pinstance->ldn.msg, | 4777 | pinstance->ldn.msg, |
| @@ -4794,17 +4792,15 @@ static void pmcraid_release_hcams(struct pmcraid_instance *pinstance) | |||
| 4794 | */ | 4792 | */ |
| 4795 | static int pmcraid_allocate_hcams(struct pmcraid_instance *pinstance) | 4793 | static int pmcraid_allocate_hcams(struct pmcraid_instance *pinstance) |
| 4796 | { | 4794 | { |
| 4797 | pinstance->ccn.msg = pci_alloc_consistent( | 4795 | pinstance->ccn.msg = dma_alloc_coherent(&pinstance->pdev->dev, |
| 4798 | pinstance->pdev, | ||
| 4799 | PMCRAID_AEN_HDR_SIZE + | 4796 | PMCRAID_AEN_HDR_SIZE + |
| 4800 | sizeof(struct pmcraid_hcam_ccn_ext), | 4797 | sizeof(struct pmcraid_hcam_ccn_ext), |
| 4801 | &(pinstance->ccn.baddr)); | 4798 | &pinstance->ccn.baddr, GFP_KERNEL); |
| 4802 | 4799 | ||
| 4803 | pinstance->ldn.msg = pci_alloc_consistent( | 4800 | pinstance->ldn.msg = dma_alloc_coherent(&pinstance->pdev->dev, |
| 4804 | pinstance->pdev, | ||
| 4805 | PMCRAID_AEN_HDR_SIZE + | 4801 | PMCRAID_AEN_HDR_SIZE + |
| 4806 | sizeof(struct pmcraid_hcam_ldn), | 4802 | sizeof(struct pmcraid_hcam_ldn), |
| 4807 | &(pinstance->ldn.baddr)); | 4803 | &pinstance->ldn.baddr, GFP_KERNEL); |
| 4808 | 4804 | ||
| 4809 | if (pinstance->ldn.msg == NULL || pinstance->ccn.msg == NULL) { | 4805 | if (pinstance->ldn.msg == NULL || pinstance->ccn.msg == NULL) { |
| 4810 | pmcraid_release_hcams(pinstance); | 4806 | pmcraid_release_hcams(pinstance); |
| @@ -4832,7 +4828,7 @@ static void pmcraid_release_config_buffers(struct pmcraid_instance *pinstance) | |||
| 4832 | { | 4828 | { |
| 4833 | if (pinstance->cfg_table != NULL && | 4829 | if (pinstance->cfg_table != NULL && |
| 4834 | pinstance->cfg_table_bus_addr != 0) { | 4830 | pinstance->cfg_table_bus_addr != 0) { |
| 4835 | pci_free_consistent(pinstance->pdev, | 4831 | dma_free_coherent(&pinstance->pdev->dev, |
| 4836 | sizeof(struct pmcraid_config_table), | 4832 | sizeof(struct pmcraid_config_table), |
| 4837 | pinstance->cfg_table, | 4833 | pinstance->cfg_table, |
| 4838 | pinstance->cfg_table_bus_addr); | 4834 | pinstance->cfg_table_bus_addr); |
| @@ -4877,10 +4873,10 @@ static int pmcraid_allocate_config_buffers(struct pmcraid_instance *pinstance) | |||
| 4877 | list_add_tail(&pinstance->res_entries[i].queue, | 4873 | list_add_tail(&pinstance->res_entries[i].queue, |
| 4878 | &pinstance->free_res_q); | 4874 | &pinstance->free_res_q); |
| 4879 | 4875 | ||
| 4880 | pinstance->cfg_table = | 4876 | pinstance->cfg_table = dma_alloc_coherent(&pinstance->pdev->dev, |
| 4881 | pci_alloc_consistent(pinstance->pdev, | ||
| 4882 | sizeof(struct pmcraid_config_table), | 4877 | sizeof(struct pmcraid_config_table), |
| 4883 | &pinstance->cfg_table_bus_addr); | 4878 | &pinstance->cfg_table_bus_addr, |
| 4879 | GFP_KERNEL); | ||
| 4884 | 4880 | ||
| 4885 | if (NULL == pinstance->cfg_table) { | 4881 | if (NULL == pinstance->cfg_table) { |
| 4886 | pmcraid_err("couldn't alloc DMA memory for config table\n"); | 4882 | pmcraid_err("couldn't alloc DMA memory for config table\n"); |
| @@ -4945,7 +4941,7 @@ static void pmcraid_release_buffers(struct pmcraid_instance *pinstance) | |||
| 4945 | pmcraid_release_host_rrqs(pinstance, pinstance->num_hrrq); | 4941 | pmcraid_release_host_rrqs(pinstance, pinstance->num_hrrq); |
| 4946 | 4942 | ||
| 4947 | if (pinstance->inq_data != NULL) { | 4943 | if (pinstance->inq_data != NULL) { |
| 4948 | pci_free_consistent(pinstance->pdev, | 4944 | dma_free_coherent(&pinstance->pdev->dev, |
| 4949 | sizeof(struct pmcraid_inquiry_data), | 4945 | sizeof(struct pmcraid_inquiry_data), |
| 4950 | pinstance->inq_data, | 4946 | pinstance->inq_data, |
| 4951 | pinstance->inq_data_baddr); | 4947 | pinstance->inq_data_baddr); |
| @@ -4955,7 +4951,7 @@ static void pmcraid_release_buffers(struct pmcraid_instance *pinstance) | |||
| 4955 | } | 4951 | } |
| 4956 | 4952 | ||
| 4957 | if (pinstance->timestamp_data != NULL) { | 4953 | if (pinstance->timestamp_data != NULL) { |
| 4958 | pci_free_consistent(pinstance->pdev, | 4954 | dma_free_coherent(&pinstance->pdev->dev, |
| 4959 | sizeof(struct pmcraid_timestamp_data), | 4955 | sizeof(struct pmcraid_timestamp_data), |
| 4960 | pinstance->timestamp_data, | 4956 | pinstance->timestamp_data, |
| 4961 | pinstance->timestamp_data_baddr); | 4957 | pinstance->timestamp_data_baddr); |
| @@ -4972,8 +4968,8 @@ static void pmcraid_release_buffers(struct pmcraid_instance *pinstance) | |||
| 4972 | * This routine pre-allocates memory based on the type of block as below: | 4968 | * This routine pre-allocates memory based on the type of block as below: |
| 4973 | * cmdblocks(PMCRAID_MAX_CMD): kernel memory using kernel's slab_allocator, | 4969 | * cmdblocks(PMCRAID_MAX_CMD): kernel memory using kernel's slab_allocator, |
| 4974 | * IOARCBs(PMCRAID_MAX_CMD) : DMAable memory, using pci pool allocator | 4970 | * IOARCBs(PMCRAID_MAX_CMD) : DMAable memory, using pci pool allocator |
| 4975 | * config-table entries : DMAable memory using pci_alloc_consistent | 4971 | * config-table entries : DMAable memory using dma_alloc_coherent |
| 4976 | * HostRRQs : DMAable memory, using pci_alloc_consistent | 4972 | * HostRRQs : DMAable memory, using dma_alloc_coherent |
| 4977 | * | 4973 | * |
| 4978 | * Return Value | 4974 | * Return Value |
| 4979 | * 0 in case all of the blocks are allocated, -ENOMEM otherwise. | 4975 | * 0 in case all of the blocks are allocated, -ENOMEM otherwise. |
| @@ -5010,11 +5006,9 @@ static int pmcraid_init_buffers(struct pmcraid_instance *pinstance) | |||
| 5010 | } | 5006 | } |
| 5011 | 5007 | ||
| 5012 | /* allocate DMAable memory for page D0 INQUIRY buffer */ | 5008 | /* allocate DMAable memory for page D0 INQUIRY buffer */ |
| 5013 | pinstance->inq_data = pci_alloc_consistent( | 5009 | pinstance->inq_data = dma_alloc_coherent(&pinstance->pdev->dev, |
| 5014 | pinstance->pdev, | ||
| 5015 | sizeof(struct pmcraid_inquiry_data), | 5010 | sizeof(struct pmcraid_inquiry_data), |
| 5016 | &pinstance->inq_data_baddr); | 5011 | &pinstance->inq_data_baddr, GFP_KERNEL); |
| 5017 | |||
| 5018 | if (pinstance->inq_data == NULL) { | 5012 | if (pinstance->inq_data == NULL) { |
| 5019 | pmcraid_err("couldn't allocate DMA memory for INQUIRY\n"); | 5013 | pmcraid_err("couldn't allocate DMA memory for INQUIRY\n"); |
| 5020 | pmcraid_release_buffers(pinstance); | 5014 | pmcraid_release_buffers(pinstance); |
| @@ -5022,11 +5016,10 @@ static int pmcraid_init_buffers(struct pmcraid_instance *pinstance) | |||
| 5022 | } | 5016 | } |
| 5023 | 5017 | ||
| 5024 | /* allocate DMAable memory for set timestamp data buffer */ | 5018 | /* allocate DMAable memory for set timestamp data buffer */ |
| 5025 | pinstance->timestamp_data = pci_alloc_consistent( | 5019 | pinstance->timestamp_data = dma_alloc_coherent(&pinstance->pdev->dev, |
| 5026 | pinstance->pdev, | ||
| 5027 | sizeof(struct pmcraid_timestamp_data), | 5020 | sizeof(struct pmcraid_timestamp_data), |
| 5028 | &pinstance->timestamp_data_baddr); | 5021 | &pinstance->timestamp_data_baddr, |
| 5029 | 5022 | GFP_KERNEL); | |
| 5030 | if (pinstance->timestamp_data == NULL) { | 5023 | if (pinstance->timestamp_data == NULL) { |
| 5031 | pmcraid_err("couldn't allocate DMA memory for \ | 5024 | pmcraid_err("couldn't allocate DMA memory for \ |
| 5032 | set time_stamp \n"); | 5025 | set time_stamp \n"); |
| @@ -5315,12 +5308,12 @@ static int pmcraid_resume(struct pci_dev *pdev) | |||
| 5315 | 5308 | ||
| 5316 | pci_set_master(pdev); | 5309 | pci_set_master(pdev); |
| 5317 | 5310 | ||
| 5318 | if ((sizeof(dma_addr_t) == 4) || | 5311 | if (sizeof(dma_addr_t) == 4 || |
| 5319 | pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) | 5312 | dma_set_mask(&pdev->dev, DMA_BIT_MASK(64))) |
| 5320 | rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); | 5313 | rc = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32)); |
| 5321 | 5314 | ||
| 5322 | if (rc == 0) | 5315 | if (rc == 0) |
| 5323 | rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); | 5316 | rc = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32)); |
| 5324 | 5317 | ||
| 5325 | if (rc != 0) { | 5318 | if (rc != 0) { |
| 5326 | dev_err(&pdev->dev, "resume: Failed to set PCI DMA mask\n"); | 5319 | dev_err(&pdev->dev, "resume: Failed to set PCI DMA mask\n"); |
| @@ -5724,19 +5717,19 @@ static int pmcraid_probe(struct pci_dev *pdev, | |||
| 5724 | /* Firmware requires the system bus address of IOARCB to be within | 5717 | /* Firmware requires the system bus address of IOARCB to be within |
| 5725 | * 32-bit addressable range though it has 64-bit IOARRIN register. | 5718 | * 32-bit addressable range though it has 64-bit IOARRIN register. |
| 5726 | * However, firmware supports 64-bit streaming DMA buffers, whereas | 5719 | * However, firmware supports 64-bit streaming DMA buffers, whereas |
| 5727 | * coherent buffers are to be 32-bit. Since pci_alloc_consistent always | 5720 | * coherent buffers are to be 32-bit. Since dma_alloc_coherent always |
| 5728 | * returns memory within 4GB (if not, change this logic), coherent | 5721 | * returns memory within 4GB (if not, change this logic), coherent |
| 5729 | * buffers are within firmware acceptable address ranges. | 5722 | * buffers are within firmware acceptable address ranges. |
| 5730 | */ | 5723 | */ |
| 5731 | if ((sizeof(dma_addr_t) == 4) || | 5724 | if (sizeof(dma_addr_t) == 4 || |
| 5732 | pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) | 5725 | dma_set_mask(&pdev->dev, DMA_BIT_MASK(64))) |
| 5733 | rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); | 5726 | rc = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32)); |
| 5734 | 5727 | ||
| 5735 | /* firmware expects 32-bit DMA addresses for IOARRIN register; set 32 | 5728 | /* firmware expects 32-bit DMA addresses for IOARRIN register; set 32 |
| 5736 | * bit mask for pci_alloc_consistent to return addresses within 4GB | 5729 | * bit mask for dma_alloc_coherent to return addresses within 4GB |
| 5737 | */ | 5730 | */ |
| 5738 | if (rc == 0) | 5731 | if (rc == 0) |
| 5739 | rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); | 5732 | rc = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32)); |
| 5740 | 5733 | ||
| 5741 | if (rc != 0) { | 5734 | if (rc != 0) { |
| 5742 | dev_err(&pdev->dev, "Failed to set PCI DMA mask\n"); | 5735 | dev_err(&pdev->dev, "Failed to set PCI DMA mask\n"); |
