]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] alpha: pci domains update
authorIvan Kokshaysky <ink@jurassic.park.msu.ru>
Fri, 1 Aug 2003 03:58:44 +0000 (20:58 -0700)
committerRichard Henderson <rth@kanga.twiddle.net>
Fri, 1 Aug 2003 03:58:44 +0000 (20:58 -0700)
- fix thinko in pci_name_bus (pointed out by DaveM);
- prevent 8-bit bus number overflow inside the hose;
- remove first_busno/last_busno fields from struct pci_controller,
  as it's a duplicate of the info in associated struct pci_bus.

Ivan.

arch/alpha/kernel/core_marvel.c
arch/alpha/kernel/core_mcpcia.c
arch/alpha/kernel/core_tsunami.c
arch/alpha/kernel/core_wildfire.c
arch/alpha/kernel/pci.c
arch/alpha/kernel/sys_dp264.c
arch/alpha/kernel/sys_nautilus.c
include/asm-alpha/pci.h

index 52d27b27ebe5649964c356667a523dd1586ab1bb..705eb73b33ae68cbb98e92f7e7553bcd6f03ff90 100644 (file)
@@ -524,7 +524,7 @@ mk_conf_addr(struct pci_bus *pbus, unsigned int devfn, int where)
        if (!io7_port->enabled)
                return addr;
 
-       if (hose->first_busno == bus) {
+       if (hose->bus == pbus) {
                /* Don't support idsel > 20 on primary bus.  */
                if (devfn >= PCI_DEVFN(21, 0))
                        return addr;
index 6dbf404aa549595ac24a1014f01a2df11b6a3cff..015cac37e053cc7f22aa49864a4c035a9438f959 100644 (file)
@@ -185,7 +185,7 @@ mk_conf_addr(struct pci_bus *pbus, unsigned int devfn, int where,
        /* Type 1 configuration cycle for *ALL* busses.  */
        *type1 = 1;
 
-       if (bus == hose->first_busno)
+       if (hose->bus == pbus)
                bus = 0;
        addr = (bus << 16) | (devfn << 8) | (where);
        addr <<= 5; /* swizzle for SPARSE */
index de1565887da37afbfcda3dd4740423fcfcda6433..ba0207a28d5cd4d62f67176c0fa3b55dd8dd6806 100644 (file)
@@ -101,7 +101,7 @@ mk_conf_addr(struct pci_bus *pbus, unsigned int device_fn, int where,
                 "pci_addr=0x%p, type1=0x%p)\n",
                 bus, device_fn, where, pci_addr, type1));
 
-       if (hose->first_busno == bus)
+       if (hose->bus == pbus)
                bus = 0;
        *type1 = (bus != 0);
 
index ea9d546afcda21de44bfd0d2242ea59b105bb434..aa4717e880be81ee58c4a822552f81e475d961eb 100644 (file)
@@ -367,7 +367,7 @@ mk_conf_addr(struct pci_bus *pbus, unsigned int device_fn, int where,
                 "pci_addr=0x%p, type1=0x%p)\n",
                 bus, device_fn, where, pci_addr, type1));
 
-       if (hose->first_busno == bus)
+       if (hose->bus == pbus)
                bus = 0;
        *type1 = (bus != 0);
 
index 1fcc0ac7312e31b057f842fb24fb052b65ccf85a..97028300b931db3d3f79c8c9e745c4d0c9309b78 100644 (file)
@@ -280,7 +280,7 @@ common_swizzle(struct pci_dev *dev, u8 *pinp)
 {
        struct pci_controller *hose = dev->sysdata;
 
-       if (dev->bus->number != hose->first_busno) {
+       if (dev->bus != hose->bus) {
                u8 pin = *pinp;
                do {
                        pin = bridge_swizzle(pin, PCI_SLOT(dev->devfn));
@@ -398,15 +398,20 @@ common_init_pci(void)
        struct pci_controller *hose;
        struct pci_bus *bus;
        int next_busno;
+       int need_domain_info = 0;
 
        /* Scan all of the recorded PCI controllers.  */
        for (next_busno = 0, hose = hose_head; hose; hose = hose->next) {
-               hose->first_busno = next_busno;
-               hose->last_busno = 0xff;
                bus = pci_scan_bus(next_busno, alpha_mv.pci_ops, hose);
                hose->bus = bus;
-               next_busno = hose->last_busno = bus->subordinate;
-               next_busno += 1;
+               hose->need_domain_info = need_domain_info;
+               next_busno = bus->subordinate + 1;
+               /* Don't allow 8-bit bus number overflow inside the hose -
+                  reserve some space for bridges. */ 
+               if (next_busno > 224) {
+                       next_busno = 0;
+                       need_domain_info = 1;
+               }
        }
 
        if (pci_probe_only)
index 0b77aa68722ac70f4566750343f9cfef8b9fdd78..4437cf42dd9cb172e0d6129299722b3334f26445 100644 (file)
@@ -463,7 +463,7 @@ monet_swizzle(struct pci_dev *dev, u8 *pinp)
        struct pci_controller *hose = dev->sysdata;
        int slot, pin = *pinp;
 
-       if (hose->first_busno == dev->bus->number) {
+       if (hose->bus == dev->bus) {
                slot = PCI_SLOT(dev->devfn);
        }
        /* Check for the built-in bridge on hose 1. */
index 53bbe02b424636846f5991714c2a99e18ec1d4d0..32bfb659fbfbb6bd27b7209cfa12c75f444b4b77 100644 (file)
@@ -200,7 +200,6 @@ nautilus_init_pci(void)
        /* Scan our single hose.  */
        bus = pci_scan_bus(0, alpha_mv.pci_ops, hose);
        hose->bus = bus;
-       hose->last_busno = bus->subordinate;
 
        irongate = pci_find_slot(0, 0);
        bus->self = irongate;
index b203d40b9282d3a1e541582087d4ce6976c2010a..2289a5350d41456c5e6673062ae885a3049bfb6f 100644 (file)
@@ -37,8 +37,9 @@ struct pci_controller {
        unsigned long config_space_base;
 
        unsigned int index;
-       unsigned int first_busno;
-       unsigned int last_busno;
+       /* For compatibility with current (as of July 2003) pciutils
+          and XFree86. Eventually will be removed. */
+       unsigned int need_domain_info;
 
        struct pci_iommu_arena *sg_pci;
        struct pci_iommu_arena *sg_isa;
@@ -194,15 +195,14 @@ pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
 
 #define pci_domain_nr(bus) ((struct pci_controller *)(bus)->sysdata)->index
 
-/* Bus number == domain number until we get above 256 busses */
 static inline int pci_name_bus(char *name, struct pci_bus *bus)
 {
-       int domain = pci_domain_nr(bus);
+       struct pci_controller *hose = bus->sysdata;
 
-       if (domain < 256) {
-               sprintf(name, "%02x", domain);
+       if (likely(hose->need_domain_info == 0)) {
+               sprintf(name, "%02x", bus->number);
        } else {
-               sprintf(name, "%04x:%02x", domain, bus->number);
+               sprintf(name, "%04x:%02x", hose->index, bus->number);
        }
        return 0;
 }