From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755136AbYI2WRn (ORCPT ); Mon, 29 Sep 2008 18:17:43 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752566AbYI2WPu (ORCPT ); Mon, 29 Sep 2008 18:15:50 -0400 Received: from ogre.sisk.pl ([217.79.144.158]:48225 "EHLO ogre.sisk.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752446AbYI2WPc (ORCPT ); Mon, 29 Sep 2008 18:15:32 -0400 From: "Rafael J. Wysocki" To: Jeff Garzik Subject: [PATCH 6/6] SATA PIIX: Blacklist system that spins off disks during ACPI power off Date: Tue, 30 Sep 2008 00:18:18 +0200 User-Agent: KMail/1.9.9 Cc: Tejun Heo , ACPI Devel Maling List , linux-ide@vger.kernel.org, Thomas Renninger , Robert Hancock , LKML , Frans Pop , Maciej Rutecki , Andrew Morton References: <200808290002.55026.rjw@sisk.pl> <48D17BBE.5020807@garzik.org> <200809300006.24919.rjw@sisk.pl> In-Reply-To: <200809300006.24919.rjw@sisk.pl> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-2" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200809300018.19813.rjw@sisk.pl> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Rafael J. Wysocki SATA PIIX: 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 2510p that uses the ata_piix driver. Signed-off-by: Rafael J. Wysocki --- drivers/ata/ata_piix.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) Index: linux-2.6/drivers/ata/ata_piix.c =================================================================== --- linux-2.6.orig/drivers/ata/ata_piix.c +++ linux-2.6/drivers/ata/ata_piix.c @@ -1449,6 +1449,32 @@ static void piix_iocfg_bit18_quirk(struc } } +static bool piix_broken_system_poweroff(struct pci_dev *pdev) +{ + static const struct dmi_system_id broken_systems[] = { + { + .ident = "HP Compaq 2510p", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), + DMI_MATCH(DMI_PRODUCT_NAME, "HP Compaq 2510p"), + }, + /* PCI slot number of the controller */ + .driver_data = (void *)0x1FUL, + }, + + { } /* terminate list */ + }; + const struct dmi_system_id *dmi = dmi_first_match(broken_systems); + + if (dmi) { + unsigned long slot = (unsigned long)dmi->driver_data; + /* apply the quirk only to on-board controllers */ + return slot == PCI_SLOT(pdev->devfn); + } + + return false; +} + /** * piix_init_one - Register PIIX ATA PCI device with kernel services * @pdev: PCI device to register @@ -1484,6 +1510,14 @@ static int __devinit piix_init_one(struc if (!in_module_init) return -ENODEV; + if (piix_broken_system_poweroff(pdev)) { + piix_port_info[ent->driver_data].flags |= + ATA_FLAG_NO_POWEROFF_SPINDOWN | + ATA_FLAG_NO_HIBERNATE_SPINDOWN; + dev_info(&pdev->dev, "quirky BIOS, skipping spindown " + "on poweroff and hibernation\n"); + } + port_info[0] = piix_port_info[ent->driver_data]; port_info[1] = piix_port_info[ent->driver_data];