Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev

* 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev:
pata_hpt37x: Fix 2.6.22 clock PLL regression
pata_ali: Correct HP detect
ata_piix: fix suspend/resume for some TOSHIBA laptops
PCI: export __pci_reenable_device()

+123 -11
+111 -2
drivers/ata/ata_piix.c
··· 91 91 #include <linux/device.h> 92 92 #include <scsi/scsi_host.h> 93 93 #include <linux/libata.h> 94 + #include <linux/dmi.h> 94 95 95 96 #define DRV_NAME "ata_piix" 96 97 #define DRV_VERSION "2.11" ··· 141 140 RV = -3, /* reserved */ 142 141 143 142 PIIX_AHCI_DEVICE = 6, 143 + 144 + /* host->flags bits */ 145 + PIIX_HOST_BROKEN_SUSPEND = (1 << 24), 144 146 }; 145 147 146 148 struct piix_map_db { ··· 163 159 static void piix_set_dmamode (struct ata_port *ap, struct ata_device *adev); 164 160 static void ich_set_dmamode (struct ata_port *ap, struct ata_device *adev); 165 161 static int ich_pata_cable_detect(struct ata_port *ap); 162 + #ifdef CONFIG_PM 163 + static int piix_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg); 164 + static int piix_pci_device_resume(struct pci_dev *pdev); 165 + #endif 166 166 167 167 static unsigned int in_module_init = 1; 168 168 ··· 263 255 .probe = piix_init_one, 264 256 .remove = ata_pci_remove_one, 265 257 #ifdef CONFIG_PM 266 - .suspend = ata_pci_device_suspend, 267 - .resume = ata_pci_device_resume, 258 + .suspend = piix_pci_device_suspend, 259 + .resume = piix_pci_device_resume, 268 260 #endif 269 261 }; 270 262 ··· 888 880 { 889 881 do_pata_set_dmamode(ap, adev, 1); 890 882 } 883 + 884 + #ifdef CONFIG_PM 885 + static struct dmi_system_id piix_broken_suspend_dmi_table[] = { 886 + { 887 + .ident = "TECRA M5", 888 + .matches = { 889 + DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), 890 + DMI_MATCH(DMI_PRODUCT_NAME, "TECRA M5"), 891 + }, 892 + }, 893 + { 894 + .ident = "Satellite U200", 895 + .matches = { 896 + DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), 897 + DMI_MATCH(DMI_PRODUCT_NAME, "Satellite U200"), 898 + }, 899 + }, 900 + { 901 + .ident = "Satellite U205", 902 + .matches = { 903 + DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), 904 + DMI_MATCH(DMI_PRODUCT_NAME, "Satellite U205"), 905 + }, 906 + }, 907 + { 908 + .ident = "Portege M500", 909 + .matches = { 910 + DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), 911 + DMI_MATCH(DMI_PRODUCT_NAME, "PORTEGE M500"), 912 + }, 913 + }, 914 + { } 915 + }; 916 + 917 + static int piix_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg) 918 + { 919 + struct ata_host *host = dev_get_drvdata(&pdev->dev); 920 + unsigned long flags; 921 + int rc = 0; 922 + 923 + rc = ata_host_suspend(host, mesg); 924 + if (rc) 925 + return rc; 926 + 927 + /* Some braindamaged ACPI suspend implementations expect the 928 + * controller to be awake on entry; otherwise, it burns cpu 929 + * cycles and power trying to do something to the sleeping 930 + * beauty. 931 + */ 932 + if (dmi_check_system(piix_broken_suspend_dmi_table) && 933 + mesg.event == PM_EVENT_SUSPEND) { 934 + pci_save_state(pdev); 935 + 936 + /* mark its power state as "unknown", since we don't 937 + * know if e.g. the BIOS will change its device state 938 + * when we suspend. 939 + */ 940 + if (pdev->current_state == PCI_D0) 941 + pdev->current_state = PCI_UNKNOWN; 942 + 943 + /* tell resume that it's waking up from broken suspend */ 944 + spin_lock_irqsave(&host->lock, flags); 945 + host->flags |= PIIX_HOST_BROKEN_SUSPEND; 946 + spin_unlock_irqrestore(&host->lock, flags); 947 + } else 948 + ata_pci_device_do_suspend(pdev, mesg); 949 + 950 + return 0; 951 + } 952 + 953 + static int piix_pci_device_resume(struct pci_dev *pdev) 954 + { 955 + struct ata_host *host = dev_get_drvdata(&pdev->dev); 956 + unsigned long flags; 957 + int rc; 958 + 959 + if (host->flags & PIIX_HOST_BROKEN_SUSPEND) { 960 + spin_lock_irqsave(&host->lock, flags); 961 + host->flags &= ~PIIX_HOST_BROKEN_SUSPEND; 962 + spin_unlock_irqrestore(&host->lock, flags); 963 + 964 + pci_set_power_state(pdev, PCI_D0); 965 + pci_restore_state(pdev); 966 + 967 + /* PCI device wasn't disabled during suspend. Use 968 + * __pci_reenable_device() to avoid affecting the 969 + * enable count. 970 + */ 971 + rc = __pci_reenable_device(pdev); 972 + if (rc) 973 + dev_printk(KERN_ERR, &pdev->dev, "failed to enable " 974 + "device after resume (%d)\n", rc); 975 + } else 976 + rc = ata_pci_device_do_resume(pdev); 977 + 978 + if (rc == 0) 979 + ata_host_resume(host); 980 + 981 + return rc; 982 + } 983 + #endif 891 984 892 985 #define AHCI_PCI_BAR 5 893 986 #define AHCI_GLOBAL_CTL 0x04
+1 -1
drivers/ata/pata_ali.c
··· 45 45 .ident = "HP Pavilion N5430", 46 46 .matches = { 47 47 DMI_MATCH(DMI_BOARD_VENDOR, "Hewlett-Packard"), 48 - DMI_MATCH(DMI_BOARD_NAME, "OmniBook N32N-736"), 48 + DMI_MATCH(DMI_BOARD_VERSION, "OmniBook N32N-736"), 49 49 }, 50 50 }, 51 51 { }
+7 -7
drivers/ata/pata_hpt37x.c
··· 26 26 #include <linux/libata.h> 27 27 28 28 #define DRV_NAME "pata_hpt37x" 29 - #define DRV_VERSION "0.6.6" 29 + #define DRV_VERSION "0.6.7" 30 30 31 31 struct hpt_clock { 32 32 u8 xfer_speed; ··· 1103 1103 1104 1104 /* Select the DPLL clock. */ 1105 1105 pci_write_config_byte(dev, 0x5b, 0x21); 1106 - pci_write_config_dword(dev, 0x5C, (f_high << 16) | f_low); 1106 + pci_write_config_dword(dev, 0x5C, (f_high << 16) | f_low | 0x100); 1107 1107 1108 1108 for(adjust = 0; adjust < 8; adjust++) { 1109 1109 if (hpt37x_calibrate_dpll(dev)) 1110 1110 break; 1111 1111 /* See if it'll settle at a fractionally different clock */ 1112 - if ((adjust & 3) == 3) { 1113 - f_low --; 1114 - f_high ++; 1115 - } 1116 - pci_write_config_dword(dev, 0x5C, (f_high << 16) | f_low); 1112 + if (adjust & 1) 1113 + f_low -= adjust >> 1; 1114 + else 1115 + f_high += adjust >> 1; 1116 + pci_write_config_dword(dev, 0x5C, (f_high << 16) | f_low | 0x100); 1117 1117 } 1118 1118 if (adjust == 8) { 1119 1119 printk(KERN_WARNING "hpt37x: DPLL did not stabilize.\n");
+1
drivers/pci/pci.c
··· 1604 1604 device_initcall(pci_init); 1605 1605 1606 1606 EXPORT_SYMBOL_GPL(pci_restore_bars); 1607 + EXPORT_SYMBOL(__pci_reenable_device); 1607 1608 EXPORT_SYMBOL(pci_enable_device_bars); 1608 1609 EXPORT_SYMBOL(pci_enable_device); 1609 1610 EXPORT_SYMBOL(pcim_enable_device);
-1
drivers/pci/pci.h
··· 1 1 /* Functions internal to the PCI core code */ 2 2 3 - extern int __must_check __pci_reenable_device(struct pci_dev *); 4 3 extern int pci_uevent(struct device *dev, char **envp, int num_envp, 5 4 char *buffer, int buffer_size); 6 5 extern int pci_create_sysfs_dev_files(struct pci_dev *pdev);
+2
include/linux/libata.h
··· 216 216 ATA_HOST_SIMPLEX = (1 << 0), /* Host is simplex, one DMA channel per host only */ 217 217 ATA_HOST_STARTED = (1 << 1), /* Host started */ 218 218 219 + /* bits 24:31 of host->flags are reserved for LLD specific flags */ 220 + 219 221 /* various lengths of time */ 220 222 ATA_TMOUT_BOOT = 30 * HZ, /* heuristic */ 221 223 ATA_TMOUT_BOOT_QUICK = 7 * HZ, /* heuristic */
+1
include/linux/pci.h
··· 534 534 535 535 int __must_check pci_enable_device(struct pci_dev *dev); 536 536 int __must_check pci_enable_device_bars(struct pci_dev *dev, int mask); 537 + int __must_check __pci_reenable_device(struct pci_dev *); 537 538 int __must_check pcim_enable_device(struct pci_dev *pdev); 538 539 void pcim_pin_device(struct pci_dev *pdev); 539 540