Re: [RFC PATCH v2] PCI: Only enable IO window if supported

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jul 29, 2015 at 1:02 PM, Guenter Roeck <linux@xxxxxxxxxxxx> wrote:

> Do you have an idea on how to make it work with
> the reversed definition ?

attached one should address the problem.

index ddda0916..e8def25 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -378,16 +378,16 @@ static void pci_read_bridge_io(struct pci_bus *child)

     if (!pci_bridge_supports_io(dev)) {
         dev_printk(KERN_DEBUG, &dev->dev, "  no I/O window\n");
+        child->bus_flags &= ~PCI_BUS_FLAGS_SUPPORTS_IO;
         return;
     }

     if (!pci_root_has_io_resource(child)) {
         dev_printk(KERN_DEBUG, &dev->dev, "  no I/O resource on root bus\n");
+        child->bus_flags &= ~PCI_BUS_FLAGS_SUPPORTS_IO;
         return;
     }

-    child->bus_flags |= PCI_BUS_FLAGS_SUPPORTS_IO;
-
     io_mask = PCI_IO_RANGE_MASK;
     io_granularity = 0x1000;
     if (dev->io_window_1k) {
@@ -544,6 +544,7 @@ static struct pci_bus *pci_alloc_bus(struct pci_bus *parent)
     INIT_LIST_HEAD(&b->resources);
     b->max_bus_speed = PCI_SPEED_UNKNOWN;
     b->cur_bus_speed = PCI_SPEED_UNKNOWN;
+    b->bus_flags |= PCI_BUS_FLAGS_SUPPORTS_IO;
 #ifdef CONFIG_PCI_DOMAINS_GENERIC
     if (parent)
         b->domain_nr = parent->domain_nr;
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index ddda0916..e8def25 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -378,16 +378,16 @@ static void pci_read_bridge_io(struct pci_bus *child)
 
 	if (!pci_bridge_supports_io(dev)) {
 		dev_printk(KERN_DEBUG, &dev->dev, "  no I/O window\n");
+		child->bus_flags &= ~PCI_BUS_FLAGS_SUPPORTS_IO;
 		return;
 	}
 
 	if (!pci_root_has_io_resource(child)) {
 		dev_printk(KERN_DEBUG, &dev->dev, "  no I/O resource on root bus\n");
+		child->bus_flags &= ~PCI_BUS_FLAGS_SUPPORTS_IO;
 		return;
 	}
 
-	child->bus_flags |= PCI_BUS_FLAGS_SUPPORTS_IO;
-
 	io_mask = PCI_IO_RANGE_MASK;
 	io_granularity = 0x1000;
 	if (dev->io_window_1k) {
@@ -544,6 +544,7 @@ static struct pci_bus *pci_alloc_bus(struct pci_bus *parent)
 	INIT_LIST_HEAD(&b->resources);
 	b->max_bus_speed = PCI_SPEED_UNKNOWN;
 	b->cur_bus_speed = PCI_SPEED_UNKNOWN;
+	b->bus_flags |= PCI_BUS_FLAGS_SUPPORTS_IO;
 #ifdef CONFIG_PCI_DOMAINS_GENERIC
 	if (parent)
 		b->domain_nr = parent->domain_nr;

[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux