From 60d4b9c2bdf5160b7154fd4bef9001fb1c6aa9a9 Mon Sep 17 00:00:00 2001 From: ragge Date: Thu, 1 Apr 1999 20:40:07 +0000 Subject: [PATCH] A bunch of small fixes to make boot work on most VAXen. --- sys/arch/vax/boot/boot/Makefile | 4 +++- sys/arch/vax/boot/boot/boot.c | 6 +++-- sys/arch/vax/boot/boot/hp.c | 8 +++---- sys/arch/vax/boot/boot/if_le.c | 7 +++++- sys/arch/vax/boot/boot/if_ze.c | 7 +++++- sys/arch/vax/boot/boot/netio.c | 4 +--- sys/arch/vax/boot/boot/ra.c | 42 ++++++++++++++++++++++++++++----- sys/arch/vax/boot/boot/tmscp.c | 8 +++---- 8 files changed, 63 insertions(+), 23 deletions(-) diff --git a/sys/arch/vax/boot/boot/Makefile b/sys/arch/vax/boot/boot/Makefile index f80e1fa0038b..16fb2deffbfa 100644 --- a/sys/arch/vax/boot/boot/Makefile +++ b/sys/arch/vax/boot/boot/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.2 1999/03/27 09:33:30 ragge Exp $ +# $NetBSD: Makefile,v 1.3 1999/04/01 20:40:07 ragge Exp $ S= ${.CURDIR}/../../../../ @@ -10,6 +10,8 @@ SRCS= srt0.s boot.c devopen.c conf.c autoconf.c netio.c rom.c romread.s \ CLEANFILES+=${PROG} ${PROG}.mop CPPFLAGS+=-DSUPPORT_BOOTPARAMS -DSUPPORT_BOOTP -DSUPPORT_DHCP -D_STANDALONE +#CPPFLAGS+=-DBOOTP_DEBUG -DNETIF_DEBUG -DETHER_DEBUG -DNFS_DEBUG -DDEV_DEBUG \ +# -DRPC_DEBUG -DRARP_DEBUG -DPARANOID BINDIR= / SA_AS= library diff --git a/sys/arch/vax/boot/boot/boot.c b/sys/arch/vax/boot/boot/boot.c index 1de7b5377c25..39a0f9974269 100644 --- a/sys/arch/vax/boot/boot/boot.c +++ b/sys/arch/vax/boot/boot/boot.c @@ -1,4 +1,4 @@ -/* $NetBSD: boot.c,v 1.1 1999/03/06 16:36:05 ragge Exp $ */ +/* $NetBSD: boot.c,v 1.2 1999/04/01 20:40:07 ragge Exp $ */ /*- * Copyright (c) 1982, 1986 The Regents of the University of California. * All rights reserved. @@ -51,7 +51,7 @@ */ char line[100]; -int devtype, bootdev, howto; +int devtype, bootdev, howto, debug; extern unsigned opendev; extern unsigned *bootregs; @@ -104,6 +104,7 @@ Xmain() } printf("\n"); + /* First try to autoboot */ if (askname == 0) { type = (devtype >> B_TYPESHIFT) & B_TYPEMASK; if ((unsigned)type < ndevs && devsw[type].dv_name) @@ -117,6 +118,7 @@ Xmain() } } + /* If any key pressed, go to conversational boot */ for (;;) { struct vals *v = &val[0]; char *c, *d; diff --git a/sys/arch/vax/boot/boot/hp.c b/sys/arch/vax/boot/boot/hp.c index 80ba205c3fe4..1049ed7e0211 100644 --- a/sys/arch/vax/boot/boot/hp.c +++ b/sys/arch/vax/boot/boot/hp.c @@ -1,4 +1,4 @@ -/* $NetBSD: hp.c,v 1.1 1999/03/06 16:36:05 ragge Exp $ */ +/* $NetBSD: hp.c,v 1.2 1999/04/01 20:40:07 ragge Exp $ */ /* * Copyright (c) 1994 Ludd, University of Lule}, Sweden. * All rights reserved. @@ -129,12 +129,12 @@ hpstrategy(hs, func, dblk, size, buf, rsize) hd = (void *)&mr->mba_md[hs->unit]; lp = &hplabel; - pfnum = (u_int)buf >> PGSHIFT; + pfnum = (u_int)buf >> VAX_PGSHIFT; - for(mapnr = 0, nsize = size; (nsize + NBPG) > 0; nsize -= NBPG) + for(mapnr = 0, nsize = size; (nsize + VAX_NBPG) > 0; nsize -= VAX_NBPG) *(int *)&mr->mba_map[mapnr++] = PG_V | pfnum++; - mr->mba_var = ((u_int)buf & PGOFSET); + mr->mba_var = ((u_int)buf & VAX_PGOFSET); mr->mba_bc = (~size) + 1; bn = dblk + lp->d_partitions[hs->part].p_offset; diff --git a/sys/arch/vax/boot/boot/if_le.c b/sys/arch/vax/boot/boot/if_le.c index 1b6f8b56abae..d500492d242a 100644 --- a/sys/arch/vax/boot/boot/if_le.c +++ b/sys/arch/vax/boot/boot/if_le.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_le.c,v 1.2 1999/03/25 23:16:37 thorpej Exp $ */ +/* $NetBSD: if_le.c,v 1.3 1999/04/01 20:40:07 ragge Exp $ */ /* * Copyright (c) 1997 Ludd, University of Lule}, Sweden. * All rights reserved. @@ -36,6 +36,11 @@ #include #include +#include +#include + +#include +#include #include #include diff --git a/sys/arch/vax/boot/boot/if_ze.c b/sys/arch/vax/boot/boot/if_ze.c index 31bf16aff62b..b632ae6cbfa9 100644 --- a/sys/arch/vax/boot/boot/if_ze.c +++ b/sys/arch/vax/boot/boot/if_ze.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_ze.c,v 1.2 1999/03/25 23:16:37 thorpej Exp $ */ +/* $NetBSD: if_ze.c,v 1.3 1999/04/01 20:40:07 ragge Exp $ */ /* * Copyright (c) 1998 James R. Maynard III. All rights reserved. * @@ -32,6 +32,11 @@ #include #include +#include +#include + +#include +#include #include #include diff --git a/sys/arch/vax/boot/boot/netio.c b/sys/arch/vax/boot/boot/netio.c index 0c8d0a1070ef..4b1bd95fa8a7 100644 --- a/sys/arch/vax/boot/boot/netio.c +++ b/sys/arch/vax/boot/boot/netio.c @@ -1,4 +1,4 @@ -/* $NetBSD: netio.c,v 1.1 1999/03/06 16:36:05 ragge Exp $ */ +/* $NetBSD: netio.c,v 1.2 1999/04/01 20:40:07 ragge Exp $ */ /*- * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc. @@ -226,7 +226,6 @@ netmountroot(f, devname) * and the more modern, BOOTP way. (RFC951, RFC1048) */ -#if 0 #ifdef SUPPORT_BOOTP /* Get boot info using BOOTP way. (RFC951, RFC1048) */ @@ -244,7 +243,6 @@ netmountroot(f, devname) printf("\n"); } else -#endif /* SUPPORT_BOOTP */ #endif /* SUPPORT_BOOTP */ { #ifdef SUPPORT_BOOTPARAMS diff --git a/sys/arch/vax/boot/boot/ra.c b/sys/arch/vax/boot/boot/ra.c index d91d7067826c..25a3b32aae49 100644 --- a/sys/arch/vax/boot/boot/ra.c +++ b/sys/arch/vax/boot/boot/ra.c @@ -1,4 +1,4 @@ -/* $NetBSD: ra.c,v 1.1 1999/03/06 16:36:05 ragge Exp $ */ +/* $NetBSD: ra.c,v 1.2 1999/04/01 20:40:07 ragge Exp $ */ /* * Copyright (c) 1995 Ludd, University of Lule}, Sweden. * All rights reserved. @@ -98,6 +98,10 @@ raopen(f, adapt, ctlr, unit, part) unsigned short johan, johan2; int i,err; +#ifdef DEV_DEBUG + printf("raopen: adapter %d ctlr %d unit %d part %d\n", + adapt, ctlr, unit, part); +#endif bzero(lp, sizeof(struct disklabel)); ra->unit = unit; ra->part = part; @@ -138,18 +142,29 @@ raopen(f, adapt, ctlr, unit, part) /* Init of this uda */ while ((*ra->ra_sa & MP_STEP1) == 0) ; - +#ifdef DEV_DEBUG + printf("MP_STEP1..."); +#endif *ra->ra_sw = 0x8000; while ((*ra->ra_sa & MP_STEP2) == 0) ; +#ifdef DEV_DEBUG + printf("MP_STEP2..."); +#endif *ra->ra_sw = johan; while ((*ra->ra_sa & MP_STEP3) == 0) ; +#ifdef DEV_DEBUG + printf("MP_STEP3..."); +#endif *ra->ra_sw = johan2; while ((*ra->ra_sa & MP_STEP4) == 0) ; +#ifdef DEV_DEBUG + printf("MP_STEP4\n"); +#endif *ra->ra_sw = 0x0001; uda.uda_ca.ca_rspdsc = (int)&ubauda->uda_rsp.mscp_cmdref; @@ -159,12 +174,18 @@ raopen(f, adapt, ctlr, unit, part) uda.uda_cmd.mscp_unit = ra->unit; command(M_OP_ONLINE); +#ifdef DEV_DEBUG + printf("reading disklabel\n"); +#endif err = rastrategy(ra,F_READ, LABELSECTOR, DEV_BSIZE, io_buf, &i); if(err){ printf("reading disklabel: %s\n",strerror(err)); return 0; } +#ifdef DEV_DEBUG + printf("getting disklabel\n"); +#endif msg = getdisklabel(io_buf+LABELOFFSET, lp); if (msg) printf("getdisklabel: %s\n", msg); @@ -182,10 +203,15 @@ command(cmd) uda.uda_rsp.mscp_msglen = MSCP_MSGLEN; uda.uda_ca.ca_rspdsc |= MSCP_OWN|MSCP_INT; uda.uda_ca.ca_cmddsc |= MSCP_OWN|MSCP_INT; +#ifdef DEV_DEBUG + printf("sending cmd %x...", cmd); +#endif hej = *ra_softc.ra_ip; while(uda.uda_ca.ca_rspdsc<0) ; - +#ifdef DEV_DEBUG + printf("sent.\n"); +#endif } rastrategy(ra, func, dblk, size, buf, rsize) @@ -202,15 +228,15 @@ rastrategy(ra, func, dblk, size, buf, rsize) u_int i, j, pfnum, mapnr, nsize; volatile int hej; - if (vax_cputype != VAX_8200) { ur = (void *)ra->ubaddr; udadev = (void*)ra->udaddr; ptmapp = (u_int *)&ur->uba_map[0]; - pfnum = (u_int)buf >> PGSHIFT; + pfnum = (u_int)buf >> VAX_PGSHIFT; - for(mapnr = 0, nsize = size; (nsize + NBPG) > 0; nsize -= NBPG) + for(mapnr = 0, nsize = size; (nsize + VAX_NBPG) > 0; + nsize -= VAX_NBPG) ptmapp[mapnr++] = PG_V | pfnum++; uda.uda_cmd.mscp_seq.seq_buffer = ((u_int)buf) & 0x1ff; } else @@ -221,6 +247,10 @@ rastrategy(ra, func, dblk, size, buf, rsize) dblk + lp->d_partitions[ra->part].p_offset; uda.uda_cmd.mscp_seq.seq_bytecount = size; uda.uda_cmd.mscp_unit = ra->unit; +#ifdef DEV_DEBUG + printf("rastrategy: blk 0x%lx count %lx unit %lx\n", + uda.uda_cmd.mscp_seq.seq_lbn, size, ra->unit); +#endif if (func == F_WRITE) command(M_OP_WRITE); else diff --git a/sys/arch/vax/boot/boot/tmscp.c b/sys/arch/vax/boot/boot/tmscp.c index f3a33b334f9a..567ef5e91699 100644 --- a/sys/arch/vax/boot/boot/tmscp.c +++ b/sys/arch/vax/boot/boot/tmscp.c @@ -1,4 +1,4 @@ -/* $NetBSD: tmscp.c,v 1.1 1999/03/06 16:36:05 ragge Exp $ */ +/* $NetBSD: tmscp.c,v 1.2 1999/04/01 20:40:08 ragge Exp $ */ /* * Copyright (c) 1995 Ludd, University of Lule}, Sweden. * All rights reserved. @@ -86,7 +86,6 @@ tmscpopen(f, adapt, ctlr, unit, part) unsigned short johan; int i,err; -printf("OPen\n"); curblock = 0; if(adapt>nuba) return(EADAPT); if(ctlr>nuda) return(ECTLR); @@ -168,10 +167,9 @@ tmscpstrategy(ra, func, dblk, size, buf, rsize) volatile u_int *ptmapp = (u_int *)&ur->uba_map[0]; volatile int hej; -printf("strategy: size %d dblk %ld\n", size, dblk); - pfnum=(u_int)buf>>PGSHIFT; + pfnum=(u_int)buf>>VAX_PGSHIFT; - for(mapnr=0, nsize=size;(nsize+NBPG)>0;nsize-=NBPG) + for(mapnr=0, nsize=size;(nsize+VAX_NBPG)>0;nsize-=VAX_NBPG) ptmapp[mapnr++]=PG_V|pfnum++; /*