Source-Changes-HG archive

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

[src/netbsd-8]: src/sys/arch/vax/boot/boot Pull up following revision(s) (req...



details:   https://anonhg.NetBSD.org/src/rev/c5814829f3ff
branches:  netbsd-8
changeset: 434778:c5814829f3ff
user:      snj <snj%NetBSD.org@localhost>
date:      Sat Mar 24 18:06:51 2018 +0000

description:
Pull up following revision(s) (requested by ragge in ticket #655):
        sys/arch/vax/boot/boot/devopen.c: 1.19-1.20
        sys/arch/vax/boot/boot/hp.c: 1.11
        sys/arch/vax/boot/boot/if_de.c: 1.10
        sys/arch/vax/boot/boot/if_qe.c: 1.10
        sys/arch/vax/boot/boot/ra.c: 1.21-1.22
        sys/arch/vax/boot/boot/vaxstand.h: 1.10
Use a common routine ubmap() that setup the map registers as needed,
not expecting everything to be below 4M.  This solves the problem
that large kernels cannot be loaded reported on port-vax.
--
Change the driver to map the data structures onto the qbus.
--
Fix bug causing autoboot on 750/780 not to work.  Cleanup.

diffstat:

 sys/arch/vax/boot/boot/devopen.c  |  37 ++++++++++++++++++---
 sys/arch/vax/boot/boot/hp.c       |  10 +----
 sys/arch/vax/boot/boot/if_de.c    |  12 +-----
 sys/arch/vax/boot/boot/if_qe.c    |  67 ++++++++++++++++++++------------------
 sys/arch/vax/boot/boot/ra.c       |  31 ++++-------------
 sys/arch/vax/boot/boot/vaxstand.h |   3 +-
 6 files changed, 82 insertions(+), 78 deletions(-)

diffs (truncated from 379 to 300 lines):

diff -r ecb782416d64 -r c5814829f3ff sys/arch/vax/boot/boot/devopen.c
--- a/sys/arch/vax/boot/boot/devopen.c  Sat Mar 24 18:03:21 2018 +0000
+++ b/sys/arch/vax/boot/boot/devopen.c  Sat Mar 24 18:06:51 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: devopen.c,v 1.18 2017/05/22 16:59:32 ragge Exp $ */
+/*     $NetBSD: devopen.c,v 1.18.2.1 2018/03/24 18:06:51 snj Exp $ */
 /*
  * Copyright (c) 1997 Ludd, University of Lule}, Sweden.
  * All rights reserved.
@@ -27,6 +27,7 @@
 #include <lib/libsa/stand.h>
 #include <lib/libkern/libkern.h>
 
+#include <machine/param.h>
 #include <machine/rpb.h>
 #include <machine/sid.h>
 #include <machine/pte.h>
@@ -38,12 +39,16 @@
 #include "vaxstand.h"
 
 int nexaddr, csrbase;
+static int *mapaddr;
 
+/*
+ * Boot device syntax:
+ * device(adapter, controller, unit, partition)file
+ */
 int
 devopen(struct open_file *f, const char *fname, char **file)
 {
        int dev, unit, ctlr, part, adapt, i, a[4], x;
-       int *mapregs;
        struct devsw *dp;
        extern int cnvtab[];
        char *s, *c;
@@ -124,6 +129,7 @@
        switch (vax_boardtype) {
        case VAX_BTYP_750:
                csrbase = (nexaddr == 0xf30000 ? 0xffe000 : 0xfbe000);
+               mapaddr = (int *)nexaddr + VAX_NBPG;
                if (adapt < 0)
                        break;
                nexaddr = (NEX750 + NEXSIZE * adapt);
@@ -132,6 +138,7 @@
        case VAX_BTYP_780:
        case VAX_BTYP_790:
                csrbase = 0x2007e000 + 0x40000 * ((nexaddr & 0x1e000) >> 13);
+               mapaddr = (int *)nexaddr + VAX_NBPG;
                if (adapt < 0)
                        break;
                nexaddr = ((int)NEX780 + NEXSIZE * adapt);
@@ -172,12 +179,9 @@
        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) {
                        nexaddr = bootrpb.adpphy;
-                       for (i = 0; i < 8192; i++)
-                               mapregs[i] = PG_V | i;
+                       mapaddr = (int *)nexaddr + VAX_NBPG;
                }
                break;
        }
@@ -195,3 +199,24 @@
        printf("usage: dev(adapter,controller,unit,partition)file -asd\n");
        return -1;
 }
+
+/*
+ * Map in virtual address vaddr of size vsize starting with map mapno.
+ * Returns the unibus address of the mapped area.
+ */
+int
+ubmap(int mapno, int vaddr, int size)
+{
+       int voff = (vaddr & VAX_PGOFSET);
+       int rv = (mapno << VAX_PGSHIFT) + voff;
+       int vpag, npag;
+
+       if (mapaddr == 0)
+               return vaddr; /* no map, phys == virt */
+
+       npag = (voff + size) / VAX_NBPG;
+       vpag = vaddr >> VAX_PGSHIFT;
+       while (npag-- >= 0)
+               mapaddr[mapno++] = vpag++ | PG_V;
+       return rv;
+}
diff -r ecb782416d64 -r c5814829f3ff sys/arch/vax/boot/boot/hp.c
--- a/sys/arch/vax/boot/boot/hp.c       Sat Mar 24 18:03:21 2018 +0000
+++ b/sys/arch/vax/boot/boot/hp.c       Sat Mar 24 18:06:51 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: hp.c,v 1.10 2017/05/22 16:59:32 ragge Exp $ */
+/*     $NetBSD: hp.c,v 1.10.2.1 2018/03/24 18:06:51 snj Exp $ */
 /*
  * Copyright (c) 1994 Ludd, University of Lule}, Sweden.
  * All rights reserved.
@@ -108,13 +108,9 @@
 hpstrategy(void *f, int func, daddr_t dblk,
     size_t size, void *buf, size_t *rsize)
 {
-       unsigned int pfnum, mapnr, nsize, bn, cn, sn, tn;
-
-       pfnum = (u_int)buf >> VAX_PGSHIFT;
+       unsigned int bn, cn, sn, tn;
 
-       for(mapnr = 0, nsize = size; (nsize + VAX_NBPG) > 0;
-           nsize -= VAX_NBPG, mapnr++, pfnum++)
-               MBA_WCSR(MAPREG(mapnr), PG_V | pfnum);
+       (void)ubmap(0, (int)buf, size);
 
        MBA_WCSR(MBA_VAR, ((u_int)buf & VAX_PGOFSET));
        MBA_WCSR(MBA_BC, (~size) + 1);
diff -r ecb782416d64 -r c5814829f3ff sys/arch/vax/boot/boot/if_de.c
--- a/sys/arch/vax/boot/boot/if_de.c    Sat Mar 24 18:03:21 2018 +0000
+++ b/sys/arch/vax/boot/boot/if_de.c    Sat Mar 24 18:06:51 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_de.c,v 1.9 2017/05/22 16:59:32 ragge Exp $  */
+/*     $NetBSD: if_de.c,v 1.9.2.1 2018/03/24 18:06:51 snj Exp $        */
 
 /*
  * Copyright (c) 2000 Ludd, University of Lule}, Sweden. All rights reserved.
@@ -86,7 +86,7 @@
 int
 deopen(struct open_file *f, int adapt, int ctlr, int unit, int part)
 {
-       int i, cdata, *map, npgs;
+       int i;
        u_char eaddr[6];
 
        /* point to the device in memory */
@@ -108,14 +108,8 @@
 
        /* Map in the control structures and buffers */
        dc = alloc(sizeof(struct de_cdata));
-       pdc = (struct de_cdata *)((int)dc & VAX_PGOFSET);
-       map = (int *)nexaddr + 512;
-       npgs = (sizeof(struct de_cdata) >> VAX_PGSHIFT) + 1;
-       cdata = (int)dc >> VAX_PGSHIFT;
-       for (i = 0; i < npgs; i++) {
-               map[i] = PG_V | (cdata + i);
-       }
 
+       pdc = (struct de_cdata *)ubmap(0, (int)dc, sizeof(struct de_cdata));
        memset((char *)dc, 0, sizeof(struct de_cdata));
        
        /* Tell the DEUNA about our PCB */
diff -r ecb782416d64 -r c5814829f3ff sys/arch/vax/boot/boot/if_qe.c
--- a/sys/arch/vax/boot/boot/if_qe.c    Sat Mar 24 18:03:21 2018 +0000
+++ b/sys/arch/vax/boot/boot/if_qe.c    Sat Mar 24 18:06:51 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_qe.c,v 1.9 2009/10/26 19:16:58 cegger Exp $ */
+/*     $NetBSD: if_qe.c,v 1.9.56.1 2018/03/24 18:06:51 snj Exp $ */
 
 /*
  * Copyright (c) 1998 Roar Thronæs.  All rights reserved.
@@ -69,8 +69,8 @@
        char    qein[2048], qeout[2048];/* Packet buffers               */
 } qe_softc;
 
-static struct qe_softc *sc = &qe_softc;
-static int addr;
+static struct qe_softc *sc = &qe_softc, *psc;
+static int addr, ubaddr;
 
 #define QE_WCSR(csr, val) \
        (*((volatile u_short *)(addr + (csr))) = (val))
@@ -111,6 +111,9 @@
        QE_WCSR(QE_CSR_CSR, QE_RESET);
        QE_WCSR(QE_CSR_CSR, QE_RCSR(QE_CSR_CSR) & ~QE_RESET);
 
+       ubaddr = ubmap(0, (int)sc, sizeof(struct qe_softc));
+       psc = (struct qe_softc *)ubaddr;
+
        for (i = 0; i < 6; i++) {
                sc->setup_pkt[i][1] = QE_RCSR(i * 2);
                sc->setup_pkt[i+8][1] = QE_RCSR(i * 2);
@@ -125,13 +128,13 @@
 
        memset((void *)sc->rring, 0, sizeof(struct qe_ring));
        sc->rring->qe_buf_len = -64;
-       sc->rring->qe_addr_lo = (short)((int)sc->setup_pkt);
-       sc->rring->qe_addr_hi = (short)((int)sc->setup_pkt >> 16);
+       sc->rring->qe_addr_lo = LOWORD(psc->setup_pkt);
+       sc->rring->qe_addr_hi = HIWORD(psc->setup_pkt);
 
        memset((void *)sc->tring, 0, sizeof(struct qe_ring));
        sc->tring->qe_buf_len = -64;
-       sc->tring->qe_addr_lo = (short)((int)sc->setup_pkt);
-       sc->tring->qe_addr_hi = (short)((int)sc->setup_pkt >> 16);
+       sc->tring->qe_addr_lo = LOWORD(psc->setup_pkt);
+       sc->tring->qe_addr_hi = HIWORD(psc->setup_pkt);
 
        sc->rring[0].qe_flag = sc->rring[0].qe_status1 = QE_NOTYET;
        sc->rring->qe_addr_hi |= QE_VALID;
@@ -141,10 +144,10 @@
 
        QE_WCSR(QE_CSR_CSR, QE_XMIT_INT | QE_RCV_INT);
 
-       QE_WCSR(QE_CSR_RCLL, LOWORD(sc->rring));
-       QE_WCSR(QE_CSR_RCLH, HIWORD(sc->rring));
-       QE_WCSR(QE_CSR_XMTL, LOWORD(sc->tring));
-       QE_WCSR(QE_CSR_XMTH, HIWORD(sc->tring));
+       QE_WCSR(QE_CSR_RCLL, LOWORD(psc->rring));
+       QE_WCSR(QE_CSR_RCLH, HIWORD(psc->rring));
+       QE_WCSR(QE_CSR_XMTL, LOWORD(psc->tring));
+       QE_WCSR(QE_CSR_XMTH, HIWORD(psc->tring));
 
        while ((QE_RCSR(QE_CSR_CSR) & QE_INTS) != QE_INTS)
                ;
@@ -152,31 +155,31 @@
        QE_WCSR(QE_CSR_CSR, QE_RCSR(QE_CSR_CSR) & ~(QE_INT_ENABLE|QE_ELOOP));
        QE_WCSR(QE_CSR_CSR, QE_RCSR(QE_CSR_CSR) | QE_ILOOP);
 
-       sc->rring[0].qe_addr_lo = (short)((int)sc->qein & 0xffff);
-       sc->rring[0].qe_addr_hi = (short)((int)sc->qein >> 16);
-       sc->rring[0].qe_buf_len=-MAXPACKETSIZE/2;
+       sc->rring[0].qe_addr_lo = LOWORD(psc->qein);
+       sc->rring[0].qe_addr_hi = HIWORD(psc->qein);
+       sc->rring[0].qe_buf_len = -MAXPACKETSIZE/2;
        sc->rring[0].qe_addr_hi |= QE_VALID;
-       sc->rring[0].qe_flag=sc->rring[0].qe_status1=QE_NOTYET;
-       sc->rring[0].qe_status2=1;
+       sc->rring[0].qe_flag = sc->rring[0].qe_status1 = QE_NOTYET;
+       sc->rring[0].qe_status2 = 1;
 
        sc->rring[1].qe_addr_lo = 0;
        sc->rring[1].qe_addr_hi = 0;
        sc->rring[1].qe_flag=sc->rring[1].qe_status1=QE_NOTYET;
        sc->rring[1].qe_status2=1;
 
-       sc->tring[0].qe_addr_lo = (short)((int)sc->qeout & 0xffff);
-       sc->tring[0].qe_addr_hi = (short)((int)sc->qeout >> 16);
-       sc->tring[0].qe_buf_len=0;
-       sc->tring[0].qe_flag=sc->tring[0].qe_status1=QE_NOTYET;
+       sc->tring[0].qe_addr_lo = LOWORD(psc->qeout);
+       sc->tring[0].qe_addr_hi = HIWORD(psc->qeout);
+       sc->tring[0].qe_buf_len = 0;
+       sc->tring[0].qe_flag = sc->tring[0].qe_status1 = QE_NOTYET;
        sc->tring[0].qe_addr_hi |= QE_EOMSG|QE_VALID;
 
-       sc->tring[1].qe_flag=sc->tring[1].qe_status1=QE_NOTYET;
+       sc->tring[1].qe_flag = sc->tring[1].qe_status1 = QE_NOTYET;
        sc->tring[1].qe_addr_lo = 0;
        sc->tring[1].qe_addr_hi = 0;
 
        QE_WCSR(QE_CSR_CSR, QE_RCSR(QE_CSR_CSR) | QE_RCV_ENABLE);
-       QE_WCSR(QE_CSR_RCLL, LOWORD(sc->rring));
-       QE_WCSR(QE_CSR_RCLH, HIWORD(sc->rring));
+       QE_WCSR(QE_CSR_RCLL, LOWORD(psc->rring));
+       QE_WCSR(QE_CSR_RCLH, HIWORD(psc->rring));
 }
 
 int
@@ -206,12 +209,12 @@
 
 end:
        sc->rring[0].qe_status2 = sc->rring[1].qe_status2 = 1;
-       sc->rring[0].qe_flag=sc->rring[0].qe_status1=QE_NOTYET;
-       sc->rring[1].qe_flag=sc->rring[1].qe_status1=QE_NOTYET;
+       sc->rring[0].qe_flag = sc->rring[0].qe_status1 = QE_NOTYET;
+       sc->rring[1].qe_flag = sc->rring[1].qe_status1 = QE_NOTYET;
        QE_WCSR(QE_CSR_CSR, QE_RCSR(QE_CSR_CSR) | QE_RCV_ENABLE);
 
-       QE_WCSR(QE_CSR_RCLL, LOWORD(sc->rring));
-       QE_WCSR(QE_CSR_RCLH, HIWORD(sc->rring));
+       QE_WCSR(QE_CSR_RCLL, LOWORD(psc->rring));
+       QE_WCSR(QE_CSR_RCLH, HIWORD(psc->rring));
        return len;
 
 fail:  len = -1;
@@ -223,12 +226,12 @@
        int j;
 
        memcpy((char *)sc->qeout, pkt, len);
-       sc->tring[0].qe_buf_len=-len/2;
-       sc->tring[0].qe_flag=sc->tring[0].qe_status1=QE_NOTYET;
-       sc->tring[1].qe_flag=sc->tring[1].qe_status1=QE_NOTYET;
+       sc->tring[0].qe_buf_len = -len/2;
+       sc->tring[0].qe_flag = sc->tring[0].qe_status1 = QE_NOTYET;
+       sc->tring[1].qe_flag = sc->tring[1].qe_status1 = QE_NOTYET;
 
-       QE_WCSR(QE_CSR_XMTL, LOWORD(sc->tring));
-       QE_WCSR(QE_CSR_XMTH, HIWORD(sc->tring));
+       QE_WCSR(QE_CSR_XMTL, LOWORD(psc->tring));
+       QE_WCSR(QE_CSR_XMTH, HIWORD(psc->tring));
 
        for(j = 0; (j < 0x10000) && ((QE_RCSR(QE_CSR_CSR) & QE_XMIT_INT) == 0); j++)
                ;
diff -r ecb782416d64 -r c5814829f3ff sys/arch/vax/boot/boot/ra.c
--- a/sys/arch/vax/boot/boot/ra.c       Sat Mar 24 18:03:21 2018 +0000
+++ b/sys/arch/vax/boot/boot/ra.c       Sat Mar 24 18:06:51 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ra.c,v 1.20 2017/05/22 16:59:32 ragge Exp $ */
+/*     $NetBSD: ra.c,v 1.20.2.1 2018/03/24 18:06:51 snj Exp $ */
 /*
  * Copyright (c) 1995 Ludd, University of Lule}, Sweden.
  * All rights reserved.



Home | Main Index | Thread Index | Old Index