diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-04-27 14:59:46 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-04-27 14:59:46 -0400 |
| commit | 3fb8e49200064adcc00c327bf61942b42978d7b0 (patch) | |
| tree | c1384aa414c0867e3a9b9b5e709dc1b7738bf22e /drivers/pci/pci.c | |
| parent | 4ebf66233798347a73b01da5d30d5d2c0ef39f56 (diff) | |
| parent | 1b6b8ce2ac372ea1f2065b89228ede105eb68dc5 (diff) | |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6:
PCI: only save/restore existent registers in the PCIe capability
x86/PCI: don't bother with root quirks if _CRS is used
docbooks: add/fix PCI kernel-doc
PCI: cleanup debug output resources
x86/PCI: set_pci_bus_resources_arch_default cleanups
x86/PCI: Move set_pci_bus_resources_arch_default into arch/x86
x86/PCI: don't call e820_all_mapped with -1 in the mmconfig case
PCI quirk: disable MSI on VIA VT3364 chipsets
Diffstat (limited to 'drivers/pci/pci.c')
| -rw-r--r-- | drivers/pci/pci.c | 70 |
1 files changed, 56 insertions, 14 deletions
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 16fd0d4c3166..34bf0fdf5047 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
| @@ -681,11 +681,34 @@ EXPORT_SYMBOL(pci_choose_state); | |||
| 681 | 681 | ||
| 682 | #define PCI_EXP_SAVE_REGS 7 | 682 | #define PCI_EXP_SAVE_REGS 7 |
| 683 | 683 | ||
| 684 | #define pcie_cap_has_devctl(type, flags) 1 | ||
| 685 | #define pcie_cap_has_lnkctl(type, flags) \ | ||
| 686 | ((flags & PCI_EXP_FLAGS_VERS) > 1 || \ | ||
| 687 | (type == PCI_EXP_TYPE_ROOT_PORT || \ | ||
| 688 | type == PCI_EXP_TYPE_ENDPOINT || \ | ||
| 689 | type == PCI_EXP_TYPE_LEG_END)) | ||
| 690 | #define pcie_cap_has_sltctl(type, flags) \ | ||
| 691 | ((flags & PCI_EXP_FLAGS_VERS) > 1 || \ | ||
| 692 | ((type == PCI_EXP_TYPE_ROOT_PORT) || \ | ||
| 693 | (type == PCI_EXP_TYPE_DOWNSTREAM && \ | ||
| 694 | (flags & PCI_EXP_FLAGS_SLOT)))) | ||
| 695 | #define pcie_cap_has_rtctl(type, flags) \ | ||
| 696 | ((flags & PCI_EXP_FLAGS_VERS) > 1 || \ | ||
| 697 | (type == PCI_EXP_TYPE_ROOT_PORT || \ | ||
| 698 | type == PCI_EXP_TYPE_RC_EC)) | ||
| 699 | #define pcie_cap_has_devctl2(type, flags) \ | ||
| 700 | ((flags & PCI_EXP_FLAGS_VERS) > 1) | ||
| 701 | #define pcie_cap_has_lnkctl2(type, flags) \ | ||
| 702 | ((flags & PCI_EXP_FLAGS_VERS) > 1) | ||
| 703 | #define pcie_cap_has_sltctl2(type, flags) \ | ||
| 704 | ((flags & PCI_EXP_FLAGS_VERS) > 1) | ||
| 705 | |||
| 684 | static int pci_save_pcie_state(struct pci_dev *dev) | 706 | static int pci_save_pcie_state(struct pci_dev *dev) |
| 685 | { | 707 | { |
| 686 | int pos, i = 0; | 708 | int pos, i = 0; |
| 687 | struct pci_cap_saved_state *save_state; | 709 | struct pci_cap_saved_state *save_state; |
| 688 | u16 *cap; | 710 | u16 *cap; |
| 711 | u16 flags; | ||
| 689 | 712 | ||
| 690 | pos = pci_find_capability(dev, PCI_CAP_ID_EXP); | 713 | pos = pci_find_capability(dev, PCI_CAP_ID_EXP); |
| 691 | if (pos <= 0) | 714 | if (pos <= 0) |
| @@ -698,13 +721,22 @@ static int pci_save_pcie_state(struct pci_dev *dev) | |||
| 698 | } | 721 | } |
| 699 | cap = (u16 *)&save_state->data[0]; | 722 | cap = (u16 *)&save_state->data[0]; |
| 700 | 723 | ||
| 701 | pci_read_config_word(dev, pos + PCI_EXP_DEVCTL, &cap[i++]); | 724 | pci_read_config_word(dev, pos + PCI_EXP_FLAGS, &flags); |
| 702 | pci_read_config_word(dev, pos + PCI_EXP_LNKCTL, &cap[i++]); | 725 | |
| 703 | pci_read_config_word(dev, pos + PCI_EXP_SLTCTL, &cap[i++]); | 726 | if (pcie_cap_has_devctl(dev->pcie_type, flags)) |
| 704 | pci_read_config_word(dev, pos + PCI_EXP_RTCTL, &cap[i++]); | 727 | pci_read_config_word(dev, pos + PCI_EXP_DEVCTL, &cap[i++]); |
| 705 | pci_read_config_word(dev, pos + PCI_EXP_DEVCTL2, &cap[i++]); | 728 | if (pcie_cap_has_lnkctl(dev->pcie_type, flags)) |
| 706 | pci_read_config_word(dev, pos + PCI_EXP_LNKCTL2, &cap[i++]); | 729 | pci_read_config_word(dev, pos + PCI_EXP_LNKCTL, &cap[i++]); |
| 707 | pci_read_config_word(dev, pos + PCI_EXP_SLTCTL2, &cap[i++]); | 730 | if (pcie_cap_has_sltctl(dev->pcie_type, flags)) |
| 731 | pci_read_config_word(dev, pos + PCI_EXP_SLTCTL, &cap[i++]); | ||
| 732 | if (pcie_cap_has_rtctl(dev->pcie_type, flags)) | ||
| 733 | pci_read_config_word(dev, pos + PCI_EXP_RTCTL, &cap[i++]); | ||
| 734 | if (pcie_cap_has_devctl2(dev->pcie_type, flags)) | ||
| 735 | pci_read_config_word(dev, pos + PCI_EXP_DEVCTL2, &cap[i++]); | ||
| 736 | if (pcie_cap_has_lnkctl2(dev->pcie_type, flags)) | ||
| 737 | pci_read_config_word(dev, pos + PCI_EXP_LNKCTL2, &cap[i++]); | ||
| 738 | if (pcie_cap_has_sltctl2(dev->pcie_type, flags)) | ||
| 739 | pci_read_config_word(dev, pos + PCI_EXP_SLTCTL2, &cap[i++]); | ||
| 708 | 740 | ||
| 709 | return 0; | 741 | return 0; |
| 710 | } | 742 | } |
| @@ -714,6 +746,7 @@ static void pci_restore_pcie_state(struct pci_dev *dev) | |||
| 714 | int i = 0, pos; | 746 | int i = 0, pos; |
| 715 | struct pci_cap_saved_state *save_state; | 747 | struct pci_cap_saved_state *save_state; |
| 716 | u16 *cap; | 748 | u16 *cap; |
| 749 | u16 flags; | ||
| 717 | 750 | ||
| 718 | save_state = pci_find_saved_cap(dev, PCI_CAP_ID_EXP); | 751 | save_state = pci_find_saved_cap(dev, PCI_CAP_ID_EXP); |
| 719 | pos = pci_find_capability(dev, PCI_CAP_ID_EXP); | 752 | pos = pci_find_capability(dev, PCI_CAP_ID_EXP); |
| @@ -721,13 +754,22 @@ static void pci_restore_pcie_state(struct pci_dev *dev) | |||
| 721 | return; | 754 | return; |
| 722 | cap = (u16 *)&save_state->data[0]; | 755 | cap = (u16 *)&save_state->data[0]; |
| 723 | 756 | ||
| 724 | pci_write_config_word(dev, pos + PCI_EXP_DEVCTL, cap[i++]); | 757 | pci_read_config_word(dev, pos + PCI_EXP_FLAGS, &flags); |
| 725 | pci_write_config_word(dev, pos + PCI_EXP_LNKCTL, cap[i++]); | 758 | |
| 726 | pci_write_config_word(dev, pos + PCI_EXP_SLTCTL, cap[i++]); | 759 | if (pcie_cap_has_devctl(dev->pcie_type, flags)) |
| 727 | pci_write_config_word(dev, pos + PCI_EXP_RTCTL, cap[i++]); | 760 | pci_write_config_word(dev, pos + PCI_EXP_DEVCTL, cap[i++]); |
| 728 | pci_write_config_word(dev, pos + PCI_EXP_DEVCTL2, cap[i++]); | 761 | if (pcie_cap_has_lnkctl(dev->pcie_type, flags)) |
| 729 | pci_write_config_word(dev, pos + PCI_EXP_LNKCTL2, cap[i++]); | 762 | pci_write_config_word(dev, pos + PCI_EXP_LNKCTL, cap[i++]); |
| 730 | pci_write_config_word(dev, pos + PCI_EXP_SLTCTL2, cap[i++]); | 763 | if (pcie_cap_has_sltctl(dev->pcie_type, flags)) |
| 764 | pci_write_config_word(dev, pos + PCI_EXP_SLTCTL, cap[i++]); | ||
| 765 | if (pcie_cap_has_rtctl(dev->pcie_type, flags)) | ||
| 766 | pci_write_config_word(dev, pos + PCI_EXP_RTCTL, cap[i++]); | ||
| 767 | if (pcie_cap_has_devctl2(dev->pcie_type, flags)) | ||
| 768 | pci_write_config_word(dev, pos + PCI_EXP_DEVCTL2, cap[i++]); | ||
| 769 | if (pcie_cap_has_lnkctl2(dev->pcie_type, flags)) | ||
| 770 | pci_write_config_word(dev, pos + PCI_EXP_LNKCTL2, cap[i++]); | ||
| 771 | if (pcie_cap_has_sltctl2(dev->pcie_type, flags)) | ||
| 772 | pci_write_config_word(dev, pos + PCI_EXP_SLTCTL2, cap[i++]); | ||
| 731 | } | 773 | } |
| 732 | 774 | ||
| 733 | 775 | ||
