diff options
Diffstat (limited to 'drivers/pci/access.c')
-rw-r--r-- | drivers/pci/access.c | 61 |
1 files changed, 59 insertions, 2 deletions
diff --git a/drivers/pci/access.c b/drivers/pci/access.c index 8b7382705bf2..74cf5fffb1e1 100644 --- a/drivers/pci/access.c +++ b/drivers/pci/access.c | |||
@@ -629,7 +629,7 @@ void pci_vpd_release(struct pci_dev *dev) | |||
629 | * | 629 | * |
630 | * When access is locked, any userspace reads or writes to config | 630 | * When access is locked, any userspace reads or writes to config |
631 | * space and concurrent lock requests will sleep until access is | 631 | * space and concurrent lock requests will sleep until access is |
632 | * allowed via pci_cfg_access_unlocked again. | 632 | * allowed via pci_cfg_access_unlock() again. |
633 | */ | 633 | */ |
634 | void pci_cfg_access_lock(struct pci_dev *dev) | 634 | void pci_cfg_access_lock(struct pci_dev *dev) |
635 | { | 635 | { |
@@ -700,7 +700,8 @@ static bool pcie_downstream_port(const struct pci_dev *dev) | |||
700 | int type = pci_pcie_type(dev); | 700 | int type = pci_pcie_type(dev); |
701 | 701 | ||
702 | return type == PCI_EXP_TYPE_ROOT_PORT || | 702 | return type == PCI_EXP_TYPE_ROOT_PORT || |
703 | type == PCI_EXP_TYPE_DOWNSTREAM; | 703 | type == PCI_EXP_TYPE_DOWNSTREAM || |
704 | type == PCI_EXP_TYPE_PCIE_BRIDGE; | ||
704 | } | 705 | } |
705 | 706 | ||
706 | bool pcie_cap_has_lnkctl(const struct pci_dev *dev) | 707 | bool pcie_cap_has_lnkctl(const struct pci_dev *dev) |
@@ -890,3 +891,59 @@ int pcie_capability_clear_and_set_dword(struct pci_dev *dev, int pos, | |||
890 | return ret; | 891 | return ret; |
891 | } | 892 | } |
892 | EXPORT_SYMBOL(pcie_capability_clear_and_set_dword); | 893 | EXPORT_SYMBOL(pcie_capability_clear_and_set_dword); |
894 | |||
895 | int pci_read_config_byte(const struct pci_dev *dev, int where, u8 *val) | ||
896 | { | ||
897 | if (pci_dev_is_disconnected(dev)) { | ||
898 | *val = ~0; | ||
899 | return -ENODEV; | ||
900 | } | ||
901 | return pci_bus_read_config_byte(dev->bus, dev->devfn, where, val); | ||
902 | } | ||
903 | EXPORT_SYMBOL(pci_read_config_byte); | ||
904 | |||
905 | int pci_read_config_word(const struct pci_dev *dev, int where, u16 *val) | ||
906 | { | ||
907 | if (pci_dev_is_disconnected(dev)) { | ||
908 | *val = ~0; | ||
909 | return -ENODEV; | ||
910 | } | ||
911 | return pci_bus_read_config_word(dev->bus, dev->devfn, where, val); | ||
912 | } | ||
913 | EXPORT_SYMBOL(pci_read_config_word); | ||
914 | |||
915 | int pci_read_config_dword(const struct pci_dev *dev, int where, | ||
916 | u32 *val) | ||
917 | { | ||
918 | if (pci_dev_is_disconnected(dev)) { | ||
919 | *val = ~0; | ||
920 | return -ENODEV; | ||
921 | } | ||
922 | return pci_bus_read_config_dword(dev->bus, dev->devfn, where, val); | ||
923 | } | ||
924 | EXPORT_SYMBOL(pci_read_config_dword); | ||
925 | |||
926 | int pci_write_config_byte(const struct pci_dev *dev, int where, u8 val) | ||
927 | { | ||
928 | if (pci_dev_is_disconnected(dev)) | ||
929 | return -ENODEV; | ||
930 | return pci_bus_write_config_byte(dev->bus, dev->devfn, where, val); | ||
931 | } | ||
932 | EXPORT_SYMBOL(pci_write_config_byte); | ||
933 | |||
934 | int pci_write_config_word(const struct pci_dev *dev, int where, u16 val) | ||
935 | { | ||
936 | if (pci_dev_is_disconnected(dev)) | ||
937 | return -ENODEV; | ||
938 | return pci_bus_write_config_word(dev->bus, dev->devfn, where, val); | ||
939 | } | ||
940 | EXPORT_SYMBOL(pci_write_config_word); | ||
941 | |||
942 | int pci_write_config_dword(const struct pci_dev *dev, int where, | ||
943 | u32 val) | ||
944 | { | ||
945 | if (pci_dev_is_disconnected(dev)) | ||
946 | return -ENODEV; | ||
947 | return pci_bus_write_config_dword(dev->bus, dev->devfn, where, val); | ||
948 | } | ||
949 | EXPORT_SYMBOL(pci_write_config_dword); | ||