PCI-PCI bridges patch update
Subsystems (2)
Some not critical changes, and a bit more testing was done (on ux164 - including card with an extra bridge, thanks to Michal).
Changes from bridges-2.4.0t11-rth:
- Disable devices before changing BARs
- Handle bridges not supporting IO forwarding
- Handle bridges with their own IO ports and/or memory
- Set cache line and default latency for all devices
- Updated comment for empty IO/memory ranges case
Diffs against bridges-2.4.0t11-rth and pristine 2.4.0-test11 attached.
Ivan.
arch/alpha/kernel/pci.c +1 -1
@@ -264,7 +264,7 @@ pcibios_fixup_bus(struct pci_bus *bus) &dev->resource[PCI_BRIDGE_RESOURCES +i]; bus->resource[i]->name = bus->name; } - bus->resource[0 ]->flags |=IORESOURCE_IO ; + bus->resource[0 ]->flags |=pci_bridge_check_io (dev); bus->resource[1 ]->flags |=IORESOURCE_MEM ;/* For now, propogate hose limits to the bus; we'll adjust them later. */
drivers/pci/setup-bus.c +50 -33
129 lines not on this page · raw message
drivers/pci/setup-res.c +12 -1
@@ -120,7 +120,8 @@ pci_assign_resource(struct pci_dev *dev, } } -DBGC ((" got res[%lx:%lx] for resource %d\n" , res->start, res->end, i)); +DBGC ((" got res[%lx:%lx] for resource %d of %s\n" , res->start, + res->end, i, dev->name));return 0 ; }
@@ -136,6 +137,12 @@ pdev_sort_resources(struct pci_dev *dev,struct resource *r;struct resource_list *list, *tmp; +/* PCI-PCI bridges may have I/O ports or +memory on the primary bus */ +if (dev->class >>8 ==PCI_CLASS_BRIDGE_PCI && + i >=PCI_BRIDGE_RESOURCES ) +continue ; + r = &dev->resource[i];if (!(r->flags & type_mask) || r->parent)continue ;
@@ -201,6 +208,10 @@ pdev_enable_device(struct pci_dev *dev)/* ??? Always turn on bus mastering. If the device doesn't support it, the bit will go into the bucket. */ cmd |=PCI_COMMAND_MASTER ; + +/* Set the cache line and default latency (32). */ +pci_write_config_word (dev,PCI_CACHE_LINE_SIZE , + (32 <<8 ) | (L1_CACHE_BYTES /sizeof (u32)));/* Enable the appropriate bits in the PCI command register. */ pci_write_config_word (dev,PCI_COMMAND , cmd);
include/linux/pci.h +1 -0
@@ -536,6 +536,7 @@ int pci_claim_resource(struct pci_dev *,void pci_assign_unassigned_resources (void );void pdev_enable_device (struct pci_dev *);void pdev_sort_resources (struct pci_dev *,struct resource_list *,u32 ); +unsigned long pci_bridge_check_io (struct pci_dev *);void pci_fixup_irqs (u8 (*)(struct pci_dev *,u8 *),int (*)(struct pci_dev *,u8 ,u8 ));