aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@redhat.com>2015-05-07 10:52:21 -0400
committerBjorn Helgaas <bhelgaas@google.com>2015-05-07 10:52:21 -0400
commit6a25f5e35ab742380742ebf2033f6d53518219db (patch)
tree1dd947c5281467ad75450d7261c1d4fd2ec0f4b9
parent61b64abd399fa4b15ac649ad93b453d2a8569314 (diff)
PCI/MSI: Export pci_msi_set_enable(), pci_msix_clear_and_set_ctrl()
Move pci_msi_set_enable() and pci_msix_clear_and_set_ctrl() to drivers/pci/pci.h so they're available even when MSI isn't configured into the kernel. No functional change. [bhelgaas: changelog, split into separate patch] Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Reviewed-by: Fam Zheng <famz@redhat.com>
-rw-r--r--drivers/pci/msi.c21
-rw-r--r--drivers/pci/pci.h21
2 files changed, 21 insertions, 21 deletions
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index 6cd366058ec4..9942f6827a4a 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -185,27 +185,6 @@ void __weak arch_restore_msi_irqs(struct pci_dev *dev)
185 return default_restore_msi_irqs(dev); 185 return default_restore_msi_irqs(dev);
186} 186}
187 187
188static void pci_msi_set_enable(struct pci_dev *dev, int enable)
189{
190 u16 control;
191
192 pci_read_config_word(dev, dev->msi_cap + PCI_MSI_FLAGS, &control);
193 control &= ~PCI_MSI_FLAGS_ENABLE;
194 if (enable)
195 control |= PCI_MSI_FLAGS_ENABLE;
196 pci_write_config_word(dev, dev->msi_cap + PCI_MSI_FLAGS, control);
197}
198
199static void pci_msix_clear_and_set_ctrl(struct pci_dev *dev, u16 clear, u16 set)
200{
201 u16 ctrl;
202
203 pci_read_config_word(dev, dev->msix_cap + PCI_MSIX_FLAGS, &ctrl);
204 ctrl &= ~clear;
205 ctrl |= set;
206 pci_write_config_word(dev, dev->msix_cap + PCI_MSIX_FLAGS, ctrl);
207}
208
209static inline __attribute_const__ u32 msi_mask(unsigned x) 188static inline __attribute_const__ u32 msi_mask(unsigned x)
210{ 189{
211 /* Don't shift by >= width of type */ 190 /* Don't shift by >= width of type */
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index 9bd762c237ab..6f04d1ea2bcb 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -146,6 +146,27 @@ static inline void pci_no_msi(void) { }
146static inline void pci_msi_init_pci_dev(struct pci_dev *dev) { } 146static inline void pci_msi_init_pci_dev(struct pci_dev *dev) { }
147#endif 147#endif
148 148
149static inline void pci_msi_set_enable(struct pci_dev *dev, int enable)
150{
151 u16 control;
152
153 pci_read_config_word(dev, dev->msi_cap + PCI_MSI_FLAGS, &control);
154 control &= ~PCI_MSI_FLAGS_ENABLE;
155 if (enable)
156 control |= PCI_MSI_FLAGS_ENABLE;
157 pci_write_config_word(dev, dev->msi_cap + PCI_MSI_FLAGS, control);
158}
159
160static inline void pci_msix_clear_and_set_ctrl(struct pci_dev *dev, u16 clear, u16 set)
161{
162 u16 ctrl;
163
164 pci_read_config_word(dev, dev->msix_cap + PCI_MSIX_FLAGS, &ctrl);
165 ctrl &= ~clear;
166 ctrl |= set;
167 pci_write_config_word(dev, dev->msix_cap + PCI_MSIX_FLAGS, ctrl);
168}
169
149void pci_realloc_get_opt(char *); 170void pci_realloc_get_opt(char *);
150 171
151static inline int pci_no_d1d2(struct pci_dev *dev) 172static inline int pci_no_d1d2(struct pci_dev *dev)