diff options
Diffstat (limited to 'drivers/pci/msi.c')
-rw-r--r-- | drivers/pci/msi.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c index 896a15d70f5b..baba2eb5367d 100644 --- a/drivers/pci/msi.c +++ b/drivers/pci/msi.c | |||
@@ -103,6 +103,14 @@ static void msix_set_enable(struct pci_dev *dev, int enable) | |||
103 | } | 103 | } |
104 | } | 104 | } |
105 | 105 | ||
106 | static inline __attribute_const__ u32 msi_mask(unsigned x) | ||
107 | { | ||
108 | /* Don't shift by >= width of type */ | ||
109 | if (x >= 5) | ||
110 | return 0xffffffff; | ||
111 | return (1 << (1 << x)) - 1; | ||
112 | } | ||
113 | |||
106 | static void msix_flush_writes(struct irq_desc *desc) | 114 | static void msix_flush_writes(struct irq_desc *desc) |
107 | { | 115 | { |
108 | struct msi_desc *entry; | 116 | struct msi_desc *entry; |
@@ -407,8 +415,7 @@ static int msi_capability_init(struct pci_dev *dev) | |||
407 | 415 | ||
408 | /* All MSIs are unmasked by default, Mask them all */ | 416 | /* All MSIs are unmasked by default, Mask them all */ |
409 | pci_read_config_dword(dev, base, &maskbits); | 417 | pci_read_config_dword(dev, base, &maskbits); |
410 | temp = (1 << multi_msi_capable(control)); | 418 | temp = msi_mask((control & PCI_MSI_FLAGS_QMASK) >> 1); |
411 | temp = ((temp - 1) & ~temp); | ||
412 | maskbits |= temp; | 419 | maskbits |= temp; |
413 | pci_write_config_dword(dev, base, maskbits); | 420 | pci_write_config_dword(dev, base, maskbits); |
414 | entry->msi_attrib.maskbits_mask = temp; | 421 | entry->msi_attrib.maskbits_mask = temp; |