.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * Aic94xx SAS/SATA Tasks |
---|
3 | 4 | * |
---|
4 | 5 | * Copyright (C) 2005 Adaptec, Inc. All rights reserved. |
---|
5 | 6 | * Copyright (C) 2005 Luben Tuikov <luben_tuikov@adaptec.com> |
---|
6 | | - * |
---|
7 | | - * This file is licensed under GPLv2. |
---|
8 | | - * |
---|
9 | | - * This file is part of the aic94xx driver. |
---|
10 | | - * |
---|
11 | | - * The aic94xx driver is free software; you can redistribute it and/or |
---|
12 | | - * modify it under the terms of the GNU General Public License as |
---|
13 | | - * published by the Free Software Foundation; version 2 of the |
---|
14 | | - * License. |
---|
15 | | - * |
---|
16 | | - * The aic94xx driver is distributed in the hope that it will be useful, |
---|
17 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
18 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
19 | | - * General Public License for more details. |
---|
20 | | - * |
---|
21 | | - * You should have received a copy of the GNU General Public License |
---|
22 | | - * along with the aic94xx driver; if not, write to the Free Software |
---|
23 | | - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
---|
24 | | - * |
---|
25 | 7 | */ |
---|
26 | 8 | |
---|
27 | 9 | #include <linux/spinlock.h> |
---|
.. | .. |
---|
42 | 24 | spin_unlock_irqrestore(&asd_ha->seq.pend_q_lock, flags); |
---|
43 | 25 | } |
---|
44 | 26 | |
---|
45 | | -/* PCI_DMA_... to our direction translation. |
---|
| 27 | +/* DMA_... to our direction translation. |
---|
46 | 28 | */ |
---|
47 | 29 | 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 */ |
---|
| 30 | + [DMA_BIDIRECTIONAL] = DATA_DIR_BYRECIPIENT, /* UNSPECIFIED */ |
---|
| 31 | + [DMA_TO_DEVICE] = DATA_DIR_OUT, /* OUTBOUND */ |
---|
| 32 | + [DMA_FROM_DEVICE] = DATA_DIR_IN, /* INBOUND */ |
---|
| 33 | + [DMA_NONE] = DATA_DIR_NONE, /* NO TRANSFER */ |
---|
52 | 34 | }; |
---|
53 | 35 | |
---|
54 | 36 | static int asd_map_scatterlist(struct sas_task *task, |
---|
.. | .. |
---|
60 | 42 | struct scatterlist *sc; |
---|
61 | 43 | int num_sg, res; |
---|
62 | 44 | |
---|
63 | | - if (task->data_dir == PCI_DMA_NONE) |
---|
| 45 | + if (task->data_dir == DMA_NONE) |
---|
64 | 46 | return 0; |
---|
65 | 47 | |
---|
66 | 48 | if (task->num_scatter == 0) { |
---|
67 | 49 | void *p = task->scatter; |
---|
68 | | - dma_addr_t dma = pci_map_single(asd_ha->pcidev, p, |
---|
| 50 | + dma_addr_t dma = dma_map_single(&asd_ha->pcidev->dev, p, |
---|
69 | 51 | task->total_xfer_len, |
---|
70 | 52 | task->data_dir); |
---|
71 | 53 | sg_arr[0].bus_addr = cpu_to_le64((u64)dma); |
---|
.. | .. |
---|
79 | 61 | if (sas_protocol_ata(task->task_proto)) |
---|
80 | 62 | num_sg = task->num_scatter; |
---|
81 | 63 | else |
---|
82 | | - num_sg = pci_map_sg(asd_ha->pcidev, task->scatter, |
---|
| 64 | + num_sg = dma_map_sg(&asd_ha->pcidev->dev, task->scatter, |
---|
83 | 65 | task->num_scatter, task->data_dir); |
---|
84 | 66 | if (num_sg == 0) |
---|
85 | 67 | return -ENOMEM; |
---|
.. | .. |
---|
126 | 108 | return 0; |
---|
127 | 109 | err_unmap: |
---|
128 | 110 | if (sas_protocol_ata(task->task_proto)) |
---|
129 | | - pci_unmap_sg(asd_ha->pcidev, task->scatter, task->num_scatter, |
---|
130 | | - task->data_dir); |
---|
| 111 | + dma_unmap_sg(&asd_ha->pcidev->dev, task->scatter, |
---|
| 112 | + task->num_scatter, task->data_dir); |
---|
131 | 113 | return res; |
---|
132 | 114 | } |
---|
133 | 115 | |
---|
.. | .. |
---|
136 | 118 | struct asd_ha_struct *asd_ha = ascb->ha; |
---|
137 | 119 | struct sas_task *task = ascb->uldd_task; |
---|
138 | 120 | |
---|
139 | | - if (task->data_dir == PCI_DMA_NONE) |
---|
| 121 | + if (task->data_dir == DMA_NONE) |
---|
140 | 122 | return; |
---|
141 | 123 | |
---|
142 | 124 | if (task->num_scatter == 0) { |
---|
143 | 125 | dma_addr_t dma = (dma_addr_t) |
---|
144 | 126 | 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); |
---|
| 127 | + dma_unmap_single(&ascb->ha->pcidev->dev, dma, |
---|
| 128 | + task->total_xfer_len, task->data_dir); |
---|
147 | 129 | return; |
---|
148 | 130 | } |
---|
149 | 131 | |
---|
150 | 132 | asd_free_coherent(asd_ha, ascb->sg_arr); |
---|
151 | 133 | if (task->task_proto != SAS_PROTOCOL_STP) |
---|
152 | | - pci_unmap_sg(asd_ha->pcidev, task->scatter, task->num_scatter, |
---|
153 | | - task->data_dir); |
---|
| 134 | + dma_unmap_sg(&asd_ha->pcidev->dev, task->scatter, |
---|
| 135 | + task->num_scatter, task->data_dir); |
---|
154 | 136 | } |
---|
155 | 137 | |
---|
156 | 138 | /* ---------- Task complete tasklet ---------- */ |
---|
.. | .. |
---|
436 | 418 | struct domain_device *dev = task->dev; |
---|
437 | 419 | struct scb *scb; |
---|
438 | 420 | |
---|
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); |
---|
| 421 | + dma_map_sg(&asd_ha->pcidev->dev, &task->smp_task.smp_req, 1, |
---|
| 422 | + DMA_TO_DEVICE); |
---|
| 423 | + dma_map_sg(&asd_ha->pcidev->dev, &task->smp_task.smp_resp, 1, |
---|
| 424 | + DMA_FROM_DEVICE); |
---|
443 | 425 | |
---|
444 | 426 | scb = ascb->scb; |
---|
445 | 427 | |
---|
.. | .. |
---|
471 | 453 | struct sas_task *task = a->uldd_task; |
---|
472 | 454 | |
---|
473 | 455 | 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); |
---|
| 456 | + dma_unmap_sg(&a->ha->pcidev->dev, &task->smp_task.smp_req, 1, |
---|
| 457 | + DMA_TO_DEVICE); |
---|
| 458 | + dma_unmap_sg(&a->ha->pcidev->dev, &task->smp_task.smp_resp, 1, |
---|
| 459 | + DMA_FROM_DEVICE); |
---|
478 | 460 | } |
---|
479 | 461 | |
---|
480 | 462 | /* ---------- SSP ---------- */ |
---|