From f2c288ae6bbb621ccd53ada6bdae389fc837317b Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Sat, 22 Dec 2001 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 2001-12-22 --- mtx/dat.h | 17 +---------------- mtx/fns.h | 2 +- mtx/l.s | 4 ++++ mtx/mmu.c | 37 ++++++++++++++++++++++++++++++++----- pc/pcmciamodem.c | 7 +++++-- 5 files changed, 43 insertions(+), 24 deletions(-) diff --git a/mtx/dat.h b/mtx/dat.h index 98c9cff39574d9cd55e8bf622744d6ebd8a531a2..687c22a58bc27a6fb4646d5af13efad5883e3e23 100644 --- a/mtx/dat.h +++ b/mtx/dat.h @@ -93,7 +93,7 @@ struct Conf #define NCOLOR 1 struct PMMU { - int pidonmach[MAXMACH]; + int mmupid; }; /* @@ -169,21 +169,6 @@ struct short ispanic; }active; -/* - * Implementation-dependant functions (outside of PPC architecture proper). - * Called PCArch because that's what mkdevc calls it (for the PC). - */ -struct PCArch -{ - char* id; - int (*ident)(void); /* this should be in the model */ - - void (*intrinit)(void); - int (*intrenable)(Vctl*); - int (*intrvecno)(int); - int (*intrdisable)(int); -}; - /* * a parsed plan9.ini line */ diff --git a/mtx/fns.h b/mtx/fns.h index b9cec89d3289a35d6d6e6479aaf354ffd257cda8..8eeb741cbeed4fea55a8a7496fecd9fc09aaf723 100644 --- a/mtx/fns.h +++ b/mtx/fns.h @@ -93,7 +93,7 @@ void procsave(Proc*); void procsetup(Proc*); void putdec(ulong); void putmsr(ulong); -void putcasid(ulong); +void putsdr1(ulong); void raveninit(void); void screeninit(void); int screenprint(char*, ...); /* debugging */ diff --git a/mtx/l.s b/mtx/l.s index 9fe6677c87af96d05366282e5169a6a50ab411e5..409c47f08089cc63950f711b9731cd2bcde9d986 100644 --- a/mtx/l.s +++ b/mtx/l.s @@ -277,6 +277,10 @@ TEXT putmsr(SB), $0 MSRSYNC RETURN +TEXT putsdr1(SB), $0 + MOVW R3, SPR(SDR1) + RETURN + TEXT eieio(SB), $0 EIEIO RETURN diff --git a/mtx/mmu.c b/mtx/mmu.c index 3b339645344b97589e53317d4c15ffe857142553..9826af3440b970c1e7f13fcd6ad551e51f3eaa64 100644 --- a/mtx/mmu.c +++ b/mtx/mmu.c @@ -5,9 +5,26 @@ #include "fns.h" #include "io.h" +void *ptab; +ulong ptabsize; + void mmuinit(void) { + int lhash, mem; + extern ulong memsize; /* passed in from ROM monitor */ + + /* heuristically size the hash table */ + lhash = 10; /* log of hash table size */ + mem = (1<<23); + while(mem < memsize) { + lhash++; + mem <<= 1; + } + + ptabsize = (1<<(lhash+6)); + ptab = xspanalloc(ptabsize, 0, ptabsize); + putsdr1(PADDR(ptab) | ((1<<(lhash-10))-1)); } void @@ -27,23 +44,33 @@ flushmmu(void) void mmuswitch(Proc *p) { - int tp; + int mp; if(p->newtlb) { - memset(p->pidonmach, 0, sizeof p->pidonmach); + p->mmupid = 0; p->newtlb = 0; } - tp = p->pidonmach[m->machno]; -// putcasid(tp); + mp = p->mmupid; + if(mp == 0) + mp = newmmupid(); + +// for(i = 0; i < 8; i++) +// putsr(i, } void mmurelease(Proc* p) { - memset(p->pidonmach, 0, sizeof p->pidonmach); + p->mmupid = 0; } void putmmu(ulong va, ulong pa, Page *pg) { } + +int +newmmupid(void) +{ + return -1; +} diff --git a/pc/pcmciamodem.c b/pc/pcmciamodem.c index 0d6a7d84b4db9dbf8bea07f2ccfcf2c78c86bedf..dd52e12bb0dcc60c84bd974535e7b49ff2770dc7 100644 --- a/pc/pcmciamodem.c +++ b/pc/pcmciamodem.c @@ -31,7 +31,7 @@ void pcmciamodemlink(void) { ISAConf isa; - int i, j, slot, com2used; + int i, j, slot, com2used, usingcom2; i = 0; com2used = 0; @@ -46,18 +46,21 @@ pcmciamodemlink(void) memset(&isa, 0, sizeof(isa)); } + usingcom2 = 0; if (isa.irq == 0 && isa.port == 0) { if (com2used == 0) { /* default is COM2 */ isa.irq = 3; isa.port = 0x2F8; - com2used++; + usingcom2 = 1; } else break; } slot = pcmspecial(modems[j], &isa); if(slot >= 0){ + if(usingcom2) + com2used = 1; if(ioalloc(isa.port, 8, 0, modems[j]) < 0) print("%s port %lux already in use\n", modems[j], isa.port); print("%s in pcmcia slot %d port 0x%lux irq %lud\n",