Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 415b6d0e authored by Bjorn Helgaas's avatar Bjorn Helgaas Committed by Greg Kroah-Hartman
Browse files

PCI: consolidate duplicated MSI enable functions

parent d6505a52
Loading
Loading
Loading
Loading
+6 −30
Original line number Diff line number Diff line
@@ -1725,32 +1725,6 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_HT2
			quirk_msi_ht_cap);


/*
 *  Force enable MSI mapping capability on HT bridges
 */
static void __devinit quirk_msi_ht_cap_enable(struct pci_dev *dev)
{
	int pos, ttl = 48;

	pos = pci_find_ht_capability(dev, HT_CAPTYPE_MSI_MAPPING);
	while (pos && ttl--) {
		u8 flags;

		if (pci_read_config_byte(dev, pos + HT_MSI_FLAGS, &flags) == 0) {
			printk(KERN_INFO "PCI: Enabling HT MSI Mapping on %s\n",
			       pci_name(dev));

			pci_write_config_byte(dev, pos + HT_MSI_FLAGS,
					      flags | HT_MSI_FLAGS_ENABLE);
		}
		pos = pci_find_next_ht_capability(dev, pos,
						  HT_CAPTYPE_MSI_MAPPING);
	}
}
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SERVERWORKS,
			 PCI_DEVICE_ID_SERVERWORKS_HT1000_PXB,
			 quirk_msi_ht_cap_enable);

/* The nVidia CK804 chipset may have 2 HT MSI mappings.
 * MSI are supported if the MSI capability set in any of these mappings.
 */
@@ -1777,9 +1751,8 @@ static void __devinit quirk_nvidia_ck804_msi_ht_cap(struct pci_dev *dev)
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_CK804_PCIE,
			quirk_nvidia_ck804_msi_ht_cap);

/*
 *  Force enable MSI mapping capability on HT bridges  */
static inline void ht_enable_msi_mapping(struct pci_dev *dev)
/* Force enable MSI mapping capability on HT bridges */
static void __devinit ht_enable_msi_mapping(struct pci_dev *dev)
{
	int pos, ttl = 48;

@@ -1798,6 +1771,9 @@ static inline void ht_enable_msi_mapping(struct pci_dev *dev)
						  HT_CAPTYPE_MSI_MAPPING);
	}
}
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SERVERWORKS,
			 PCI_DEVICE_ID_SERVERWORKS_HT1000_PXB,
			 ht_enable_msi_mapping);

static void __devinit nv_msi_ht_cap_quirk(struct pci_dev *dev)
{
@@ -1829,7 +1805,7 @@ static void __devinit nv_msi_ht_cap_quirk(struct pci_dev *dev)

		if (pci_read_config_byte(dev, pos + HT_MSI_FLAGS,
					 &flags) == 0) {
			dev_info(&dev->dev, "Quirk disabling HT MSI mapping");
			dev_info(&dev->dev, "Disabling HT MSI mapping");
			pci_write_config_byte(dev, pos + HT_MSI_FLAGS,
					      flags & ~HT_MSI_FLAGS_ENABLE);
		}