aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/msi.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-08-06 14:44:36 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-08-06 14:44:36 -0400
commit1cfd2bda8c486ae0e7a8005354758ebb68172bca (patch)
tree76ce15f377d8d6eb3ae4aa8b8b0b415457e38d36 /drivers/pci/msi.c
parentb57bdda58cda0aaf6def042d101dd85977a286ed (diff)
parent763e9db9994e27a7d2cb3701c8a097a867d0e0b4 (diff)
Merge branch 'linux-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6
* 'linux-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6: (30 commits) PCI: update for owner removal from struct device_attribute PCI: Fix warnings when CONFIG_DMI unset PCI: Do not run NVidia quirks related to MSI with MSI disabled x86/PCI: use for_each_pci_dev() PCI: use for_each_pci_dev() PCI: MSI: Restore read_msi_msg_desc(); add get_cached_msi_msg_desc() PCI: export SMBIOS provided firmware instance and label to sysfs PCI: Allow read/write access to sysfs I/O port resources x86/PCI: use host bridge _CRS info on ASRock ALiveSATA2-GLAN PCI: remove unused HAVE_ARCH_PCI_SET_DMA_MAX_SEGMENT_{SIZE|BOUNDARY} PCI: disable mmio during bar sizing PCI: MSI: Remove unsafe and unnecessary hardware access PCI: Default PCIe ASPM control to on and require !EMBEDDED to disable PCI: kernel oops on access to pci proc file while hot-removal PCI: pci-sysfs: remove casts from void* ACPI: Disable ASPM if the platform won't provide _OSC control for PCIe PCI hotplug: make sure child bridges are enabled at hotplug time PCI hotplug: shpchp: Removed check for hotplug of display devices PCI hotplug: pciehp: Fixed return value sign for pciehp_unconfigure_device PCI: Don't enable aspm before drivers have had a chance to veto it ...
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