aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/pci/msi.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index f8105783da2f..4aea563bda60 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -916,6 +916,7 @@ static int msix_capability_init(struct pci_dev *dev,
916 **/ 916 **/
917int pci_enable_msi(struct pci_dev* dev) 917int pci_enable_msi(struct pci_dev* dev)
918{ 918{
919 struct pci_bus *bus;
919 int pos, temp, status = -EINVAL; 920 int pos, temp, status = -EINVAL;
920 u16 control; 921 u16 control;
921 922
@@ -925,8 +926,9 @@ int pci_enable_msi(struct pci_dev* dev)
925 if (dev->no_msi) 926 if (dev->no_msi)
926 return status; 927 return status;
927 928
928 if (dev->bus->bus_flags & PCI_BUS_FLAGS_NO_MSI) 929 for (bus = dev->bus; bus; bus = bus->parent)
929 return -EINVAL; 930 if (bus->bus_flags & PCI_BUS_FLAGS_NO_MSI)
931 return -EINVAL;
930 932
931 temp = dev->irq; 933 temp = dev->irq;
932 934
@@ -1162,6 +1164,7 @@ static int reroute_msix_table(int head, struct msix_entry *entries, int *nvec)
1162 **/ 1164 **/
1163int pci_enable_msix(struct pci_dev* dev, struct msix_entry *entries, int nvec) 1165int pci_enable_msix(struct pci_dev* dev, struct msix_entry *entries, int nvec)
1164{ 1166{
1167 struct pci_bus *bus;
1165 int status, pos, nr_entries, free_vectors; 1168 int status, pos, nr_entries, free_vectors;
1166 int i, j, temp; 1169 int i, j, temp;
1167 u16 control; 1170 u16 control;
@@ -1170,6 +1173,13 @@ int pci_enable_msix(struct pci_dev* dev, struct msix_entry *entries, int nvec)
1170 if (!pci_msi_enable || !dev || !entries) 1173 if (!pci_msi_enable || !dev || !entries)
1171 return -EINVAL; 1174 return -EINVAL;
1172 1175
1176 if (dev->no_msi)
1177 return -EINVAL;
1178
1179 for (bus = dev->bus; bus; bus = bus->parent)
1180 if (bus->bus_flags & PCI_BUS_FLAGS_NO_MSI)
1181 return -EINVAL;
1182
1173 status = msi_init(); 1183 status = msi_init();
1174 if (status < 0) 1184 if (status < 0)
1175 return status; 1185 return status;