Adopt to the RPB changes. Complete change of how network devices are
handled. No more hacks to find bus addresses.
This commit is contained in:
parent
c5f56fab00
commit
027ee49b0f
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: autoconf.c,v 1.10 2000/05/08 17:06:48 ragge Exp $ */
|
||||
/* $NetBSD: autoconf.c,v 1.11 2000/05/20 13:35:07 ragge Exp $ */
|
||||
/*
|
||||
* Copyright (c) 1994, 1998 Ludd, University of Lule}, Sweden.
|
||||
* All rights reserved.
|
||||
@ -33,45 +33,26 @@
|
||||
|
||||
|
||||
|
||||
#include "sys/param.h"
|
||||
#include <sys/param.h>
|
||||
|
||||
#include <lib/libsa/stand.h>
|
||||
|
||||
#include "../include/mtpr.h"
|
||||
#include "../include/sid.h"
|
||||
#include "../include/trap.h"
|
||||
#include "../include/frame.h"
|
||||
#include "../include/rpb.h"
|
||||
|
||||
#include "vaxstand.h"
|
||||
|
||||
int nmba=0, nuba=0, nbi=0,nsbi=0,nuda=0;
|
||||
int *mbaaddr, *ubaaddr, *biaddr;
|
||||
int *udaaddr, *uioaddr, tmsaddr, *bioaddr;
|
||||
|
||||
static int mba750[]={0xf28000,0xf2a000,0xf2c000};
|
||||
static int uba750[]={0xf30000,0xf32000};
|
||||
static int uio750[]={0xfc0000,0xf80000};
|
||||
static int uda750[]={0772150};
|
||||
|
||||
/* 11/780's only have 4, 8600 have 8 of these. */
|
||||
/* XXX - all of these should be bound to physical addresses */
|
||||
static int mba780[]={0x20010000,0x20012000,0x20014000,0x20016000,
|
||||
0x22010000,0x22012000,0x22014000,0x22016000};
|
||||
static int uba780[]={0, 0, 0, 0x20006000,0x20008000,0x2000a000,0x2000c000, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0x22006000,0x22008000,0x2200a000,0x2200c000};
|
||||
static int uio780[]={0, 0, 0, 0x20100000,0x20140000,0x20180000,0x201c0000, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0x22100000,0x22140000,0x22180000,0x221c0000};
|
||||
static int bi8200[]={0x20000000, 0x22000000, 0x24000000, 0x26000000,
|
||||
0x28000000, 0x2a000000};
|
||||
static int bio8200[]={0x20400000};
|
||||
|
||||
static int uba630[]={0x20087800};
|
||||
static int uio630[]={0x30000000};
|
||||
#define qbdev(csr) (((csr) & 017777)-0x10000000)
|
||||
static int uda630[]={qbdev(0772150),qbdev(0760334)};
|
||||
|
||||
static int uba670[]={0x20040000};
|
||||
static int uio670[]={0x20000000};
|
||||
static int uda670[]={0x20004030,0x20004230};
|
||||
#define qb670dev(csr) (((csr) & 017777)+0x20000000)
|
||||
void autoconf(void);
|
||||
void findcpu(void);
|
||||
void consinit(void);
|
||||
void scbinit(void);
|
||||
int getsecs(void);
|
||||
void scb_stray(void *);
|
||||
void longjmp(int *);
|
||||
void rtimer(void *);
|
||||
|
||||
/*
|
||||
* Autoconf routine is really stupid; but it actually don't
|
||||
@ -79,9 +60,9 @@ static int uda670[]={0x20004030,0x20004230};
|
||||
* devices exists on each cpu. Fast & easy.
|
||||
*/
|
||||
|
||||
void
|
||||
autoconf()
|
||||
{
|
||||
extern int memsz;
|
||||
|
||||
findcpu(); /* Configures CPU variables */
|
||||
consinit(); /* Allow us to print out things */
|
||||
@ -89,57 +70,6 @@ autoconf()
|
||||
|
||||
switch (vax_boardtype) {
|
||||
|
||||
default:
|
||||
printf("\nCPU type %d not supported by boot\n",vax_cputype);
|
||||
printf("trying anyway...\n");
|
||||
break;
|
||||
|
||||
case VAX_BTYP_780:
|
||||
case VAX_BTYP_790:
|
||||
memsz = 0;
|
||||
nmba = 8;
|
||||
nuba = 32; /* XXX */
|
||||
nuda = 1;
|
||||
mbaaddr = mba780;
|
||||
ubaaddr = uba780;
|
||||
udaaddr = uda750;
|
||||
uioaddr = uio780;
|
||||
tmsaddr = 0774500;
|
||||
break;
|
||||
|
||||
case VAX_BTYP_750:
|
||||
memsz = 0;
|
||||
nmba = 3;
|
||||
nuba = 2;
|
||||
nuda = 1;
|
||||
mbaaddr = mba750;
|
||||
ubaaddr = uba750;
|
||||
udaaddr = uda750;
|
||||
uioaddr = uio750;
|
||||
tmsaddr = 0774500;
|
||||
break;
|
||||
|
||||
case VAX_BTYP_630: /* the same for uvaxIII */
|
||||
case VAX_BTYP_650:
|
||||
case VAX_BTYP_660:
|
||||
case VAX_BTYP_670:
|
||||
case VAX_BTYP_680:
|
||||
case VAX_BTYP_53:
|
||||
nuba = 1;
|
||||
nuda = 2;
|
||||
ubaaddr = uba630;
|
||||
udaaddr = uda630;
|
||||
uioaddr = uio630;
|
||||
tmsaddr = qbdev(0774500);
|
||||
break;
|
||||
|
||||
case VAX_BTYP_8000:
|
||||
memsz = 0;
|
||||
nbi = 1;
|
||||
biaddr = bi8200;
|
||||
bioaddr = bio8200;
|
||||
break;
|
||||
|
||||
case VAX_BTYP_46:
|
||||
case VAX_BTYP_48:
|
||||
{int *map, i;
|
||||
@ -151,10 +81,6 @@ autoconf()
|
||||
map[i] = 0x80000000 | i;
|
||||
}break;
|
||||
|
||||
case VAX_BTYP_410:
|
||||
case VAX_BTYP_420:
|
||||
case VAX_BTYP_43:
|
||||
case VAX_BTYP_49:
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -165,15 +91,12 @@ autoconf()
|
||||
|
||||
volatile int tickcnt;
|
||||
|
||||
int
|
||||
getsecs()
|
||||
{
|
||||
volatile int loop;
|
||||
int todr;
|
||||
|
||||
return tickcnt/100;
|
||||
}
|
||||
|
||||
void scb_stray(), rtimer();
|
||||
struct ivec_dsp **scb;
|
||||
struct ivec_dsp *scb_vec;
|
||||
extern struct ivec_dsp idsptch;
|
||||
@ -182,16 +105,16 @@ extern struct ivec_dsp idsptch;
|
||||
* Init the SCB and set up a handler for all vectors in the lower space,
|
||||
* to detect unwanted interrupts.
|
||||
*/
|
||||
void
|
||||
scbinit()
|
||||
{
|
||||
extern int timer;
|
||||
int i;
|
||||
|
||||
/*
|
||||
* Allocate space. We need one page for the SCB, and 128*16 == 2k
|
||||
* for the vectors. The SCB must be on a page boundary.
|
||||
*/
|
||||
i = alloc(VAX_NBPG * 6) + VAX_PGOFSET;
|
||||
i = (int)alloc(VAX_NBPG * 6) + VAX_PGOFSET;
|
||||
i &= ~VAX_PGOFSET;
|
||||
|
||||
mtpr(i, PR_SCBB);
|
||||
@ -216,7 +139,7 @@ extern int jbuf[10];
|
||||
extern int sluttid, senast, skip;
|
||||
|
||||
void
|
||||
rtimer()
|
||||
rtimer(void *arg)
|
||||
{
|
||||
mtpr(31, PR_IPL);
|
||||
tickcnt++;
|
||||
@ -255,8 +178,7 @@ _eidsptch:
|
||||
* This function must _not_ save any registers (in the reg save mask).
|
||||
*/
|
||||
void
|
||||
scb_stray(arg)
|
||||
int arg;
|
||||
scb_stray(void *arg)
|
||||
{
|
||||
static struct callsframe *cf;
|
||||
static int vector, ipl, *a;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: boot.c,v 1.5 2000/04/22 20:29:59 ragge Exp $ */
|
||||
/* $NetBSD: boot.c,v 1.6 2000/05/20 13:35:07 ragge Exp $ */
|
||||
/*-
|
||||
* Copyright (c) 1982, 1986 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
@ -40,6 +40,8 @@
|
||||
|
||||
#define V750UCODE(x) ((x>>8)&255)
|
||||
|
||||
#include "machine/rpb.h"
|
||||
|
||||
#include "vaxstand.h"
|
||||
|
||||
/*
|
||||
@ -49,15 +51,20 @@
|
||||
*/
|
||||
|
||||
char line[100];
|
||||
int devtype, bootdev, howto, debug;
|
||||
int bootdev, debug;
|
||||
extern unsigned opendev;
|
||||
extern unsigned *bootregs;
|
||||
|
||||
void usage(), boot(), halt();
|
||||
void usage(char *), boot(char *), halt(char *);
|
||||
void Xmain(struct rpb *);
|
||||
void autoconf(void);
|
||||
int getsecs(void);
|
||||
int setjmp(int *);
|
||||
int testkey(void);
|
||||
void loadpcs(void);
|
||||
|
||||
struct vals {
|
||||
char *namn;
|
||||
void (*func)();
|
||||
void (*func)(char *);
|
||||
char *info;
|
||||
} val[] = {
|
||||
{"?", usage, "Show this help menu"},
|
||||
@ -76,18 +83,27 @@ char *filer[] = {
|
||||
};
|
||||
|
||||
int jbuf[10];
|
||||
int sluttid, senast, skip;
|
||||
int sluttid, senast, skip, askname;
|
||||
struct rpb bootrpb;
|
||||
|
||||
Xmain()
|
||||
void
|
||||
Xmain(struct rpb *prpb)
|
||||
{
|
||||
int io, type, askname, filindex = 0;
|
||||
int io, filindex = 0;
|
||||
int j, nu;
|
||||
|
||||
/* First copy rpb/bqo to its new location */
|
||||
bcopy((caddr_t)prpb, &bootrpb, sizeof(struct rpb));
|
||||
if (prpb->iovec) {
|
||||
bootrpb.iovec = (int)alloc(prpb->iovecsz);
|
||||
bcopy((caddr_t)prpb->iovec, (caddr_t)bootrpb.iovec,
|
||||
prpb->iovecsz);
|
||||
}
|
||||
io = 0;
|
||||
skip = 1;
|
||||
autoconf();
|
||||
|
||||
askname = howto & RB_ASKNAME;
|
||||
askname = bootrpb.rpb_bootr5 & RB_ASKNAME;
|
||||
printf("\n\r>> NetBSD/vax boot [%s %s] <<\n", __DATE__, __TIME__);
|
||||
printf(">> Press any key to abort autoboot ");
|
||||
sluttid = getsecs() + 5;
|
||||
@ -115,16 +131,14 @@ Xmain()
|
||||
|
||||
/* First try to autoboot */
|
||||
if (askname == 0) {
|
||||
type = (devtype >> B_TYPESHIFT) & B_TYPEMASK;
|
||||
if ((unsigned)type < ndevs && devsw[type].dv_name)
|
||||
while (filer[filindex]) {
|
||||
errno = 0;
|
||||
printf("> boot %s\n", filer[filindex]);
|
||||
exec(filer[filindex++], 0, 0);
|
||||
printf("boot failed: %s\n", strerror(errno));
|
||||
if (testkey())
|
||||
break;
|
||||
}
|
||||
while (filer[filindex]) {
|
||||
errno = 0;
|
||||
printf("> boot %s\n", filer[filindex]);
|
||||
exec(filer[filindex++], 0, 0);
|
||||
printf("boot failed: %s\n", strerror(errno));
|
||||
if (testkey())
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* If any key pressed, go to conversational boot */
|
||||
@ -154,19 +168,17 @@ Xmain()
|
||||
(*v->func)(d);
|
||||
else
|
||||
printf("Unknown command: %s\n", c);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
halt()
|
||||
halt(char *hej)
|
||||
{
|
||||
asm("halt");
|
||||
}
|
||||
|
||||
void
|
||||
boot(arg)
|
||||
char *arg;
|
||||
boot(char *arg)
|
||||
{
|
||||
char *fn = "netbsd";
|
||||
|
||||
@ -190,11 +202,11 @@ fail: printf("usage: boot [filename] [-asd]\n");
|
||||
|
||||
while (*++arg) {
|
||||
if (*arg == 'a')
|
||||
howto |= RB_ASKNAME;
|
||||
bootrpb.rpb_bootr5 |= RB_ASKNAME;
|
||||
else if (*arg == 'd')
|
||||
howto |= RB_KDB;
|
||||
bootrpb.rpb_bootr5 |= RB_KDB;
|
||||
else if (*arg == 's')
|
||||
howto |= RB_SINGLE;
|
||||
bootrpb.rpb_bootr5 |= RB_SINGLE;
|
||||
else
|
||||
goto fail;
|
||||
}
|
||||
@ -223,6 +235,7 @@ load: exec(fn, 0, 0);
|
||||
})
|
||||
|
||||
|
||||
void
|
||||
loadpcs()
|
||||
{
|
||||
static int pcsdone = 0;
|
||||
@ -296,7 +309,7 @@ loadpcs()
|
||||
}
|
||||
|
||||
void
|
||||
usage()
|
||||
usage(char *hej)
|
||||
{
|
||||
struct vals *v = &val[0];
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: conf.c,v 1.6 2000/04/24 21:46:07 matt Exp $ */
|
||||
/* $NetBSD: conf.c,v 1.7 2000/05/20 13:35:07 ragge Exp $ */
|
||||
/*
|
||||
* Copyright (c) 1994 Ludd, University of Lule}, Sweden.
|
||||
* All rights reserved.
|
||||
@ -45,27 +45,18 @@
|
||||
|
||||
#include "vaxstand.h"
|
||||
|
||||
int raopen(), rastrategy();
|
||||
int hpopen(), hpstrategy();
|
||||
int ctuopen(), ctustrategy();
|
||||
int tmscpopen(), tmscpstrategy();
|
||||
int romopen(), romstrategy();
|
||||
int mfmopen(), mfmstrategy();
|
||||
int sdopen(), sdstrategy();
|
||||
int netopen(), netstrategy(), netclose();
|
||||
|
||||
struct devsw devsw[]={
|
||||
SADEV("hp",hpstrategy, hpopen, nullsys, noioctl),
|
||||
SADEV("qe",netstrategy, netopen, netclose, noioctl), /* DEQNA */
|
||||
SADEV("qe",nodev, qeopen, qeclose, noioctl), /* DEQNA */
|
||||
SADEV("ctu",ctustrategy, ctuopen, nullsys, noioctl),
|
||||
SADEV("ra",rastrategy, raopen, nullsys, noioctl),
|
||||
SADEV("mt",tmscpstrategy, tmscpopen, nullsys, noioctl),
|
||||
SADEV("mt",rastrategy, raopen, nullsys, noioctl),
|
||||
SADEV("rom",romstrategy, romopen, nullsys, noioctl),
|
||||
SADEV("rd",mfmstrategy, mfmopen, nullsys, noioctl),
|
||||
SADEV("sd",romstrategy, romopen, nullsys, noioctl),
|
||||
SADEV("st",nullsys, nullsys, nullsys, noioctl),
|
||||
SADEV("le",netstrategy, netopen, netclose, noioctl), /* LANCE */
|
||||
SADEV("ze",netstrategy, netopen, netclose, noioctl), /* SGEC */
|
||||
SADEV("le",nodev, leopen, leclose, noioctl), /* LANCE */
|
||||
SADEV("ze",nodev, zeopen, zeclose, noioctl), /* SGEC */
|
||||
SADEV("rl",romstrategy, romopen, nullsys, noioctl),
|
||||
};
|
||||
|
||||
@ -96,15 +87,3 @@ struct fs_ops file_system[] = {
|
||||
};
|
||||
|
||||
int nfsys = (sizeof(file_system) / sizeof(struct fs_ops));
|
||||
|
||||
extern struct netif_driver qe_driver;
|
||||
extern struct netif_driver le_driver;
|
||||
extern struct netif_driver ze_driver;
|
||||
|
||||
struct netif_driver *netif_drivers[] = {
|
||||
&qe_driver,
|
||||
&le_driver,
|
||||
&ze_driver,
|
||||
};
|
||||
int n_netif_drivers = (sizeof(netif_drivers) / sizeof(netif_drivers[0]));
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: consio.c,v 1.8 2000/05/09 20:53:51 ragge Exp $ */
|
||||
/* $NetBSD: consio.c,v 1.9 2000/05/20 13:35:07 ragge Exp $ */
|
||||
/*
|
||||
* Copyright (c) 1994, 1998 Ludd, University of Lule}, Sweden.
|
||||
* All rights reserved.
|
||||
@ -45,19 +45,15 @@
|
||||
|
||||
void setup __P((void));
|
||||
|
||||
unsigned *bootregs;
|
||||
struct rpb *rpb;
|
||||
struct bqo *bqo;
|
||||
|
||||
static int (*put_fp) __P((int)) = NULL;
|
||||
static void (*put_fp) __P((int)) = NULL;
|
||||
static int (*get_fp) __P((void)) = NULL;
|
||||
static int (*test_fp) __P((void)) = NULL;
|
||||
|
||||
int pr_putchar __P((int c)); /* putchar() using mtpr/mfpr */
|
||||
void pr_putchar __P((int c)); /* putchar() using mtpr/mfpr */
|
||||
int pr_getchar __P((void));
|
||||
int pr_testchar __P((void));
|
||||
|
||||
int rom_putchar __P((int c)); /* putchar() using ROM routines */
|
||||
void rom_putchar __P((int c)); /* putchar() using ROM routines */
|
||||
int rom_getchar __P((void));
|
||||
int rom_testchar __P((void));
|
||||
|
||||
@ -81,25 +77,31 @@ unsigned char *ka630_conspage;
|
||||
/* Function that initializes things for KA630 ROM console I/O */
|
||||
void ka630_consinit __P((void));
|
||||
/* Functions that use KA630 ROM for console I/O */
|
||||
int ka630_rom_putchar __P((int c));
|
||||
void ka630_rom_putchar __P((int c));
|
||||
int ka630_rom_getchar __P((void));
|
||||
int ka630_rom_testchar __P((void));
|
||||
/* Also added such a thing for KA53 - MK-991208 */
|
||||
unsigned char *ka53_conspage;
|
||||
void ka53_consinit(void);
|
||||
int ka53_rom_putchar(int c);
|
||||
void ka53_rom_putchar(int c);
|
||||
int ka53_rom_getchar(void);
|
||||
int ka53_rom_testchar(void);
|
||||
|
||||
void putchar(int);
|
||||
int getchar(void);
|
||||
int testkey(void);
|
||||
void consinit(void);
|
||||
void _rtt(void);
|
||||
|
||||
putchar(c)
|
||||
int c;
|
||||
void
|
||||
putchar(int c)
|
||||
{
|
||||
(*put_fp)(c);
|
||||
if (c == 10)
|
||||
(*put_fp)(13); /* CR/LF */
|
||||
}
|
||||
|
||||
int
|
||||
getchar()
|
||||
{
|
||||
int c;
|
||||
@ -112,6 +114,7 @@ getchar()
|
||||
return c;
|
||||
}
|
||||
|
||||
int
|
||||
testkey()
|
||||
{
|
||||
return (*test_fp)();
|
||||
@ -128,8 +131,6 @@ consinit()
|
||||
get_fp = pr_getchar;
|
||||
test_fp = pr_testchar;
|
||||
|
||||
rpb = (struct rpb *)XXRPB;
|
||||
|
||||
/*
|
||||
* According to the vax_boardtype (vax_cputype is not specific
|
||||
* enough to do that) we decide which method/routines to use
|
||||
@ -193,8 +194,8 @@ consinit()
|
||||
/*
|
||||
* putchar() using MTPR
|
||||
*/
|
||||
pr_putchar(c)
|
||||
int c;
|
||||
void
|
||||
pr_putchar(int c)
|
||||
{
|
||||
int timeout = 1<<15; /* don't hang the machine! */
|
||||
while ((mfpr(PR_TXCS) & GC_RDY) == 0) /* Wait until xmit ready */
|
||||
@ -206,12 +207,14 @@ pr_putchar(c)
|
||||
/*
|
||||
* getchar() using MFPR
|
||||
*/
|
||||
int
|
||||
pr_getchar()
|
||||
{
|
||||
while ((mfpr(PR_RXCS) & GC_DON) == 0); /* wait for char */
|
||||
return (mfpr(PR_RXDB)); /* now get it */
|
||||
}
|
||||
|
||||
int
|
||||
pr_testchar()
|
||||
{
|
||||
if (mfpr(PR_RXCS) & GC_DON)
|
||||
@ -256,6 +259,7 @@ asm("
|
||||
1: ret
|
||||
");
|
||||
|
||||
void
|
||||
_rtt()
|
||||
{
|
||||
asm("halt");
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: data.h,v 1.1 1999/03/06 16:36:05 ragge Exp $ */
|
||||
/* $NetBSD: data.h,v 1.2 2000/05/20 13:35:07 ragge Exp $ */
|
||||
/*
|
||||
* Copyright (c) 1995 Ludd, University of Lule}, Sweden.
|
||||
* All rights reserved.
|
||||
@ -37,8 +37,6 @@
|
||||
|
||||
|
||||
|
||||
extern unsigned *bootregs;
|
||||
|
||||
/*
|
||||
* rpb->iovec gives pointer to this structure.
|
||||
*
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: devopen.c,v 1.2 1999/06/30 18:30:42 ragge Exp $ */
|
||||
/* $NetBSD: devopen.c,v 1.3 2000/05/20 13:35:07 ragge Exp $ */
|
||||
/*
|
||||
* Copyright (c) 1997 Ludd, University of Lule}, Sweden.
|
||||
* All rights reserved.
|
||||
@ -30,12 +30,20 @@
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/reboot.h>
|
||||
|
||||
#include "lib/libsa/stand.h"
|
||||
|
||||
#include "machine/rpb.h"
|
||||
#include "machine/sid.h"
|
||||
#include "machine/pte.h"
|
||||
#define VAX780 1
|
||||
#include "machine/ka750.h"
|
||||
|
||||
#include "dev/bi/bireg.h"
|
||||
|
||||
#include "vaxstand.h"
|
||||
|
||||
unsigned int opendev;
|
||||
int atoi(char *);
|
||||
int nexaddr, csrbase;
|
||||
|
||||
int
|
||||
devopen(f, fname, file)
|
||||
@ -43,23 +51,30 @@ devopen(f, fname, file)
|
||||
const char *fname;
|
||||
char **file;
|
||||
{
|
||||
int dev, ctlr, unit, part, adapt, i, a[4], x;
|
||||
int dev, unit, ctlr, part, adapt, i, a[4], x;
|
||||
int *mapregs;
|
||||
struct devsw *dp;
|
||||
extern int cnvtab[];
|
||||
char *s, *c, *u;
|
||||
char *s, *c;
|
||||
|
||||
dev = B_TYPE(bootdev);
|
||||
ctlr = B_CONTROLLER(bootdev);
|
||||
unit = B_UNIT(bootdev);
|
||||
part = B_PARTITION(bootdev);
|
||||
adapt = B_ADAPTOR(bootdev);
|
||||
part = 0;
|
||||
|
||||
/*
|
||||
* Adaptor and controller are normally zero (or uninteresting),
|
||||
* but we need to do some conversion here anyway (if it's a
|
||||
* manual boot, but that's checked by the device driver).
|
||||
* Set them to -1 to tell if it's a set number or default.
|
||||
*/
|
||||
dev = bootrpb.devtyp;
|
||||
unit = bootrpb.unit;
|
||||
adapt = ctlr = -1;
|
||||
|
||||
for (i = 0, dp = 0; i < ndevs; i++)
|
||||
if (cnvtab[i] == dev)
|
||||
dp = devsw + i;
|
||||
|
||||
x = 0;
|
||||
if ((s = index(fname, '('))) {
|
||||
if ((s = index((char *)fname, '('))) {
|
||||
*s++ = 0;
|
||||
|
||||
for (i = 0, dp = devsw; i < ndevs; i++, dp++)
|
||||
@ -106,15 +121,51 @@ devopen(f, fname, file)
|
||||
if (!dp->dv_open)
|
||||
return(ENODEV);
|
||||
f->f_dev = dp;
|
||||
bootrpb.unit = unit;
|
||||
bootrpb.devtyp = dev;
|
||||
|
||||
opendev = MAKEBOOTDEV(dev, adapt, ctlr, unit, part);
|
||||
switch (vax_cputype) {
|
||||
case VAX_750:
|
||||
if (adapt < 0)
|
||||
break;
|
||||
nexaddr = (NEX750 + NEXSIZE * adapt);
|
||||
csrbase = (adapt == 8 ? 0xffe000 : 0xfbe000);
|
||||
break;
|
||||
case VAX_780:
|
||||
case VAX_8600:
|
||||
if (adapt < 0)
|
||||
break;
|
||||
nexaddr = ((int)NEX780 + NEXSIZE * adapt);
|
||||
csrbase = 0x2007e000 + 0x40000 * adapt;
|
||||
break;
|
||||
case VAX_8200:
|
||||
case VAX_8800:
|
||||
case VAX_TYP_8PS:
|
||||
nexaddr = bootrpb.adpphy;
|
||||
if (ctlr < 0)
|
||||
break;
|
||||
if (adapt < 0)
|
||||
nexaddr = (bootrpb.adpphy & 0xff000000) + BI_NODE(ctlr);
|
||||
else
|
||||
nexaddr = BI_BASE(ctlr, adapt);
|
||||
csrbase = 0; /* _may_ be a KDB */
|
||||
break;
|
||||
#ifdef notyet
|
||||
case VAX_6200:
|
||||
...
|
||||
#endif
|
||||
default:
|
||||
nexaddr = 0; /* No map regs */
|
||||
csrbase = 0x20000000;
|
||||
/* Always map in the lowest 4M on qbus-based machines */
|
||||
mapregs = (void *)0x20088000;
|
||||
if (bootrpb.adpphy == 0x20087800)
|
||||
for (i = 0; i < 8192; i++)
|
||||
mapregs[i] = PG_V | i;
|
||||
break;
|
||||
}
|
||||
|
||||
if (dev > 95) { /* MOP boot over network, root & swap over NFS */
|
||||
i = (*dp->dv_open)(f, dp->dv_name);
|
||||
} else
|
||||
i = (*dp->dv_open)(f, adapt, ctlr, unit, part);
|
||||
|
||||
return i;
|
||||
return (*dp->dv_open)(f, adapt, ctlr, unit, part);
|
||||
|
||||
usage:
|
||||
printf("usage: dev(adapter,controller,unit,partition)file -asd\n");
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: netio.c,v 1.4 1999/06/30 18:38:03 ragge Exp $ */
|
||||
/* $NetBSD: netio.c,v 1.5 2000/05/20 13:35:07 ragge Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
|
||||
@ -52,7 +52,7 @@
|
||||
* derived from this software without specific prior written permission.
|
||||
* 4. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Gordon W. Ross
|
||||
* This product includes software developed by Gordon W. Ross
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
@ -68,7 +68,7 @@
|
||||
|
||||
/*
|
||||
* This module implements a "raw device" interface suitable for
|
||||
* use by the stand-alone I/O library NFS code. This interface
|
||||
* use by the stand-alone I/O library NFS code. This interface
|
||||
* does not support any "block" access, and exists only for the
|
||||
* purpose of initializing the network interface, getting boot
|
||||
* parameters, and performing the NFS mount.
|
||||
@ -78,7 +78,7 @@
|
||||
* find interface - netif_open()
|
||||
* RARP for IP address - rarp_getipaddress()
|
||||
* RPC/bootparams - callrpc(d, RPC_BOOTPARAMS, ...)
|
||||
* RPC/mountd - nfs_mount(sock, ip, path)
|
||||
* RPC/mountd - nfs_mount(sock, ip, path)
|
||||
*
|
||||
* the root file handle from mountd is saved in a global
|
||||
* for use by the NFS open code (NFS/lookup).
|
||||
@ -96,131 +96,32 @@
|
||||
#include "lib/libsa/netif.h"
|
||||
#include "lib/libsa/bootparam.h"
|
||||
#include "lib/libsa/nfs.h"
|
||||
#include "lib/libsa/bootp.h"
|
||||
|
||||
#include <lib/libkern/libkern.h>
|
||||
|
||||
extern int nfs_root_node[]; /* XXX - get from nfs_mount() */
|
||||
#include "vaxstand.h"
|
||||
|
||||
struct in_addr myip, rootip, gateip;
|
||||
n_long netmask;
|
||||
char rootpath[FNAME_SIZE];
|
||||
static struct iodesc desc;
|
||||
|
||||
int netdev_sock = -1;
|
||||
static int open_count;
|
||||
|
||||
int netio_ask = 0; /* default to bootparam, can override */
|
||||
|
||||
static char input_line[100];
|
||||
|
||||
/*
|
||||
* Called by devopen after it sets f->f_dev to our devsw entry.
|
||||
* This opens the low-level device and sets f->f_devdata.
|
||||
*/
|
||||
int
|
||||
netopen(f, devname)
|
||||
struct open_file *f;
|
||||
char *devname; /* Device part of file name (or NULL). */
|
||||
struct iodesc *
|
||||
socktodesc(sock)
|
||||
{
|
||||
int error = 0;
|
||||
|
||||
/* On first open, do netif open, mount, etc. */
|
||||
if (open_count == 0) {
|
||||
/* Find network interface. */
|
||||
if ((netdev_sock = netif_open(devname)) < 0)
|
||||
return (error=ENXIO);
|
||||
if ((error = netmountroot(f, devname)) != 0)
|
||||
return (error);
|
||||
}
|
||||
open_count++;
|
||||
f->f_devdata = nfs_root_node;
|
||||
return (error);
|
||||
return &desc;
|
||||
}
|
||||
|
||||
int
|
||||
netclose(f)
|
||||
struct open_file *f;
|
||||
{
|
||||
netif_close(netdev_sock);
|
||||
f->f_devdata = NULL;
|
||||
}
|
||||
net_devinit(struct open_file *f, struct netif_driver *drv, u_char *eaddr) {
|
||||
static struct netif best_if;
|
||||
struct iodesc *s;
|
||||
|
||||
int
|
||||
netstrategy(devdata, func, dblk, size, v_buf, rsize)
|
||||
void *devdata;
|
||||
int func;
|
||||
daddr_t dblk;
|
||||
size_t size;
|
||||
void *v_buf;
|
||||
size_t *rsize;
|
||||
{
|
||||
/* find a free socket */
|
||||
s = &desc;
|
||||
|
||||
*rsize = size;
|
||||
return EIO;
|
||||
}
|
||||
|
||||
int
|
||||
netmountroot(f, devname)
|
||||
struct open_file *f;
|
||||
char *devname; /* Device part of file name (or NULL). */
|
||||
{
|
||||
int error;
|
||||
struct iodesc *d;
|
||||
|
||||
if (netio_ask) {
|
||||
get_my_ip:
|
||||
printf("My IP address? ");
|
||||
bzero(input_line, sizeof(input_line));
|
||||
gets(input_line);
|
||||
if ((myip.s_addr = inet_addr(input_line)) ==
|
||||
htonl(INADDR_NONE)) {
|
||||
printf("invalid IP address: %s\n", input_line);
|
||||
goto get_my_ip;
|
||||
}
|
||||
|
||||
get_my_netmask:
|
||||
printf("My netmask? ");
|
||||
bzero(input_line, sizeof(input_line));
|
||||
gets(input_line);
|
||||
if ((netmask = inet_addr(input_line)) ==
|
||||
htonl(INADDR_NONE)) {
|
||||
printf("invalid netmask: %s\n", input_line);
|
||||
goto get_my_netmask;
|
||||
}
|
||||
|
||||
get_my_gateway:
|
||||
printf("My gateway? ");
|
||||
bzero(input_line, sizeof(input_line));
|
||||
gets(input_line);
|
||||
if ((gateip.s_addr = inet_addr(input_line)) ==
|
||||
htonl(INADDR_NONE)) {
|
||||
printf("invalid IP address: %s\n", input_line);
|
||||
goto get_my_gateway;
|
||||
}
|
||||
|
||||
get_server_ip:
|
||||
printf("Server IP address? ");
|
||||
bzero(input_line, sizeof(input_line));
|
||||
gets(input_line);
|
||||
if ((rootip.s_addr = inet_addr(input_line)) ==
|
||||
htonl(INADDR_NONE)) {
|
||||
printf("invalid IP address: %s\n", input_line);
|
||||
goto get_server_ip;
|
||||
}
|
||||
|
||||
get_server_path:
|
||||
printf("Server path? ");
|
||||
bzero(rootpath, sizeof(rootpath));
|
||||
gets(rootpath);
|
||||
if (rootpath[0] == '\0' || rootpath[0] == '\n')
|
||||
goto get_server_path;
|
||||
|
||||
if ((d = socktodesc(netdev_sock)) == NULL)
|
||||
return (EMFILE);
|
||||
|
||||
d->myip = myip;
|
||||
|
||||
goto do_nfs_mount;
|
||||
}
|
||||
bzero(s, sizeof(*s));
|
||||
best_if.nif_driver = drv;
|
||||
s->io_netif = &best_if;
|
||||
bcopy(eaddr, s->myea, 6);
|
||||
|
||||
/*
|
||||
* Get info for NFS boot: our IP address, our hostname,
|
||||
@ -233,17 +134,12 @@ netmountroot(f, devname)
|
||||
|
||||
/* Get boot info using BOOTP way. (RFC951, RFC1048) */
|
||||
printf("Trying BOOTP\n");
|
||||
bootp(netdev_sock);
|
||||
bootp(0);
|
||||
|
||||
if (myip.s_addr) {
|
||||
printf("Using IP address: %s\n", inet_ntoa(myip));
|
||||
|
||||
printf("myip: %s (%s)", hostname, inet_ntoa(myip));
|
||||
if (gateip.s_addr)
|
||||
printf(", gateip: %s", inet_ntoa(gateip));
|
||||
if (netmask)
|
||||
printf(", mask: %s", intoa(netmask));
|
||||
printf("\n");
|
||||
printf("myip: %s (%s)\n", hostname, inet_ntoa(myip));
|
||||
} else
|
||||
|
||||
#endif /* SUPPORT_BOOTP */
|
||||
@ -252,28 +148,38 @@ netmountroot(f, devname)
|
||||
/* Get boot info using RARP and Sun bootparams. */
|
||||
|
||||
printf("Trying BOOTPARAMS\n");
|
||||
/* Get our IP address. (rarp.c) */
|
||||
if (rarp_getipaddress(netdev_sock) == -1)
|
||||
/* Get our IP address. (rarp.c) */
|
||||
if (rarp_getipaddress(0) == -1)
|
||||
return (errno);
|
||||
|
||||
printf("boot: client IP address: %s\n", inet_ntoa(myip));
|
||||
|
||||
/* Get our hostname, server IP address. */
|
||||
if (bp_whoami(netdev_sock))
|
||||
if (bp_whoami(0))
|
||||
return (errno);
|
||||
|
||||
printf("boot: client name: %s\n", hostname);
|
||||
|
||||
/* Get the root pathname. */
|
||||
if (bp_getfile(netdev_sock, "root", &rootip, rootpath))
|
||||
if (bp_getfile(0, "root", &rootip, rootpath))
|
||||
return (errno);
|
||||
#endif
|
||||
}
|
||||
printf("root addr=%s path=%s\n", inet_ntoa(rootip), rootpath);
|
||||
f->f_devdata = s;
|
||||
|
||||
do_nfs_mount:
|
||||
/* Get the NFS file handle (mount). */
|
||||
error = nfs_mount(netdev_sock, rootip, rootpath);
|
||||
|
||||
return (error);
|
||||
return nfs_mount(0, rootip, rootpath);
|
||||
}
|
||||
|
||||
ssize_t
|
||||
netif_put(struct iodesc *desc, void *pkt, size_t len)
|
||||
{
|
||||
return (*desc->io_netif->nif_driver->netif_put)(desc, pkt, len);
|
||||
}
|
||||
|
||||
ssize_t
|
||||
netif_get(struct iodesc *desc, void *pkt, size_t len, time_t timo)
|
||||
{
|
||||
return (*desc->io_netif->nif_driver->netif_get)(desc, pkt, len, timo);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: vaxstand.h,v 1.2 2000/05/09 20:53:52 ragge Exp $ */
|
||||
/* $NetBSD: vaxstand.h,v 1.3 2000/05/20 13:35:07 ragge Exp $ */
|
||||
/*
|
||||
* Copyright (c) 1994 Ludd, University of Lule}, Sweden.
|
||||
* All rights reserved.
|
||||
@ -29,31 +29,50 @@
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* All bugs are subject to removal without further notice */
|
||||
|
||||
|
||||
#define MAXNMBA 8 /* Massbussadapters */
|
||||
#define MAXNUBA 8 /* Unibusadapters */
|
||||
#define MAXMBAU 8 /* Units on an mba */
|
||||
|
||||
/* Variables used in autoconf */
|
||||
extern int nmba, nuba, nbi, nsbi, nuda;
|
||||
extern int *ubaaddr, *mbaaddr, *udaaddr, *uioaddr, *biaddr;
|
||||
extern int cpunumber, howto, bootdev;
|
||||
extern struct rpb *rpb;
|
||||
extern int askname;
|
||||
extern struct rpb bootrpb;
|
||||
extern int csrbase, nexaddr;
|
||||
|
||||
/* devsw type definitions, used in bootxx and conf */
|
||||
#define SADEV(name,strategy,open,close,ioctl) \
|
||||
{ (char *)name, \
|
||||
(int(*)(void *, int ,daddr_t , size_t, void *, size_t *))strategy, \
|
||||
(int(*)(struct open_file *, ...))open, \
|
||||
(int(*)(struct open_file *))close, \
|
||||
(int(*)(struct open_file *,u_long, void *))ioctl}
|
||||
{ (char *)name, \
|
||||
(int(*)(void *, int ,daddr_t , size_t, void *, size_t *))strategy, \
|
||||
(int(*)(struct open_file *, ...))open, \
|
||||
(int(*)(struct open_file *))close, \
|
||||
(int(*)(struct open_file *,u_long, void *))ioctl}
|
||||
|
||||
#define SDELAY(count) {volatile int i; for (i = count; i; i--);}
|
||||
#define SDELAY(count) {volatile int i; for (i = count; i; i--);}
|
||||
/*
|
||||
* Easy-to-use definitions
|
||||
*/
|
||||
#define min(x,y) (x < y ? x : y)
|
||||
#define min(x,y) (x < y ? x : y)
|
||||
|
||||
struct netif_driver;
|
||||
|
||||
char *index(char *, int);
|
||||
int net_devinit(struct open_file *f, struct netif_driver *drv, u_char *eaddr);
|
||||
|
||||
/* device calls */
|
||||
int raopen(struct open_file *, int, int, int, int),
|
||||
rastrategy(void *, int, daddr_t, size_t, void *, size_t *);
|
||||
int hpopen(struct open_file *, int, int, int, int),
|
||||
hpstrategy(void *, int, daddr_t, size_t, void *, size_t *);
|
||||
int ctuopen(struct open_file *, int, int, int, int),
|
||||
ctustrategy(void *, int, daddr_t, size_t, void *, size_t *);
|
||||
int tmscpopen(struct open_file *, int, int, int, int),
|
||||
tmscpstrategy(void *, int, daddr_t, size_t, void *, size_t *);
|
||||
int romopen(struct open_file *, int, int, int, int),
|
||||
romstrategy(void *, int, daddr_t, size_t, void *, size_t *);
|
||||
int mfmopen(struct open_file *, int, int, int, int),
|
||||
mfmstrategy(void *, int, daddr_t, size_t, void *, size_t *);
|
||||
int sdopen(struct open_file *),
|
||||
sdstrategy(void *, int, daddr_t, size_t, void *, size_t *);
|
||||
int leopen(struct open_file *, int, int, int, int),
|
||||
leclose(struct open_file *);
|
||||
int qeopen(struct open_file *, int, int, int, int),
|
||||
qeclose(struct open_file *);
|
||||
int zeopen(struct open_file *, int, int, int, int),
|
||||
zeclose(struct open_file *);
|
||||
int netopen(struct open_file *), netclose(struct open_file *);
|
||||
|
||||
char *index();
|
||||
|
Loading…
Reference in New Issue
Block a user