Commit 08e8ead7 authored by Ivan Kokshaysky's avatar Ivan Kokshaysky Committed by Richard Henderson

[PATCH] alpha: pci domains update

- 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.
parent 3a2b9514
...@@ -524,7 +524,7 @@ mk_conf_addr(struct pci_bus *pbus, unsigned int devfn, int where) ...@@ -524,7 +524,7 @@ mk_conf_addr(struct pci_bus *pbus, unsigned int devfn, int where)
if (!io7_port->enabled) if (!io7_port->enabled)
return addr; return addr;
if (hose->first_busno == bus) { if (hose->bus == pbus) {
/* Don't support idsel > 20 on primary bus. */ /* Don't support idsel > 20 on primary bus. */
if (devfn >= PCI_DEVFN(21, 0)) if (devfn >= PCI_DEVFN(21, 0))
return addr; return addr;
......
...@@ -185,7 +185,7 @@ mk_conf_addr(struct pci_bus *pbus, unsigned int devfn, int where, ...@@ -185,7 +185,7 @@ mk_conf_addr(struct pci_bus *pbus, unsigned int devfn, int where,
/* Type 1 configuration cycle for *ALL* busses. */ /* Type 1 configuration cycle for *ALL* busses. */
*type1 = 1; *type1 = 1;
if (bus == hose->first_busno) if (hose->bus == pbus)
bus = 0; bus = 0;
addr = (bus << 16) | (devfn << 8) | (where); addr = (bus << 16) | (devfn << 8) | (where);
addr <<= 5; /* swizzle for SPARSE */ addr <<= 5; /* swizzle for SPARSE */
......
...@@ -101,7 +101,7 @@ mk_conf_addr(struct pci_bus *pbus, unsigned int device_fn, int where, ...@@ -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", "pci_addr=0x%p, type1=0x%p)\n",
bus, device_fn, where, pci_addr, type1)); bus, device_fn, where, pci_addr, type1));
if (hose->first_busno == bus) if (hose->bus == pbus)
bus = 0; bus = 0;
*type1 = (bus != 0); *type1 = (bus != 0);
......
...@@ -367,7 +367,7 @@ mk_conf_addr(struct pci_bus *pbus, unsigned int device_fn, int where, ...@@ -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", "pci_addr=0x%p, type1=0x%p)\n",
bus, device_fn, where, pci_addr, type1)); bus, device_fn, where, pci_addr, type1));
if (hose->first_busno == bus) if (hose->bus == pbus)
bus = 0; bus = 0;
*type1 = (bus != 0); *type1 = (bus != 0);
......
...@@ -280,7 +280,7 @@ common_swizzle(struct pci_dev *dev, u8 *pinp) ...@@ -280,7 +280,7 @@ common_swizzle(struct pci_dev *dev, u8 *pinp)
{ {
struct pci_controller *hose = dev->sysdata; struct pci_controller *hose = dev->sysdata;
if (dev->bus->number != hose->first_busno) { if (dev->bus != hose->bus) {
u8 pin = *pinp; u8 pin = *pinp;
do { do {
pin = bridge_swizzle(pin, PCI_SLOT(dev->devfn)); pin = bridge_swizzle(pin, PCI_SLOT(dev->devfn));
...@@ -398,15 +398,20 @@ common_init_pci(void) ...@@ -398,15 +398,20 @@ common_init_pci(void)
struct pci_controller *hose; struct pci_controller *hose;
struct pci_bus *bus; struct pci_bus *bus;
int next_busno; int next_busno;
int need_domain_info = 0;
/* Scan all of the recorded PCI controllers. */ /* Scan all of the recorded PCI controllers. */
for (next_busno = 0, hose = hose_head; hose; hose = hose->next) { 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); bus = pci_scan_bus(next_busno, alpha_mv.pci_ops, hose);
hose->bus = bus; hose->bus = bus;
next_busno = hose->last_busno = bus->subordinate; hose->need_domain_info = need_domain_info;
next_busno += 1; 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) if (pci_probe_only)
......
...@@ -463,7 +463,7 @@ monet_swizzle(struct pci_dev *dev, u8 *pinp) ...@@ -463,7 +463,7 @@ monet_swizzle(struct pci_dev *dev, u8 *pinp)
struct pci_controller *hose = dev->sysdata; struct pci_controller *hose = dev->sysdata;
int slot, pin = *pinp; int slot, pin = *pinp;
if (hose->first_busno == dev->bus->number) { if (hose->bus == dev->bus) {
slot = PCI_SLOT(dev->devfn); slot = PCI_SLOT(dev->devfn);
} }
/* Check for the built-in bridge on hose 1. */ /* Check for the built-in bridge on hose 1. */
......
...@@ -200,7 +200,6 @@ nautilus_init_pci(void) ...@@ -200,7 +200,6 @@ nautilus_init_pci(void)
/* Scan our single hose. */ /* Scan our single hose. */
bus = pci_scan_bus(0, alpha_mv.pci_ops, hose); bus = pci_scan_bus(0, alpha_mv.pci_ops, hose);
hose->bus = bus; hose->bus = bus;
hose->last_busno = bus->subordinate;
irongate = pci_find_slot(0, 0); irongate = pci_find_slot(0, 0);
bus->self = irongate; bus->self = irongate;
......
...@@ -37,8 +37,9 @@ struct pci_controller { ...@@ -37,8 +37,9 @@ struct pci_controller {
unsigned long config_space_base; unsigned long config_space_base;
unsigned int index; unsigned int index;
unsigned int first_busno; /* For compatibility with current (as of July 2003) pciutils
unsigned int last_busno; and XFree86. Eventually will be removed. */
unsigned int need_domain_info;
struct pci_iommu_arena *sg_pci; struct pci_iommu_arena *sg_pci;
struct pci_iommu_arena *sg_isa; struct pci_iommu_arena *sg_isa;
...@@ -194,15 +195,14 @@ pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region, ...@@ -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 #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) 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) { if (likely(hose->need_domain_info == 0)) {
sprintf(name, "%02x", domain); sprintf(name, "%02x", bus->number);
} else { } else {
sprintf(name, "%04x:%02x", domain, bus->number); sprintf(name, "%04x:%02x", hose->index, bus->number);
} }
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment