[PATCH 4/8] Stop inheriting bus flags and check root chipset bus flags instead

From: Brice Goglin
Date: Sun Jun 18 2006 - 21:07:54 EST


[PATCH 4/8] Stop inheriting bus flags and check root chipset bus flags instead

Inheriting bus flags requires to set them during the PCI hierarchy is
scanned, with EARLY or HEADER quirks. But the subordinate bus has not
been set at this point, so the bus flags cannot be set.

Signed-off-by: Brice Goglin <brice@xxxxxxxx>
---
drivers/pci/msi.c | 13 +++++++++----
drivers/pci/probe.c | 2 +-
include/linux/pci.h | 2 +-
3 files changed, 11 insertions(+), 6 deletions(-)

Index: linux-mm/drivers/pci/probe.c
===================================================================
--- linux-mm.orig/drivers/pci/probe.c 2006-06-17 23:24:50.000000000 -0400
+++ linux-mm/drivers/pci/probe.c 2006-06-17 23:25:41.000000000 -0400
@@ -351,7 +351,7 @@
child->parent = parent;
child->ops = parent->ops;
child->sysdata = parent->sysdata;
- child->bus_flags = parent->bus_flags;
+ child->bus_flags = 0;
child->bridge = get_device(&bridge->dev);

child->class_dev.class = &pcibus_class;
Index: linux-mm/include/linux/pci.h
===================================================================
--- linux-mm.orig/include/linux/pci.h 2006-06-17 23:24:51.000000000 -0400
+++ linux-mm/include/linux/pci.h 2006-06-17 23:25:41.000000000 -0400
@@ -242,7 +242,7 @@
char name[48];

unsigned short bridge_ctl; /* manage NO_ISA/FBB/et al behaviors */
- pci_bus_flags_t bus_flags; /* Inherited by child busses */
+ pci_bus_flags_t bus_flags;
struct device *bridge;
struct class_device class_dev;
struct bin_attribute *legacy_io; /* legacy I/O for this bus */
Index: linux-mm/drivers/pci/msi.c
===================================================================
--- linux-mm.orig/drivers/pci/msi.c 2006-06-17 23:24:50.000000000 -0400
+++ linux-mm/drivers/pci/msi.c 2006-06-17 23:25:41.000000000 -0400
@@ -911,14 +911,19 @@
static
int pci_msi_supported(struct pci_dev * dev)
{
- struct pci_bus *bus;
+ struct pci_dev *pdev;

if (!pci_msi_enable || !dev || dev->no_msi)
return -1;

- for (bus = dev->bus; bus; bus = bus->parent)
- if (bus->bus_flags & PCI_BUS_FLAGS_NO_MSI)
- return -1;
+ /* find root complex for our device */
+ pdev = dev;
+ while (pdev->bus && pdev->bus->self)
+ pdev = pdev->bus->self;
+
+ /* check its bus flags */
+ if (pdev->subordinate->bus_flags & PCI_BUS_FLAGS_NO_MSI)
+ return -1;

return 0;
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/