mirror of
https://github.com/torvalds/linux.git
synced 2026-03-08 01:04:41 +01:00
ata: ahci: Do not read the per port area for unimplemented ports
An AHCI HBA specifies the number of ports it supports using CAP.NP.
The HBA is free to only make a subset of the number of ports available
using the PI (Ports Implemented) register.
libata currently creates dummy ports for HBA ports that are provided by
the HBA, but which are marked as "unavailable" using the PI register.
Each port will have a per port area of registers in the HBA, regardless
if the port is marked as "unavailable" or not.
ahci_mark_external_port() currently reads this per port area of registers
using readl() to see if the port is marked as external/hotplug-capable.
However, AHCI 1.3.1, section "3.1.4 Offset 0Ch: PI – Ports Implemented"
states: "Software must not read or write to registers within unavailable
ports."
Thus, make sure that we only call ahci_mark_external_port() and
ahci_update_initial_lpm_policy() for ports that are implemented.
From a libata perspective, this should not change anything related to LPM,
as dummy ports do not provide any ap->ops (they do not have a .set_lpm()
callback), so even if EH were to call .set_lpm() on a dummy port, it was
already a no-op.
Fixes: f713193523 ("ata: ahci: move marking of external port earlier")
Signed-off-by: Niklas Cassel <cassel@kernel.org>
Tested-by: Wolf <wolf@yoxt.cc>
Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
This commit is contained in:
parent
0f61b1860c
commit
ea4d4ea6d1
1 changed files with 5 additions and 5 deletions
|
|
@ -2094,13 +2094,13 @@ 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);
|
||||
|
||||
/* disabled/not-implemented port */
|
||||
if (!(hpriv->port_map & (1 << i)))
|
||||
if (!(hpriv->port_map & (1 << i))) {
|
||||
ap->ops = &ata_dummy_port_ops;
|
||||
} else {
|
||||
ahci_mark_external_port(ap);
|
||||
ahci_update_initial_lpm_policy(ap);
|
||||
}
|
||||
}
|
||||
|
||||
/* apply workaround for ASUS P5W DH Deluxe mainboard */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue