From d1382cd365ee3bd499342fb2a7588a7080b421b5 Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Sat, 27 Apr 2002 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 2002-04-27 --- port/devpnp.c | 26 ++++++-------------------- port/qlock.c | 6 +++--- 2 files changed, 9 insertions(+), 23 deletions(-) diff --git a/port/devpnp.c b/port/devpnp.c index af995a0f641cb48c9040dda6b5e8aface0d7a20f..27aa14c30195ddf3772c850ef973d92ac42d7107 100644 --- a/port/devpnp.c +++ b/port/devpnp.c @@ -3,11 +3,10 @@ * * TODO * - implement PNP card configuration (setting io bases etc) - * - implement PCI raw access to configuration space + * - write user program to drive PNP configuration... + * - extend PCI raw access to configuration space (writes, byte/short access?) * - implement PCI access to memory/io space/BIOS ROM - * - use c->aux instead of performing lookup on each read/write - * - * I also need to write the user program that'll drive the PNP configuration... + * - use c->aux instead of performing lookup on each read/write? */ #include "u.h" #include "../port/lib.h" @@ -601,6 +600,7 @@ pnpwrite(Chan *c, void *a, long n, vlong) if(!pnpscan(port, 0)) error("no cards found"); qunlock(&pnp); + poperror(); } else if(strncmp(buf, "debug ", 6) == 0) pnp.debug = strtoul(buf+6, 0, 0); @@ -624,22 +624,8 @@ pnpwrite(Chan *c, void *a, long n, vlong) static int wrconfig(Card *c, char *cmd) { - for(;;) { - while(*cmd == ' ' || *cmd == '\t' || *cmd == '\n') - cmd++; - if(*cmd == '\0') - break; - if(strncmp(cmd, "foo ", 4) == 0) { - print("pnp%d: got foo\n", c->csn); - cmd += 4; - } - else if(strncmp(cmd, "bar ", 4) == 0) { - print("pnp%d: got bar\n", c->csn); - cmd += 4; - } - else - return 0; - } + /* This should implement setting of I/O bases, etc */ + USED(c, cmd); return 1; } diff --git a/port/qlock.c b/port/qlock.c index c18482d870abcd1e53a32d0042e5bad5b7679d83..629fcd4d6b5a7dedb9427d5c8843dc6dd909a476 100644 --- a/port/qlock.c +++ b/port/qlock.c @@ -18,11 +18,9 @@ qlock(QLock *q) { Proc *p; - if(up == 0) - panic("qlock"); if(m->ilockdepth != 0) print("qlock: %lux: ilockdepth %d", getcallerpc(&q), m->ilockdepth); - if(up->nlocks) + if(up != nil && up->nlocks) print("qlock: %lux: nlocks %lud", getcallerpc(&q), up->nlocks); lock(&q->use); @@ -32,6 +30,8 @@ qlock(QLock *q) unlock(&q->use); return; } + if(up == 0) + panic("qlock"); rwstats.qlockq++; p = q->tail; if(p == 0)