[PATCH] 2.5.29-pci

From: Russell King (rmk@arm.linux.org.uk)
Date: Fri Aug 30 2002 - 16:39:07 EST


This patch appears not to be in 2.5.32, but applies cleanly.

This is something that I ported forward from Ivan's original PCI
changes, and has been sitting in the -rmk patch since the previous
round of PCI changes, and has working for me since.

If anyone wants to pick it up and do something with it, that's
fine by me.

Unfortunately, there doesn't seem to be a listed maintainer for
the PCI subsystem.

 drivers/pci/setup-bus.c | 22 ++++++++++------------
 include/linux/ioport.h | 1 -
 include/linux/pci.h | 2 ++
 3 files changed, 12 insertions, 13 deletions

diff -urN orig/drivers/pci/setup-bus.c linux/drivers/pci/setup-bus.c
--- orig/drivers/pci/setup-bus.c Wed May 29 21:40:34 2002
+++ linux/drivers/pci/setup-bus.c Wed May 29 21:55:30 2002
@@ -35,13 +35,13 @@
 
 #define ROUND_UP(x, a) (((x) + (a) - 1) & ~((a) - 1))
 
-static int __init
+static void __init
 pbus_assign_resources_sorted(struct pci_bus *bus)
 {
         struct list_head *ln;
         struct resource *res;
         struct resource_list head, *list, *tmp;
- int idx, found_vga = 0;
+ int idx;
 
         head.next = NULL;
         for (ln=bus->devices.next; ln != &bus->devices; ln=ln->next) {
@@ -57,7 +57,7 @@
                    have VGA behind them. */
                 if (class == PCI_CLASS_DISPLAY_VGA
                                 || class == PCI_CLASS_NOT_DEFINED_VGA)
- found_vga = 1;
+ bus->bridge_ctl |= PCI_BRIDGE_CTL_VGA;
                 else if (class >> 8 != PCI_BASE_CLASS_BRIDGE) {
                         pci_read_config_word(dev, PCI_COMMAND, &cmd);
                         cmd &= ~(PCI_COMMAND_IO | PCI_COMMAND_MEMORY
@@ -76,8 +76,6 @@
                 list = list->next;
                 kfree(tmp);
         }
-
- return found_vga;
 }
 
 /* Initialize bridges with base/limit values we have collected.
@@ -159,10 +157,7 @@
         }
         pci_write_config_dword(bridge, PCI_PREF_MEMORY_BASE, l);
 
- /* Check if we have VGA behind the bridge.
- Enable ISA in either case (FIXME!). */
- l = (bus->resource[0]->flags & IORESOURCE_BUS_HAS_VGA) ? 0x0c : 0x04;
- pci_write_config_word(bridge, PCI_BRIDGE_CONTROL, l);
+ pci_write_config_word(bridge, PCI_BRIDGE_CONTROL, bus->bridge_ctl);
 }
 
 /* Check whether the bridge supports optional I/O and
@@ -362,18 +357,21 @@
 pbus_assign_resources(struct pci_bus *bus)
 {
         struct list_head *ln;
- int found_vga = pbus_assign_resources_sorted(bus);
 
- if (found_vga) {
+ pbus_assign_resources_sorted(bus);
+
+ if (bus->bridge_ctl & PCI_BRIDGE_CTL_VGA) {
                 struct pci_bus *b;
 
                 /* Propagate presence of the VGA to upstream bridges */
                 for (b = bus; b->parent; b = b->parent) {
- b->resource[0]->flags |= IORESOURCE_BUS_HAS_VGA;
+ b->bridge_ctl |= PCI_BRIDGE_CTL_VGA;
                 }
         }
         for (ln=bus->children.next; ln != &bus->children; ln=ln->next) {
                 struct pci_bus *b = pci_bus_b(ln);
+
+ b->bridge_ctl = PCI_BRIDGE_CTL_NO_ISA;
 
                 pbus_assign_resources(b);
                 pci_setup_bridge(b);
diff -urN orig/include/linux/ioport.h linux/include/linux/ioport.h
--- orig/include/linux/ioport.h Mon May 13 10:48:43 2002
+++ linux/include/linux/ioport.h Mon May 13 10:42:24 2002
@@ -40,7 +40,6 @@
 #define IORESOURCE_CACHEABLE 0x00004000
 #define IORESOURCE_RANGELENGTH 0x00008000
 #define IORESOURCE_SHADOWABLE 0x00010000
-#define IORESOURCE_BUS_HAS_VGA 0x00080000
 
 #define IORESOURCE_UNSET 0x20000000
 #define IORESOURCE_AUTO 0x40000000
diff -urN orig/include/linux/pci.h linux/include/linux/pci.h
--- orig/include/linux/pci.h Thu Jul 25 20:13:54 2002
+++ linux/include/linux/pci.h Thu Jul 25 19:59:46 2002
@@ -433,6 +433,8 @@
         unsigned char productver; /* product version */
         unsigned char checksum; /* if zero - checksum passed */
         unsigned char pad1;
+ unsigned short bridge_ctl; /* manage NO_ISA/FBB/et al behaviors */
+ unsigned short pad2;
         struct device * dev;
 };
 

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



This archive was generated by hypermail 2b29 : Sat Aug 31 2002 - 22:00:31 EST