diff options
author | Alex Williamson <alex.williamson@redhat.com> | 2012-06-11 01:27:19 -0400 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2012-06-12 11:21:42 -0400 |
commit | c63587d7f5b9db84e71daf5962dc0394eb657da2 (patch) | |
tree | 215aace1e4365938c497e2329b5c48614e01188d | |
parent | ad805758c0eb25bce7b2e3b298d63dc62a1bc71c (diff) |
PCI: export pci_user functions for use by other drivers
VFIO PCI support will make use of these for user-initiated
PCI config accesses.
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
-rw-r--r-- | drivers/pci/access.c | 6 | ||||
-rw-r--r-- | drivers/pci/pci.h | 7 | ||||
-rw-r--r-- | include/linux/pci.h | 8 |
3 files changed, 12 insertions, 9 deletions
diff --git a/drivers/pci/access.c b/drivers/pci/access.c index 2a581642c237..ba91a7e17519 100644 --- a/drivers/pci/access.c +++ b/drivers/pci/access.c | |||
@@ -162,7 +162,8 @@ int pci_user_read_config_##size \ | |||
162 | if (ret > 0) \ | 162 | if (ret > 0) \ |
163 | ret = -EINVAL; \ | 163 | ret = -EINVAL; \ |
164 | return ret; \ | 164 | return ret; \ |
165 | } | 165 | } \ |
166 | EXPORT_SYMBOL_GPL(pci_user_read_config_##size); | ||
166 | 167 | ||
167 | /* Returns 0 on success, negative values indicate error. */ | 168 | /* Returns 0 on success, negative values indicate error. */ |
168 | #define PCI_USER_WRITE_CONFIG(size,type) \ | 169 | #define PCI_USER_WRITE_CONFIG(size,type) \ |
@@ -181,7 +182,8 @@ int pci_user_write_config_##size \ | |||
181 | if (ret > 0) \ | 182 | if (ret > 0) \ |
182 | ret = -EINVAL; \ | 183 | ret = -EINVAL; \ |
183 | return ret; \ | 184 | return ret; \ |
184 | } | 185 | } \ |
186 | EXPORT_SYMBOL_GPL(pci_user_write_config_##size); | ||
185 | 187 | ||
186 | PCI_USER_READ_CONFIG(byte, u8) | 188 | PCI_USER_READ_CONFIG(byte, u8) |
187 | PCI_USER_READ_CONFIG(word, u16) | 189 | PCI_USER_READ_CONFIG(word, u16) |
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h index e4943479b234..f2dcc46bdece 100644 --- a/drivers/pci/pci.h +++ b/drivers/pci/pci.h | |||
@@ -86,13 +86,6 @@ static inline bool pci_is_bridge(struct pci_dev *pci_dev) | |||
86 | return !!(pci_dev->subordinate); | 86 | return !!(pci_dev->subordinate); |
87 | } | 87 | } |
88 | 88 | ||
89 | extern int pci_user_read_config_byte(struct pci_dev *dev, int where, u8 *val); | ||
90 | extern int pci_user_read_config_word(struct pci_dev *dev, int where, u16 *val); | ||
91 | extern int pci_user_read_config_dword(struct pci_dev *dev, int where, u32 *val); | ||
92 | extern int pci_user_write_config_byte(struct pci_dev *dev, int where, u8 val); | ||
93 | extern int pci_user_write_config_word(struct pci_dev *dev, int where, u16 val); | ||
94 | extern int pci_user_write_config_dword(struct pci_dev *dev, int where, u32 val); | ||
95 | |||
96 | struct pci_vpd_ops { | 89 | struct pci_vpd_ops { |
97 | ssize_t (*read)(struct pci_dev *dev, loff_t pos, size_t count, void *buf); | 90 | ssize_t (*read)(struct pci_dev *dev, loff_t pos, size_t count, void *buf); |
98 | ssize_t (*write)(struct pci_dev *dev, loff_t pos, size_t count, const void *buf); | 91 | ssize_t (*write)(struct pci_dev *dev, loff_t pos, size_t count, const void *buf); |
diff --git a/include/linux/pci.h b/include/linux/pci.h index dd7af0f37b3a..9d04599c6bd9 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
@@ -777,6 +777,14 @@ static inline int pci_write_config_dword(const struct pci_dev *dev, int where, | |||
777 | return pci_bus_write_config_dword(dev->bus, dev->devfn, where, val); | 777 | return pci_bus_write_config_dword(dev->bus, dev->devfn, where, val); |
778 | } | 778 | } |
779 | 779 | ||
780 | /* user-space driven config access */ | ||
781 | int pci_user_read_config_byte(struct pci_dev *dev, int where, u8 *val); | ||
782 | int pci_user_read_config_word(struct pci_dev *dev, int where, u16 *val); | ||
783 | int pci_user_read_config_dword(struct pci_dev *dev, int where, u32 *val); | ||
784 | int pci_user_write_config_byte(struct pci_dev *dev, int where, u8 val); | ||
785 | int pci_user_write_config_word(struct pci_dev *dev, int where, u16 val); | ||
786 | int pci_user_write_config_dword(struct pci_dev *dev, int where, u32 val); | ||
787 | |||
780 | int __must_check pci_enable_device(struct pci_dev *dev); | 788 | int __must_check pci_enable_device(struct pci_dev *dev); |
781 | int __must_check pci_enable_device_io(struct pci_dev *dev); | 789 | int __must_check pci_enable_device_io(struct pci_dev *dev); |
782 | int __must_check pci_enable_device_mem(struct pci_dev *dev); | 790 | int __must_check pci_enable_device_mem(struct pci_dev *dev); |