Skip to content

Commit f713193

Browse files
committed
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 <[email protected]> Tested-by: Jian-Hong Pan <[email protected]> Reviewed-by: Damien Le Moal <[email protected]> Reviewed-by: Mario Limonciello <[email protected]> Reviewed-by: Mika Westerberg <[email protected]> Signed-off-by: Niklas Cassel <[email protected]>
1 parent 7f7f2b7 commit f713193

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

drivers/ata/ahci.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1642,6 +1642,18 @@ static int ahci_init_msi(struct pci_dev *pdev, unsigned int n_ports,
16421642
return pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_MSIX);
16431643
}
16441644

1645+
static void ahci_mark_external_port(struct ata_port *ap)
1646+
{
1647+
struct ahci_host_priv *hpriv = ap->host->private_data;
1648+
void __iomem *port_mmio = ahci_port_base(ap);
1649+
u32 tmp;
1650+
1651+
/* mark esata ports */
1652+
tmp = readl(port_mmio + PORT_CMD);
1653+
if ((tmp & PORT_CMD_ESP) && (hpriv->cap & HOST_CAP_SXS))
1654+
ap->pflags |= ATA_PFLAG_EXTERNAL;
1655+
}
1656+
16451657
static void ahci_update_initial_lpm_policy(struct ata_port *ap,
16461658
struct ahci_host_priv *hpriv)
16471659
{
@@ -1934,6 +1946,8 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
19341946
if (ap->flags & ATA_FLAG_EM)
19351947
ap->em_message_type = hpriv->em_msg_type;
19361948

1949+
ahci_mark_external_port(ap);
1950+
19371951
ahci_update_initial_lpm_policy(ap, hpriv);
19381952

19391953
/* disabled/not-implemented port */

drivers/ata/libahci.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1280,22 +1280,15 @@ static void ahci_port_init(struct device *dev, struct ata_port *ap,
12801280
int port_no, void __iomem *mmio,
12811281
void __iomem *port_mmio)
12821282
{
1283-
struct ahci_host_priv *hpriv = ap->host->private_data;
12841283
const char *emsg = NULL;
12851284
int rc;
1286-
u32 tmp;
12871285

12881286
/* make sure port is not active */
12891287
rc = ahci_deinit_port(ap, &emsg);
12901288
if (rc)
12911289
dev_warn(dev, "%s (%d)\n", emsg, rc);
12921290

12931291
ahci_port_clear_pending_irq(ap);
1294-
1295-
/* mark esata ports */
1296-
tmp = readl(port_mmio + PORT_CMD);
1297-
if ((tmp & PORT_CMD_ESP) && (hpriv->cap & HOST_CAP_SXS))
1298-
ap->pflags |= ATA_PFLAG_EXTERNAL;
12991292
}
13001293

13011294
void ahci_init_controller(struct ata_host *host)

0 commit comments

Comments
 (0)