Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/vax/boot/boot Change all devices to use the RPB inf...



details:   https://anonhg.NetBSD.org/src/rev/7dfac1e79ef2
branches:  trunk
changeset: 486368:7dfac1e79ef2
user:      ragge <ragge%NetBSD.org@localhost>
date:      Sat May 20 13:30:03 2000 +0000

description:
Change all devices to use the RPB info when autobooting, this allows for
booting from unsupported devices also. As a side effect; it fixes PR#9202.

diffstat:

 sys/arch/vax/boot/boot/ctu.c   |   22 ++-
 sys/arch/vax/boot/boot/hp.c    |  103 ++++++----------
 sys/arch/vax/boot/boot/if_le.c |  106 +++++++----------
 sys/arch/vax/boot/boot/if_qe.c |  175 +++++++++++++---------------
 sys/arch/vax/boot/boot/if_ze.c |   66 ++++-------
 sys/arch/vax/boot/boot/mfm.c   |   90 +++++++-------
 sys/arch/vax/boot/boot/ra.c    |  245 ++++++++++++++++++++++++----------------
 sys/arch/vax/boot/boot/rom.c   |   70 +++++------
 8 files changed, 427 insertions(+), 450 deletions(-)

diffs (truncated from 1678 to 300 lines):

diff -r afe16fe50528 -r 7dfac1e79ef2 sys/arch/vax/boot/boot/ctu.c
--- a/sys/arch/vax/boot/boot/ctu.c      Sat May 20 13:22:39 2000 +0000
+++ b/sys/arch/vax/boot/boot/ctu.c      Sat May 20 13:30:03 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ctu.c,v 1.2 2000/03/16 23:21:10 darrenr Exp $ */
+/*     $NetBSD: ctu.c,v 1.3 2000/05/20 13:30:03 ragge Exp $ */
 /*
  * Copyright (c) 1996 Ludd, University of Lule}, Sweden.
  * All rights reserved.
@@ -42,6 +42,10 @@
 #include <machine/mtpr.h>
 #include <machine/rsp.h>
 
+#include "vaxstand.h"
+
+static short ctu_cksum(unsigned short *, int);
+
 enum tu_state {
        SC_INIT,
        SC_READY,
@@ -77,15 +81,13 @@
 }
 
 int
-ctustrategy(ra, func, dblk, size, buf, rsize)
-        struct ra_softc *ra;
+ctustrategy(f, func, dblk, size, buf, rsize)
+        void *f;
         int func;
         daddr_t dblk;
-        char *buf;
-        u_int size, *rsize;
+        void *buf;
+        size_t size, *rsize;
 {
-       int     s;
-
        struct rsp *rsp = (struct rsp *)tu_sc.sc_rsp;
 
        tu_sc.sc_xfptr = buf;
@@ -100,7 +102,7 @@
        rsp->rsp_sw = rsp->rsp_xx1 = rsp->rsp_xx2 = 0;
        rsp->rsp_cnt = tu_sc.sc_nbytes;
        rsp->rsp_blk = dblk;
-       rsp->rsp_sum = ctu_cksum(rsp, 6);
+       rsp->rsp_sum = ctu_cksum((u_short *)rsp, 6);
        tu_sc.sc_state = SC_SEND_CMD;
        while (tu_sc.sc_state != SC_GET_RESP)
                ctutintr();
@@ -144,6 +146,9 @@
                tu_sc.sc_xfptr[tu_sc.sc_xbytes++] = status;
                break;
 
+       case SC_READY:
+       case SC_SEND_CMD:
+               break;
        }
 
 }
@@ -164,6 +169,7 @@
        }
 }
 
+short
 ctu_cksum(buf, words)
        unsigned short *buf;
        int words;
diff -r afe16fe50528 -r 7dfac1e79ef2 sys/arch/vax/boot/boot/hp.c
--- a/sys/arch/vax/boot/boot/hp.c       Sat May 20 13:22:39 2000 +0000
+++ b/sys/arch/vax/boot/boot/hp.c       Sat May 20 13:30:03 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: hp.c,v 1.2 1999/04/01 20:40:07 ragge Exp $ */
+/*     $NetBSD: hp.c,v 1.3 2000/05/20 13:30:03 ragge Exp $ */
 /*
  * Copyright (c) 1994 Ludd, University of Lule}, Sweden.
  * All rights reserved.
@@ -38,8 +38,13 @@
 
 #include "lib/libsa/stand.h"
 
+#include "lib/libkern/libkern.h"
+
 #include "../include/pte.h"
-/*#include "../include/macros.h"*/
+#include "../include/rpb.h"
+#include "../include/sid.h"
+#define VAX780 1
+#include "../include/ka750.h"
 
 #include "../mba/mbareg.h"
 #include "../mba/hpreg.h"
@@ -53,81 +58,54 @@
  * But it works :)
  */
 
-struct hp_softc {
-       int adapt;
-       int ctlr;
-       int unit;
-       int part;
-};
+static struct disklabel hplabel;
+static char io_buf[DEV_BSIZE];
+static volatile struct mba_regs *mr;
+static volatile struct hp_drv *hd;
+static int dpart;
 
-struct disklabel hplabel;
-struct hp_softc hp_softc;
-char io_buf[MAXBSIZE];
-daddr_t part_offset;
-
-hpopen(f, adapt, ctlr, unit, part)
-       struct open_file *f;
-        int ctlr, unit, part;
+int
+hpopen(struct open_file *f, int adapt, int ctlr, int unit, int part)
 {
-       struct disklabel *lp;
-       struct hp_softc *hs;
-       volatile struct mba_regs *mr;
-       volatile struct hp_drv *hd;
        char *msg;
-       int i,err;
-
-       lp = &hplabel;
-       hs = &hp_softc;
-       mr = (void *)mbaaddr[ctlr];
-       hd = (void *)&mr->mba_md[unit];
+       int i, err;
 
-       if (adapt > nsbi) return(EADAPT);
-       if (ctlr > nmba) return(ECTLR);
-       if (unit > MAXMBAU) return(EUNIT);
-
-       bzero(lp, sizeof(struct disklabel));
+       if (askname == 0) { /* Take info from RPB */
+               mr = (void *)bootrpb.adpphy;
+               hd = (void *)&mr->mba_md[bootrpb.unit];
+       } else {
+               mr = (void *)nexaddr;
+               hd = (void *)&mr->mba_md[unit];
+               bootrpb.adpphy = (int)mr;
+               bootrpb.unit = unit;
+       }
+       bzero(&hplabel, sizeof(struct disklabel));
 
-       lp->d_secpercyl = 32;
-       lp->d_nsectors = 32;
-       hs->adapt = adapt;
-       hs->ctlr = ctlr;
-       hs->unit = unit;
-       hs->part = part;
+       hplabel.d_secpercyl = 32;
+       hplabel.d_nsectors = 32;
 
        /* Set volume valid and 16 bit format; only done once */
        mr->mba_cr = MBACR_INIT;
        hd->hp_cs1 = HPCS_PA;
        hd->hp_of = HPOF_FMT;
 
-       err = hpstrategy(hs, F_READ, LABELSECTOR, DEV_BSIZE, io_buf, &i);
+       err = hpstrategy(0, F_READ, LABELSECTOR, DEV_BSIZE, io_buf, &i);
        if (err) {
                printf("reading disklabel: %s\n", strerror(err));
                return 0;
        }
 
-       msg = getdisklabel(io_buf + LABELOFFSET, lp);
+       msg = getdisklabel(io_buf + LABELOFFSET, &hplabel);
        if (msg)
                printf("getdisklabel: %s\n", msg);
-       
-       f->f_devdata = (void *)hs;
        return 0;
 }
 
-hpstrategy(hs, func, dblk, size, buf, rsize)
-       struct hp_softc *hs;
-       daddr_t dblk;
-       u_int size, *rsize;
-       char *buf;
-       int func;
+int
+hpstrategy(void *f, int func, daddr_t dblk,
+    size_t size, void *buf, size_t *rsize)
 {
-       volatile struct mba_regs *mr;
-       volatile struct hp_drv *hd;
-       struct disklabel *lp;
-       unsigned int i, pfnum, mapnr, nsize, bn, cn, sn, tn;
-
-       mr = (void *)mbaaddr[hs->ctlr];
-       hd = (void *)&mr->mba_md[hs->unit];
-       lp = &hplabel;
+       unsigned int pfnum, mapnr, nsize, bn, cn, sn, tn;
 
        pfnum = (u_int)buf >> VAX_PGSHIFT;
 
@@ -136,21 +114,23 @@
 
        mr->mba_var = ((u_int)buf & VAX_PGOFSET);
        mr->mba_bc = (~size) + 1;
-       bn = dblk + lp->d_partitions[hs->part].p_offset;
+       bn = dblk + hplabel.d_partitions[dpart].p_offset;
 
        if (bn) {
-               cn = bn / lp->d_secpercyl;
-               sn = bn % lp->d_secpercyl;
-               tn = sn / lp->d_nsectors;
-               sn = sn % lp->d_nsectors;
+               cn = bn / hplabel.d_secpercyl;
+               sn = bn % hplabel.d_secpercyl;
+               tn = sn / hplabel.d_nsectors;
+               sn = sn % hplabel.d_nsectors;
        } else
                cn = sn = tn = 0;
 
        hd->hp_dc = cn;
        hd->hp_da = (tn << 8) | sn;
+#ifdef notdef
        if (func == F_WRITE)
                hd->hp_cs1 = HPCS_WRITE;
        else
+#endif
                hd->hp_cs1 = HPCS_READ;
 
        while (mr->mba_sr & MBASR_DTBUSY)
@@ -158,8 +138,7 @@
 
        if (mr->mba_sr & MBACR_ABORT)
                return 1;
-       
+
        *rsize = size;
-
        return 0;
 }
diff -r afe16fe50528 -r 7dfac1e79ef2 sys/arch/vax/boot/boot/if_le.c
--- a/sys/arch/vax/boot/boot/if_le.c    Sat May 20 13:22:39 2000 +0000
+++ b/sys/arch/vax/boot/boot/if_le.c    Sat May 20 13:30:03 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_le.c,v 1.5 2000/05/09 20:53:52 ragge Exp $ */
+/*     $NetBSD: if_le.c,v 1.6 2000/05/20 13:30:03 ragge Exp $ */
 /*
  * Copyright (c) 1997, 1999 Ludd, University of Lule}, Sweden.
  * All rights reserved.
@@ -49,6 +49,7 @@
 #include <../include/rpb.h>
 
 #include <lib/libsa/netif.h>
+#include <lib/libsa/stand.h>
 
 #include <dev/ic/lancereg.h>
 #include <dev/ic/am7990reg.h>
@@ -56,7 +57,7 @@
 #include "vaxstand.h"
 
 /*
- * The following are incorrect. Why doesn't DEC follow its own specs???
+ * Buffer sizes.
  */
 #define TLEN    1
 #define NTBUF   (1 << TLEN)
@@ -64,23 +65,15 @@
 #define NRBUF   (1 << RLEN)
 #define BUFSIZE 1518
 
-#define        QW_ALLOC(x)     ((alloc((x) + 7) + 7) & ~7)
-
-int le_probe(), le_match(), le_get(), le_put();
-void le_init(), le_end();
-static void copyin(), copyout();
+#define        QW_ALLOC(x)     (((int)alloc((x) + 7) + 7) & ~7)
 
-struct netif_stats le_stats;
-
-struct netif_dif le_ifs[] = {
-/*     dif_unit        dif_nsel        dif_stats       dif_private     */
-{      0,              1,              &le_stats,      },
-};
-
-struct netif_stats le_stats;
+static int le_get(struct iodesc *, void *, size_t, time_t);
+static int le_put(struct iodesc *, void *, size_t);
+static void copyout(void *from, int dest, int len);
+static void copyin(int src, void *to, int len);
 
 struct netif_driver le_driver = {
-       "le", le_match, le_probe, le_init, le_get, le_put, le_end, le_ifs, 1,
+       0, 0, 0, 0, le_get, le_put,
 };
 
 /*
@@ -140,31 +133,14 @@
        (nireg->ni_rap = port, nireg->ni_rdp)
  
 int
-le_match(nif, machdep_hint)
-       struct netif *nif;



Home | Main Index | Thread Index | Old Index