From def14cb134adf0fb42d45d20c651a6140c8849d9 Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Wed, 3 Jul 2002 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 2002-07-03 --- bitsy/dat.h | 2 +- bitsy/devether.c | 2 +- bitsy/devpcmcia.c | 2 +- pc/dat.h | 16 ++++++++-------- pc/devarch.c | 13 +++++++------ pc/devether.c | 2 +- pc/fns.h | 13 ++++++------- pc/i8253.c | 2 +- pc/kbd.c | 1 - pc/l.s | 10 ---------- pc/main.c | 4 ++-- pc/memory.c | 15 +-------------- pc/sdata.c | 2 +- pc/wavelan.c | 4 ++-- port/devsd.c | 6 +++--- 15 files changed, 35 insertions(+), 59 deletions(-) diff --git a/bitsy/dat.h b/bitsy/dat.h index 47e2da42fc0739337e153adbced5110ff6a77195..80a1ace180b95c9e4a64574213a404e7a813203c 100644 --- a/bitsy/dat.h +++ b/bitsy/dat.h @@ -262,6 +262,6 @@ struct DevConf ulong port; /* mapped i/o regs */ int size; /* access size */ int itype; /* type of interrupt */ - ulong intnum; /* interrupt number */ + ulong irq; /* interrupt number */ char *type; /* card type, mallocated */ }; diff --git a/bitsy/devether.c b/bitsy/devether.c index f0b904d94be943b4f313e83355f833af9b8d9613..3be71ffd95a405a28ae8dc755e3e4f4a08cd6564 100644 --- a/bitsy/devether.c +++ b/bitsy/devether.c @@ -110,7 +110,7 @@ etherconfig(int on, char *spec, DevConf *cf) ether->maxmtu = ETHERMAXTU; if(ether->interrupt != nil) - intrenable(cf->itype, cf->intnum, ether->interrupt, ether, name); + intrenable(cf->itype, cf->irq, ether->interrupt, ether, name); p = buf; e = buf+sizeof(buf); diff --git a/bitsy/devpcmcia.c b/bitsy/devpcmcia.c index 13a83002f8dbbe20a6e57fe2ec558c25ba0e4e09..7d7dd5140767b58d4a772e1fe7c82b1c2032e059 100644 --- a/bitsy/devpcmcia.c +++ b/bitsy/devpcmcia.c @@ -338,7 +338,7 @@ pcmctlwrite(char *p, long n, ulong, PCMslot *sp) cf.mem = (ulong)sp->mem; cf.port = (ulong)sp->regs; cf.itype = GPIOfalling; - cf.intnum = bitno(sp == slot ? GPIO_CARD_IRQ0_i : GPIO_CARD_IRQ1_i); + cf.irq = bitno(sp == slot ? GPIO_CARD_IRQ0_i : GPIO_CARD_IRQ1_i); if(devtab[dtx]->config(1, p, &cf) < 0) error("couldn't configure device"); sp->dev = devtab[dtx]; diff --git a/pc/dat.h b/pc/dat.h index 0c94fb0644abcb8cf20cd16028f48c6c20d34195..725e3bba0accca4f28f64c3debff1251cf5312e6 100644 --- a/pc/dat.h +++ b/pc/dat.h @@ -29,7 +29,7 @@ struct Lock ulong key; ulong sr; ulong pc; - Proc * p; + Proc *p; ushort isilock; }; @@ -177,7 +177,7 @@ struct Mach int intr; vlong intrts; /* time stamp of last interrupt */ int flushmmu; /* make current proc flush it's mmu state */ - int ilockdepth; + int ilockdepth; ulong spuriousintr; int lastintr; @@ -247,7 +247,7 @@ struct PCArch #define NISAOPT 8 struct ISAConf { - char *type; + char *type; ulong port; ulong irq; ulong dma; @@ -279,13 +279,13 @@ extern Mach *m; */ typedef struct { ulong port; - int size; + int size; } port_t; struct DevConf { - ulong interrupt; /* interrupt number */ - char *type; /* card type, malloced */ - int nports; /* Number of ports */ - port_t *ports; /* The ports themselves */ + ulong intnum; /* interrupt number */ + char *type; /* card type, malloced */ + int nports; /* Number of ports */ + port_t *ports; /* The ports themselves */ }; diff --git a/pc/devarch.c b/pc/devarch.c index bc0046e583d8a2dd91273f0e6f6128bb674b6723..db22b9de2f3c2e367cea9eed9a3c0236f1ad4eb8 100644 --- a/pc/devarch.c +++ b/pc/devarch.c @@ -11,7 +11,7 @@ typedef struct IOMap IOMap; struct IOMap { IOMap *next; - int reserved; + int reserved; char tag[13]; ulong start; ulong end; @@ -44,7 +44,7 @@ static Rdwrfn *readfn[Qmax]; static Rdwrfn *writefn[Qmax]; static Dirtab archdir[Qmax] = { - ".", { Qdir, 0, QTDIR }, 0, 0555, + ".", { Qdir, 0, QTDIR }, 0, 0555, "ioalloc", { Qioalloc, 0 }, 0, 0444, "iob", { Qiob, 0 }, 0, 0660, "iow", { Qiow, 0 }, 0, 0660, @@ -52,7 +52,7 @@ static Dirtab archdir[Qmax] = { }; Lock archwlock; /* the lock is only for changing archdir */ int narchdir = Qbase; -int (*_pcmspecial)(char *, ISAConf *); +int (*_pcmspecial)(char*, ISAConf*); void (*_pcmspecialclose)(int); @@ -109,7 +109,7 @@ ioinit(void) // a dummy entry at 2^16 ioalloc(0x10000, 1, 0, "dummy"); ioalloc(0x0fff, 1, 0, "dummy"); // i82557 is at 0x1000, the dummy - // entry is needed for swappable devs. + // entry is needed for swappable devs. if ((excluded = getconf("ioexclude")) != nil) { char *s; @@ -137,7 +137,8 @@ ioinit(void) } -// Reserve a range to be ioalloced later. This is in particular useful for exchangable cards, such +// Reserve a range to be ioalloced later. +// This is in particular useful for exchangable cards, such // as pcmcia and cardbus cards. int ioreserve(int port, int size, int align, char *tag) @@ -805,7 +806,7 @@ archinit(void) int pcmspecial(char *idstr, ISAConf *isa) { - return (_pcmspecial != nil)? _pcmspecial(idstr, isa): -1; + return (_pcmspecial != nil)? _pcmspecial(idstr, isa): -1; } /* diff --git a/pc/devether.c b/pc/devether.c index a2d68b52e928bde3d23d31df1b5f0634bf0eec9c..84172db49cb84e75f950235e418ccec25e1eb72e 100644 --- a/pc/devether.c +++ b/pc/devether.c @@ -328,7 +328,7 @@ parseether(uchar *to, char *from) int i; p = from; - for(i = 0; i < 6; i++){ + for(i = 0; i < Eaddrlen; i++){ if(*p == 0) return -1; nip[0] = *p++; diff --git a/pc/fns.h b/pc/fns.h index e9c1709bd4c5feb2cf066d1577cb3e07ac44b0f2..aac5ca4275347e4f9c350f77cff42c5ba9cbb93f 100644 --- a/pc/fns.h +++ b/pc/fns.h @@ -2,7 +2,6 @@ void aamloop(int); Dirtab* addarchfile(char*, int, long(*)(Chan*,void*,long,vlong), long(*)(Chan*,void*,long,vlong)); -//void addscsilink(char*, Scsiio (*)(int, ISAConf*)); void apicclkenable(void); void archinit(void); void bootargs(ulong); @@ -59,7 +58,7 @@ ushort ins(int); void inss(int, void*, int); ulong inl(int); void insl(int, void*, int); -void intrdisable(int, void (*)(Ureg *, void *), void*, int, char*); +void intrdisable(int, void (*)(Ureg *, void *), void*, int, char*); void intrenable(int, void (*)(Ureg*, void*), void*, int, char*); void iofree(int); void ioinit(void); @@ -95,16 +94,16 @@ void outss(int, void*, int); void outl(int, ulong); void outsl(int, void*, int); int pciscan(int, Pcidev **); -ulong pcibarsize(Pcidev *, int); +ulong pcibarsize(Pcidev *, int); int pcicfgr8(Pcidev*, int); int pcicfgr16(Pcidev*, int); int pcicfgr32(Pcidev*, int); void pcicfgw8(Pcidev*, int, int); void pcicfgw16(Pcidev*, int, int); void pcicfgw32(Pcidev*, int, int); -void pciclrbme(Pcidev*); +void pciclrbme(Pcidev*); void pcihinv(Pcidev*); -uchar pciipin(Pcidev *, uchar); +uchar pciipin(Pcidev *, uchar); Pcidev* pcimatch(Pcidev*, int, int); Pcidev* pcimatchtbdf(int); void pcireset(void); @@ -113,9 +112,9 @@ void pcmcisread(PCMslot*); int pcmcistuple(int, int, int, void*, int); PCMmap* pcmmap(int, ulong, int, int); int pcmspecial(char*, ISAConf*); -int (*_pcmspecial)(char *, ISAConf *); +int (*_pcmspecial)(char *, ISAConf *); void pcmspecialclose(int); -void (*_pcmspecialclose)(int); +void (*_pcmspecialclose)(int); void pcmunmap(int, PCMmap*); void printcpufreq(void); #define procrestore(p) diff --git a/pc/i8253.c b/pc/i8253.c index 63d21d13033fca7612faa2989cb6561c6fe4df96..34e96c569e5a29a9d412c6d9e19a5e0f2cb27683 100644 --- a/pc/i8253.c +++ b/pc/i8253.c @@ -210,7 +210,7 @@ i8253timerset(uvlong next) period = MaxPeriod; } - /* histeresis */ + /* hysteresis */ if(i8253.period != period){ ilock(&i8253); /* load new value */ diff --git a/pc/kbd.c b/pc/kbd.c index efc5fde59847502d707705f810984fc6a8370235..f59fbd050ce1ea5cfc483a70a4f25333acf16482 100644 --- a/pc/kbd.c +++ b/pc/kbd.c @@ -469,4 +469,3 @@ kbdenable(void) intrenable(IrqKBD, i8042intr, 0, BUSUNKNOWN, "kbd"); } - diff --git a/pc/l.s b/pc/l.s index a472dee93594d9fe4a163a7cf4d1531febbd2575..f58c31de59d57052840bdbbc26a538764d82d525 100644 --- a/pc/l.s +++ b/pc/l.s @@ -503,16 +503,6 @@ TEXT gotolabel(SB), $0 MOVL $1, AX /* return 1 */ RET -TEXT swaplabel(SB), $0 - MOVL label+0(FP), AX - MOVL pc+4(FP), BX - MOVL 0(AX), SP /* restore sp */ - MOVL 4(AX), CX /* put return pc on the stack */ - MOVL CX, 0(SP) - MOVL BX, 4(AX) /* put caller pc where return pc was */ - MOVL $1, AX /* return 1 */ - RET - TEXT setlabel(SB), $0 MOVL label+0(FP), AX MOVL SP, 0(AX) /* store sp */ diff --git a/pc/main.c b/pc/main.c index 90e450771eab573b119e33f4236831b37d5f790a..1d9642965a83f8d167af5c401c412163c818fd73 100644 --- a/pc/main.c +++ b/pc/main.c @@ -24,11 +24,11 @@ Mach *m; #define MAXCONF 64 char bootdisk[KNAMELEN]; -Conf conf; +Conf conf; char *confname[MAXCONF]; char *confval[MAXCONF]; int nconf; -uchar *sp; /* user stack of init proc */ +uchar *sp; /* user stack of init proc */ static void diff --git a/pc/memory.c b/pc/memory.c index e3f77f83b12f20bba0b9afdf6594b5da99072ae1..a10faa30d60c2b8786c6141894616902e0505ebd 100644 --- a/pc/memory.c +++ b/pc/memory.c @@ -266,19 +266,6 @@ umbscan(void) } } -int -touch(uchar *p, int n) -{ - int x; - int i; - - x = 0; - for(i=0; inports != 2) error(Ebadarg); - return ataprobe(cf->ports[0].port, cf->ports[1].port, cf->interrupt); + return ataprobe(cf->ports[0].port, cf->ports[1].port, cf->intnum); } static int diff --git a/pc/wavelan.c b/pc/wavelan.c index 45fe1b339a448e79eed1aeaa7d23391dc1b13df6..0ddda9a29107fef83713644208b2795cadea85f0 100644 --- a/pc/wavelan.c +++ b/pc/wavelan.c @@ -1127,8 +1127,8 @@ wavelanreset(Ether* ether, Ctlr *ctlr) ether->multicast = w_multicast; ether->arg = ether; - DEBUG("#l%d: intnum %ld port %lx type %s", - ether->ctlrno, ether->intnum, ether->port, ether->type); + DEBUG("#l%d: irq %ld port %lx type %s", + ether->ctlrno, ether->irq, ether->port, ether->type); DEBUG(" %2.2uX%2.2uX%2.2uX%2.2uX%2.2uX%2.2uX\n", ether->ea[0], ether->ea[1], ether->ea[2], ether->ea[3], ether->ea[4], ether->ea[5]); diff --git a/port/devsd.c b/port/devsd.c index 31bf5253a03a675b5d8c30b68640fc02ef43a845..85d68abf6ba5dc0e3ad786c2267487c59836d05a 100644 --- a/port/devsd.c +++ b/port/devsd.c @@ -1055,7 +1055,7 @@ parse_irq(confdata_t* cd, char* option) { char *e; - cd->o_cf.interrupt = strtoul(option, &e, 0); + cd->o_cf.intnum = strtoul(option, &e, 0); if(e == nil || *e != '\0') error(Ebadarg); } @@ -1123,7 +1123,7 @@ sdwrite(Chan* c, void* a, long n, vlong off) if(cd.o_on){ if(cd.o_spec == '\0' || cd.o_cf.nports == 0 || - cd.o_cf.interrupt == 0 || cd.o_cf.type == nil) + cd.o_cf.intnum == 0 || cd.o_cf.type == nil) error(Ebadarg); } else{ @@ -1337,7 +1337,7 @@ configure(char* spec, DevConf* cf) in sdata and I'll move it later. Really! */ memset(&isa, 0, sizeof(isa)); isa.port = cf->ports[0].port; - isa.irq = cf->interrupt; + isa.irq = cf->intnum; if(pcmspecial(p, &isa) < 0) error("Cannot find controller");