diff options
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/vax/vax/cfl.c | 261 | ||||
-rw-r--r-- | sys/arch/vax/vax/disksubr.c | 83 | ||||
-rw-r--r-- | sys/arch/vax/vax/intvec.s | 8 | ||||
-rw-r--r-- | sys/arch/vax/vax/ka410.c | 26 | ||||
-rw-r--r-- | sys/arch/vax/vax/ka630.c | 31 | ||||
-rw-r--r-- | sys/arch/vax/vax/ka650.c | 33 | ||||
-rw-r--r-- | sys/arch/vax/vax/machdep.c | 37 | ||||
-rw-r--r-- | sys/arch/vax/vax/pmap.c | 21 | ||||
-rw-r--r-- | sys/arch/vax/vax/trap.c | 14 | ||||
-rw-r--r-- | sys/arch/vax/vax/vm_machdep.c | 7 |
10 files changed, 413 insertions, 108 deletions
diff --git a/sys/arch/vax/vax/cfl.c b/sys/arch/vax/vax/cfl.c new file mode 100644 index 00000000000..b7345dd5883 --- /dev/null +++ b/sys/arch/vax/vax/cfl.c @@ -0,0 +1,261 @@ +/* $OpenBSD: cfl.c,v 1.1 1997/09/12 09:30:53 maja Exp $ */ +/* $NetBSD: cfl.c,v 1.1 1997/06/13 14:55:07 ragge Exp $ */ +/*- + * Copyright (c) 1996 Ludd, University of Lule}, Sweden. + * Copyright (c) 1982, 1986 The Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)crl.c 7.5 (Berkeley) 5/9/91 + */ + +/* + * Console floppy driver for 11/780. + * XXX - Does not work. (Not completed) + * Included here if someone wants to finish it. + */ + +#include <sys/param.h> +#include <sys/systm.h> +#include <sys/conf.h> +#include <sys/proc.h> +#include <sys/user.h> +#include <sys/buf.h> + +#include <machine/cpu.h> +#include <machine/mtpr.h> +#include <machine/sid.h> +#include <machine/scb.h> + +#include <vax/vax/gencons.h> + +#define CFL_TRACKS 77 +#define CFL_SECTORS 26 +#define CFL_BYTESPERSEC 128 +#define CFL_MAXSEC (CFL_TRACKS * CFL_SECTORS) + +#define FLOP_READSECT 0x900 +#define FLOP_WRITSECT 0x901 +#define FLOP_DATA 0x100 +#define FLOP_COMPLETE 0x200 + +struct { + short cfl_state; /* open and busy flags */ + short cfl_active; /* driver state flag */ + struct buf *cfl_buf; /* buffer we're using */ + unsigned char *cfl_xaddr; /* transfer address */ + short cfl_errcnt; +} cfltab; + +#define IDLE 0 +#define OPEN 1 +#define BUSY 2 + +#define CFL_IDLE 0 +#define CFL_START 1 +#define CFL_SECTOR 2 +#define CFL_DATA 3 +#define CFL_TRACK 4 +#define CFL_NEXT 5 +#define CFL_FINISH 6 +#define CFL_GETIN 7 + +static void cflstart __P((void)); + +int cflopen __P((dev_t, int, struct proc *)); +int cflclose __P((dev_t, int, struct proc *)); +int cflrw __P((dev_t, struct uio *, int)); + +/*ARGSUSED*/ +int +cflopen(dev, flag, p) + dev_t dev; + int flag; + struct proc *p; +{ + if (vax_cputype != VAX_780) + return (ENXIO); + if (cfltab.cfl_state != IDLE) + return (EALREADY); + cfltab.cfl_state = OPEN; + cfltab.cfl_buf = geteblk(512); + return (0); +} + +/*ARGSUSED*/ +int +cflclose(dev, flag, p) + dev_t dev; + int flag; + struct proc *p; +{ + + brelse(cfltab.cfl_buf); + cfltab.cfl_state = IDLE; + return 0; +} + +/*ARGSUSED*/ +int +cflrw(dev, uio, flag) + dev_t dev; + struct uio *uio; + int flag; +{ + register struct buf *bp; + register int i; + register int s; + int error; + + if (uio->uio_resid == 0) + return (0); + s = spl4(); + while (cfltab.cfl_state == BUSY) + sleep((caddr_t)&cfltab, PRIBIO); + cfltab.cfl_state = BUSY; + splx(s); + + bp = cfltab.cfl_buf; + error = 0; + while ((i = imin(CFL_BYTESPERSEC, uio->uio_resid)) > 0) { + bp->b_blkno = uio->uio_offset>>7; + if (bp->b_blkno >= CFL_MAXSEC || + (uio->uio_offset & 0x7F) != 0) { + error = EIO; + break; + } + if (uio->uio_rw == UIO_WRITE) { + error = uiomove(bp->b_un.b_addr, i, uio); + if (error) + break; + } + bp->b_flags = uio->uio_rw == UIO_WRITE ? B_WRITE : B_READ; + s = spl4(); + cflstart(); + while ((bp->b_flags & B_DONE) == 0) + sleep((caddr_t)bp, PRIBIO); + splx(s); + if (bp->b_flags & B_ERROR) { + error = EIO; + break; + } + if (uio->uio_rw == UIO_READ) { + error = uiomove(bp->b_un.b_addr, i, uio); + if (error) + break; + } + } + cfltab.cfl_state = OPEN; + wakeup((caddr_t)&cfltab); + return (error); +} + +void +cflstart() +{ + register struct buf *bp; + + bp = cfltab.cfl_buf; + cfltab.cfl_errcnt = 0; + cfltab.cfl_xaddr = (unsigned char *) bp->b_un.b_addr; + cfltab.cfl_active = CFL_START; + bp->b_resid = 0; + + if ((mfpr(PR_TXCS) & GC_RDY) == 0) + /* not ready to receive order */ + return; + + cfltab.cfl_active = CFL_SECTOR; + mtpr(bp->b_flags & B_READ ? FLOP_READSECT : FLOP_WRITSECT, PR_TXDB); + +#ifdef lint + cflintr(); +#endif +} + +void +cfltint(arg) + int arg; +{ + register struct buf *bp = cfltab.cfl_buf; + + switch (cfltab.cfl_active) { + case CFL_START:/* do a read */ + mtpr(bp->b_flags & B_READ ? FLOP_READSECT : FLOP_WRITSECT, + PR_TXDB); + cfltab.cfl_active = CFL_SECTOR; + break; + + case CFL_SECTOR:/* send sector */ + mtpr(FLOP_DATA | (int)bp->b_blkno % CFL_SECTORS + 1, PR_TXDB); + cfltab.cfl_active = CFL_TRACK; + break; + + case CFL_TRACK: + mtpr(FLOP_DATA | (int)bp->b_blkno / CFL_SECTORS, PR_TXDB); + cfltab.cfl_active = CFL_NEXT; + break; + + case CFL_NEXT: + mtpr(FLOP_DATA | *cfltab.cfl_xaddr++, PR_TXDB); + if (--bp->b_bcount == 0) + cfltab.cfl_active = CFL_FINISH; + break; + + } +} + +void +cflrint(ch) + int ch; +{ + struct buf *bp = cfltab.cfl_buf; + + switch (cfltab.cfl_active) { + case CFL_NEXT: + if ((bp->b_flags & B_READ) == B_READ) + cfltab.cfl_active = CFL_GETIN; + else { + cfltab.cfl_active = CFL_IDLE; + bp->b_flags |= B_DONE; + wakeup(bp); + } + break; + + case CFL_GETIN: + *cfltab.cfl_xaddr++ = ch & 0377; + if (--bp->b_bcount==0) { + cfltab.cfl_active = CFL_IDLE; + bp->b_flags |= B_DONE; + wakeup(bp); + } + break; + } +} diff --git a/sys/arch/vax/vax/disksubr.c b/sys/arch/vax/vax/disksubr.c index 6861cbf435d..8b213eeca28 100644 --- a/sys/arch/vax/vax/disksubr.c +++ b/sys/arch/vax/vax/disksubr.c @@ -1,5 +1,5 @@ -/* $OpenBSD: disksubr.c,v 1.8 1997/08/08 21:46:57 niklas Exp $ */ -/* $NetBSD: disksubr.c,v 1.11 1997/01/11 11:24:51 ragge Exp $ */ +/* $OpenBSD: disksubr.c,v 1.9 1997/09/12 09:30:54 maja Exp $ */ +/* $NetBSD: disksubr.c,v 1.13 1997/07/06 22:38:26 ragge Exp $ */ /* * Copyright (c) 1982, 1986, 1988 Regents of the University of California. @@ -55,11 +55,6 @@ #define b_cylin b_resid -int cpu_setdisklabel __P((struct disklabel *, struct disklabel *, u_long, - struct cpu_disklabel *)); -int cpu_writedisklabel __P((dev_t, void (*)(struct buf *), - struct disklabel *, struct cpu_disklabel *)); - /* * Determine the size of the transfer, and make sure it is * within the boundaries of the partition. Adjust transfer @@ -115,36 +110,6 @@ bad: } /* - * Check new disk label for sensibility - * before setting it. - */ -int -setdisklabel(olp, nlp, openmask, osdep) - register struct disklabel *olp, *nlp; - u_long openmask; - struct cpu_disklabel *osdep; -{ - return cpu_setdisklabel(olp, nlp, openmask, osdep); -} - - -/* - * Write disk label back to device after modification. - */ -int -writedisklabel(dev, strat, lp, osdep) - dev_t dev; - void (*strat) __P((struct buf *)); - register struct disklabel *lp; - struct cpu_disklabel *osdep; -{ - return cpu_writedisklabel(dev, strat, lp, osdep); -} -/* - * from: @(#)ufs_disksubr.c 7.16 (Berkeley) 5/4/91 - */ - -/* * Attempt to read a disk label from a device * using the indicated stategy routine. * The label must be partly set up before this: @@ -163,12 +128,12 @@ readdisklabel(dev, strat, lp, osdep) struct disklabel *dlp; char *msg = NULL; - if (lp->d_secperunit == 0) + if (lp->d_npartitions == 0) { /* Assume no label */ lp->d_secperunit = 0x1fffffff; - lp->d_npartitions = 1; - if (lp->d_partitions[0].p_size == 0) - lp->d_partitions[0].p_size = 0x1fffffff; - lp->d_partitions[0].p_offset = 0; + lp->d_npartitions = 3; + lp->d_partitions[2].p_size = 0x1fffffff; + lp->d_partitions[2].p_offset = 0; + } bp = geteblk((int)lp->d_secsize); bp->b_dev = dev; @@ -208,7 +173,7 @@ readdisklabel(dev, strat, lp, osdep) * before setting it. */ int -cpu_setdisklabel(olp, nlp, openmask, osdep) +setdisklabel(olp, nlp, openmask, osdep) register struct disklabel *olp, *nlp; u_long openmask; struct cpu_disklabel *osdep; @@ -247,9 +212,10 @@ cpu_setdisklabel(olp, nlp, openmask, osdep) /* * Write disk label back to device after modification. + * Always allow writing of disk label; even if the disk is unlabeled. */ int -cpu_writedisklabel(dev, strat, lp, osdep) +writedisklabel(dev, strat, lp, osdep) dev_t dev; void (*strat) __P((struct buf *)); register struct disklabel *lp; @@ -257,37 +223,22 @@ cpu_writedisklabel(dev, strat, lp, osdep) { struct buf *bp; struct disklabel *dlp; - int labelpart; int error = 0; - labelpart = DISKPART(dev); - if (lp->d_partitions[labelpart].p_offset != 0) { - if (lp->d_partitions[0].p_offset != 0) - return (EXDEV); /* not quite right */ - labelpart = 0; - } bp = geteblk((int)lp->d_secsize); - bp->b_dev = MAKEDISKDEV(major(dev), DISKUNIT(dev), labelpart); + bp->b_dev = MAKEDISKDEV(major(dev), DISKUNIT(dev), RAW_PART); bp->b_blkno = LABELSECTOR; bp->b_bcount = lp->d_secsize; bp->b_flags = B_READ; (*strat)(bp); if ((error = biowait(bp))) goto done; - for (dlp = (struct disklabel *)bp->b_un.b_addr; - dlp <= (struct disklabel *) - (bp->b_un.b_addr + lp->d_secsize - sizeof(*dlp)); - dlp = (struct disklabel *)((char *)dlp + sizeof(long))) { - if (dlp->d_magic == DISKMAGIC && dlp->d_magic2 == DISKMAGIC && - dkcksum(dlp) == 0) { - *dlp = *lp; - bp->b_flags = B_WRITE; - (*strat)(bp); - error = biowait(bp); - goto done; - } - } - error = ESRCH; + dlp = (struct disklabel *)(bp->b_un.b_addr + LABELOFFSET); + bcopy(lp, dlp, sizeof(struct disklabel)); + bp->b_flags = B_WRITE; + (*strat)(bp); + error = biowait(bp); + done: brelse(bp); return (error); diff --git a/sys/arch/vax/vax/intvec.s b/sys/arch/vax/vax/intvec.s index 34caecce194..3e0ced31332 100644 --- a/sys/arch/vax/vax/intvec.s +++ b/sys/arch/vax/vax/intvec.s @@ -1,5 +1,5 @@ -/* $OpenBSD: intvec.s,v 1.7 1997/09/10 12:04:45 maja Exp $ */ -/* $NetBSD: intvec.s,v 1.22 1997/03/22 23:02:07 ragge Exp $ */ +/* $OpenBSD: intvec.s,v 1.8 1997/09/12 09:30:54 maja Exp $ */ +/* $NetBSD: intvec.s,v 1.23 1997/07/28 21:48:35 ragge Exp $ */ /* * Copyright (c) 1994 Ludd, University of Lule}, Sweden. @@ -94,7 +94,7 @@ _rpb: INTVEC(invkstk, ISTACK) # Kernel Stack Invalid., 8 INTVEC(stray0C, ISTACK) # Power Failed., C INTVEC(privinflt, KSTACK) # Privileged/Reserved Instruction. - INTVEC(stray14, ISTACK) # Customer Reserved Instruction, 14 + INTVEC(xfcflt, KSTACK) # Customer Reserved Instruction, 14 INTVEC(resopflt, KSTACK) # Reserved Operand/Boot Vector(?), 18 INTVEC(resadflt, KSTACK) # # Reserved Address Mode., 1C INTVEC(access_v, KSTACK) # Access Control Violation, 20 @@ -204,7 +204,7 @@ L4: addl2 (sp)+,sp # remove info pushed on stack STRAY(0,0C) TRAPCALL(privinflt, T_PRIVINFLT) - STRAY(0,14) + TRAPCALL(xfcflt, T_XFCFLT); TRAPCALL(resopflt, T_RESOPFLT) TRAPCALL(resadflt, T_RESADFLT) diff --git a/sys/arch/vax/vax/ka410.c b/sys/arch/vax/vax/ka410.c index e383af37f78..30f2b6e08dd 100644 --- a/sys/arch/vax/vax/ka410.c +++ b/sys/arch/vax/vax/ka410.c @@ -1,5 +1,5 @@ -/* $OpenBSD: ka410.c,v 1.3 1997/09/10 12:04:46 maja Exp $ */ -/* $NetBSD: ka410.c,v 1.6 1997/04/18 18:49:35 ragge Exp $ */ +/* $OpenBSD: ka410.c,v 1.4 1997/09/12 09:30:55 maja Exp $ */ +/* $NetBSD: ka410.c,v 1.7 1997/07/26 10:12:45 ragge Exp $ */ /* * Copyright (c) 1996 Ludd, University of Lule}, Sweden. * All rights reserved. @@ -55,6 +55,10 @@ static void ka410_memenable __P((struct sbi_attach_args*, struct device *)); static void ka410_steal_pages __P((void)); static void ka410_memerr __P((void)); static int ka410_mchk __P((caddr_t)); +static void ka410_halt __P((void)); +static void ka410_reboot __P((int)); + +extern short *clk_page; static struct uc_map ka410_map[] = { { KA410_CFGTST, KA410_CFGTST+1023, 1024, 0 }, @@ -93,6 +97,8 @@ struct cpu_dep ka410_calls = { (void*)KA410_INTCLR, /* Used by vaxstation */ (void*)KA410_INTMSK, /* Used by vaxstation */ ka410_map, + ka410_halt, + ka410_reboot, }; @@ -140,7 +146,6 @@ void ka410_steal_pages() { extern vm_offset_t avail_start, virtual_avail, avail_end; - extern short *clk_page; extern int clk_adrshift, clk_tweak; int junk; @@ -237,3 +242,18 @@ ka410_steal_pages() /* (UVAXIIMSER_PEN | UVAXIIMSER_MERR | UVAXIIMSER_LEB); */ } + +static void +ka410_halt() +{ + asm("movl $0xc, (%0)"::"r"((int)clk_page + 0x38)); /* Don't ask */ + asm("halt"); +} + +static void +ka410_reboot(arg) + int arg; +{ + asm("movl $0xc, (%0)"::"r"((int)clk_page + 0x38)); /* Don't ask */ + asm("halt"); +} diff --git a/sys/arch/vax/vax/ka630.c b/sys/arch/vax/vax/ka630.c index 72511886c3d..8e54da3654f 100644 --- a/sys/arch/vax/vax/ka630.c +++ b/sys/arch/vax/vax/ka630.c @@ -1,5 +1,5 @@ -/* $OpenBSD: ka630.c,v 1.3 1997/09/10 12:04:47 maja Exp $ */ -/* $NetBSD: ka630.c,v 1.6 1997/04/18 18:49:36 ragge Exp $ */ +/* $OpenBSD: ka630.c,v 1.4 1997/09/12 09:30:55 maja Exp $ */ +/* $NetBSD: ka630.c,v 1.7 1997/07/26 10:12:46 ragge Exp $ */ /*- * Copyright (c) 1982, 1988, 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -53,6 +53,7 @@ #include <machine/uvax.h> #include <machine/ka630.h> #include <machine/clock.h> +#include <vax/vax/gencons.h> static struct uvaxIIcpu *uvaxIIcpu_ptr; @@ -60,6 +61,10 @@ static void ka630_conf __P((struct device *, struct device *, void *)); static void ka630_memerr __P((void)); static int ka630_mchk __P((caddr_t)); static void ka630_steal_pages __P((void)); +static void ka630_halt __P((void)); +static void ka630_reboot __P((int)); + +extern short *clk_page; struct cpu_dep ka630_calls = { ka630_steal_pages, @@ -73,7 +78,9 @@ struct cpu_dep ka630_calls = { 0, /* Used by vaxstation */ 0, /* Used by vaxstation */ 0, /* Used by vaxstation */ - + 0, + ka630_halt, + ka630_reboot, }; /* @@ -140,7 +147,6 @@ void ka630_steal_pages() { extern vm_offset_t avail_start, virtual_avail, avail_end; - extern short *clk_page; extern int clk_adrshift, clk_tweak; int junk; @@ -177,3 +183,20 @@ ka630_steal_pages() UVAXIICPU->uvaxII_mser = (UVAXIIMSER_PEN | UVAXIIMSER_MERR | UVAXIIMSER_LEB); } + +static void +ka630_halt() +{ + ((struct ka630clock *)clk_page)->cpmbx = KA630CLK_DOTHIS|KA630CLK_HALT; + asm("halt"); +} + +static void +ka630_reboot(arg) + int arg; +{ + ((struct ka630clock *)clk_page)->cpmbx = + KA630CLK_DOTHIS | KA630CLK_REBOOT; + mtpr(GC_BOOT, PR_TXDB); + asm("movl %0,r5;halt"::"g"(arg)); +} diff --git a/sys/arch/vax/vax/ka650.c b/sys/arch/vax/vax/ka650.c index acca6d0ef67..f73a758d7b5 100644 --- a/sys/arch/vax/vax/ka650.c +++ b/sys/arch/vax/vax/ka650.c @@ -1,5 +1,5 @@ -/* $OpenBSD: ka650.c,v 1.5 1997/09/10 12:04:47 maja Exp $ */ -/* $NetBSD: ka650.c,v 1.9 1997/02/19 10:04:16 ragge Exp $ */ +/* $OpenBSD: ka650.c,v 1.6 1997/09/12 09:30:55 maja Exp $ */ +/* $NetBSD: ka650.c,v 1.10 1997/07/26 10:12:48 ragge Exp $ */ /* * Copyright (c) 1988 The Regents of the University of California. * All rights reserved. @@ -58,6 +58,8 @@ #include <machine/nexus.h> #include <machine/sid.h> +#include <vax/vax/gencons.h> + struct ka650_merr *ka650merr_ptr; struct ka650_cbd *ka650cbd_ptr; struct ka650_ssc *ka650ssc_ptr; @@ -69,6 +71,8 @@ static int subtyp; #define CACHEON 1 void ka650setcache __P((int)); +static void ka650_halt __P((void)); +static void ka650_reboot __P((int)); struct cpu_dep ka650_calls = { uvaxIII_steal_pages, @@ -82,7 +86,9 @@ struct cpu_dep ka650_calls = { 0, /* Used by vaxstation */ 0, /* Used by vaxstation */ 0, /* Used by vaxstation */ - + 0, + ka650_halt, + ka650_reboot, }; /* @@ -159,9 +165,9 @@ uvaxIII_steal_pages() pmap_map((vm_offset_t)ka650cbd_ptr, (vm_offset_t)KA650_CBD, KA650_CBD + NBPG, VM_PROT_READ|VM_PROT_WRITE); - MAPVIRT(ka650ssc_ptr, 1); /* SSC regs (& console prog mail box) */ + MAPVIRT(ka650ssc_ptr, 3); /* SSC regs (& console prog mail box) */ pmap_map((vm_offset_t)ka650ssc_ptr, (vm_offset_t)KA650_SSC, - KA650_SSC + NBPG, VM_PROT_READ|VM_PROT_WRITE); + KA650_SSC + NBPG * 3, VM_PROT_READ|VM_PROT_WRITE); MAPVIRT(ka650ipcr_ptr, 1); /* InterProcessor Com Regs */ pmap_map((vm_offset_t)ka650ipcr_ptr, (vm_offset_t)KA650_IPCR, @@ -325,3 +331,20 @@ ka650setcache(state) mtpr(CADR_SEN2 | CADR_SEN1 | CADR_CENI | CADR_CEND, PR_CADR); } } + +static void +ka650_halt() +{ + ka650ssc_ptr->ssc_cpmbx = CPMB650_DOTHIS | CPMB650_HALT; + asm("halt"); +} + +static void +ka650_reboot(arg) + int arg; +{ + ka650ssc_ptr->ssc_cpmbx = CPMB650_DOTHIS | CPMB650_REBOOT; + mtpr(GC_BOOT, PR_TXDB); + asm("movl %0,r5;halt"::"g"(arg)); +} + diff --git a/sys/arch/vax/vax/machdep.c b/sys/arch/vax/vax/machdep.c index 2662f547577..68d6a282b8d 100644 --- a/sys/arch/vax/vax/machdep.c +++ b/sys/arch/vax/vax/machdep.c @@ -1,5 +1,5 @@ -/* $OpenBSD: machdep.c,v 1.15 1997/09/10 12:04:50 maja Exp $ */ -/* $NetBSD: machdep.c,v 1.41 1997/04/19 15:02:31 ragge Exp $ */ +/* $OpenBSD: machdep.c,v 1.16 1997/09/12 09:30:56 maja Exp $ */ +/* $NetBSD: machdep.c,v 1.45 1997/07/26 10:12:49 ragge Exp $ */ /* * Copyright (c) 1994 Ludd, University of Lule}, Sweden. @@ -124,7 +124,8 @@ int nmcr, nmba, numuba, cold = 1; caddr_t mcraddr[MAXNMCR]; int astpending; int want_resched; -char machine[] = "vax"; +char machine[] = MACHINE; /* from <machine/param.h> */ +char machine_arch[] = MACHINE_ARCH; /* from <machine/param.h> */ char cpu_model[100]; int msgbufmapped = 0; struct msgbuf *msgbufp; @@ -599,10 +600,25 @@ boot(howto /* , bootstr */) } splhigh(); /* extreme priority */ if (howto & RB_HALT) { + if (dep_call->cpu_halt) + (*dep_call->cpu_halt) (); printf("halting (in tight loop); hit\n\t^P\n\tHALT\n\n"); - for ( ; ; ) + for (;;) ; } else { + showto = howto; +#ifdef notyet + /* + * If we are provided with a bootstring, parse it and send + * it to the boot program. + */ + if (b) + while (*b) { + showto |= (*b == 'a' ? RB_ASKBOOT : (*b == 'd' ? + RB_DEBUG : (*b == 's' ? RB_SINGLE : 0))); + b++; + } +#endif /* * Now it's time to: * 0. Save some registers that are needed in new world. @@ -614,6 +630,7 @@ boot(howto /* , bootstr */) * The RPB page is _always_ first page in memory, we can * rely on that. */ +#ifdef notyet asm(" movl sp, (0x80000200) movl 0x80000200, sp mfpr $0x10, -(sp) # PR_PCBB @@ -622,18 +639,19 @@ boot(howto /* , bootstr */) mfpr $0xd, -(sp) # PR_SLR mtpr $0, $0x38 # PR_MAPEN "); +#endif + if (showto & RB_DUMP) dumpsys(); - - asm("movl %0,r5":: "g" (showto)); /* How to boot */ + if (dep_call->cpu_reboot) + (*dep_call->cpu_reboot)(showto); switch (vax_cputype) { int state; -#if VAX750 || VAX780 || VAX630 +#if VAX750 || VAX780 case VAX_780: case VAX_750: - case VAX_TYP_UV2: mtpr(GC_BOOT, PR_TXDB); /* boot command */ break; #endif @@ -648,7 +666,8 @@ boot(howto /* , bootstr */) } } - asm("movl %0, r11":: "r"(showto)); + asm("movl %0,r5":: "g" (showto)); /* How to boot */ + asm("movl %0, r11":: "r"(showto)); /* ??? */ asm("halt"); panic("Halt sket sej"); } diff --git a/sys/arch/vax/vax/pmap.c b/sys/arch/vax/vax/pmap.c index 61c2223c367..c9387839c13 100644 --- a/sys/arch/vax/vax/pmap.c +++ b/sys/arch/vax/vax/pmap.c @@ -1,5 +1,5 @@ -/* $OpenBSD: pmap.c,v 1.8 1997/09/10 12:04:51 maja Exp $ */ -/* $NetBSD: pmap.c,v 1.35 1997/03/22 12:50:56 ragge Exp $ */ +/* $OpenBSD: pmap.c,v 1.9 1997/09/12 09:30:56 maja Exp $ */ +/* $NetBSD: pmap.c,v 1.37 1997/07/25 21:54:48 ragge Exp $ */ /* * Copyright (c) 1994 Ludd, University of Lule}, Sweden. * All rights reserved. @@ -184,22 +184,21 @@ pmap_bootstrap() * physical memory and that isn't managed by the vm system. */ #ifdef DDB - MAPPHYS(junk, ((ROUND_PAGE(&etext) - KERNBASE) >> PGSHIFT), + MAPPHYS(junk, btoc(ROUND_PAGE(&etext) - KERNBASE), VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE); #else - MAPPHYS(junk, ((ROUND_PAGE(&etext) - KERNBASE) >> PGSHIFT), - VM_PROT_EXECUTE); + MAPPHYS(junk, btoc(ROUND_PAGE(&etext) - KERNBASE), VM_PROT_EXECUTE); #endif - MAPPHYS(junk, (((u_int)Sysmap - ROUND_PAGE(&etext)) >> PGSHIFT), + MAPPHYS(junk, btoc((u_int)Sysmap - ROUND_PAGE(&etext)), VM_PROT_READ|VM_PROT_WRITE); /* Map System Page Table and zero it, Sysmap already set. */ mtpr(avail_start, PR_SBR); - MAPPHYS(junk, (ROUND_PAGE(sysptsize * 4) >> PGSHIFT), + MAPPHYS(junk, btoc(ROUND_PAGE(sysptsize * 4)), VM_PROT_READ|VM_PROT_WRITE); /* Map Interrupt stack and set red zone */ - MAPPHYS(istack, (ISTACK_SIZE >> PGSHIFT), VM_PROT_READ|VM_PROT_WRITE); + MAPPHYS(istack, btoc(ISTACK_SIZE), VM_PROT_READ|VM_PROT_WRITE); mtpr(istack + ISTACK_SIZE, PR_ISP); kvtopte(istack)->pg_v = 0; @@ -207,12 +206,12 @@ pmap_bootstrap() MAPPHYS(scratch, 4, VM_PROT_READ|VM_PROT_WRITE); /* Kernel message buffer */ - MAPPHYS(msgbufp, ((u_int)ROUND_PAGE(sizeof(struct msgbuf)) >> PGSHIFT), + MAPPHYS(msgbufp, btoc(ROUND_PAGE(sizeof(struct msgbuf))), VM_PROT_READ|VM_PROT_WRITE); /* Physical-to-virtual translation table */ - MAPPHYS(pv_table, ((avail_end / PAGE_SIZE ) * sizeof(struct pv_entry)) - >> PGSHIFT, VM_PROT_READ|VM_PROT_WRITE); + MAPPHYS(pv_table, btoc((avail_end / PAGE_SIZE ) * + sizeof(struct pv_entry)), VM_PROT_READ|VM_PROT_WRITE); /* zero all mapped physical memory from Sysmap to here */ blkclr((void *)istack, (avail_start | 0x80000000) - istack); diff --git a/sys/arch/vax/vax/trap.c b/sys/arch/vax/vax/trap.c index a2e03262648..be19c0b7779 100644 --- a/sys/arch/vax/vax/trap.c +++ b/sys/arch/vax/vax/trap.c @@ -1,5 +1,5 @@ -/* $OpenBSD: trap.c,v 1.7 1997/05/28 23:29:43 niklas Exp $ */ -/* $NetBSD: trap.c,v 1.24 1996/11/06 20:19:55 cgd Exp $ */ +/* $OpenBSD: trap.c,v 1.8 1997/09/12 09:30:57 maja Exp $ */ +/* $NetBSD: trap.c,v 1.28 1997/07/28 21:48:33 ragge Exp $ */ /* * Copyright (c) 1994 Ludd, University of Lule}, Sweden. @@ -96,7 +96,7 @@ userret(p, pc, psl) */ s=splstatclock(); setrunqueue(curproc); - cpu_switch(0); + mi_switch(); splx(s); while ((sig = CURSIG(curproc)) != 0) postsig(sig); @@ -110,7 +110,7 @@ char *traptypes[]={ "privileged instruction", "reserved operand", "breakpoint instruction", - "Nothing", + "XFC instruction", "system call ", "arithmetic trap", "asynchronous system trap", @@ -346,6 +346,12 @@ if(faultdebug)printf("trap ptelen type %x, code %x, pc %x, psl %x\n", sig = SIGILL; break; + case T_XFCFLT|T_USER: + typ = 0; /* XXX/MAJA */ + v = (caddr_t)0; /* XXX/MAJA */ + sig = SIGEMT; + break; + case T_ARITHFLT|T_USER: typ = FPE_FLTINV; /* XXX? */ v = (caddr_t)0; diff --git a/sys/arch/vax/vax/vm_machdep.c b/sys/arch/vax/vax/vm_machdep.c index 72b2cb28492..7ff23f0761f 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.10 1997/09/10 12:04:53 maja Exp $ */ -/* $NetBSD: vm_machdep.c,v 1.31 1997/03/09 16:00:06 ragge Exp $ */ +/* $OpenBSD: vm_machdep.c,v 1.11 1997/09/12 09:30:57 maja Exp $ */ +/* $NetBSD: vm_machdep.c,v 1.33 1997/07/06 22:38:22 ragge Exp $ */ /* * Copyright (c) 1994 Ludd, University of Lule}, Sweden. @@ -288,9 +288,12 @@ again: return; /* New process! */ idle: + p = curproc; + curproc = NULL; /* This is nice. /BQT */ spl0(); while (whichqs == 0) ; + curproc = p; goto again; } |