Commit f7131935 authored by Niklas Cassel's avatar Niklas Cassel

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: default avatarDamien Le Moal <dlemoal@kernel.org>
Tested-by: default avatarJian-Hong Pan <jhp@endlessos.org>
Reviewed-by: default avatarDamien Le Moal <dlemoal@kernel.org>
Reviewed-by: default avatarMario Limonciello <mario.limonciello@amd.com>
Reviewed-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: default avatarNiklas Cassel <cassel@kernel.org>
parent 7f7f2b76
...@@ -1642,6 +1642,18 @@ static int ahci_init_msi(struct pci_dev *pdev, unsigned int n_ports, ...@@ -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); 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, static void ahci_update_initial_lpm_policy(struct ata_port *ap,
struct ahci_host_priv *hpriv) struct ahci_host_priv *hpriv)
{ {
...@@ -1934,6 +1946,8 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -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) if (ap->flags & ATA_FLAG_EM)
ap->em_message_type = hpriv->em_msg_type; ap->em_message_type = hpriv->em_msg_type;
ahci_mark_external_port(ap);
ahci_update_initial_lpm_policy(ap, hpriv); ahci_update_initial_lpm_policy(ap, hpriv);
/* disabled/not-implemented port */ /* disabled/not-implemented port */
......
...@@ -1280,10 +1280,8 @@ static void ahci_port_init(struct device *dev, struct ata_port *ap, ...@@ -1280,10 +1280,8 @@ static void ahci_port_init(struct device *dev, struct ata_port *ap,
int port_no, void __iomem *mmio, int port_no, void __iomem *mmio,
void __iomem *port_mmio) void __iomem *port_mmio)
{ {
struct ahci_host_priv *hpriv = ap->host->private_data;
const char *emsg = NULL; const char *emsg = NULL;
int rc; int rc;
u32 tmp;
/* make sure port is not active */ /* make sure port is not active */
rc = ahci_deinit_port(ap, &emsg); rc = ahci_deinit_port(ap, &emsg);
...@@ -1291,11 +1289,6 @@ static void ahci_port_init(struct device *dev, struct ata_port *ap, ...@@ -1291,11 +1289,6 @@ static void ahci_port_init(struct device *dev, struct ata_port *ap,
dev_warn(dev, "%s (%d)\n", emsg, rc); dev_warn(dev, "%s (%d)\n", emsg, rc);
ahci_port_clear_pending_irq(ap); ahci_port_clear_pending_irq(ap);
/* mark esata ports */
tmp = readl(port_mmio + PORT_CMD);
if ((tmp & PORT_CMD_ESP) && (hpriv->cap & HOST_CAP_SXS))
ap->pflags |= ATA_PFLAG_EXTERNAL;
} }
void ahci_init_controller(struct ata_host *host) void ahci_init_controller(struct ata_host *host)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment