hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/drivers/ata/sata_nv.c
....@@ -1,24 +1,9 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * sata_nv.c - NVIDIA nForce SATA
34 *
45 * Copyright 2004 NVIDIA Corp. All rights reserved.
56 * Copyright 2004 Andrew Chew
6
- *
7
- *
8
- * This program is free software; you can redistribute it and/or modify
9
- * it under the terms of the GNU General Public License as published by
10
- * the Free Software Foundation; either version 2, or (at your option)
11
- * any later version.
12
- *
13
- * This program is distributed in the hope that it will be useful,
14
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
- * GNU General Public License for more details.
17
- *
18
- * You should have received a copy of the GNU General Public License
19
- * along with this program; see the file COPYING. If not, write to
20
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
21
- *
227 *
238 * libata documentation is available via 'make {ps|pdf}docs',
249 * as Documentation/driver-api/libata.rst
....@@ -33,7 +18,6 @@
3318 * similar to the ADMA specification (with some modifications).
3419 * This allows the use of NCQ. Non-DMA-mapped ATA commands are still
3520 * sent through the legacy interface.
36
- *
3721 */
3822
3923 #include <linux/kernel.h>
....@@ -1138,21 +1122,16 @@
11381122
11391123 /*
11401124 * Now that the legacy PRD and padding buffer are allocated we can
1141
- * try to raise the DMA mask to allocate the CPB/APRD table.
1125
+ * raise the DMA mask to allocate the CPB/APRD table.
11421126 */
1143
- rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
1144
- if (rc) {
1145
- rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
1146
- if (rc)
1147
- return rc;
1148
- }
1127
+ dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
1128
+
11491129 pp->adma_dma_mask = *dev->dma_mask;
11501130
11511131 mem = dmam_alloc_coherent(dev, NV_ADMA_PORT_PRIV_DMA_SZ,
11521132 &mem_dma, GFP_KERNEL);
11531133 if (!mem)
11541134 return -ENOMEM;
1155
- memset(mem, 0, NV_ADMA_PORT_PRIV_DMA_SZ);
11561135
11571136 /*
11581137 * First item in chunk of DMA memory:
....@@ -1964,7 +1943,6 @@
19641943 &pp->prd_dma, GFP_KERNEL);
19651944 if (!pp->prd)
19661945 return -ENOMEM;
1967
- memset(pp->prd, 0, ATA_PRD_TBL_SZ * ATA_MAX_QUEUE);
19681946
19691947 ap->private_data = pp;
19701948 pp->sactive_block = ap->ioaddr.scr_addr + 4 * SCR_ACTIVE;
....@@ -2351,7 +2329,7 @@
23512329 // Make sure this is a SATA controller by counting the number of bars
23522330 // (NVIDIA SATA controllers will always have six bars). Otherwise,
23532331 // it's an IDE controller and we ignore it.
2354
- for (bar = 0; bar < 6; bar++)
2332
+ for (bar = 0; bar < PCI_STD_NUM_BARS; bar++)
23552333 if (pci_resource_start(pdev, bar) == 0)
23562334 return -ENODEV;
23572335