allow pci_ioctl to work with multi-hose alphas.

Rather than teaching pci_ioctl about hoses, we just pass down a magic number
& let the platform code figure out what the hose is based on what the bus
number is.

concept approved by dfr
This commit is contained in:
Andrew Gallatin 1999-10-12 22:10:53 +00:00
parent 25afb89b1c
commit da7ca2d9bd
5 changed files with 31 additions and 9 deletions

View File

@ -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; \

View File

@ -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)
{

View File

@ -28,3 +28,4 @@
extern void tsunami_init(void);
extern int tsunami_bus_within_hose(int, int);
extern int tsunami_hose_from_bus(int);

View File

@ -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;

View File

@ -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;