| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * NinjaSCSI-32Bi Cardbus, NinjaSCSI-32UDE PCI/CardBus SCSI driver |
|---|
| 3 | 4 | * Copyright (C) 2001, 2002, 2003 |
|---|
| 4 | 5 | * YOKOTA Hiroshi <yokota@netlab.is.tsukuba.ac.jp> |
|---|
| 5 | 6 | * GOTO Masanori <gotom@debian.or.jp>, <gotom@debian.org> |
|---|
| 6 | | - * |
|---|
| 7 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 8 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 9 | | - * the Free Software Foundation; either version 2, or (at your option) |
|---|
| 10 | | - * any later version. |
|---|
| 11 | | - * |
|---|
| 12 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 13 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 14 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 15 | | - * GNU General Public License for more details. |
|---|
| 16 | | - * |
|---|
| 17 | 7 | * |
|---|
| 18 | 8 | * Revision History: |
|---|
| 19 | 9 | * 1.0: Initial Release. |
|---|
| .. | .. |
|---|
| 274 | 264 | .sg_tablesize = NSP32_SG_SIZE, |
|---|
| 275 | 265 | .max_sectors = 128, |
|---|
| 276 | 266 | .this_id = NSP32_HOST_SCSIID, |
|---|
| 277 | | - .use_clustering = DISABLE_CLUSTERING, |
|---|
| 267 | + .dma_boundary = PAGE_SIZE - 1, |
|---|
| 278 | 268 | .eh_abort_handler = nsp32_eh_abort, |
|---|
| 279 | 269 | .eh_host_reset_handler = nsp32_eh_host_reset, |
|---|
| 280 | 270 | /* .highmem_io = 1, */ |
|---|
| .. | .. |
|---|
| 1257 | 1247 | * ---> AutoSCSI with MSGOUTreg is processed. |
|---|
| 1258 | 1248 | */ |
|---|
| 1259 | 1249 | data->msgout_len = 0; |
|---|
| 1260 | | - }; |
|---|
| 1250 | + } |
|---|
| 1261 | 1251 | |
|---|
| 1262 | 1252 | nsp32_dbg(NSP32_DEBUG_INTR, "MsgOut phase processed"); |
|---|
| 1263 | 1253 | } |
|---|
| .. | .. |
|---|
| 1552 | 1542 | * with ACK reply when below condition is matched: |
|---|
| 1553 | 1543 | * MsgIn 00: Command Complete. |
|---|
| 1554 | 1544 | * MsgIn 02: Save Data Pointer. |
|---|
| 1555 | | - * MsgIn 04: Diconnect. |
|---|
| 1545 | + * MsgIn 04: Disconnect. |
|---|
| 1556 | 1546 | * In other case, unexpected BUSFREE is detected. |
|---|
| 1557 | 1547 | */ |
|---|
| 1558 | 1548 | static int nsp32_busfree_occur(struct scsi_cmnd *SCpnt, unsigned short execph) |
|---|
| .. | .. |
|---|
| 1849 | 1839 | |
|---|
| 1850 | 1840 | nsp32_dbg(NSP32_DEBUG_MSGOUTOCCUR, "bus: 0x%x\n", |
|---|
| 1851 | 1841 | nsp32_read1(base, SCSI_BUS_MONITOR)); |
|---|
| 1852 | | - }; |
|---|
| 1842 | + } |
|---|
| 1853 | 1843 | |
|---|
| 1854 | 1844 | data->msgout_len = 0; |
|---|
| 1855 | 1845 | |
|---|
| .. | .. |
|---|
| 2441 | 2431 | |
|---|
| 2442 | 2432 | period = data->synct[entry].period_num; |
|---|
| 2443 | 2433 | ackwidth = data->synct[entry].ackwidth; |
|---|
| 2444 | | - offset = offset; |
|---|
| 2445 | 2434 | sample_rate = data->synct[entry].sample_rate; |
|---|
| 2446 | 2435 | |
|---|
| 2447 | 2436 | target->syncreg = TO_SYNCREG(period, offset); |
|---|
| .. | .. |
|---|
| 2638 | 2627 | /* |
|---|
| 2639 | 2628 | * setup DMA |
|---|
| 2640 | 2629 | */ |
|---|
| 2641 | | - if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32)) != 0) { |
|---|
| 2630 | + if (dma_set_mask(&pdev->dev, DMA_BIT_MASK(32)) != 0) { |
|---|
| 2642 | 2631 | nsp32_msg (KERN_ERR, "failed to set PCI DMA mask"); |
|---|
| 2643 | 2632 | goto scsi_unregister; |
|---|
| 2644 | 2633 | } |
|---|
| .. | .. |
|---|
| 2646 | 2635 | /* |
|---|
| 2647 | 2636 | * allocate autoparam DMA resource. |
|---|
| 2648 | 2637 | */ |
|---|
| 2649 | | - data->autoparam = pci_alloc_consistent(pdev, sizeof(nsp32_autoparam), &(data->auto_paddr)); |
|---|
| 2638 | + data->autoparam = dma_alloc_coherent(&pdev->dev, |
|---|
| 2639 | + sizeof(nsp32_autoparam), &(data->auto_paddr), |
|---|
| 2640 | + GFP_KERNEL); |
|---|
| 2650 | 2641 | if (data->autoparam == NULL) { |
|---|
| 2651 | 2642 | nsp32_msg(KERN_ERR, "failed to allocate DMA memory"); |
|---|
| 2652 | 2643 | goto scsi_unregister; |
|---|
| .. | .. |
|---|
| 2655 | 2646 | /* |
|---|
| 2656 | 2647 | * allocate scatter-gather DMA resource. |
|---|
| 2657 | 2648 | */ |
|---|
| 2658 | | - data->sg_list = pci_alloc_consistent(pdev, NSP32_SG_TABLE_SIZE, |
|---|
| 2659 | | - &(data->sg_paddr)); |
|---|
| 2649 | + data->sg_list = dma_alloc_coherent(&pdev->dev, NSP32_SG_TABLE_SIZE, |
|---|
| 2650 | + &data->sg_paddr, GFP_KERNEL); |
|---|
| 2660 | 2651 | if (data->sg_list == NULL) { |
|---|
| 2661 | 2652 | nsp32_msg(KERN_ERR, "failed to allocate DMA memory"); |
|---|
| 2662 | 2653 | goto free_autoparam; |
|---|
| .. | .. |
|---|
| 2761 | 2752 | free_irq(host->irq, data); |
|---|
| 2762 | 2753 | |
|---|
| 2763 | 2754 | free_sg_list: |
|---|
| 2764 | | - pci_free_consistent(pdev, NSP32_SG_TABLE_SIZE, |
|---|
| 2755 | + dma_free_coherent(&pdev->dev, NSP32_SG_TABLE_SIZE, |
|---|
| 2765 | 2756 | data->sg_list, data->sg_paddr); |
|---|
| 2766 | 2757 | |
|---|
| 2767 | 2758 | free_autoparam: |
|---|
| 2768 | | - pci_free_consistent(pdev, sizeof(nsp32_autoparam), |
|---|
| 2759 | + dma_free_coherent(&pdev->dev, sizeof(nsp32_autoparam), |
|---|
| 2769 | 2760 | data->autoparam, data->auto_paddr); |
|---|
| 2770 | 2761 | |
|---|
| 2771 | 2762 | scsi_unregister: |
|---|
| .. | .. |
|---|
| 2780 | 2771 | nsp32_hw_data *data = (nsp32_hw_data *)host->hostdata; |
|---|
| 2781 | 2772 | |
|---|
| 2782 | 2773 | if (data->autoparam) { |
|---|
| 2783 | | - pci_free_consistent(data->Pci, sizeof(nsp32_autoparam), |
|---|
| 2774 | + dma_free_coherent(&data->Pci->dev, sizeof(nsp32_autoparam), |
|---|
| 2784 | 2775 | data->autoparam, data->auto_paddr); |
|---|
| 2785 | 2776 | } |
|---|
| 2786 | 2777 | |
|---|
| 2787 | 2778 | if (data->sg_list) { |
|---|
| 2788 | | - pci_free_consistent(data->Pci, NSP32_SG_TABLE_SIZE, |
|---|
| 2779 | + dma_free_coherent(&data->Pci->dev, NSP32_SG_TABLE_SIZE, |
|---|
| 2789 | 2780 | data->sg_list, data->sg_paddr); |
|---|
| 2790 | 2781 | } |
|---|
| 2791 | 2782 | |
|---|