Skip to content

Commit 5a3b583

Browse files
committed
Merge tag 'ata-6.16-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/libata/linux
Pull ata fixes from Niklas Cassel: - Force PIO for ATAPI devices on VT6415/VT6330 as the controller locks up on ATAPI DMA (Tasos) - Fix ACPI PATA cable type detection such that the controller is not forced down to a slow transfer mode (Tasos) - Fix build error on 32-bit UML (Johannes) - Fix a PCI region leak in the pata_macio driver so that the driver no longer fails to load after rmmod (Philipp) - Use correct DMI BIOS build date for ThinkPad W541 quirk (me) - Disallow LPM for ASUSPRO-D840SA motherboard as this board interestingly enough gets graphical corruptions on the iGPU when LPM is enabled (me) - Disallow LPM for Asus B550-F motherboard as this board will get command timeouts on ports 5 and 6, yet LPM with the same drive works fine on all other ports (Mikko) * tag 'ata-6.16-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/libata/linux: ata: ahci: Disallow LPM for Asus B550-F motherboard ata: ahci: Disallow LPM for ASUSPRO-D840SA motherboard ata: ahci: Use correct BIOS build date for ThinkPad W541 quirk ata: pata_macio: Fix PCI region leak ata: pata_cs5536: fix build on 32-bit UML ata: libata-acpi: Do not assume 40 wire cable if no devices are enabled ata: pata_via: Force PIO for ATAPI devices on VT6415/VT6330
2 parents 52da431 + a7b3b77 commit 5a3b583

File tree

6 files changed

+58
-25
lines changed

6 files changed

+58
-25
lines changed

drivers/ata/ahci.c

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1410,8 +1410,15 @@ static bool ahci_broken_suspend(struct pci_dev *pdev)
14101410

14111411
static bool ahci_broken_lpm(struct pci_dev *pdev)
14121412
{
1413+
/*
1414+
* Platforms with LPM problems.
1415+
* If driver_data is NULL, there is no existing BIOS version with
1416+
* functioning LPM.
1417+
* If driver_data is non-NULL, then driver_data contains the DMI BIOS
1418+
* build date of the first BIOS version with functioning LPM (i.e. older
1419+
* BIOS versions have broken LPM).
1420+
*/
14131421
static const struct dmi_system_id sysids[] = {
1414-
/* Various Lenovo 50 series have LPM issues with older BIOSen */
14151422
{
14161423
.matches = {
14171424
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
@@ -1438,13 +1445,30 @@ static bool ahci_broken_lpm(struct pci_dev *pdev)
14381445
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
14391446
DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad W541"),
14401447
},
1448+
.driver_data = "20180409", /* 2.35 */
1449+
},
1450+
{
1451+
.matches = {
1452+
DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
1453+
DMI_MATCH(DMI_PRODUCT_VERSION, "ASUSPRO D840MB_M840SA"),
1454+
},
1455+
/* 320 is broken, there is no known good version. */
1456+
},
1457+
{
14411458
/*
1442-
* Note date based on release notes, 2.35 has been
1443-
* reported to be good, but I've been unable to get
1444-
* a hold of the reporter to get the DMI BIOS date.
1445-
* TODO: fix this.
1459+
* AMD 500 Series Chipset SATA Controller [1022:43eb]
1460+
* on this motherboard timeouts on ports 5 and 6 when
1461+
* LPM is enabled, at least with WDC WD20EFAX-68FB5N0
1462+
* hard drives. LPM with the same drive works fine on
1463+
* all other ports on the same controller.
14461464
*/
1447-
.driver_data = "20180310", /* 2.35 */
1465+
.matches = {
1466+
DMI_MATCH(DMI_BOARD_VENDOR,
1467+
"ASUSTeK COMPUTER INC."),
1468+
DMI_MATCH(DMI_BOARD_NAME,
1469+
"ROG STRIX B550-F GAMING (WI-FI)"),
1470+
},
1471+
/* 3621 is broken, there is no known good version. */
14481472
},
14491473
{ } /* terminate list */
14501474
};
@@ -1455,6 +1479,9 @@ static bool ahci_broken_lpm(struct pci_dev *pdev)
14551479
if (!dmi)
14561480
return false;
14571481

1482+
if (!dmi->driver_data)
1483+
return true;
1484+
14581485
dmi_get_date(DMI_BIOS_DATE, &year, &month, &date);
14591486
snprintf(buf, sizeof(buf), "%04d%02d%02d", year, month, date);
14601487

drivers/ata/libata-acpi.c

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -514,29 +514,37 @@ unsigned int ata_acpi_gtm_xfermask(struct ata_device *dev,
514514
EXPORT_SYMBOL_GPL(ata_acpi_gtm_xfermask);
515515

516516
/**
517-
* ata_acpi_cbl_80wire - Check for 80 wire cable
517+
* ata_acpi_cbl_pata_type - Return PATA cable type
518518
* @ap: Port to check
519-
* @gtm: GTM data to use
520519
*
521-
* Return 1 if the @gtm indicates the BIOS selected an 80wire mode.
520+
* Return ATA_CBL_PATA* according to the transfer mode selected by BIOS
522521
*/
523-
int ata_acpi_cbl_80wire(struct ata_port *ap, const struct ata_acpi_gtm *gtm)
522+
int ata_acpi_cbl_pata_type(struct ata_port *ap)
524523
{
525524
struct ata_device *dev;
525+
int ret = ATA_CBL_PATA_UNK;
526+
const struct ata_acpi_gtm *gtm = ata_acpi_init_gtm(ap);
527+
528+
if (!gtm)
529+
return ATA_CBL_PATA40;
526530

527531
ata_for_each_dev(dev, &ap->link, ENABLED) {
528532
unsigned int xfer_mask, udma_mask;
529533

530534
xfer_mask = ata_acpi_gtm_xfermask(dev, gtm);
531535
ata_unpack_xfermask(xfer_mask, NULL, NULL, &udma_mask);
532536

533-
if (udma_mask & ~ATA_UDMA_MASK_40C)
534-
return 1;
537+
ret = ATA_CBL_PATA40;
538+
539+
if (udma_mask & ~ATA_UDMA_MASK_40C) {
540+
ret = ATA_CBL_PATA80;
541+
break;
542+
}
535543
}
536544

537-
return 0;
545+
return ret;
538546
}
539-
EXPORT_SYMBOL_GPL(ata_acpi_cbl_80wire);
547+
EXPORT_SYMBOL_GPL(ata_acpi_cbl_pata_type);
540548

541549
static void ata_acpi_gtf_to_tf(struct ata_device *dev,
542550
const struct ata_acpi_gtf *gtf,

drivers/ata/pata_cs5536.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#include <scsi/scsi_host.h>
2828
#include <linux/dmi.h>
2929

30-
#ifdef CONFIG_X86_32
30+
#if defined(CONFIG_X86) && defined(CONFIG_X86_32)
3131
#include <asm/msr.h>
3232
static int use_msr;
3333
module_param_named(msr, use_msr, int, 0644);

drivers/ata/pata_macio.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1298,7 +1298,7 @@ static int pata_macio_pci_attach(struct pci_dev *pdev,
12981298
priv->dev = &pdev->dev;
12991299

13001300
/* Get MMIO regions */
1301-
if (pci_request_regions(pdev, "pata-macio")) {
1301+
if (pcim_request_all_regions(pdev, "pata-macio")) {
13021302
dev_err(&pdev->dev,
13031303
"Cannot obtain PCI resources\n");
13041304
return -EBUSY;

drivers/ata/pata_via.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -201,11 +201,9 @@ static int via_cable_detect(struct ata_port *ap) {
201201
two drives */
202202
if (ata66 & (0x10100000 >> (16 * ap->port_no)))
203203
return ATA_CBL_PATA80;
204+
204205
/* Check with ACPI so we can spot BIOS reported SATA bridges */
205-
if (ata_acpi_init_gtm(ap) &&
206-
ata_acpi_cbl_80wire(ap, ata_acpi_init_gtm(ap)))
207-
return ATA_CBL_PATA80;
208-
return ATA_CBL_PATA40;
206+
return ata_acpi_cbl_pata_type(ap);
209207
}
210208

211209
static int via_pre_reset(struct ata_link *link, unsigned long deadline)
@@ -368,7 +366,8 @@ static unsigned int via_mode_filter(struct ata_device *dev, unsigned int mask)
368366
}
369367

370368
if (dev->class == ATA_DEV_ATAPI &&
371-
dmi_check_system(no_atapi_dma_dmi_table)) {
369+
(dmi_check_system(no_atapi_dma_dmi_table) ||
370+
config->id == PCI_DEVICE_ID_VIA_6415)) {
372371
ata_dev_warn(dev, "controller locks up on ATAPI DMA, forcing PIO\n");
373372
mask &= ATA_MASK_PIO;
374373
}

include/linux/libata.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1352,7 +1352,7 @@ int ata_acpi_stm(struct ata_port *ap, const struct ata_acpi_gtm *stm);
13521352
int ata_acpi_gtm(struct ata_port *ap, struct ata_acpi_gtm *stm);
13531353
unsigned int ata_acpi_gtm_xfermask(struct ata_device *dev,
13541354
const struct ata_acpi_gtm *gtm);
1355-
int ata_acpi_cbl_80wire(struct ata_port *ap, const struct ata_acpi_gtm *gtm);
1355+
int ata_acpi_cbl_pata_type(struct ata_port *ap);
13561356
#else
13571357
static inline const struct ata_acpi_gtm *ata_acpi_init_gtm(struct ata_port *ap)
13581358
{
@@ -1377,10 +1377,9 @@ static inline unsigned int ata_acpi_gtm_xfermask(struct ata_device *dev,
13771377
return 0;
13781378
}
13791379

1380-
static inline int ata_acpi_cbl_80wire(struct ata_port *ap,
1381-
const struct ata_acpi_gtm *gtm)
1380+
static inline int ata_acpi_cbl_pata_type(struct ata_port *ap)
13821381
{
1383-
return 0;
1382+
return ATA_CBL_PATA40;
13841383
}
13851384
#endif
13861385

0 commit comments

Comments
 (0)