summaryrefslogtreecommitdiffstats
path: root/drivers/ata/ahci.c
diff options
context:
space:
mode:
authorNiklas Cassel <cassel@kernel.org>2024-02-06 22:13:42 +0100
committerNiklas Cassel <cassel@kernel.org>2024-02-09 10:29:59 +0100
commitf7131935238d00745638b826f8c31efc8d361435 (patch)
tree84ef44353029a1352221565da0a09cacba99d238 /drivers/ata/ahci.c
parent7f7f2b7624d4770978c15c0ecd720dc703f7ace3 (diff)
downloadlinux-stable-f7131935238d00745638b826f8c31efc8d361435.tar.gz
linux-stable-f7131935238d00745638b826f8c31efc8d361435.tar.bz2
linux-stable-f7131935238d00745638b826f8c31efc8d361435.zip
ata: ahci: move marking of external port earlier
Move the marking of an external port earlier in the call chain. This is needed for further cleanups. No functional change intended. Tested-by: Damien Le Moal <dlemoal@kernel.org> Tested-by: Jian-Hong Pan <jhp@endlessos.org> Reviewed-by: Damien Le Moal <dlemoal@kernel.org> Reviewed-by: Mario Limonciello <mario.limonciello@amd.com> Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Niklas Cassel <cassel@kernel.org>
Diffstat (limited to 'drivers/ata/ahci.c')
-rw-r--r--drivers/ata/ahci.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index da2e74fce2d9..aa58ce615e79 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -1642,6 +1642,18 @@ static int ahci_init_msi(struct pci_dev *pdev, unsigned int n_ports,
return pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_MSIX);
}
+static void ahci_mark_external_port(struct ata_port *ap)
+{
+ struct ahci_host_priv *hpriv = ap->host->private_data;
+ void __iomem *port_mmio = ahci_port_base(ap);
+ u32 tmp;
+
+ /* mark esata ports */
+ tmp = readl(port_mmio + PORT_CMD);
+ if ((tmp & PORT_CMD_ESP) && (hpriv->cap & HOST_CAP_SXS))
+ ap->pflags |= ATA_PFLAG_EXTERNAL;
+}
+
static void ahci_update_initial_lpm_policy(struct ata_port *ap,
struct ahci_host_priv *hpriv)
{
@@ -1934,6 +1946,8 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
if (ap->flags & ATA_FLAG_EM)
ap->em_message_type = hpriv->em_msg_type;
+ ahci_mark_external_port(ap);
+
ahci_update_initial_lpm_policy(ap, hpriv);
/* disabled/not-implemented port */