summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrandon Creighton <bjc@cvs.openbsd.org>2000-10-09 23:11:58 +0000
committerBrandon Creighton <bjc@cvs.openbsd.org>2000-10-09 23:11:58 +0000
commitbe549a5de4c9bd14b798d181d6654b123f22c79e (patch)
tree851d24c277f9b1339b363a62f5cade7b1695da0d
parenta4344e6b151e74c9e64e9f4577dd0d46881a78cc (diff)
code to get asc* (ncr 53c9x) working; most of this from netbsd
also, write the correct stuff in cpu_coredump (vm_machdep.c)
-rw-r--r--sys/arch/vax/include/bus.h5
-rw-r--r--sys/arch/vax/include/reg.h7
-rw-r--r--sys/arch/vax/include/rpb.h5
-rw-r--r--sys/arch/vax/include/sgmap.h6
-rw-r--r--sys/arch/vax/include/vsbus.h26
-rw-r--r--sys/arch/vax/vax/conf.c6
-rw-r--r--sys/arch/vax/vax/rootfil.c18
-rw-r--r--sys/arch/vax/vax/sgmap.c53
-rw-r--r--sys/arch/vax/vax/vm_machdep.c81
9 files changed, 169 insertions, 38 deletions
diff --git a/sys/arch/vax/include/bus.h b/sys/arch/vax/include/bus.h
index b012cae6449..37e0952eefc 100644
--- a/sys/arch/vax/include/bus.h
+++ b/sys/arch/vax/include/bus.h
@@ -1,5 +1,5 @@
-/* $OpenBSD: bus.h,v 1.1 2000/04/26 06:08:27 bjc Exp $ */
-/* $NetBSD: bus.h,v 1.11 2000/03/15 16:44:50 drochner Exp $ */
+/* $OpenBSD: bus.h,v 1.2 2000/10/09 23:11:56 bjc Exp $ */
+/* $NetBSD: bus.h,v 1.14 2000/06/26 04:56:13 simonb Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -868,6 +868,7 @@ vax_mem_copy_region_4(t, h1, o1, h2, o2, c)
#define BUS_DMA_BUS3 0x40
#define BUS_DMA_BUS4 0x80
+#define VAX_BUS_DMA_SPILLPAGE BUS_DMA_BUS1 /* VS4000 kludge */
/*
* Private flags stored in the DMA map.
*/
diff --git a/sys/arch/vax/include/reg.h b/sys/arch/vax/include/reg.h
index 2d0de80db20..b04552f8165 100644
--- a/sys/arch/vax/include/reg.h
+++ b/sys/arch/vax/include/reg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: reg.h,v 1.2 1997/05/29 00:04:49 niklas Exp $ */
+/* $OpenBSD: reg.h,v 1.3 2000/10/09 23:11:57 bjc Exp $ */
/* $NetBSD: reg.h,v 1.3 1995/04/12 15:26:52 ragge Exp $ */
/*
@@ -32,7 +32,9 @@
*/
/* All bugs are subject to removal without further notice */
-
+
+#ifndef _VAX_REG_H_
+#define _VAX_REG_H_
struct reg {
int r0; /* General registers saved upon trap/syscall */
@@ -54,3 +56,4 @@ struct reg {
int psl; /* User psl */
};
+#endif /* _VAX_REG_H_ */
diff --git a/sys/arch/vax/include/rpb.h b/sys/arch/vax/include/rpb.h
index 4ac82087cd8..cdd956d5d31 100644
--- a/sys/arch/vax/include/rpb.h
+++ b/sys/arch/vax/include/rpb.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: rpb.h,v 1.6 2000/04/26 03:08:42 bjc Exp $ */
+/* $OpenBSD: rpb.h,v 1.7 2000/10/09 23:11:56 bjc Exp $ */
/* $NetBSD: rpb.h,v 1.6 1998/07/01 09:37:11 ragge Exp $ */
/*
* Copyright (c) 1995 Ludd, University of Lule}, Sweden.
@@ -115,6 +115,7 @@ struct rpb { /* size description */
#define BDEV_RD 36 /* ST506/MFM disk on HDC9224 */
#define BDEV_ST 37 /* SCSI tape on NCR5380 */
#define BDEV_SD 42 /* SCSI disk on NCR5380 */
+#define BDEV_SDN 46 /* SCSI disk on NCR5394 */
#define BDEV_CNSL 64
#define BDEV_QE 96
#define BDEV_DE 97
@@ -125,5 +126,5 @@ struct rpb { /* size description */
#define BDEV_NET BDEV_QE /* first network BDEV */
#ifdef _KERNEL
-extern struct rpb rpb;
+extern struct rpb *rpb;
#endif
diff --git a/sys/arch/vax/include/sgmap.h b/sys/arch/vax/include/sgmap.h
index 87db65d9831..1bc50eac082 100644
--- a/sys/arch/vax/include/sgmap.h
+++ b/sys/arch/vax/include/sgmap.h
@@ -1,5 +1,5 @@
-/* $OpenBSD: sgmap.h,v 1.2 2000/04/27 00:54:02 bjc Exp $ */
-/* $NetBSD: sgmap.h,v 1.1 1999/06/06 18:58:50 ragge Exp $ */
+/* $OpenBSD: sgmap.h,v 1.3 2000/10/09 23:11:57 bjc Exp $ */
+/* $NetBSD: sgmap.h,v 1.3 2000/05/17 21:22:18 matt Exp $ */
/*-
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -60,6 +60,8 @@ struct vax_sgmap {
bus_addr_t aps_sgvabase; /* base of the sgva space */
bus_size_t aps_sgvasize; /* size of the sgva space */
bus_addr_t aps_pa; /* Address in region */
+ unsigned int aps_flags; /* flags */
+#define SGMAP_KA49 0x01 /* KA49 SGMAP is weird */
};
void vax_sgmap_init __P((bus_dma_tag_t, struct vax_sgmap *,
diff --git a/sys/arch/vax/include/vsbus.h b/sys/arch/vax/include/vsbus.h
index 664d45bab5d..1c0eb6af228 100644
--- a/sys/arch/vax/include/vsbus.h
+++ b/sys/arch/vax/include/vsbus.h
@@ -1,5 +1,5 @@
-/* $OpenBSD: vsbus.h,v 1.4 2000/04/27 07:19:57 bjc Exp $ */
-/* $NetBSD: vsbus.h,v 1.9 1999/10/22 21:10:13 ragge Exp $ */
+/* $OpenBSD: vsbus.h,v 1.5 2000/10/09 23:11:57 bjc Exp $ */
+/* $NetBSD: vsbus.h,v 1.13 2000/06/25 16:00:46 ragge Exp $ */
/*
* Copyright (c) 1996 Ludd, University of Lule}, Sweden.
* All rights reserved.
@@ -42,6 +42,7 @@
#define _VAX_VSBUS_H_
#include <machine/bus.h>
+#include <machine/sgmap.h>
struct vsbus_softc {
struct device sc_dev;
@@ -52,6 +53,18 @@ struct vsbus_softc {
u_char *sc_intclr; /* Clear interrupt register */
u_char *sc_intreq; /* Interrupt request register */
u_char sc_mask; /* Interrupts to enable after autoconf */
+ vaddr_t sc_vsregs; /* Where the VS_REGS are mapped */
+ vaddr_t sc_dmaaddr; /* Mass storage virtual DMA area */
+ vsize_t sc_dmasize; /* Size of the DMA area */
+
+ struct vax_bus_dma_tag sc_dmatag;
+ struct vax_sgmap sc_sgmap;
+};
+
+struct vsbus_dma {
+ SIMPLEQ_ENTRY(vsbus_dma) vd_q;
+ void (*vd_go)(void *);
+ void *vd_arg;
};
struct confargs {
@@ -104,6 +117,9 @@ struct vsbus_attach_args {
short va_br; /* Interrupt level */
short va_cvec; /* Interrupt vector address */
u_char va_maskno; /* Interrupt vector in mask */
+ vaddr_t va_dmaaddr; /* DMA area address */
+ vsize_t va_dmasize; /* DMA area size */
+ bus_space_tag_t va_iot;
bus_dma_tag_t va_dmat;
struct confargs *confargs;
};
@@ -120,15 +136,21 @@ struct vsbus_attach_args {
#define NI_BASE 0x200e0000 /* LANCE CSRs */
#define NI_IOSIZE (128 * VAX_NBPG) /* IO address size */
+#define KA49_SCSIMAP 0x27000000 /* KA49 SCSI SGMAP */
/*
* Small monochrome graphics framebuffer, present on all machines.
*/
#define SMADDR 0x30000000
#define SMSIZE 0x20000 /* Actually 256k, only 128k used */
+#ifdef _KERNEL
+void vsbus_dma_init __P((struct vsbus_softc *, unsigned ptecnt));
u_char vsbus_setmask __P((unsigned char));
void vsbus_clrintr __P((unsigned char));
void vsbus_intr __P((void *));
void vsbus_copytoproc __P((struct proc *, caddr_t, caddr_t, int));
void vsbus_copyfromproc __P((struct proc *, caddr_t, caddr_t, int));
+void vsbus_dma_start __P((struct vsbus_dma *));
+void vsbus_dma_intr __P((void));
+#endif
#endif /* _VAX_VSBUS_H_ */
diff --git a/sys/arch/vax/vax/conf.c b/sys/arch/vax/vax/conf.c
index e67b655ef12..01f1eeddf77 100644
--- a/sys/arch/vax/vax/conf.c
+++ b/sys/arch/vax/vax/conf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: conf.c,v 1.20 2000/09/26 14:03:55 art Exp $ */
+/* $OpenBSD: conf.c,v 1.21 2000/10/09 23:11:57 bjc Exp $ */
/* $NetBSD: conf.c,v 1.44 1999/10/27 16:38:54 ragge Exp $ */
/*-
@@ -169,6 +169,7 @@ struct bdevmajtpl {
{ BDEV_KDB, 16 },
{ BDEV_RD, 19 },
{ BDEV_SD, 20 },
+ { BDEV_SDN, 20 },
{ BDEV_ST, 21 },
/* some things need these network devices, do not change them */
@@ -193,6 +194,7 @@ int bdevtomaj (bdev)
if(bdev == bd->bdev || bd->bdev == -1)
return bd->maj;
}
+ return bd != NULL ? bd->maj : NULL;
}
/*
@@ -225,7 +227,7 @@ struct consdev constab[]={
#else
#define NGEN 0
#endif
-#if VAX410 || VAX43 || VAX46 || VAX48 || VAX49
+#if VAX410 || VAX43 || VAX46 || VAX48 || VAX49 || VAX53
cons_init(dz), /* DZ11-like serial console on VAXstations */
#endif
#if VAX650 || VAX630
diff --git a/sys/arch/vax/vax/rootfil.c b/sys/arch/vax/vax/rootfil.c
index 38a919040dc..33da1dd8a24 100644
--- a/sys/arch/vax/vax/rootfil.c
+++ b/sys/arch/vax/vax/rootfil.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rootfil.c,v 1.8 2000/04/27 01:10:13 bjc Exp $ */
+/* $OpenBSD: rootfil.c,v 1.9 2000/10/09 23:11:57 bjc Exp $ */
/* $NetBSD: rootfil.c,v 1.14 1996/10/13 03:35:58 christos Exp $ */
/*
@@ -59,10 +59,12 @@
#include <machine/disklabel.h>
#include <machine/pte.h>
#include <machine/cpu.h>
+#include <machine/rpb.h>
#include "hp.h"
#include "ra.h"
#include "sd.h"
+#include "asc.h"
#define DOSWAP /* Change swdevt, argdev, and dumpdev too */
#ifdef MAJA
@@ -88,7 +90,7 @@ setroot()
char *uname;
if (boothowto & RB_DFLTROOT ||
- (bootdev & B_MAGICMASK) != (u_long)B_DEVMAGIC)
+ (bootdev & B_MAGICMASK) != (u_long)B_DEVMAGIC)
return;
majdev = bdevtomaj(B_TYPE(bootdev));
if (majdev >= nblkdev || majdev == -1)
@@ -114,8 +116,8 @@ setroot()
break;
case 20: /* SCSI disk */
-#if NSD
- if((mindev = sd_getdev(adaptor, controller, part, unit, &uname)) < 0)
+#if NASC || NSD
+ if((mindev = sd_getdev(adaptor, controller, part, unit, &uname)) < 0)
#endif
return;
break;
@@ -126,6 +128,8 @@ setroot()
orootdev = rootdev;
rootdev = makedev(majdev, mindev);
+ swdevt[0].sw_dev = dumpdev =
+ makedev(major(rootdev), 1);
/*
* If the original rootdev is the same as the one
* just calculated, don't need to adjust the swap configuration.
@@ -137,7 +141,7 @@ setroot()
#ifdef DOSWAP
mindev &= ~PARTITIONMASK;
- for (swp = swdevt; swp->sw_dev; swp++) {
+ for (swp = swdevt; swp->sw_dev != NODEV; swp++) {
if (majdev == major(swp->sw_dev) &&
mindev == (minor(swp->sw_dev) & ~PARTITIONMASK)) {
temp = swdevt[0].sw_dev;
@@ -146,7 +150,7 @@ setroot()
break;
}
}
- if (swp->sw_dev == 0)
+ if (swp->sw_dev == NODEV)
return;
/*
@@ -183,3 +187,5 @@ swapconf()
}
}
}
+
+
diff --git a/sys/arch/vax/vax/sgmap.c b/sys/arch/vax/vax/sgmap.c
index befde02b503..5b8cd210027 100644
--- a/sys/arch/vax/vax/sgmap.c
+++ b/sys/arch/vax/vax/sgmap.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: sgmap.c,v 1.1 2000/04/27 01:10:11 bjc Exp $ */
-/* $NetBSD: sgmap.c,v 1.3 1999/07/08 18:11:02 thorpej Exp $ */
+/* $OpenBSD: sgmap.c,v 1.2 2000/10/09 23:11:57 bjc Exp $ */
+/* $NetBSD: sgmap.c,v 1.8 2000/06/29 07:14:34 mrg Exp $ */
/*-
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -129,8 +129,14 @@ vax_sgmap_alloc(map, origlen, sgmap, flags)
panic("vax_sgmap_alloc: already have sgva space");
#endif
- map->_dm_sgvalen = vax_round_page(len);
+ /* If we need a spill page (for the VS4000 SCSI), make sure we
+ * allocate enough space for an extra page.
+ */
+ if (flags & VAX_BUS_DMA_SPILLPAGE) {
+ len += VAX_NBPG;
+ }
+ map->_dm_sgvalen = vax_round_page(len);
#if 0
printf("len %x -> %x, _dm_sgvalen %x _dm_boundary %x boundary %x -> ",
origlen, len, map->_dm_sgvalen, map->_dm_boundary, boundary);
@@ -206,10 +212,6 @@ vax_sgmap_load(t, map, buf, buflen, p, flags, sgmap)
/*
* Allocate the necessary virtual address space for the
* mapping. Round the size, since we deal with whole pages.
- *
- * alpha_sgmap_alloc will deal with the appropriate spill page
- * allocations.
- *
*/
endva = vax_round_page(va + buflen);
va = vax_trunc_page(va);
@@ -236,8 +238,7 @@ vax_sgmap_load(t, map, buf, buflen, p, flags, sgmap)
* Create the bus-specific page tables.
* Can be done much more efficient than this.
*/
- for (; va < endva; va += VAX_NBPG, pteidx++,
- pte = &page_table[pteidx], map->_dm_ptecnt++) {
+ for (; va < endva; va += VAX_NBPG, pte++, map->_dm_ptecnt++) {
/*
* Get the physical address for this segment.
*/
@@ -249,7 +250,28 @@ vax_sgmap_load(t, map, buf, buflen, p, flags, sgmap)
/*
* Load the current PTE with this page.
*/
- *pte = (pa >> VAX_PGSHIFT) | PG_V;
+ if (sgmap->aps_flags & SGMAP_KA49) {
+ unsigned long tmp = pa >> VAX_PGSHIFT;
+ int cnt;
+
+ for (cnt = 0; tmp != 0; tmp >>= 1) {
+ cnt += (tmp & 1);
+ }
+ *pte = pa | PG_V | ((cnt & 1) ? 0 : 0x10000000);
+#if 0
+ printf("[%d]: va=0x%08lx map=0x%08lx\n",
+ pteidx + map->_dm_ptecnt, va + dmaoffset, *pte);
+#endif
+ } else {
+ *pte = (pa >> VAX_PGSHIFT) | PG_V;
+ }
+ }
+ /* The VS4000 SCSI prefetcher doesn't like to end on a page boundary
+ * so add an extra page to quiet it down.
+ */
+ if (flags & VAX_BUS_DMA_SPILLPAGE) {
+ *pte = pte[-1];
+ map->_dm_ptecnt++;
}
map->dm_mapsize = buflen;
@@ -302,17 +324,14 @@ vax_sgmap_unload(t, map, sgmap)
struct vax_sgmap *sgmap;
{
long *pte, *page_table = (long *)sgmap->aps_pt;
- int ptecnt, pteidx;
+ int ptecnt;
/*
* Invalidate the PTEs for the mapping.
*/
- for (ptecnt = map->_dm_ptecnt, pteidx = map->_dm_pteidx,
- pte = &page_table[pteidx];
- ptecnt != 0;
- ptecnt--, pteidx++,
- pte = &page_table[pteidx]) {
- *pte = 0;
+ for (ptecnt = map->_dm_ptecnt, pte = &page_table[map->_dm_pteidx];
+ ptecnt-- != 0; ) {
+ *pte++ = 0;
}
/*
diff --git a/sys/arch/vax/vax/vm_machdep.c b/sys/arch/vax/vax/vm_machdep.c
index e9805a9a0a4..68854567bf8 100644
--- a/sys/arch/vax/vax/vm_machdep.c
+++ b/sys/arch/vax/vax/vm_machdep.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: vm_machdep.c,v 1.17 2000/06/08 22:25:23 niklas Exp $ */
-/* $NetBSD: vm_machdep.c,v 1.56 2000/01/20 22:19:00 sommerfeld Exp $ */
+/* $OpenBSD: vm_machdep.c,v 1.18 2000/10/09 23:11:57 bjc Exp $ */
+/* $NetBSD: vm_machdep.c,v 1.67 2000/06/29 07:14:34 mrg Exp $ */
/*
* Copyright (c) 1994 Ludd, University of Lule}, Sweden.
@@ -236,6 +236,7 @@ cpu_coredump(p, vp, cred, chdr)
{
struct trapframe *tf;
struct md_coredump state;
+ struct reg *regs = &state.md_reg;
struct coreseg cseg;
int error;
@@ -245,7 +246,12 @@ cpu_coredump(p, vp, cred, chdr)
chdr->c_seghdrsize = sizeof(struct coreseg);
chdr->c_cpusize = sizeof(struct md_coredump);
- bcopy(tf, &state, sizeof(struct md_coredump));
+ bcopy(&tf->r0, &regs->r0, 12 * sizeof(int));
+ regs->ap = tf->ap;
+ regs->fp = tf->fp;
+ regs->sp = tf->sp;
+ regs->pc = tf->pc;
+ regs->psl = tf->psl;
CORE_SETMAGIC(cseg, CORESEGMAGIC, MID_MACHINE, CORE_CPU);
cseg.c_addr = 0;
@@ -291,6 +297,7 @@ ioaccess(vaddr, paddr, npgs)
for (i = 0; i < npgs; i++)
pte[i] = PG_V | PG_KW | (PG_PFNUM(paddr) + i);
+ mtpr(0, PR_TBIA);
}
/*
@@ -308,3 +315,71 @@ iounaccess(vaddr, npgs)
pte[i] = 0;
mtpr(0, PR_TBIA);
}
+
+extern vm_map_t phys_map;
+
+/*
+ * Map a user I/O request into kernel virtual address space.
+ * Note: the pages are already locked by uvm_vslock(), so we
+ * do not need to pass an access_type to pmap_enter().
+ */
+void
+vmapbuf(bp, len)
+ struct buf *bp;
+ vsize_t len;
+{
+#if VAX46 || VAX48 || VAX49
+ vaddr_t faddr, taddr, off;
+ paddr_t pa;
+ struct proc *p;
+
+ if (vax_boardtype != VAX_BTYP_46
+ && vax_boardtype != VAX_BTYP_48
+ && vax_boardtype != VAX_BTYP_49)
+ return;
+ if ((bp->b_flags & B_PHYS) == 0)
+ panic("vmapbuf");
+ p = bp->b_proc;
+ faddr = trunc_page((vaddr_t)bp->b_saveaddr = bp->b_data);
+ off = (vaddr_t)bp->b_data - faddr;
+ len = round_page(off + len);
+ taddr = uvm_km_valloc_wait(phys_map, len);
+ bp->b_data = (caddr_t)(taddr + off);
+ len = atop(len);
+ while (len--) {
+ if ((pa = pmap_extract(vm_map_pmap(&p->p_vmspace->vm_map), faddr))
+ == FALSE)
+ panic("vmapbuf: null page frame");
+ pmap_enter(vm_map_pmap(phys_map), taddr, trunc_page(pa),
+ VM_PROT_READ|VM_PROT_WRITE, TRUE, VM_PROT_READ|VM_PROT_WRITE);
+ faddr += PAGE_SIZE;
+ taddr += PAGE_SIZE;
+ }
+#endif
+}
+
+/*
+ * Unmap a previously-mapped user I/O request.
+ */
+void
+vunmapbuf(bp, len)
+ struct buf *bp;
+ vsize_t len;
+{
+#if VAX46 || VAX48 || VAX49
+ vaddr_t addr, off;
+
+ if (vax_boardtype != VAX_BTYP_46
+ && vax_boardtype != VAX_BTYP_48
+ && vax_boardtype != VAX_BTYP_49)
+ return;
+ if ((bp->b_flags & B_PHYS) == 0)
+ panic("vunmapbuf");
+ addr = trunc_page((vaddr_t)bp->b_data);
+ off = (vaddr_t)bp->b_data - addr;
+ len = round_page(off + len);
+ uvm_km_free_wakeup(phys_map, addr, len);
+ bp->b_data = bp->b_saveaddr;
+ bp->b_saveaddr = NULL;
+#endif
+}