diff options
author | Kristen Carlson Accardi <kristen.c.accardi@intel.com> | 2006-07-12 11:59:00 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-07-12 19:05:48 -0400 |
commit | ffadcc2ff42ecedf71ea67d9051ff028927aed08 (patch) | |
tree | 540351be72173f69c552c05dfeffd0804ca0bd6b /drivers | |
parent | 6f0312fd7e0e6f96fd847b0b2e1e0d2d2e8ef89d (diff) |
[PATCH] PCI: PCIE power management quirk
When changing power states from D0->DX and then from DX->D0, some
Intel PCIE chipsets will cause a device reset to occur. This will
cause problems for any D State other than D3, since any state
information that the driver will expect to be present coming from
a D1 or D2 state will have been cleared. This patch addes a
flag to the pci_dev structure to indicate that devices should
not use states D1 or D2, and will set that flag for the affected
chipsets. This patch also modifies pci_set_power_state() so that
when a device driver tries to set the power state on
a device that is downstream from an affected chipset, or on one
of the affected devices it only allows state changes to or
from D0 & D3. In addition, this patch allows the delay time
between D3->D0 to be changed via a quirk. These chipsets also
need additional time to change states beyond the normal 10ms.
Signed-off-by: Kristen Carlson Accardi <kristen.c.accardi@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/pci/pci.c | 11 | ||||
-rw-r--r-- | drivers/pci/pci.h | 10 | ||||
-rw-r--r-- | drivers/pci/quirks.c | 31 |
3 files changed, 50 insertions, 2 deletions
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index cf57d7de3765..9f79dd6d51ab 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <asm/dma.h> /* isa_dma_bridge_buggy */ | 19 | #include <asm/dma.h> /* isa_dma_bridge_buggy */ |
20 | #include "pci.h" | 20 | #include "pci.h" |
21 | 21 | ||
22 | unsigned int pci_pm_d3_delay = 10; | ||
22 | 23 | ||
23 | /** | 24 | /** |
24 | * pci_bus_max_busnr - returns maximum PCI bus number of given bus' children | 25 | * pci_bus_max_busnr - returns maximum PCI bus number of given bus' children |
@@ -313,6 +314,14 @@ pci_set_power_state(struct pci_dev *dev, pci_power_t state) | |||
313 | } else if (dev->current_state == state) | 314 | } else if (dev->current_state == state) |
314 | return 0; /* we're already there */ | 315 | return 0; /* we're already there */ |
315 | 316 | ||
317 | /* | ||
318 | * If the device or the parent bridge can't support PCI PM, ignore | ||
319 | * the request if we're doing anything besides putting it into D0 | ||
320 | * (which would only happen on boot). | ||
321 | */ | ||
322 | if ((state == PCI_D1 || state == PCI_D2) && pci_no_d1d2(dev)) | ||
323 | return 0; | ||
324 | |||
316 | /* find PCI PM capability in list */ | 325 | /* find PCI PM capability in list */ |
317 | pm = pci_find_capability(dev, PCI_CAP_ID_PM); | 326 | pm = pci_find_capability(dev, PCI_CAP_ID_PM); |
318 | 327 | ||
@@ -363,7 +372,7 @@ pci_set_power_state(struct pci_dev *dev, pci_power_t state) | |||
363 | /* Mandatory power management transition delays */ | 372 | /* Mandatory power management transition delays */ |
364 | /* see PCI PM 1.1 5.6.1 table 18 */ | 373 | /* see PCI PM 1.1 5.6.1 table 18 */ |
365 | if (state == PCI_D3hot || dev->current_state == PCI_D3hot) | 374 | if (state == PCI_D3hot || dev->current_state == PCI_D3hot) |
366 | msleep(10); | 375 | msleep(pci_pm_d3_delay); |
367 | else if (state == PCI_D2 || dev->current_state == PCI_D2) | 376 | else if (state == PCI_D2 || dev->current_state == PCI_D2) |
368 | udelay(200); | 377 | udelay(200); |
369 | 378 | ||
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h index 9cc842b666eb..08d58fc78ee1 100644 --- a/drivers/pci/pci.h +++ b/drivers/pci/pci.h | |||
@@ -47,7 +47,7 @@ extern int pci_msi_quirk; | |||
47 | #else | 47 | #else |
48 | #define pci_msi_quirk 0 | 48 | #define pci_msi_quirk 0 |
49 | #endif | 49 | #endif |
50 | 50 | extern unsigned int pci_pm_d3_delay; | |
51 | #ifdef CONFIG_PCI_MSI | 51 | #ifdef CONFIG_PCI_MSI |
52 | void disable_msi_mode(struct pci_dev *dev, int pos, int type); | 52 | void disable_msi_mode(struct pci_dev *dev, int pos, int type); |
53 | void pci_no_msi(void); | 53 | void pci_no_msi(void); |
@@ -66,7 +66,15 @@ static inline int pci_save_msix_state(struct pci_dev *dev) { return 0; } | |||
66 | static inline void pci_restore_msi_state(struct pci_dev *dev) {} | 66 | static inline void pci_restore_msi_state(struct pci_dev *dev) {} |
67 | static inline void pci_restore_msix_state(struct pci_dev *dev) {} | 67 | static inline void pci_restore_msix_state(struct pci_dev *dev) {} |
68 | #endif | 68 | #endif |
69 | static inline int pci_no_d1d2(struct pci_dev *dev) | ||
70 | { | ||
71 | unsigned int parent_dstates = 0; | ||
69 | 72 | ||
73 | if (dev->bus->self) | ||
74 | parent_dstates = dev->bus->self->no_d1d2; | ||
75 | return (dev->no_d1d2 || parent_dstates); | ||
76 | |||
77 | } | ||
70 | extern int pcie_mch_quirk; | 78 | extern int pcie_mch_quirk; |
71 | extern struct device_attribute pci_dev_attrs[]; | 79 | extern struct device_attribute pci_dev_attrs[]; |
72 | extern struct class_device_attribute class_device_attr_cpuaffinity; | 80 | extern struct class_device_attribute class_device_attr_cpuaffinity; |
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 53a887e1014c..e3c78c39b7e4 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c | |||
@@ -1418,6 +1418,37 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_PXH_0, quirk_pc | |||
1418 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_PXH_1, quirk_pcie_pxh); | 1418 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_PXH_1, quirk_pcie_pxh); |
1419 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_PXHV, quirk_pcie_pxh); | 1419 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_PXHV, quirk_pcie_pxh); |
1420 | 1420 | ||
1421 | /* | ||
1422 | * Some Intel PCI Express chipsets have trouble with downstream | ||
1423 | * device power management. | ||
1424 | */ | ||
1425 | static void quirk_intel_pcie_pm(struct pci_dev * dev) | ||
1426 | { | ||
1427 | pci_pm_d3_delay = 120; | ||
1428 | dev->no_d1d2 = 1; | ||
1429 | } | ||
1430 | |||
1431 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x25e2, quirk_intel_pcie_pm); | ||
1432 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x25e3, quirk_intel_pcie_pm); | ||
1433 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x25e4, quirk_intel_pcie_pm); | ||
1434 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x25e5, quirk_intel_pcie_pm); | ||
1435 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x25e6, quirk_intel_pcie_pm); | ||
1436 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x25e7, quirk_intel_pcie_pm); | ||
1437 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x25f7, quirk_intel_pcie_pm); | ||
1438 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x25f8, quirk_intel_pcie_pm); | ||
1439 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x25f9, quirk_intel_pcie_pm); | ||
1440 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x25fa, quirk_intel_pcie_pm); | ||
1441 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x2601, quirk_intel_pcie_pm); | ||
1442 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x2602, quirk_intel_pcie_pm); | ||
1443 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x2603, quirk_intel_pcie_pm); | ||
1444 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x2604, quirk_intel_pcie_pm); | ||
1445 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x2605, quirk_intel_pcie_pm); | ||
1446 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x2606, quirk_intel_pcie_pm); | ||
1447 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x2607, quirk_intel_pcie_pm); | ||
1448 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x2608, quirk_intel_pcie_pm); | ||
1449 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x2609, quirk_intel_pcie_pm); | ||
1450 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x260a, quirk_intel_pcie_pm); | ||
1451 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x260b, quirk_intel_pcie_pm); | ||
1421 | 1452 | ||
1422 | /* | 1453 | /* |
1423 | * Fixup the cardbus bridges on the IBM Dock II docking station | 1454 | * Fixup the cardbus bridges on the IBM Dock II docking station |