M boot/boot.c => boot/boot.c +7 -3
@@ 149,7 149,7 @@ rootserver(char *arg)
char reply[64];
Method *mp;
char *cp;
- int n;
+ int n, j;
int notfirst;
mp = method;
@@ 165,9 165,13 @@ rootserver(char *arg)
for(notfirst = 0;; notfirst = 1){
if(pflag || notfirst)
outin(prompt, reply, sizeof(reply));
+ cp = strchr(reply, '!');
+ if(cp)
+ j = cp - reply;
+ else
+ j = strlen(reply);
for(mp = method; mp->name; mp++)
- if(*reply == *mp->name){
- cp = strchr(reply, '!');
+ if(strncmp(reply, mp->name, j) == 0){
if(cp)
strcpy(sys, cp+1);
return mp;
M pc/dat.h => pc/dat.h +2 -0
@@ 186,3 186,5 @@ extern int flipD[]; /* for flipping bitblt destination polarity */
* bootline passed by boot program
*/
#define BOOTLINE ((char *)0x80000100)
+
+extern char machtype[];
M pc/devether.c => pc/devether.c +23 -18
@@ 693,7 693,6 @@ int intrmap[] =
9, 3, 5, 7, 10, 11, 15, 4,
};
-
/*
* get configuration parameters, enable memory
*/
@@ 702,18 701,28 @@ wd8013reset(Ctlr *cp)
{
Hw *hw = cp->hw;
int i;
- uchar msr;
- uchar icr;
- uchar laar;
- uchar irr;
+ uchar msr, icr, laar, irr;
ulong ram;
- msr = IN(hw, msr);
- icr = IN(hw, icr);
- irr = IN(hw, irr);
- laar = IN(hw, laar);
-
- if(msr == 0xff || icr == 0xff || irr == 0xff || laar == 0xff)
+ /* find the ineterface */
+ SET(msr, icr, irr, laar);
+ for(hw->addr = 0x200; hw->addr < 0x400; hw->addr += 0x20){
+ msr = IN(hw, msr);
+ icr = IN(hw, icr);
+ irr = IN(hw, irr);
+ laar = IN(hw, laar);
+ if((msr&0x80) || (icr&0xf0) || irr == 0xff || laar == 0xff)
+ continue; /* nothing there */
+
+ /* ethernet address */
+ for(i = 0; i < sizeof(cp->ea); i++)
+ cp->ea[i] = IN(hw, lan[i]);
+
+ /* look for an elite ether address */
+ if(cp->ea[0] == 0x00 && cp->ea[1] == 0x00 && cp->ea[2] == 0xC0)
+ break;
+ }
+ if(hw->addr >= 0x400)
return -1;
if(cp->rb == 0){
@@ 723,10 732,6 @@ wd8013reset(Ctlr *cp)
cp->ntb = Ntb;
}
- /* ethernet address */
- for(i = 0; i < sizeof(cp->ea); i++)
- cp->ea[i] = IN(hw, lan[i]);
-
/* 16 bit operation? */
hw->bt16 = icr & 0x1;
@@ 751,7 756,7 @@ wd8013reset(Ctlr *cp)
hw->pstart = HOWMANY(sizeof(Etherpkt), 256);
hw->pstop = HOWMANY(hw->size, 256);
-/* print("ether width %d addr %lux size %d lvl %d\n", hw->bt16?16:8,
+print("elite at %lux width %d addr %lux size %d lvl %d\n", hw->addr, hw->bt16?16:8,
hw->ram, hw->size, hw->lvl);/**/
/* enable interface RAM, set interface width */
@@ 902,7 907,8 @@ wd8013receive(Ctlr *cp)
OUT(hw, w.cr, Page0|RD2|STA);
if(next == curr)
break;
- waitfordma(hw);
+ if(strcmp(machtype, "NCRD.0") == 0)
+ waitfordma(hw);
cp->inpackets++;
p = &((Ring*)hw->ram)[next];
len = ((p->len1<<8)|p->len0)-4;
@@ 1009,5 1015,4 @@ static Hw wd8013 =
wd8013transmit,
wd8013intr,
wd8013tweek,
- 0x360, /* I/O base address */
};
M pc/fns.h => pc/fns.h +0 -1
@@ 33,7 33,6 @@ void idle(void);
int inb(int);
void inss(int, void*, int);
void kbdinit(void);
-void ksetpcinfo(void);
void mathinit(void);
void mmuinit(void);
int modem(int);
M pc/kbd.c => pc/kbd.c +6 -3
@@ 295,19 295,23 @@ mouseres(int res)
}
}
+static int shift;
+
/*
* mouse message is three bytes
*
* byte 0 - 0 0 SDY SDX 1 M R L
* byte 1 - DX
* byte 2 - DY
+ *
+ * shift & left button is the same as middle button
*/
static void
mymouseputc(int c)
{
static short msg[3];
static int nb;
- static uchar b[] = {0, 1, 4, 5, 2, 3, 6, 7};
+ static uchar b[] = {0, 1, 4, 5, 2, 3, 6, 7, 0, 1, 2, 5, 2, 3, 6, 7 };
static lastdx, lastdy;
extern Mouseinfo mouse;
@@ 325,7 329,7 @@ mymouseputc(int c)
if(msg[0] & 0x20)
msg[2] |= 0xFF00;
- mousebuttons = b[msg[0]&7];
+ mousebuttons = b[(msg[0]&7) | (shift ? 8 : 0)];
mouse.newbuttons = mousebuttons | keybuttons;
mouse.dx = msg[1];
mouse.dy = -msg[2];
@@ 369,7 373,6 @@ kbdintr0(void)
{
int s, c, i, nk;
static int esc1, esc2;
- static int shift;
static int caps;
static int ctl;
static int num;
M pc/main.c => pc/main.c +17 -3
@@ 6,6 6,7 @@
#include "io.h"
#include "ureg.h"
#include "init.h"
+#include <ctype.h>
/* configuration parameters */
enum
@@ 21,6 22,7 @@ enum
};
int pmutype;
int resettype;
+char machtype[9];
uchar *sp; /* stack pointer for /boot */
@@ 62,11 64,19 @@ void
ident(void)
{
char *id = (char*)(ROMBIOS + 0xFF40);
+ int i;
- if(strncmp(id, "AT&TNSX", 7) == 0){
+ for(i = 0; i < 8; i++){
+ if(isprint(id[i]) == 0)
+ break;
+ machtype[i] = id[i];
+ }
+ if(i == 0)
+ strcpy(machtype, "generic");
+ if(strcmp(machtype, "AT&TNSX") == 0){
pmutype = PMUnsx20;
resettype = Resetheadland;
- }else if(strncmp(id, "NCRD.0", 6) == 0){
+ }else if(strcmp(machtype, "NCRD.0") == 0){
resettype = Reset8042;
}
}
@@ 87,6 97,8 @@ ulong garbage;
void
init0(void)
{
+ char tstr[32];
+
u->nerrlab = 0;
m->proc = u->p;
u->p->state = Running;
@@ 105,7 117,9 @@ init0(void)
chandevinit();
if(!waserror()){
- ksetpcinfo();
+ strcpy(tstr, machtype);
+ strcat(tstr, " %s");
+ ksetterm(tstr);
ksetenv("cputype", "386");
poperror();
}
M pc/trap.c => pc/trap.c +2 -1
@@ 235,7 235,8 @@ trap(Ureg *ur)
panic("%s pc=0x%lux", excname[v], ur->pc);
}
}
- panic("bad trap type %d pc=0x%lux\n", v, ur->pc);
+ print("bad trap type %d pc=0x%lux\n", v, ur->pc);
+ return;
}
(*ivec[v])(ur);