Commit 5993760f authored by Jike Song's avatar Jike Song Committed by Jesse Barnes

PCI: utilize calculated results when detecting MSI features

In msi_capability_init, we can make use of the calculated results
instead of calling is_mask_bit_support and is_64bit_address twice.
Signed-off-by: default avatarJike Song <albcamus@gmail.com>
Signed-off-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
parent 7f2feec1
...@@ -378,23 +378,21 @@ static int msi_capability_init(struct pci_dev *dev) ...@@ -378,23 +378,21 @@ static int msi_capability_init(struct pci_dev *dev)
entry->msi_attrib.masked = 1; entry->msi_attrib.masked = 1;
entry->msi_attrib.default_irq = dev->irq; /* Save IOAPIC IRQ */ entry->msi_attrib.default_irq = dev->irq; /* Save IOAPIC IRQ */
entry->msi_attrib.pos = pos; entry->msi_attrib.pos = pos;
if (is_mask_bit_support(control)) { if (entry->msi_attrib.maskbit) {
entry->mask_base = (void __iomem *)(long)msi_mask_bits_reg(pos, entry->mask_base = (void __iomem *)(long)msi_mask_bits_reg(pos,
is_64bit_address(control)); entry->msi_attrib.is_64);
} }
entry->dev = dev; entry->dev = dev;
if (entry->msi_attrib.maskbit) { if (entry->msi_attrib.maskbit) {
unsigned int maskbits, temp; unsigned int maskbits, temp;
/* All MSIs are unmasked by default, Mask them all */ /* All MSIs are unmasked by default, Mask them all */
pci_read_config_dword(dev, pci_read_config_dword(dev,
msi_mask_bits_reg(pos, is_64bit_address(control)), msi_mask_bits_reg(pos, entry->msi_attrib.is_64),
&maskbits); &maskbits);
temp = (1 << multi_msi_capable(control)); temp = (1 << multi_msi_capable(control));
temp = ((temp - 1) & ~temp); temp = ((temp - 1) & ~temp);
maskbits |= temp; maskbits |= temp;
pci_write_config_dword(dev, pci_write_config_dword(dev, entry->msi_attrib.is_64, maskbits);
msi_mask_bits_reg(pos, is_64bit_address(control)),
maskbits);
entry->msi_attrib.maskbits_mask = temp; entry->msi_attrib.maskbits_mask = temp;
} }
list_add_tail(&entry->list, &dev->msi_list); list_add_tail(&entry->list, &dev->msi_list);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment