|
|
1.1 ! root 1: /* ! 2: * stuff for dealing with io nexus on stars ! 3: * probably nearly identical to 8600 ! 4: */ ! 5: ! 6: #include "sys/param.h" ! 7: #include "sys/nexus.h" ! 8: #include "sys/nxaddr.h" ! 9: #include "sys/pte.h" ! 10: ! 11: static int nexcnt; ! 12: char *iospace; /* an array of struct nexus */ ! 13: ! 14: static int nexreg(), nexwind(); ! 15: ! 16: /* ! 17: * how much address space ! 18: * is needed for nexus space? ! 19: * needed when allocating system page table ! 20: */ ! 21: ! 22: mchiopsize() ! 23: { ! 24: register int i; ! 25: ! 26: for (i = 0; nextab[i].bus >= 0; i++) ! 27: ; ! 28: nexcnt = i; ! 29: return (i * sizeof(struct nexus)); ! 30: } ! 31: ! 32: /* ! 33: * map appropriate parts of nexus space into kernel space ! 34: * called early on, before memory mapping is set up ! 35: * argument is the first relevant spt entry ! 36: */ ! 37: ! 38: mchiopinit(pt) ! 39: struct pte *pt; ! 40: { ! 41: register long *p; ! 42: register int i, n; ! 43: register int b; ! 44: ! 45: p = (long *)pt; ! 46: for (i = 0; i < nexcnt; i++) { ! 47: b = nexreg(&nextab[i]); ! 48: for (n = 0; n < btoc(NXSIZE); n++) ! 49: if (b) ! 50: *p++ = PG_V|PG_KW|(b+n); ! 51: else ! 52: *p++ = 0; ! 53: b = nexwind(&nextab[i]); ! 54: for (n = 0; n < btoc(NXWSIZE); n++) ! 55: if (b) ! 56: *p++ = PG_V|PG_KW|(b+n); ! 57: else ! 58: *p++ = 0; ! 59: } ! 60: } ! 61: ! 62: static ! 63: nexreg(n) ! 64: register struct nextab *n; ! 65: { ! 66: if (n->bus) ! 67: return (0); /* only one SBI */ ! 68: if (n->adp >= 16) ! 69: return (0); ! 70: return (btoc(n->adp * NXSIZE + 0x20000000)); ! 71: } ! 72: ! 73: #define FIRSTUBA 3 ! 74: #define LASTUBA (FIRSTUBA+4) ! 75: ! 76: static ! 77: nexwind(n) ! 78: register struct nextab *n; ! 79: { ! 80: if (n->bus) ! 81: return (0); /* only one SBI */ ! 82: if (n->adp < FIRSTUBA || n->adp > LASTUBA) ! 83: return (0); /* only UBAs have windows */ ! 84: return (btoc(0x20100000+(n->adp - FIRSTUBA)*01000000)); ! 85: } ! 86: ! 87: caddr_t ! 88: nxaddr(np) ! 89: register struct nxaddr *np; ! 90: { ! 91: if (np->adno != 0) ! 92: return (0); ! 93: if (np->nexus < 0 || np->nexus >= nexcnt) ! 94: return (0); ! 95: return((caddr_t)(iospace + np->nexus*sizeof(struct nexus))); ! 96: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.