Skip to content

Commit a90af8f

Browse files
committed
Merge tag 'libata-5.16-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/dlemoal/libata
Pull libata fixes from Damien Le Moal: - Prevent accesses to unsupported log pages as that causes device scan failures with LLDDs using libsas (from me). - A couple of fixes for AMD AHCI adapters handling of low power modes and resume (from Mario). - Fix a compilation warning (from me). * tag 'libata-5.16-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/dlemoal/libata: ata: libata-sata: Declare ata_ncq_sdev_attrs static ata: libahci: Adjust behavior when StorageD3Enable _DSD is set ata: ahci: Add Green Sardine vendor ID as board_ahci_mobile ata: libata: add missing ata_identify_page_supported() calls ata: libata: improve ata_read_log_page() error message
2 parents e4365e3 + cac7e8b commit a90af8f

File tree

4 files changed

+25
-4
lines changed

4 files changed

+25
-4
lines changed

drivers/ata/ahci.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,7 @@ static const struct pci_device_id ahci_pci_tbl[] = {
438438
/* AMD */
439439
{ PCI_VDEVICE(AMD, 0x7800), board_ahci }, /* AMD Hudson-2 */
440440
{ PCI_VDEVICE(AMD, 0x7900), board_ahci }, /* AMD CZ */
441+
{ PCI_VDEVICE(AMD, 0x7901), board_ahci_mobile }, /* AMD Green Sardine */
441442
/* AMD is using RAID class only for ahci controllers */
442443
{ PCI_VENDOR_ID_AMD, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
443444
PCI_CLASS_STORAGE_RAID << 8, 0xffffff, board_ahci },

drivers/ata/libahci.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2323,6 +2323,18 @@ int ahci_port_resume(struct ata_port *ap)
23232323
EXPORT_SYMBOL_GPL(ahci_port_resume);
23242324

23252325
#ifdef CONFIG_PM
2326+
static void ahci_handle_s2idle(struct ata_port *ap)
2327+
{
2328+
void __iomem *port_mmio = ahci_port_base(ap);
2329+
u32 devslp;
2330+
2331+
if (pm_suspend_via_firmware())
2332+
return;
2333+
devslp = readl(port_mmio + PORT_DEVSLP);
2334+
if ((devslp & PORT_DEVSLP_ADSE))
2335+
ata_msleep(ap, devslp_idle_timeout);
2336+
}
2337+
23262338
static int ahci_port_suspend(struct ata_port *ap, pm_message_t mesg)
23272339
{
23282340
const char *emsg = NULL;
@@ -2336,6 +2348,9 @@ static int ahci_port_suspend(struct ata_port *ap, pm_message_t mesg)
23362348
ata_port_freeze(ap);
23372349
}
23382350

2351+
if (acpi_storage_d3(ap->host->dev))
2352+
ahci_handle_s2idle(ap);
2353+
23392354
ahci_rpm_put_port(ap);
23402355
return rc;
23412356
}

drivers/ata/libata-core.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2031,8 +2031,9 @@ unsigned int ata_read_log_page(struct ata_device *dev, u8 log,
20312031
dev->horkage |= ATA_HORKAGE_NO_DMA_LOG;
20322032
goto retry;
20332033
}
2034-
ata_dev_err(dev, "Read log page 0x%02x failed, Emask 0x%x\n",
2035-
(unsigned int)page, err_mask);
2034+
ata_dev_err(dev,
2035+
"Read log 0x%02x page 0x%02x failed, Emask 0x%x\n",
2036+
(unsigned int)log, (unsigned int)page, err_mask);
20362037
}
20372038

20382039
return err_mask;
@@ -2177,6 +2178,9 @@ static void ata_dev_config_ncq_prio(struct ata_device *dev)
21772178
struct ata_port *ap = dev->link->ap;
21782179
unsigned int err_mask;
21792180

2181+
if (!ata_identify_page_supported(dev, ATA_LOG_SATA_SETTINGS))
2182+
return;
2183+
21802184
err_mask = ata_read_log_page(dev,
21812185
ATA_LOG_IDENTIFY_DEVICE,
21822186
ATA_LOG_SATA_SETTINGS,
@@ -2453,7 +2457,8 @@ static void ata_dev_config_devslp(struct ata_device *dev)
24532457
* Check device sleep capability. Get DevSlp timing variables
24542458
* from SATA Settings page of Identify Device Data Log.
24552459
*/
2456-
if (!ata_id_has_devslp(dev->id))
2460+
if (!ata_id_has_devslp(dev->id) ||
2461+
!ata_identify_page_supported(dev, ATA_LOG_SATA_SETTINGS))
24572462
return;
24582463

24592464
err_mask = ata_read_log_page(dev,

drivers/ata/libata-sata.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -922,7 +922,7 @@ DEVICE_ATTR(ncq_prio_enable, S_IRUGO | S_IWUSR,
922922
ata_ncq_prio_enable_show, ata_ncq_prio_enable_store);
923923
EXPORT_SYMBOL_GPL(dev_attr_ncq_prio_enable);
924924

925-
struct attribute *ata_ncq_sdev_attrs[] = {
925+
static struct attribute *ata_ncq_sdev_attrs[] = {
926926
&dev_attr_unload_heads.attr,
927927
&dev_attr_ncq_prio_enable.attr,
928928
&dev_attr_ncq_prio_supported.attr,

0 commit comments

Comments
 (0)