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 Use a common routine ubmap() that set...
details: https://anonhg.NetBSD.org/src/rev/f24aa890a772
branches: trunk
changeset: 321510:f24aa890a772
user: ragge <ragge%NetBSD.org@localhost>
date: Mon Mar 19 15:43:45 2018 +0000
description:
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.
diffstat:
sys/arch/vax/boot/boot/devopen.c | 32 +++++++++++++++++++++++++++++++-
sys/arch/vax/boot/boot/hp.c | 10 +++-------
sys/arch/vax/boot/boot/if_de.c | 12 +++---------
sys/arch/vax/boot/boot/ra.c | 24 +++++-------------------
sys/arch/vax/boot/boot/vaxstand.h | 3 ++-
5 files changed, 44 insertions(+), 37 deletions(-)
diffs (213 lines):
diff -r 311dc6c756ff -r f24aa890a772 sys/arch/vax/boot/boot/devopen.c
--- a/sys/arch/vax/boot/boot/devopen.c Mon Mar 19 15:37:56 2018 +0000
+++ b/sys/arch/vax/boot/boot/devopen.c Mon Mar 19 15:43:45 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.19 2018/03/19 15:43:45 ragge 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,7 +39,12 @@
#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)
{
@@ -127,6 +133,7 @@
if (adapt < 0)
break;
nexaddr = (NEX750 + NEXSIZE * adapt);
+ mapaddr = (int *)nexaddr + VAX_NBPG;
csrbase = (adapt == 8 ? 0xffe000 : 0xfbe000);
break;
case VAX_BTYP_780:
@@ -135,6 +142,7 @@
if (adapt < 0)
break;
nexaddr = ((int)NEX780 + NEXSIZE * adapt);
+ mapaddr = (int *)nexaddr + VAX_NBPG;
csrbase = 0x2007e000 + 0x40000 * adapt;
break;
case VAX_BTYP_9CC: /* 6000/200 */
@@ -176,6 +184,7 @@
mapregs = (void *)0x20088000;
if (bootrpb.adpphy == 0x20087800) {
nexaddr = bootrpb.adpphy;
+ mapaddr = (int *)nexaddr + VAX_NBPG;
for (i = 0; i < 8192; i++)
mapregs[i] = PG_V | i;
}
@@ -195,3 +204,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 311dc6c756ff -r f24aa890a772 sys/arch/vax/boot/boot/hp.c
--- a/sys/arch/vax/boot/boot/hp.c Mon Mar 19 15:37:56 2018 +0000
+++ b/sys/arch/vax/boot/boot/hp.c Mon Mar 19 15:43:45 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.11 2018/03/19 15:43:45 ragge 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 311dc6c756ff -r f24aa890a772 sys/arch/vax/boot/boot/if_de.c
--- a/sys/arch/vax/boot/boot/if_de.c Mon Mar 19 15:37:56 2018 +0000
+++ b/sys/arch/vax/boot/boot/if_de.c Mon Mar 19 15:43:45 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.10 2018/03/19 15:43:45 ragge 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 311dc6c756ff -r f24aa890a772 sys/arch/vax/boot/boot/ra.c
--- a/sys/arch/vax/boot/boot/ra.c Mon Mar 19 15:37:56 2018 +0000
+++ b/sys/arch/vax/boot/boot/ra.c Mon Mar 19 15:43:45 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.21 2018/03/19 15:43:45 ragge Exp $ */
/*
* Copyright (c) 1995 Ludd, University of Lule}, Sweden.
* All rights reserved.
@@ -67,7 +67,6 @@
static char io_buf[DEV_BSIZE];
static int dpart, dunit, remap, is_tmscp, curblock;
static volatile u_short *ra_ip, *ra_sa, *ra_sw;
-static volatile u_int *mapregs;
int
raopen(struct open_file *f, int adapt, int ctlr, int unit, int part)
@@ -102,14 +101,9 @@
csrbase += (ctlr ? 000334 : 012150);
ra_ip = (u_short *)csrbase;
ra_sa = ra_sw = (u_short *)csrbase + 1;
- if (nexaddr) { /* have map registers */
- mapregs = (u_int *)nexaddr + 512;
- mapregs[494] = PG_V | (((u_int)&uda) >> 9);
- mapregs[495] = mapregs[494] + 1;
- ubauda = (struct uda *)((char*)0x3dc00 +
- (((u_int)(&uda))&0x1ff));
- } else
- ubauda = &uda;
+
+ ubauda = (struct uda *)ubmap(494,
+ (int)&uda, sizeof(struct uda));
johan = (((u_int)ubauda) & 0xffff) + 8;
johan2 = (((u_int)ubauda) >> 16) & 077;
*ra_ip = 0; /* Start init */
@@ -258,21 +252,13 @@
rastrategy(void *f, int func, daddr_t dblk,
size_t size, void *buf, size_t *rsize)
{
- u_int pfnum, mapnr, nsize;
#ifdef DEV_DEBUG
printf("rastrategy: buf %p remap %d is_tmscp %d\n",
buf, remap, is_tmscp);
#endif
- if (remap) {
- pfnum = (u_int)buf >> VAX_PGSHIFT;
- for(mapnr = 0, nsize = size; (nsize + VAX_NBPG) > 0;
- nsize -= VAX_NBPG)
- mapregs[mapnr++] = PG_V | pfnum++;
- uda.uda_cmd.mscp_seq.seq_buffer = ((u_int)buf) & 0x1ff;
- } else
- uda.uda_cmd.mscp_seq.seq_buffer = ((u_int)buf);
+ uda.uda_cmd.mscp_seq.seq_buffer = ubmap(0, (int)buf, size);
if (is_tmscp) {
int i;
diff -r 311dc6c756ff -r f24aa890a772 sys/arch/vax/boot/boot/vaxstand.h
--- a/sys/arch/vax/boot/boot/vaxstand.h Mon Mar 19 15:37:56 2018 +0000
+++ b/sys/arch/vax/boot/boot/vaxstand.h Mon Mar 19 15:43:45 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vaxstand.h,v 1.9 2017/05/22 16:59:32 ragge Exp $ */
+/* $NetBSD: vaxstand.h,v 1.10 2018/03/19 15:43:45 ragge Exp $ */
/*
* Copyright (c) 1994 Ludd, University of Lule}, Sweden.
* All rights reserved.
@@ -46,6 +46,7 @@
struct netif_driver;
int net_devinit(struct open_file *f, struct netif_driver *drv, u_char *eaddr);
+int ubmap(int mapno, int vaddr, int size);
/* device calls */
int raopen(struct open_file *, int, int, int, int),
Home |
Main Index |
Thread Index |
Old Index