SATA AHCI: Blacklist system that spins off disks during ACPI power off

Some notebooks from HP have the problem that their BIOSes attempt to
spin down hard drives before entering ACPI system states S4 and S5.
This leads to a yo-yo effect during system power-off shutdown and the
last phase of hibernation when the disk is first spun down by the
kernel and then almost immediately turned on and off by the BIOS.
This, in turn, may result in shortening the disk's life times.

To prevent this from happening we can blacklist the affected systems
using DMI information.

Blacklist HP nx6310 that uses the AHCI driver.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>

authored by Rafael J. Wysocki and committed by Jeff Garzik 1fd68434 2a6e58d2

+32
+32
drivers/ata/ahci.c
··· 2548 2548 } 2549 2549 } 2550 2550 2551 + static bool ahci_broken_system_poweroff(struct pci_dev *pdev) 2552 + { 2553 + static const struct dmi_system_id broken_systems[] = { 2554 + { 2555 + .ident = "HP Compaq nx6310", 2556 + .matches = { 2557 + DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), 2558 + DMI_MATCH(DMI_PRODUCT_NAME, "HP Compaq nx6310"), 2559 + }, 2560 + /* PCI slot number of the controller */ 2561 + .driver_data = (void *)0x1FUL, 2562 + }, 2563 + 2564 + { } /* terminate list */ 2565 + }; 2566 + const struct dmi_system_id *dmi = dmi_first_match(broken_systems); 2567 + 2568 + if (dmi) { 2569 + unsigned long slot = (unsigned long)dmi->driver_data; 2570 + /* apply the quirk only to on-board controllers */ 2571 + return slot == PCI_SLOT(pdev->devfn); 2572 + } 2573 + 2574 + return false; 2575 + } 2576 + 2551 2577 static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) 2552 2578 { 2553 2579 static int printed_version; ··· 2671 2645 if (!(em_ctl & EM_CTL_ALHD)) 2672 2646 pi.flags |= ATA_FLAG_SW_ACTIVITY; 2673 2647 } 2648 + } 2649 + 2650 + if (ahci_broken_system_poweroff(pdev)) { 2651 + pi.flags |= ATA_FLAG_NO_POWEROFF_SPINDOWN; 2652 + dev_info(&pdev->dev, 2653 + "quirky BIOS, skipping spindown on poweroff\n"); 2674 2654 } 2675 2655 2676 2656 /* CAP.NP sometimes indicate the index of the last enabled