aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/msi.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pci/msi.c')
-rw-r--r--drivers/pci/msi.c29
1 files changed, 27 insertions, 2 deletions
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index 77b68eaf021e..69b7be33b3a2 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -196,6 +196,9 @@ void unmask_msi_irq(unsigned int irq)
196void read_msi_msg_desc(struct irq_desc *desc, struct msi_msg *msg) 196void read_msi_msg_desc(struct irq_desc *desc, struct msi_msg *msg)
197{ 197{
198 struct msi_desc *entry = get_irq_desc_msi(desc); 198 struct msi_desc *entry = get_irq_desc_msi(desc);
199
200 BUG_ON(entry->dev->current_state != PCI_D0);
201
199 if (entry->msi_attrib.is_msix) { 202 if (entry->msi_attrib.is_msix) {
200 void __iomem *base = entry->mask_base + 203 void __iomem *base = entry->mask_base +
201 entry->msi_attrib.entry_nr * PCI_MSIX_ENTRY_SIZE; 204 entry->msi_attrib.entry_nr * PCI_MSIX_ENTRY_SIZE;
@@ -229,10 +232,32 @@ void read_msi_msg(unsigned int irq, struct msi_msg *msg)
229 read_msi_msg_desc(desc, msg); 232 read_msi_msg_desc(desc, msg);
230} 233}
231 234
235void get_cached_msi_msg_desc(struct irq_desc *desc, struct msi_msg *msg)
236{
237 struct msi_desc *entry = get_irq_desc_msi(desc);
238
239 /* Assert that the cache is valid, assuming that
240 * valid messages are not all-zeroes. */
241 BUG_ON(!(entry->msg.address_hi | entry->msg.address_lo |
242 entry->msg.data));
243
244 *msg = entry->msg;
245}
246
247void get_cached_msi_msg(unsigned int irq, struct msi_msg *msg)
248{
249 struct irq_desc *desc = irq_to_desc(irq);
250
251 get_cached_msi_msg_desc(desc, msg);
252}
253
232void write_msi_msg_desc(struct irq_desc *desc, struct msi_msg *msg) 254void write_msi_msg_desc(struct irq_desc *desc, struct msi_msg *msg)
233{ 255{
234 struct msi_desc *entry = get_irq_desc_msi(desc); 256 struct msi_desc *entry = get_irq_desc_msi(desc);
235 if (entry->msi_attrib.is_msix) { 257
258 if (entry->dev->current_state != PCI_D0) {
259 /* Don't touch the hardware now */
260 } else if (entry->msi_attrib.is_msix) {
236 void __iomem *base; 261 void __iomem *base;
237 base = entry->mask_base + 262 base = entry->mask_base +
238 entry->msi_attrib.entry_nr * PCI_MSIX_ENTRY_SIZE; 263 entry->msi_attrib.entry_nr * PCI_MSIX_ENTRY_SIZE;
@@ -435,7 +460,7 @@ static int msi_capability_init(struct pci_dev *dev, int nvec)
435static void __iomem *msix_map_region(struct pci_dev *dev, unsigned pos, 460static void __iomem *msix_map_region(struct pci_dev *dev, unsigned pos,
436 unsigned nr_entries) 461 unsigned nr_entries)
437{ 462{
438 unsigned long phys_addr; 463 resource_size_t phys_addr;
439 u32 table_offset; 464 u32 table_offset;
440 u8 bir; 465 u8 bir;
441 466