diff options
Diffstat (limited to 'sys/pci')
-rw-r--r-- | sys/pci/pci.c | 46 |
1 files changed, 37 insertions, 9 deletions
diff --git a/sys/pci/pci.c b/sys/pci/pci.c index bbb9dff..349778f 100644 --- a/sys/pci/pci.c +++ b/sys/pci/pci.c @@ -56,6 +56,10 @@ #include <pci/pcivar.h> #include <sys/pciio.h> +#ifdef __alpha__ +#include <machine/rpb.h> +#endif + #ifdef APIC_IO #include <machine/smp.h> #endif /* APIC_IO */ @@ -1034,17 +1038,41 @@ pci_add_map(device_t dev, pcicfgregs* cfg, int reg) * can deal with multiple hoses */ - if(cfg->hose){ - if (base & 0x80000000) { - printf("base addr = 0x%lx\n", base); - printf("hacked addr = 0x%lx\n", - base | ((u_int64_t)cfg->hose << 31)); - + if (cfg->hose) { + u_int32_t mask, shift, maxh; + + switch (hwrpb->rpb_type) { + case ST_DEC_21000: + case ST_DEC_4100: + mask = 0xf8000000; + shift = 27; + maxh = 32; + break; + case ST_DEC_6600: + mask = 0x80000000; + shift = 31; + maxh = 2; + break; + default: + mask = 0; + shift = 0; + maxh = 0; + break; + } + if (base & mask) { + printf("base addr = 0x%llx\n", (long long) base); + printf("mask addr = 0x%lx\n", (long) mask); + printf("hacked addr = 0x%llx\n", (long long) + (base | ((u_int64_t)cfg->hose << shift))); panic("hose encoding hack would clobber base addr"); + /* NOTREACHED */ + } + if (cfg->hose >= maxh) { + panic("Hose %d - can only encode %d hose(s)", + cfg->hose, maxh); + /* NOTREACHED */ } - if (cfg->hose > 1) - panic("only one hose supported!"); - base |= ((u_int64_t)cfg->hose << 31); + base |= ((u_int64_t)cfg->hose << shift); } #endif if (type == SYS_RES_IOPORT && !pci_porten(cfg)) |