Lines Matching +full:pch +full:- +full:msi +full:- +full:1

1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * ahci.c - AHCI SATA support
6 * Please ALWAYS copy linux-ide@vger.kernel.org
9 * Copyright 2004-2005 Red Hat, Inc.
12 * as Documentation/driver-api/libata.rst
25 #include <linux/dma-mapping.h>
32 #include <linux/ahci-remap.h>
33 #include <linux/io-64-nonatomic-lo-hi.h>
263 { PCI_VDEVICE(INTEL, 0x06d6), board_ahci_pcs_quirk }, /* Comet Lake PCH-H RAID */
273 { PCI_VDEVICE(INTEL, 0x27c6), board_ahci_pcs_quirk }, /* ICH7-M DH */
296 { PCI_VDEVICE(INTEL, 0x3b22), board_ahci_pcs_quirk }, /* PCH AHCI */
297 { PCI_VDEVICE(INTEL, 0x3b23), board_ahci_pcs_quirk }, /* PCH AHCI */
298 { PCI_VDEVICE(INTEL, 0x3b24), board_ahci_pcs_quirk }, /* PCH RAID */
299 { PCI_VDEVICE(INTEL, 0x3b25), board_ahci_pcs_quirk }, /* PCH RAID */
300 { PCI_VDEVICE(INTEL, 0x3b29), board_ahci_pcs_quirk }, /* PCH M AHCI */
301 { PCI_VDEVICE(INTEL, 0x3b2b), board_ahci_pcs_quirk }, /* PCH RAID */
302 { PCI_VDEVICE(INTEL, 0x3b2c), board_ahci_pcs_quirk }, /* PCH M RAID */
303 { PCI_VDEVICE(INTEL, 0x3b2f), board_ahci_pcs_quirk }, /* PCH AHCI */
357 { PCI_VDEVICE(INTEL, 0x9dd3), board_ahci_pcs_quirk }, /* Cannon Lake PCH-LP AHCI */
378 { PCI_VDEVICE(INTEL, 0x43d4), board_ahci_pcs_quirk }, /* Rocket Lake PCH-H RAID */
379 { PCI_VDEVICE(INTEL, 0x43d5), board_ahci_pcs_quirk }, /* Rocket Lake PCH-H RAID */
380 { PCI_VDEVICE(INTEL, 0x43d6), board_ahci_pcs_quirk }, /* Rocket Lake PCH-H RAID */
381 { PCI_VDEVICE(INTEL, 0x43d7), board_ahci_pcs_quirk }, /* Rocket Lake PCH-H RAID */
406 { PCI_VDEVICE(INTEL, 0xa102), board_ahci_pcs_quirk }, /* Sunrise Point-H AHCI */
408 { PCI_VDEVICE(INTEL, 0xa105), board_ahci_pcs_quirk }, /* Sunrise Point-H RAID */
409 { PCI_VDEVICE(INTEL, 0xa106), board_ahci_pcs_quirk }, /* Sunrise Point-H RAID */
411 { PCI_VDEVICE(INTEL, 0xa10f), board_ahci_pcs_quirk }, /* Sunrise Point-H RAID */
420 { PCI_VDEVICE(INTEL, 0xa356), board_ahci_pcs_quirk }, /* Cannon Lake PCH-H RAID */
421 { PCI_VDEVICE(INTEL, 0x06d7), board_ahci_pcs_quirk }, /* Comet Lake-H RAID */
422 { PCI_VDEVICE(INTEL, 0xa386), board_ahci_pcs_quirk }, /* Comet Lake PCH-V RAID */
428 { PCI_VDEVICE(INTEL, 0x02d3), board_ahci_pcs_quirk }, /* Comet Lake PCH-U AHCI */
429 { PCI_VDEVICE(INTEL, 0x02d7), board_ahci_pcs_quirk }, /* Comet Lake PCH RAID */
430 /* Elkhart Lake IDs 0x4b60 & 0x4b62 https://sata-io.org/product/8803 not tested yet */
433 /* JMicron 360/1/3/5/6, match class to avoid IDE function */
456 { PCI_VDEVICE(AMD, 0x7800), board_ahci }, /* AMD Hudson-2 */
457 { PCI_VDEVICE(AMD, 0x7801), board_ahci_no_debounce_delay }, /* AMD Hudson-2 (AHCI mode) */
603 { PCI_VDEVICE(PROMISE, 0x3781), board_ahci }, /* FastTrak TX8660 ahci-mode */
620 * Samsung SSDs found on some macbooks. NCQ times out if MSI is
659 static int marvell_enable = 1;
662 MODULE_PARM_DESC(marvell_enable, "Marvell SATA via AHCI (1 = enabled)");
664 static int mobile_lpm_policy = -1;
671 "32-bits port map masks to ignore controllers ports. "
689 hpriv->mask_port_map = mask; in ahci_apply_port_map_mask()
752 if (pdev->vendor == PCI_VENDOR_ID_JMICRON && pdev->device == 0x2361) { in ahci_pci_save_initial_config()
753 dev_info(&pdev->dev, "JMB361 has only one port\n"); in ahci_pci_save_initial_config()
754 hpriv->saved_port_map = 1; in ahci_pci_save_initial_config()
762 if (hpriv->flags & AHCI_HFLAG_MV_PATA) { in ahci_pci_save_initial_config()
763 if (pdev->device == 0x6121) in ahci_pci_save_initial_config()
764 hpriv->mask_port_map = 0x3; in ahci_pci_save_initial_config()
766 hpriv->mask_port_map = 0xf; in ahci_pci_save_initial_config()
767 dev_info(&pdev->dev, in ahci_pci_save_initial_config()
773 ahci_get_port_map_mask(&pdev->dev, hpriv); in ahci_pci_save_initial_config()
775 ahci_save_initial_config(&pdev->dev, hpriv); in ahci_pci_save_initial_config()
780 struct pci_dev *pdev = to_pci_dev(host->dev); in ahci_pci_reset_controller()
781 struct ahci_host_priv *hpriv = host->private_data; in ahci_pci_reset_controller()
799 struct ahci_host_priv *hpriv = host->private_data; in ahci_pci_init_controller()
800 struct pci_dev *pdev = to_pci_dev(host->dev); in ahci_pci_init_controller()
805 if (hpriv->flags & AHCI_HFLAG_MV_PATA) { in ahci_pci_init_controller()
806 if (pdev->device == 0x6121) in ahci_pci_init_controller()
816 dev_dbg(&pdev->dev, "PORT_IRQ_STAT 0x%x\n", tmp); in ahci_pci_init_controller()
827 struct ata_port *ap = link->ap; in ahci_vt8251_hardreset()
828 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_vt8251_hardreset()
832 hpriv->stop_engine(ap); in ahci_vt8251_hardreset()
834 rc = sata_link_hardreset(link, sata_ehc_deb_timing(&link->eh_context), in ahci_vt8251_hardreset()
837 hpriv->start_engine(ap); in ahci_vt8251_hardreset()
840 * request follow-up softreset. in ahci_vt8251_hardreset()
842 return online ? -EAGAIN : rc; in ahci_vt8251_hardreset()
848 struct ata_port *ap = link->ap; in ahci_p5wdh_hardreset()
849 struct ahci_port_priv *pp = ap->private_data; in ahci_p5wdh_hardreset()
850 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_p5wdh_hardreset()
851 u8 *d2h_fis = pp->rx_fis + RX_FIS_D2H_REG; in ahci_p5wdh_hardreset()
856 hpriv->stop_engine(ap); in ahci_p5wdh_hardreset()
859 ata_tf_init(link->device, &tf); in ahci_p5wdh_hardreset()
863 rc = sata_link_hardreset(link, sata_ehc_deb_timing(&link->eh_context), in ahci_p5wdh_hardreset()
866 hpriv->start_engine(ap); in ahci_p5wdh_hardreset()
869 * ASUS P5W-DH Deluxe doesn't send signature FIS after in ahci_p5wdh_hardreset()
891 * ahci_avn_hardreset - attempt more aggressive recovery of Avoton ports.
895 * be recovered by a SATA-hard-reset alone. The failing signature is
896 * SStatus.DET stuck at 1 ("Device presence detected but Phy
903 * see DET==1 after a reset.
908 const unsigned int *timing = sata_ehc_deb_timing(&link->eh_context); in ahci_avn_hardreset()
909 struct ata_port *ap = link->ap; in ahci_avn_hardreset()
910 struct ahci_port_priv *pp = ap->private_data; in ahci_avn_hardreset()
911 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_avn_hardreset()
912 u8 *d2h_fis = pp->rx_fis + RX_FIS_D2H_REG; in ahci_avn_hardreset()
913 unsigned long tmo = deadline - jiffies; in ahci_avn_hardreset()
918 hpriv->stop_engine(ap); in ahci_avn_hardreset()
923 int port = ap->port_no; in ahci_avn_hardreset()
924 struct ata_host *host = ap->host; in ahci_avn_hardreset()
925 struct pci_dev *pdev = to_pci_dev(host->dev); in ahci_avn_hardreset()
928 ata_tf_init(link->device, &tf); in ahci_avn_hardreset()
936 (sstatus & 0xf) != 1) in ahci_avn_hardreset()
942 val &= ~(1 << port); in ahci_avn_hardreset()
945 val |= 1 << port; in ahci_avn_hardreset()
950 hpriv->start_engine(ap); in ahci_avn_hardreset()
962 struct ahci_host_priv *hpriv = host->private_data; in ahci_pci_disable_interrupts()
963 void __iomem *mmio = hpriv->mmio; in ahci_pci_disable_interrupts()
966 /* AHCI spec rev1.1 section 8.3.3: in ahci_pci_disable_interrupts()
1003 struct ahci_host_priv *hpriv = host->private_data; in ahci_pci_device_suspend()
1005 if (hpriv->flags & AHCI_HFLAG_NO_SUSPEND) { in ahci_pci_device_suspend()
1006 dev_err(&pdev->dev, in ahci_pci_device_suspend()
1008 return -EIO; in ahci_pci_device_suspend()
1026 if (pdev->dev.power.power_state.event == PM_EVENT_SUSPEND) { in ahci_pci_device_resume()
1048 if (hpriv->cap & HOST_CAP_64) { in ahci_configure_dma_masks()
1050 if (hpriv->flags & AHCI_HFLAG_43BIT_ONLY) in ahci_configure_dma_masks()
1057 * If the device fixup already set the dma_mask to some non-standard in ahci_configure_dma_masks()
1061 * bogus, platform code should use dev->bus_dma_limit instead.. in ahci_configure_dma_masks()
1063 if (pdev->dma_mask && pdev->dma_mask < DMA_BIT_MASK(32)) in ahci_configure_dma_masks()
1066 rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(dma_bits)); in ahci_configure_dma_masks()
1068 dev_err(&pdev->dev, "DMA enable failed\n"); in ahci_configure_dma_masks()
1074 struct pci_dev *pdev = to_pci_dev(host->dev); in ahci_pci_print_info()
1091 /* On ASUS P5W DH Deluxe, the second port of PCI device 00:1f.2 is
1092 * hardwired to on-board SIMG 4726. The chipset is ICH8 and doesn't
1095 * controller and emulate a single ATA device (can be RAID 0/1 or some
1107 * assumed without follow-up softreset.
1122 struct pci_dev *pdev = to_pci_dev(host->dev); in ahci_p5wdh_workaround()
1124 if (pdev->bus->number == 0 && pdev->devfn == PCI_DEVFN(0x1f, 2) && in ahci_p5wdh_workaround()
1126 struct ata_port *ap = host->ports[1]; in ahci_p5wdh_workaround()
1128 dev_info(&pdev->dev, in ahci_p5wdh_workaround()
1129 "enabling ASUS P5W DH Deluxe on-board SIMG4726 workaround\n"); in ahci_p5wdh_workaround()
1131 ap->ops = &ahci_p5wdh_ops; in ahci_p5wdh_workaround()
1132 ap->link.flags |= ATA_LFLAG_NO_SRST | ATA_LFLAG_ASSUME_ATA; in ahci_p5wdh_workaround()
1137 * Macbook7,1 firmware forcibly disables MCP89 AHCI and changes PCI ID when
1147 val |= 1 << 0x1b; in ahci_mcp89_apple_enable()
1153 val |= 1 << 0xc; in ahci_mcp89_apple_enable()
1162 val &= ~(1 << 0xc); in ahci_mcp89_apple_enable()
1166 val &= ~(1 << 0x1b); in ahci_mcp89_apple_enable()
1172 return pdev->vendor == PCI_VENDOR_ID_NVIDIA && in is_mcp89_apple()
1173 pdev->device == PCI_DEVICE_ID_NVIDIA_NFORCE_MCP89_SATA && in is_mcp89_apple()
1174 pdev->subsystem_vendor == PCI_VENDOR_ID_APPLE && in is_mcp89_apple()
1175 pdev->subsystem_device == 0xcb89; in is_mcp89_apple()
1184 * working is 1501 which was released on 2007-10-26. in ahci_sb600_enable_64bit()
1190 .ident = "ASUS M2A-VM", in ahci_sb600_enable_64bit()
1194 DMI_MATCH(DMI_BOARD_NAME, "M2A-VM"), in ahci_sb600_enable_64bit()
1199 * All BIOS versions for the MSI K9A2 Platinum (MS-7376) in ahci_sb600_enable_64bit()
1203 * fields as "MICRO-STAR INTERANTIONAL CO.,LTD". in ahci_sb600_enable_64bit()
1206 * "MICRO-STAR INTERNATIONAL CO.,LTD". in ahci_sb600_enable_64bit()
1207 * So try to match on DMI_BOARD_VENDOR of "MICRO-STAR INTER". in ahci_sb600_enable_64bit()
1210 * DMI field of "MS-7376". This was changed to be in ahci_sb600_enable_64bit()
1211 * "K9A2 Platinum (MS-7376)" in version 1.9, but we can still in ahci_sb600_enable_64bit()
1212 * match on DMI_BOARD_NAME of "MS-7376". in ahci_sb600_enable_64bit()
1215 .ident = "MSI K9A2 Platinum", in ahci_sb600_enable_64bit()
1218 "MICRO-STAR INTER"), in ahci_sb600_enable_64bit()
1219 DMI_MATCH(DMI_BOARD_NAME, "MS-7376"), in ahci_sb600_enable_64bit()
1223 * All BIOS versions for the MSI K9AGM2 (MS-7327) support in ahci_sb600_enable_64bit()
1228 * match on DMI_BOARD_VENDOR of "MICRO-STAR INTER" again. in ahci_sb600_enable_64bit()
1231 .ident = "MSI K9AGM2", in ahci_sb600_enable_64bit()
1234 "MICRO-STAR INTER"), in ahci_sb600_enable_64bit()
1235 DMI_MATCH(DMI_BOARD_NAME, "MS-7327"), in ahci_sb600_enable_64bit()
1257 if (pdev->bus->number != 0 || pdev->devfn != PCI_DEVFN(0x12, 0) || in ahci_sb600_enable_64bit()
1261 if (!match->driver_data) in ahci_sb600_enable_64bit()
1267 if (strcmp(buf, match->driver_data) >= 0) in ahci_sb600_enable_64bit()
1270 dev_warn(&pdev->dev, in ahci_sb600_enable_64bit()
1272 match->ident); in ahci_sb600_enable_64bit()
1277 dev_warn(&pdev->dev, "%s: enabling 64bit DMA\n", match->ident); in ahci_sb600_enable_64bit()
1287 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), in ahci_broken_system_poweroff()
1296 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), in ahci_broken_system_poweroff()
1308 unsigned long slot = (unsigned long)dmi->driver_data; in ahci_broken_system_poweroff()
1309 /* apply the quirk only to on-board controllers */ in ahci_broken_system_poweroff()
1310 return slot == PCI_SLOT(pdev->devfn); in ahci_broken_system_poweroff()
1320 * On HP dv[4-6] and HDX18 with earlier BIOSen, link in ahci_broken_suspend()
1335 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), in ahci_broken_suspend()
1344 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), in ahci_broken_suspend()
1353 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), in ahci_broken_suspend()
1362 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), in ahci_broken_suspend()
1391 if (!dmi || pdev->bus->number || pdev->devfn != PCI_DEVFN(0x1f, 2)) in ahci_broken_suspend()
1397 return strcmp(buf, dmi->driver_data) < 0; in ahci_broken_suspend()
1450 return strcmp(buf, dmi->driver_data) < 0; in ahci_broken_lpm()
1472 .ident = "EP45-DQ6", in ahci_broken_online()
1476 DMI_MATCH(DMI_BOARD_NAME, "EP45-DQ6"), in ahci_broken_online()
1481 .ident = "EP45-DS5", in ahci_broken_online()
1485 DMI_MATCH(DMI_BOARD_NAME, "EP45-DS5"), in ahci_broken_online()
1498 val = (unsigned long)dmi->driver_data; in ahci_broken_online()
1500 return pdev->bus->number == (val >> 8) && pdev->devfn == (val & 0xff); in ahci_broken_online()
1511 * is FPDMA non-zero offset enable which when enabled in ahci_gtf_filter_workaround()
1532 filter = (unsigned long)dmi->driver_data; in ahci_gtf_filter_workaround()
1533 dev_info(host->dev, "applying extra ACPI _GTF filter 0x%x for %s\n", in ahci_gtf_filter_workaround()
1534 filter, dmi->ident); in ahci_gtf_filter_workaround()
1536 for (i = 0; i < host->n_ports; i++) { in ahci_gtf_filter_workaround()
1537 struct ata_port *ap = host->ports[i]; in ahci_gtf_filter_workaround()
1543 dev->gtf_filter |= filter; in ahci_gtf_filter_workaround()
1570 DMI_MATCH(DMI_PRODUCT_NAME, "Switch SA5-271") in acer_sa5_271_workaround()
1577 dev_info(&pdev->dev, "enabling Acer Switch Alpha 12 workaround\n"); in acer_sa5_271_workaround()
1578 if ((hpriv->saved_cap & 0xC734FF00) == 0xC734FF00) { in acer_sa5_271_workaround()
1579 hpriv->port_map = 0x7; in acer_sa5_271_workaround()
1580 hpriv->cap = 0xC734FF02; in acer_sa5_271_workaround()
1598 unsigned int handled = 1; in ahci_thunderx_irq_handler()
1600 hpriv = host->private_data; in ahci_thunderx_irq_handler()
1601 mmio = hpriv->mmio; in ahci_thunderx_irq_handler()
1607 irq_masked = irq_stat & hpriv->port_map; in ahci_thunderx_irq_handler()
1608 spin_lock(&host->lock); in ahci_thunderx_irq_handler()
1614 spin_unlock(&host->lock); in ahci_thunderx_irq_handler()
1630 if (pdev->vendor != PCI_VENDOR_ID_INTEL || in ahci_remap_check()
1633 !(readl(hpriv->mmio + AHCI_VSCAP) & 1)) in ahci_remap_check()
1636 cap = readq(hpriv->mmio + AHCI_REMAP_CAP); in ahci_remap_check()
1638 if ((cap & (1 << i)) == 0) in ahci_remap_check()
1640 if (readl(hpriv->mmio + ahci_remap_dcc(i)) in ahci_remap_check()
1645 hpriv->remapped_nvme++; in ahci_remap_check()
1648 if (!hpriv->remapped_nvme) in ahci_remap_check()
1651 dev_warn(&pdev->dev, "Found %u remapped NVMe devices.\n", in ahci_remap_check()
1652 hpriv->remapped_nvme); in ahci_remap_check()
1653 dev_warn(&pdev->dev, in ahci_remap_check()
1657 * Don't rely on the msi-x capability in the remap case, in ahci_remap_check()
1660 hpriv->flags |= AHCI_HFLAG_NO_MSI; in ahci_remap_check()
1665 return pci_irq_vector(to_pci_dev(host->dev), port); in ahci_get_irq_vector()
1673 if (hpriv->flags & AHCI_HFLAG_NO_MSI) in ahci_init_msi()
1674 return -ENODEV; in ahci_init_msi()
1679 * of multipe MSIs is negated and use single MSI mode instead. in ahci_init_msi()
1681 if (n_ports > 1) { in ahci_init_msi()
1685 if (!(readl(hpriv->mmio + HOST_CTL) & HOST_MRSM)) { in ahci_init_msi()
1686 hpriv->get_irq_vector = ahci_get_irq_vector; in ahci_init_msi()
1687 hpriv->flags |= AHCI_HFLAG_MULTI_MSI; in ahci_init_msi()
1692 * Fallback to single MSI mode if the controller in ahci_init_msi()
1696 "ahci: MRSM is on, fallback to single MSI\n"); in ahci_init_msi()
1702 * If the host is not capable of supporting per-port vectors, fall in ahci_init_msi()
1703 * back to single MSI before finally attempting single MSI-X. in ahci_init_msi()
1705 nvec = pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_MSI); in ahci_init_msi()
1706 if (nvec == 1) in ahci_init_msi()
1708 return pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_MSIX); in ahci_init_msi()
1713 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_mark_external_port()
1717 /* mark external ports (hotplug-capable, eSATA) */ in ahci_mark_external_port()
1719 if (((tmp & PORT_CMD_ESP) && (hpriv->cap & HOST_CAP_SXS)) || in ahci_mark_external_port()
1721 ap->pflags |= ATA_PFLAG_EXTERNAL; in ahci_mark_external_port()
1726 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_update_initial_lpm_policy()
1730 * AHCI contains a known incompatibility between LPM and hot-plug in ahci_update_initial_lpm_policy()
1731 * removal events, see 7.3.1 Hot Plug Removal Detection and Power in ahci_update_initial_lpm_policy()
1732 * Management Interaction in AHCI 1.3.1. Therefore, do not enable in ahci_update_initial_lpm_policy()
1735 if (ap->pflags & ATA_PFLAG_EXTERNAL) { in ahci_update_initial_lpm_policy()
1741 if ((ap->host->flags & ATA_HOST_NO_PART) && in ahci_update_initial_lpm_policy()
1742 (ap->host->flags & ATA_HOST_NO_SSC) && in ahci_update_initial_lpm_policy()
1743 (ap->host->flags & ATA_HOST_NO_DEVSLP)) { in ahci_update_initial_lpm_policy()
1749 if (mobile_lpm_policy != -1) { in ahci_update_initial_lpm_policy()
1755 if (hpriv->cap & HOST_CAP_PART) in ahci_update_initial_lpm_policy()
1757 else if (hpriv->cap & HOST_CAP_SSC) in ahci_update_initial_lpm_policy()
1763 ap->target_lpm_policy = policy; in ahci_update_initial_lpm_policy()
1770 if (!(hpriv->flags & AHCI_HFLAG_INTEL_PCS_QUIRK)) in ahci_intel_pcs_quirk()
1775 * implemented as write or write-once register. If the register in ahci_intel_pcs_quirk()
1782 if ((tmp16 & hpriv->port_map) != hpriv->port_map) { in ahci_intel_pcs_quirk()
1783 tmp16 |= hpriv->port_map; in ahci_intel_pcs_quirk()
1793 struct ahci_host_priv *hpriv = host->private_data; in remapped_nvme_show()
1795 return sysfs_emit(buf, "%u\n", hpriv->remapped_nvme); in remapped_nvme_show()
1802 unsigned int board_id = ent->driver_data; in ahci_init_one()
1805 struct device *dev = &pdev->dev; in ahci_init_one()
1813 ata_print_version_once(&pdev->dev, DRV_VERSION); in ahci_init_one()
1818 if (pdev->vendor == PCI_VENDOR_ID_MARVELL && !marvell_enable) in ahci_init_one()
1819 return -ENODEV; in ahci_init_one()
1829 if (pdev->vendor == PCI_VENDOR_ID_PROMISE) in ahci_init_one()
1830 dev_info(&pdev->dev, in ahci_init_one()
1833 /* Some devices use non-standard BARs */ in ahci_init_one()
1834 if (pdev->vendor == PCI_VENDOR_ID_STMICRO && pdev->device == 0xCC06) in ahci_init_one()
1836 else if (pdev->vendor == 0x1c44 && pdev->device == 0x8000) in ahci_init_one()
1838 else if (pdev->vendor == PCI_VENDOR_ID_CAVIUM) { in ahci_init_one()
1839 if (pdev->device == 0xa01c) in ahci_init_one()
1841 if (pdev->device == 0xa084) in ahci_init_one()
1843 } else if (pdev->vendor == PCI_VENDOR_ID_LOONGSON) { in ahci_init_one()
1844 if (pdev->device == 0x7a08) in ahci_init_one()
1853 if (pdev->vendor == PCI_VENDOR_ID_INTEL && in ahci_init_one()
1854 (pdev->device == 0x2652 || pdev->device == 0x2653)) { in ahci_init_one()
1863 dev_info(&pdev->dev, in ahci_init_one()
1865 return -ENODEV; in ahci_init_one()
1872 rc = pcim_iomap_regions_request_all(pdev, 1 << ahci_pci_bar, DRV_NAME); in ahci_init_one()
1873 if (rc == -EBUSY) in ahci_init_one()
1880 return -ENOMEM; in ahci_init_one()
1881 hpriv->flags |= (unsigned long)pi.private_data; in ahci_init_one()
1883 /* MCP65 revision A1 and A2 can't do MSI */ in ahci_init_one()
1885 (pdev->revision == 0xa1 || pdev->revision == 0xa2)) in ahci_init_one()
1886 hpriv->flags |= AHCI_HFLAG_NO_MSI; in ahci_init_one()
1889 if (board_id == board_ahci_sb700 && pdev->revision >= 0x40) in ahci_init_one()
1890 hpriv->flags &= ~AHCI_HFLAG_IGN_SERR_INTERNAL; in ahci_init_one()
1894 hpriv->flags &= ~AHCI_HFLAG_32BIT_ONLY; in ahci_init_one()
1896 hpriv->mmio = pcim_iomap_table(pdev)[ahci_pci_bar]; in ahci_init_one()
1901 sysfs_add_file_to_group(&pdev->dev.kobj, in ahci_init_one()
1906 if (pdev->vendor == PCI_VENDOR_ID_HUAWEI && in ahci_init_one()
1907 pdev->device == 0xa235 && in ahci_init_one()
1908 pdev->revision < 0x30) in ahci_init_one()
1909 hpriv->flags |= AHCI_HFLAG_NO_SXS; in ahci_init_one()
1911 if (pdev->vendor == 0x177d && pdev->device == 0xa01c) in ahci_init_one()
1912 hpriv->irq_handler = ahci_thunderx_irq_handler; in ahci_init_one()
1919 if (hpriv->cap & HOST_CAP_NCQ) { in ahci_init_one()
1922 * Auto-activate optimization is supposed to be in ahci_init_one()
1927 if (!(hpriv->flags & AHCI_HFLAG_NO_FPDMA_AA)) in ahci_init_one()
1931 * All AHCI controllers should be forward-compatible in ahci_init_one()
1939 if (hpriv->cap & HOST_CAP_PMP) in ahci_init_one()
1946 dev_info(&pdev->dev, in ahci_init_one()
1952 dev_warn(&pdev->dev, in ahci_init_one()
1957 hpriv->flags |= AHCI_HFLAG_NO_SUSPEND; in ahci_init_one()
1958 dev_warn(&pdev->dev, in ahci_init_one()
1963 hpriv->flags |= AHCI_HFLAG_SRST_TOUT_IS_OFFLINE; in ahci_init_one()
1964 dev_info(&pdev->dev, in ahci_init_one()
1969 /* Acer SA5-271 workaround modifies private_data */ in ahci_init_one()
1977 n_ports = max(ahci_nr_ports(hpriv->cap), fls(hpriv->port_map)); in ahci_init_one()
1979 host = ata_host_alloc_pinfo(&pdev->dev, ppi, n_ports); in ahci_init_one()
1981 rc = -ENOMEM; in ahci_init_one()
1984 host->private_data = hpriv; in ahci_init_one()
1988 pci_intx(pdev, 1); in ahci_init_one()
1990 hpriv->irq = pci_irq_vector(pdev, 0); in ahci_init_one()
1992 if (!(hpriv->cap & HOST_CAP_SSS) || ahci_ignore_sss) in ahci_init_one()
1993 host->flags |= ATA_HOST_PARALLEL_SCAN; in ahci_init_one()
1995 dev_info(&pdev->dev, "SSS flag set, parallel bus scan disabled\n"); in ahci_init_one()
1997 if (!(hpriv->cap & HOST_CAP_PART)) in ahci_init_one()
1998 host->flags |= ATA_HOST_NO_PART; in ahci_init_one()
2000 if (!(hpriv->cap & HOST_CAP_SSC)) in ahci_init_one()
2001 host->flags |= ATA_HOST_NO_SSC; in ahci_init_one()
2003 if (!(hpriv->cap2 & HOST_CAP2_SDS)) in ahci_init_one()
2004 host->flags |= ATA_HOST_NO_DEVSLP; in ahci_init_one()
2009 for (i = 0; i < host->n_ports; i++) { in ahci_init_one()
2010 struct ata_port *ap = host->ports[i]; in ahci_init_one()
2012 ata_port_pbar_desc(ap, ahci_pci_bar, -1, "abar"); in ahci_init_one()
2014 0x100 + ap->port_no * 0x80, "port"); in ahci_init_one()
2017 if (ap->flags & ATA_FLAG_EM) in ahci_init_one()
2018 ap->em_message_type = hpriv->em_msg_type; in ahci_init_one()
2024 /* disabled/not-implemented port */ in ahci_init_one()
2025 if (!(hpriv->port_map & (1 << i))) in ahci_init_one()
2026 ap->ops = &ata_dummy_port_ops; in ahci_init_one()
2053 pm_runtime_put_noidle(&pdev->dev); in ahci_init_one()
2057 sysfs_remove_file_from_group(&pdev->dev.kobj, in ahci_init_one()
2069 sysfs_remove_file_from_group(&pdev->dev.kobj, in ahci_remove_one()
2072 pm_runtime_get_noresume(&pdev->dev); in ahci_remove_one()
2079 MODULE_DESCRIPTION("AHCI SATA low-level driver");