diff --git a/sys/alpha/pci/tsunami.c b/sys/alpha/pci/tsunami.c index 48cdd457e94..5468a62ca0d 100644 --- a/sys/alpha/pci/tsunami.c +++ b/sys/alpha/pci/tsunami.c @@ -275,9 +275,13 @@ tsunami_check_abort(void) KV(TSUNAMI_CONF(h) | ((b) << 16) | ((s) << 11) | ((f) << 8) | (r)) #define CFGREAD(h, b, s, f, r, op, width, type) \ - int bus = tsunami_bus_within_hose(h, b) ? b : 0; \ - vm_offset_t va = TSUNAMI_CFGADDR(bus, s, f, r, h); \ + int bus; \ + vm_offset_t va; \ type data; \ + if (h == (u_int8_t)-1) \ + h = tsunami_hose_from_bus(b); \ + bus = tsunami_bus_within_hose(h, b) ? b : 0; \ + va = TSUNAMI_CFGADDR(bus, s, f, r, h); \ tsunami_clear_abort(); \ if (badaddr((caddr_t)va, width)) { \ tsunami_check_abort(); \ @@ -289,8 +293,12 @@ tsunami_check_abort(void) return data; #define CFWRITE(h, b, s, f, r, data, op, width) \ - int bus = tsunami_bus_within_hose(h, b) ? b : 0; \ - vm_offset_t va = TSUNAMI_CFGADDR(bus, s, f, r, h); \ + int bus; \ + vm_offset_t va; \ + if (h == (u_int8_t)-1) \ + h = tsunami_hose_from_bus(b); \ + bus = tsunami_bus_within_hose(h, b) ? b : 0; \ + va = TSUNAMI_CFGADDR(bus, s, f, r, h); \ tsunami_clear_abort(); \ if (badaddr((caddr_t)va, width)) \ return; \ diff --git a/sys/alpha/pci/tsunami_pci.c b/sys/alpha/pci/tsunami_pci.c index 6f7af8820f1..634260c476d 100644 --- a/sys/alpha/pci/tsunami_pci.c +++ b/sys/alpha/pci/tsunami_pci.c @@ -41,7 +41,7 @@ static devclass_t pcib_devclass; -int tsunami_hoses[TSUNAMI_MAXHOSES] = {0,0,0,0}; +int tsunami_hoses[TSUNAMI_MAXHOSES+1] = {0,-1,-1,-1,-1}; int tsunami_bus_within_hose(int hose, int bus) @@ -49,6 +49,19 @@ tsunami_bus_within_hose(int hose, int bus) return(bus - tsunami_hoses[hose]); } +int +tsunami_hose_from_bus(int bus) +{ + int i; + for(i = 1; i <= TSUNAMI_MAXHOSES && tsunami_hoses[i] != -1; i++){ + if(tsunami_hoses[i] > bus) + return i-1; + } + return i-1; + +} + + static int tsunami_pcib_probe(device_t dev) { diff --git a/sys/alpha/pci/tsunamivar.h b/sys/alpha/pci/tsunamivar.h index f82351f702f..89cb2aba65c 100644 --- a/sys/alpha/pci/tsunamivar.h +++ b/sys/alpha/pci/tsunamivar.h @@ -28,3 +28,4 @@ extern void tsunami_init(void); extern int tsunami_bus_within_hose(int, int); +extern int tsunami_hose_from_bus(int); diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c index 4305b6cfd81..bfdf9d0452e 100644 --- a/sys/dev/pci/pci.c +++ b/sys/dev/pci/pci.c @@ -845,7 +845,7 @@ pci_ioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) case 4: case 2: case 1: - probe.hose = 0; /* XXXXX */ + probe.hose = -1; probe.bus = io->pi_sel.pc_bus; probe.slot = io->pi_sel.pc_dev; probe.func = io->pi_sel.pc_func; @@ -866,7 +866,7 @@ pci_ioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) case 4: case 2: case 1: - probe.hose = 0; /* XXXXX */ + probe.hose = -1; probe.bus = io->pi_sel.pc_bus; probe.slot = io->pi_sel.pc_dev; probe.func = io->pi_sel.pc_func; diff --git a/sys/pci/pci.c b/sys/pci/pci.c index 4305b6cfd81..bfdf9d0452e 100644 --- a/sys/pci/pci.c +++ b/sys/pci/pci.c @@ -845,7 +845,7 @@ pci_ioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) case 4: case 2: case 1: - probe.hose = 0; /* XXXXX */ + probe.hose = -1; probe.bus = io->pi_sel.pc_bus; probe.slot = io->pi_sel.pc_dev; probe.func = io->pi_sel.pc_func; @@ -866,7 +866,7 @@ pci_ioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) case 4: case 2: case 1: - probe.hose = 0; /* XXXXX */ + probe.hose = -1; probe.bus = io->pi_sel.pc_bus; probe.slot = io->pi_sel.pc_dev; probe.func = io->pi_sel.pc_func;