forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-11 072de836f53be56a70cecf70b43ae43b7ce17376
kernel/drivers/ata/libahci.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * libahci.c - Common AHCI SATA low-level routines
34 *
....@@ -7,29 +8,12 @@
78 *
89 * Copyright 2004-2005 Red Hat, Inc.
910 *
10
- *
11
- * This program is free software; you can redistribute it and/or modify
12
- * it under the terms of the GNU General Public License as published by
13
- * the Free Software Foundation; either version 2, or (at your option)
14
- * any later version.
15
- *
16
- * This program 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
19
- * GNU General Public License for more details.
20
- *
21
- * You should have received a copy of the GNU General Public License
22
- * along with this program; see the file COPYING. If not, write to
23
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
24
- *
25
- *
2611 * libata documentation is available via 'make {ps|pdf}docs',
2712 * as Documentation/driver-api/libata.rst
2813 *
2914 * AHCI hardware documentation:
3015 * http://www.intel.com/technology/serialata/pdf/rev1_0.pdf
3116 * http://www.intel.com/technology/serialata/pdf/rev1_1.pdf
32
- *
3317 */
3418
3519 #include <linux/kernel.h>
....@@ -507,6 +491,11 @@
507491 if (!(cap & HOST_CAP_ALPM) && (hpriv->flags & AHCI_HFLAG_YES_ALPM)) {
508492 dev_info(dev, "controller can do ALPM, turning on CAP_ALPM\n");
509493 cap |= HOST_CAP_ALPM;
494
+ }
495
+
496
+ if ((cap & HOST_CAP_SXS) && (hpriv->flags & AHCI_HFLAG_NO_SXS)) {
497
+ dev_info(dev, "controller does not support SXS, disabling CAP_SXS\n");
498
+ cap &= ~HOST_CAP_SXS;
510499 }
511500
512501 if (hpriv->force_port_map && port_map != hpriv->force_port_map) {
....@@ -1465,7 +1454,7 @@
14651454 *class = ahci_dev_classify(ap);
14661455
14671456 /* re-enable FBS if disabled before */
1468
- if (fbs_disabled)
1457
+ if (fbs_disabled || (!ata_is_host_link(link) && pp->fbs_supported))
14691458 ahci_enable_fbs(ap);
14701459
14711460 DPRINTK("EXIT, class=%u\n", *class);
....@@ -2382,7 +2371,6 @@
23822371 mem = dmam_alloc_coherent(dev, dma_sz, &mem_dma, GFP_KERNEL);
23832372 if (!mem)
23842373 return -ENOMEM;
2385
- memset(mem, 0, dma_sz);
23862374
23872375 /*
23882376 * First item in chunk of DMA memory: 32-slot command table,
....@@ -2600,7 +2588,8 @@
26002588 int rc;
26012589
26022590 if (hpriv->flags & AHCI_HFLAG_MULTI_MSI) {
2603
- if (hpriv->irq_handler)
2591
+ if (hpriv->irq_handler &&
2592
+ hpriv->irq_handler != ahci_single_level_irq_intr)
26042593 dev_warn(host->dev,
26052594 "both AHCI_HFLAG_MULTI_MSI flag set and custom irq handler implemented\n");
26062595 if (!hpriv->get_irq_vector) {