diff options
author | Steve Murphree <smurph@cvs.openbsd.org> | 1998-12-15 05:11:04 +0000 |
---|---|---|
committer | Steve Murphree <smurph@cvs.openbsd.org> | 1998-12-15 05:11:04 +0000 |
commit | 2fb8d39328cdf8894f11b9eb00c06436c0677e5d (patch) | |
tree | dc7a87cecccdd0885972f76c63f1366891f9ffdc /sys/arch/mvme88k | |
parent | 85093f914b09ca3d7d75beffd1ce64f48d3ec9e9 (diff) |
Commit for the first working mvme88k port.
Diffstat (limited to 'sys/arch/mvme88k')
-rw-r--r-- | sys/arch/mvme88k/mvme88k/autoconf.c | 449 | ||||
-rw-r--r-- | sys/arch/mvme88k/mvme88k/cmmu.c | 9 | ||||
-rw-r--r-- | sys/arch/mvme88k/mvme88k/conf.c | 38 | ||||
-rw-r--r-- | sys/arch/mvme88k/mvme88k/disksubr.c | 68 | ||||
-rw-r--r-- | sys/arch/mvme88k/mvme88k/eh.S | 243 | ||||
-rw-r--r-- | sys/arch/mvme88k/mvme88k/locore.S | 61 | ||||
-rw-r--r-- | sys/arch/mvme88k/mvme88k/locore_asm_routines.S | 12 | ||||
-rw-r--r-- | sys/arch/mvme88k/mvme88k/locore_c_routines.c | 3 | ||||
-rw-r--r-- | sys/arch/mvme88k/mvme88k/machdep.c | 218 | ||||
-rw-r--r-- | sys/arch/mvme88k/mvme88k/pmap.c | 31 | ||||
-rw-r--r-- | sys/arch/mvme88k/mvme88k/process_machdep.c | 4 | ||||
-rw-r--r-- | sys/arch/mvme88k/mvme88k/swapgeneric.c | 222 | ||||
-rw-r--r-- | sys/arch/mvme88k/mvme88k/trap.c | 75 | ||||
-rw-r--r-- | sys/arch/mvme88k/mvme88k/vm_machdep.c | 97 |
14 files changed, 1071 insertions, 459 deletions
diff --git a/sys/arch/mvme88k/mvme88k/autoconf.c b/sys/arch/mvme88k/mvme88k/autoconf.c index 596bef1fa20..3a04a63dcfa 100644 --- a/sys/arch/mvme88k/mvme88k/autoconf.c +++ b/sys/arch/mvme88k/mvme88k/autoconf.c @@ -1,4 +1,5 @@ /* + * Copyright (c) 1998 Steve Murphree, Jr. * Copyright (c) 1996 Nivas Madhur * Copyright (c) 1994 Christian E. Hopps * All rights reserved. @@ -28,29 +29,53 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: autoconf.c,v 1.3 1997/03/03 20:21:28 rahnds Exp $ + * $Id: autoconf.c,v 1.4 1998/12/15 05:11:01 smurph Exp $ */ #include <sys/param.h> #include <sys/systm.h> +#include <sys/map.h> +#include <sys/buf.h> +#include <sys/dkstat.h> +#include <sys/dmap.h> #include <sys/reboot.h> #include <sys/conf.h> #include <sys/device.h> #include <sys/disklabel.h> +#include <machine/vmparam.h> #include <machine/cpu.h> +#include <machine/autoconf.h> +#include <machine/disklabel.h> +#include <machine/pte.h> -void configure __P((void)); -void setroot __P((void)); -void swapconf __P((void)); +/* + * The following several variables are related to + * the configuration process, and are used in initializing + * the machine. + */ + +struct device *parsedisk __P((char *, int, int, dev_t *)); +void setroot __P((void)); +void swapconf __P((void)); +void configure __P((void)); +char buginchr __P((void)); +int getsb __P((char *, int)); int cold; /* 1 if still booting */ #include <sys/kernel.h> +/* XXX must be allocated statically because of early console init */ +struct map extiomap[EIOMAPSIZE/16]; +extern void *extiobase; + /* * called at boot time, configure all devices on the system. */ void configure() { + bootdv = NULL; /* set by device drivers (if found) */ +/* rminit(extiomap, (long)EIOMAPSIZE, (long)1, "extio", EIOMAPSIZE/16);*/ + if (config_rootfound("mainbus", "mainbus") == 0) panic("no mainbus found"); @@ -60,19 +85,8 @@ configure() */ enable_interrupt(); spl0(); - -#if 0 -#ifdef GENERIC - if ((boothowto & RB_ASKNAME) == 0) - setroot(); - setconf(); -#else - setroot(); -#endif -#endif /* 0 */ setroot(); swapconf(); - /* * Done with autoconfig! */ @@ -102,97 +116,378 @@ matchname(fp, sp) return(0); } -void +/* + * Configure swap space and related parameters. + */ +void swapconf() { - struct swdevt *swp; - u_int maj; - int nb; + register struct swdevt *swp; + register int nblks; - for (swp = swdevt; swp->sw_dev > 0; swp++) { - maj = major(swp->sw_dev); + for (swp = swdevt; swp->sw_dev != NODEV; swp++) + if (bdevsw[major(swp->sw_dev)].d_psize) { + nblks = + (*bdevsw[major(swp->sw_dev)].d_psize)(swp->sw_dev); + if (nblks != -1 && + (swp->sw_nblks == 0 || swp->sw_nblks > nblks)) + swp->sw_nblks = nblks; + } + dumpconf(); +} - if (maj > nblkdev) - break; +/* + * the rest of this file was adapted from Theo de Raadt's code in the + * sparc port to nuke the "options GENERIC" stuff. + */ + +struct nam2blk { + char *name; + int maj; +} nam2blk[] = { + { "sd", 4 }, + { "st", 5 }, + { "rd", 7 }, +}; - if (bdevsw[maj].d_psize) { - nb = bdevsw[maj].d_psize(swp->sw_dev); - if (nb > 0 && - (swp->sw_nblks == 0 || swp->sw_nblks > nb)) - swp->sw_nblks = nb; - else - swp->sw_nblks = 0; + +static int +findblkmajor(dv) + struct device *dv; +{ + char *name = dv->dv_xname; + register int i; + + for (i = 0; i < sizeof(nam2blk)/sizeof(nam2blk[0]); ++i) + if (strncmp(name, nam2blk[i].name, strlen(nam2blk[0].name)) == 0) + return (nam2blk[i].maj); + return (-1); +} + +static struct device * +getdisk(str, len, defpart, devp) + char *str; + int len, defpart; + dev_t *devp; +{ + register struct device *dv; + + if ((dv = parsedisk(str, len, defpart, devp)) == NULL) { + printf("use one of:"); + for (dv = alldevs.tqh_first; dv != NULL; + dv = dv->dv_list.tqe_next) { + if (dv->dv_class == DV_DISK) + printf(" %s[a-h]", dv->dv_xname); +#ifdef NFSCLIENT + if (dv->dv_class == DV_IFNET) + printf(" %s", dv->dv_xname); +#endif } - swp->sw_nblks = ctod(dtoc(swp->sw_nblks)); + printf("\n"); } - if (dumplo == 0 && dumpdev != NODEV && bdevsw[major(dumpdev)].d_psize) - /*dumplo = (*bdevsw[major(dumpdev)].d_psize)(dumpdev) - physmem;*/ - dumplo = (*bdevsw[major(dumpdev)].d_psize)(dumpdev) - - ctob(physmem)/DEV_BSIZE; - if (dumplo < 0) - dumplo = 0; - - dumpconf(); + return (dv); } -#define DOSWAP /* change swdevt and dumpdev */ -u_long bootdev = 0; /* should be dev_t, but not until 32 bits */ +struct device * +parsedisk(str, len, defpart, devp) + char *str; + int len, defpart; + dev_t *devp; +{ + register struct device *dv; + register char *cp, c; + int majdev, mindev, part; -static char devname[][2] = { - 0,0, - 0,0, - 0,0, - 0,0, - 's','d', /* 4 = sd -- new SCSI system */ -}; + if (len == 0) + return (NULL); + cp = str + len - 1; + c = *cp; + if (c >= 'a' && c <= 'h') { + part = c - 'a'; + *cp = '\0'; + } else + part = defpart; + for (dv = alldevs.tqh_first; dv != NULL; dv = dv->dv_list.tqe_next) { + if (dv->dv_class == DV_DISK && + strcmp(str, dv->dv_xname) == 0) { + majdev = findblkmajor(dv); + if (majdev < 0) + panic("parsedisk"); + mindev = (dv->dv_unit << PARTITIONSHIFT) + part; + *devp = makedev(majdev, mindev); + break; + } +#ifdef NFSCLIENT + if (dv->dv_class == DV_IFNET && + strcmp(str, dv->dv_xname) == 0) { + *devp = NODEV; + break; + } +#endif + } + + *cp = c; + return (dv); +} + +/* + * Attempt to find the device from which we were booted. + * If we can do so, and not instructed not to do so, + * change rootdev to correspond to the load device. + * + * XXX Actually, swap and root must be on the same type of device, + * (ie. DV_DISK or DV_IFNET) because of how (*mountroot) is written. + * That should be fixed. + */ void setroot() { - int majdev, mindev, unit, part, adaptor; - dev_t temp, orootdev; - struct swdevt *swp; + register struct swdevt *swp; + register struct device *dv; + register int len, majdev, mindev; + dev_t nrootdev, nswapdev = NODEV; + char buf[128]; + dev_t temp; +#if defined(NFSCLIENT) + extern char *nfsbootdevname; +#endif + + printf("boot device: %s\n", + (bootdv) ? bootdv->dv_xname : "<unknown>"); - printf("setroot boothowto %x bootdev %x\n", boothowto, bootdev); - if (boothowto & RB_DFLTROOT || - (bootdev & B_MAGICMASK) != (u_long)B_DEVMAGIC) + if (boothowto & RB_ASKNAME) { + for (;;) { + printf("root device"); + if (bootdv != NULL) + printf("(default %s%c)", + bootdv->dv_xname, + bootdv->dv_class == DV_DISK + ? 'a' : ' '); + printf(": "); + len = getsb(buf, sizeof(buf)); + if (len == 0 && bootdv != NULL) { + strcpy(buf, bootdv->dv_xname); + len = strlen(buf); + } + if (len > 0 && buf[len - 1] == '*') { + buf[--len] = '\0'; + dv = getdisk(buf, len, 1, &nrootdev); + if (dv != NULL) { + bootdv = dv; + nswapdev = nrootdev; + goto gotswap; + } + } + dv = getdisk(buf, len, 0, &nrootdev); + if (dv != NULL) { + bootdv = dv; + break; + } + } + + /* + * because swap must be on same device as root, for + * network devices this is easy. + */ + if (bootdv->dv_class == DV_IFNET) { + goto gotswap; + } + for (;;) { + printf("swap device "); + if (bootdv != NULL) + printf("(default %s%c)", + bootdv->dv_xname, + bootdv->dv_class == DV_DISK?'b':' '); + printf(": "); + len = getsb(buf, sizeof(buf)); + if (len == 0 && bootdv != NULL) { + switch (bootdv->dv_class) { + case DV_IFNET: + nswapdev = NODEV; + break; + case DV_DISK: + nswapdev = makedev(major(nrootdev), + (minor(nrootdev) & ~ PARTITIONMASK) | 1); + break; + case DV_TAPE: + case DV_TTY: + case DV_DULL: + case DV_CPU: + break; + } + break; + } + dv = getdisk(buf, len, 1, &nswapdev); + if (dv) { + if (dv->dv_class == DV_IFNET) + nswapdev = NODEV; + break; + } + } +gotswap: + rootdev = nrootdev; + dumpdev = nswapdev; + swdevt[0].sw_dev = nswapdev; + swdevt[1].sw_dev = NODEV; + + } else if (mountroot == NULL) { + + /* + * `swap generic': Use the device the ROM told us to use. + */ + if (bootdv == NULL) + panic("boot device not known"); + + majdev = findblkmajor(bootdv); + if (majdev >= 0) { + /* + * Root and swap are on a disk. + * val[2] of the boot device is the partition number. + * Assume swap is on partition b. + */ + int part = bootpart; + mindev = (bootdv->dv_unit << PARTITIONSHIFT) + part; + rootdev = makedev(majdev, mindev); + nswapdev = dumpdev = makedev(major(rootdev), + (minor(rootdev) & ~ PARTITIONMASK) | 1); + } else { + /* + * Root and swap are on a net. + */ + nswapdev = dumpdev = NODEV; + } + swdevt[0].sw_dev = nswapdev; + swdevt[1].sw_dev = NODEV; + + } else { + + /* + * `root DEV swap DEV': honour rootdev/swdevt. + * rootdev/swdevt/mountroot already properly set. + */ + return; + } + + switch (bootdv->dv_class) { +#if defined(NFSCLIENT) + case DV_IFNET: + mountroot = nfs_mountroot; + nfsbootdevname = bootdv->dv_xname; return; - majdev = (bootdev >> B_TYPESHIFT) & B_TYPEMASK; - if (majdev > sizeof(devname) / sizeof(devname[0])) +#endif +#if defined(FFS) + case DV_DISK: + mountroot = dk_mountroot; + majdev = major(rootdev); + mindev = minor(rootdev); + printf("root on %s%c\n", bootdv->dv_xname, + (mindev & PARTITIONMASK) + 'a'); + break; +#endif + default: + printf("can't figure root, hope your kernel is right\n"); return; - adaptor = (bootdev >> B_ADAPTORSHIFT) & B_ADAPTORMASK; - part = (bootdev >> B_PARTITIONSHIFT) & B_PARTITIONMASK; - unit = (bootdev >> B_UNITSHIFT) & B_UNITMASK; - orootdev = rootdev; - rootdev = MAKEDISKDEV(majdev, unit, part); + } + /* - * If the original rootdev is the same as the one - * just calculated, don't need to adjust the swap configuration. + * XXX: What is this doing? */ - if (rootdev == orootdev) - return; - printf("changing root device to %c%c%d%c\n", - devname[majdev][0], devname[majdev][1], - unit, part + 'a'); -#ifdef DOSWAP - mindev = DISKUNIT(rootdev); - for (swp = swdevt; swp->sw_dev; swp++) { - printf("DOSWAP swap %x dev %x\n", swp, swp->sw_dev); + mindev &= ~PARTITIONMASK; + temp = NODEV; + for (swp = swdevt; swp->sw_dev != NODEV; swp++) { if (majdev == major(swp->sw_dev) && - mindev == DISKUNIT(swp->sw_dev)) { + mindev == (minor(swp->sw_dev) & ~PARTITIONMASK)) { temp = swdevt[0].sw_dev; swdevt[0].sw_dev = swp->sw_dev; swp->sw_dev = temp; break; } } - if (swp->sw_dev == 0) + if (swp->sw_dev == NODEV) return; + /* - * If dumpdev was the same as the old primary swap - * device, move it to the new primary swap device. + * If dumpdev was the same as the old primary swap device, move + * it to the new primary swap device. */ if (temp == dumpdev) dumpdev = swdevt[0].sw_dev; -#endif +} + +/* + * find a device matching "name" and unit number + */ +struct device * +getdevunit(name, unit) + char *name; + int unit; +{ + struct device *dev = alldevs.tqh_first; + char num[10], fullname[16]; + int lunit; + + /* compute length of name and decimal expansion of unit number */ + sprintf(num, "%d", unit); + lunit = strlen(num); + if (strlen(name) + lunit >= sizeof(fullname) - 1) + panic("config_attach: device name too long"); + + strcpy(fullname, name); + strcat(fullname, num); + + while (strcmp(dev->dv_xname, fullname) != 0) { + if ((dev = dev->dv_list.tqe_next) == NULL) + return NULL; + } + return dev; +} + +int +getsb(cp, size) + char *cp; + int size; +{ + register char *lp; + register int len; + register int c; + + lp = cp; + len = 0; + for (;;) { + c = buginchr(); + + switch (c) { + case '\n': + case '\r': + printf("\n"); + *lp++ = '\0'; + return (len); + case '\b': + case '\177': + if (len) { + printf("\b \b"); + --lp; + --len; + } + break; + case 'u' & 037: + while (len) { + printf("\b \b"); + --lp; + --len; + } + break; + case '\t': + c = ' '; + default: + if (len + 1 >= size || c < ' ') { + printf("\007"); + break; + } + printf("%c", c); + ++len; + *lp++ = c; + } + } } diff --git a/sys/arch/mvme88k/mvme88k/cmmu.c b/sys/arch/mvme88k/mvme88k/cmmu.c index 9499324945a..33061b2d668 100644 --- a/sys/arch/mvme88k/mvme88k/cmmu.c +++ b/sys/arch/mvme88k/mvme88k/cmmu.c @@ -1,4 +1,5 @@ /* + * Copyright (c) 1998 Steve Murphree, Jr. * Copyright (c) 1996 Nivas Madhur * All rights reserved. * @@ -27,7 +28,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: cmmu.c,v 1.3 1997/03/03 20:21:30 rahnds Exp $ + * $Id: cmmu.c,v 1.4 1998/12/15 05:11:01 smurph Exp $ */ /* * Mach Operating System @@ -65,6 +66,8 @@ /* On some versions of 88200, page size flushes don't work. I am using * sledge hammer approach till I find for sure which ones are bad XXX nivas */ #define BROKEN_MMU_MASK +#define CMMU_DEBUG 1 + #if defined(MVME187) #undef SNOOP_ENABLE #else @@ -148,13 +151,13 @@ show_apr(unsigned value) union apr_template apr_template; apr_template.bits = value; - _printf("table @ 0x%x000", apr_template.field.st_base); + printf("table @ 0x%x000", apr_template.field.st_base); if (apr_template.field.wt) printf(", writethrough"); if (apr_template.field.g) printf(", global"); if (apr_template.field.ci) printf(", cache inhibit"); if (apr_template.field.te) printf(", valid"); else printf(", not valid"); - printf("]\n"); + printf("\n"); } void diff --git a/sys/arch/mvme88k/mvme88k/conf.c b/sys/arch/mvme88k/mvme88k/conf.c index 51b12df8fb6..f5ea7ec9121 100644 --- a/sys/arch/mvme88k/mvme88k/conf.c +++ b/sys/arch/mvme88k/mvme88k/conf.c @@ -52,6 +52,11 @@ bdev_decl(st); bdev_decl(sd); #include "cd.h" bdev_decl(cd); +#include "rd.h" +#include "vnd.h" +#include "ccd.h" +bdev_decl(rd); + #if notyet #include "ch.h" @@ -78,7 +83,7 @@ struct bdevsw bdevsw[] = bdev_disk_init(NSD,sd), /* 4: SCSI disk */ bdev_tape_init(NST,st), /* 5: SCSI tape */ bdev_disk_init(NCD,cd), /* 6: SCSI CD-ROM */ - bdev_notdef(), /* 7 */ + bdev_disk_init(NRD,rd), /* 7: ramdisk */ bdev_disk_init(NVND,vnd), /* 8: vnode disk driver */ bdev_notdef(), /* 9 */ #if notyet @@ -102,19 +107,21 @@ cdev_decl(ctty); cdev_decl(mm); cdev_decl(sw); -#if notyet +#if 1 /*notyet*/ #include "sram.h" cdev_decl(sram); +#include "nvram.h" +cdev_decl(nvram); +#endif + +#if notyet #include "vmel.h" cdev_decl(vmel); #include "vmes.h" cdev_decl(vmes); -#include "nvram.h" -cdev_decl(nvram); - #include "flash.h" cdev_decl(flash); #endif /* notyet */ @@ -163,6 +170,7 @@ cdev_decl(st); cdev_decl(sd); cdev_decl(cd); cdev_decl(xd); +cdev_decl(rd); cdev_decl(vnd); dev_decl(filedesc,open); @@ -195,20 +203,24 @@ struct cdevsw cdevsw[] = cdev_tty_init(NPTY,pts), /* 4: pseudo-tty slave */ cdev_ptc_init(NPTY,ptc), /* 5: pseudo-tty master */ cdev_log_init(1,log), /* 6: /dev/klog */ -#if notyet +#if 1 cdev_mdev_init(NSRAM,sram), /* 7: /dev/sramX */ -#else /* notyet */ - cdev_notdef(), /* 7: /dev/sramX */ +#else + cdev_notdef(), /* 7: */ #endif /* notyet */ cdev_disk_init(NSD,sd), /* 8: SCSI disk */ cdev_disk_init(NCD,cd), /* 9: SCSI CD-ROM */ -#if notyet +#if 1 cdev_mdev_init(NNVRAM,nvram), /* 10: /dev/nvramX */ +#else + cdev_notdef(), /* 10: */ +#endif /* notyet */ + +#if notyet cdev_mdev_init(NFLASH,flash), /* 11: /dev/flashX */ cdev_tty_init(NZS,zs), /* 12: SCC serial (tty[a-d]) */ #else - cdev_notdef(), /* 10 */ - cdev_notdef(), /* 11 */ + cdev_notdef(), /* 11: */ cdev_notdef(), /* 12: SCC serial (tty[a-d]) */ #endif /* notyet */ cdev_tty_init(NCL,cl), /* 13: CL-CD1400 serial (tty0[0-3]) */ @@ -216,7 +228,7 @@ struct cdevsw cdevsw[] = cdev_notdef(), /* 15 */ cdev_notdef(), /* 16 */ cdev_notdef(), /* 17: concatenated disk */ - cdev_notdef(), /* 18 */ + cdev_disk_init(NRD,rd), /* 18: ramdisk disk */ cdev_disk_init(NVND,vnd), /* 19: vnode disk */ cdev_tape_init(NST,st), /* 20: SCSI tape */ cdev_fd_init(1,filedesc), /* 21: file descriptor pseudo-dev */ @@ -325,7 +337,7 @@ static int chrtoblktbl[] = { /* 15 */ NODEV, /* 16 */ NODEV, /* 17 */ NODEV, - /* 18 */ NODEV, + /* 18 */ 7, /* ram disk */ /* 19 */ 8, /* vnode disk */ /* 20 */ NODEV, /* 21 */ NODEV, diff --git a/sys/arch/mvme88k/mvme88k/disksubr.c b/sys/arch/mvme88k/mvme88k/disksubr.c index f0bbd23f15e..3b0ee3222be 100644 --- a/sys/arch/mvme88k/mvme88k/disksubr.c +++ b/sys/arch/mvme88k/mvme88k/disksubr.c @@ -1,4 +1,5 @@ /* + * Copyright (c) 1998 Steve Murphree, Jr. * Copyright (c) 1995 Dale Rahn. * All rights reserved. * @@ -30,8 +31,15 @@ #include <sys/param.h> #include <sys/buf.h> +#include <sys/device.h> #define DKTYPENAMES #include <sys/disklabel.h> +#include <sys/disk.h> + +#include <scsi/scsi_all.h> +#include <scsi/scsiconf.h> + +#include <machine/autoconf.h> #define b_cylin b_resid @@ -49,12 +57,37 @@ static void printlp __P((struct disklabel *lp, char *str)); static void printclp __P((struct cpu_disklabel *clp, char *str)); #endif -int -dk_establish() +void +dk_establish(dk, dev) + struct disk *dk; + struct device *dev; { - return(-1); + struct scsibus_softc *sbsc; + int target, lun; + + if (bootpart == -1) /* ignore flag from controller driver? */ + return; + + /* + * scsi: sd,cd + */ + + if (strncmp("sd", dev->dv_xname, 2) == 0 || + strncmp("cd", dev->dv_xname, 2) == 0) { + + sbsc = (struct scsibus_softc *)dev->dv_parent; + target = bootdevlun / 10; + lun = bootdevlun % 10; + + if (sbsc->sc_link[target][lun] != NULL && + sbsc->sc_link[target][lun]->device_softc == (void *)dev) { + bootdv = dev; + return; + } + } } + /* * Attempt to read a disk label from a device * using the indicated stategy routine. @@ -64,30 +97,15 @@ dk_establish() * Returns null on success and an error string on failure. */ char * -readdisklabel(dev, strat, lp, clp, spoofonly) +readdisklabel(dev, strat, lp, clp) dev_t dev; void (*strat)(); struct disklabel *lp; struct cpu_disklabel *clp; - int spoofonly; { struct buf *bp; char *msg = NULL; - /* minimal requirements for archetypal disk label */ - if (lp->d_secsize == 0) - lp->d_secsize = DEV_BSIZE; - if (lp->d_secperunit == 0) - lp->d_secperunit = 0x1fffffff; - lp->d_npartitions = RAW_PART + 1; - if (lp->d_partitions[RAW_PART].p_size == 0) - lp->d_partitions[RAW_PART].p_size = lp->d_secperunit; - lp->d_partitions[RAW_PART].p_offset = 0; - - /* don't read the on-disk label if we are in spoofed-only mode */ - if (spoofonly) - return (NULL); - /* obtain buffer to probe drive with */ bp = geteblk((int)lp->d_secsize); @@ -464,7 +482,11 @@ cputobsdlabel(lp, clp) if (clp->version == 0) { struct cpu_disklabel_old *clpo = (void *) clp; - printf("Reading old disklabel\n"); +#ifdef DEBUG + if (disksubr_debug > 0) { + printf("Reading old disklabel\n"); + } +#endif lp->d_magic = clp->magic1; lp->d_type = clp->type; lp->d_subtype = clp->subtype; @@ -524,7 +546,11 @@ cputobsdlabel(lp, clp) lp->d_checksum = 0; lp->d_checksum = dkcksum(lp); } else { - printf("Reading new disklabel\n"); +#ifdef DEBUG + if (disksubr_debug > 0) { + printf("Reading new disklabel\n"); + } +#endif lp->d_magic = clp->magic1; lp->d_type = clp->type; lp->d_subtype = clp->subtype; diff --git a/sys/arch/mvme88k/mvme88k/eh.S b/sys/arch/mvme88k/mvme88k/eh.S index 9319d1f5b83..687a46d6083 100644 --- a/sys/arch/mvme88k/mvme88k/eh.S +++ b/sys/arch/mvme88k/mvme88k/eh.S @@ -3,6 +3,7 @@ * Copyright (c) 1993-1991 Carnegie Mellon University * Copyright (c) 1991 OMRON Corporation * Copyright (c) 1996 Nivas Madhur + * Copyright (c) 1998 Steve Murphree, Jr. * All Rights Reserved. * * Permission to use, copy, modify and distribute this software and its @@ -25,6 +26,7 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. */ + /* * HISTORY * 1. Should get rid of SR0 reference for thread stuff. @@ -195,7 +197,7 @@ * unimportant). * * Now is a good time to recap SR0..SR3 usage: - * SR0 - + * SR0 - Used for subroutine returns. XXX smurph XXX2 not any more... * SR1 - CPU flags (exception handler flags) * SR2 - generally free * SR3 - free only if the exception is from user mode @@ -234,7 +236,7 @@ #define EF_SR3 (EF_R0 + 5) #define EF_FLAGS EF_MODE -#define FLAG_FROM_KERNEL 8 /* this should be in locore.h */ +#define FLAG_FROM_KERNEL 8 /* this should be in asm.h */ text align 8 @@ -270,13 +272,29 @@ ** be used freely as they've all been saved in the exception frame ** (which is pointed-to by r31). **/ + +/* This define can replace the xcr instruction XXX smurph */ +#define XCR(DR, SR, CR) ; \ + stcr r13, SR0 ; \ + or r13, r0, SR ; \ + ldcr DR, CR ; \ + stcr r13, CR ; \ + ldcr r13, SR0 + +/* This define can be used to debug sub routine returns XXX smurph*/ +#define STORE_R1(varname) ; \ + stcr r13, SR0 /* r13 now free */ ; \ + /* save r1 to memory location varname */ ; \ + or.u r13, r0, hi16(varname) ; \ + st r1, r13, lo16(varname) ; \ + ldcr r13, SR0 /* retore r13 */ + #define PREP(NAME, NUM, BIT, SSBR_STUFF, FLAG_PRECHECK) ; \ - xcr FLAGS, FLAGS, SR1 ; \ + xcr FLAGS, FLAGS, SR1 ; \ FLAG_PRECHECK ; \ ; \ /* the bsr later clobbers r1, so save now */ ; \ stcr r1, SR2 /* r1 now free */ ; \ - ; \ /* set or clear the FLAG_FROM_KERNEL bit */ ; \ ldcr r1, EPSR ; \ bb0.n PSR_SUPERVISOR_MODE_BIT, r1, 1f ; \ @@ -284,7 +302,7 @@ set FLAGS, FLAGS, 1<FLAG_FROM_KERNEL> ; \ ; \ /* get a stack (exception frame) */ ; \ - 1: bsr setup_phase_one ; \ + 1: bsr setup_phase_one ; \ ; \ /* TMP2 now free -- use to set EF_VECTOR */ ; \ or TMP2, r0, NUM ; \ @@ -301,9 +319,6 @@ /* All general regs free -- do any debugging */ ; \ PREP_DEBUG(BIT, NAME) -#undef EH_DEBUG -#define EH_DEBUG 1 - /* Some defines for use with PREP() */ #define No_SSBR_Stuff /* empty */ #define Clear_SSBR_Dest bsr clear_dest_ssbr_bit @@ -318,7 +333,7 @@ * is set for an exception, debugging information is printed * about that exception whenever it occurs. * - * The bits are defined in "locore.h" + * The bits are defined in "asm.h" */ LABEL(_eh_debug) word 0x00000000 @@ -378,19 +393,19 @@ /*#########################################################################*/ /* unknown exception handler */ -LABEL(unknown_handler) +LABEL(_unknown_handler) PREP("unknown", 0, DEBUG_UNKNOWN_BIT, No_SSBR_Stuff, No_Precheck) CALL(_trap, T_UNKNOWNFLT, r30) DONE(DEBUG_UNKNOWN_BIT) /* interrupt exception handler */ -LABEL(interrupt_handler) +LABEL(_interrupt_handler) PREP("interrupt", 1, DEBUG_INTERRUPT_BIT, No_SSBR_Stuff, No_Precheck) CALL(_ext_int, 1, r30) DONE(DEBUG_INTERRUPT_BIT) /* instruction access exception handler */ -LABEL(instruction_access_handler) +LABEL(_instruction_access_handler) PREP("inst", 2, DEBUG_INSTRUCTION_BIT, No_SSBR_Stuff, No_Precheck) CALL(_trap, T_INSTFLT, r30) #if 0 @@ -413,18 +428,18 @@ LABEL(instruction_access_handler) * data access exception handler -- * See badaddr() below for info about Data_Precheck. */ -LABEL(data_exception_handler) +LABEL(_data_exception_handler) PREP("data", 3, DEBUG_DATA_BIT, No_SSBR_Stuff, Data_Precheck) DONE(DEBUG_DATA_BIT) /* misaligned access exception handler */ -LABEL(misaligned_handler) +LABEL(_misaligned_handler) PREP("misalign", 4, DEBUG_MISALIGN_BIT, Clear_SSBR_Dest, No_Precheck) CALL(_trap, T_MISALGNFLT, r30) DONE(DEBUG_MISALIGN_BIT) /* unimplemented opcode exception handler */ -LABEL(unimplemented_handler) +LABEL(_unimplemented_handler) PREP("unimp", 5, DEBUG_UNIMPLEMENTED_BIT, No_SSBR_Stuff, No_Precheck) CALL(_trap, T_ILLFLT, r30) DONE(DEBUG_UNIMPLEMENTED_BIT) @@ -434,7 +449,7 @@ LABEL(unimplemented_handler) * violation exceptions are raised. If the valid bit in the SXIP is clear, * it is false. If so, just return. The code before PREP handles this.... */ -LABEL(privilege_handler) +LABEL(_privilege_handler) stcr r1, SR2 /* hold r1 for a moment */ ldcr r1, SXIP /* look at the sxip... valid bit set? */ bb1.n RTE_VALID_BIT, r1, 1f /*skip over return if a valid exception*/ @@ -448,19 +463,19 @@ LABEL(privilege_handler) * I'm not sure what the trap(T_BNDFLT,...) does, but it doesn't send * a signal to the process... */ -LABEL(bounds_handler) +LABEL(_bounds_handler) PREP("bounds", 7, DEBUG_BOUNDS_BIT, Clear_SSBR_Dest, No_Precheck) CALL(_trap, T_BNDFLT, r30) DONE(DEBUG_BOUNDS_BIT) /* integer divide-by-zero exception handler */ -LABEL(divide_handler) +LABEL(_divide_handler) PREP("divide", 8, DEBUG_DIVIDE_BIT, Clear_SSBR_Dest, No_Precheck) CALL(_trap, T_ZERODIV, r30) DONE(DEBUG_DIVIDE_BIT) /* integer overflow exception handelr */ -LABEL(overflow_handler) +LABEL(_overflow_handler) PREP("overflow", 9, DEBUG_OVERFLOW_BIT, No_SSBR_Stuff, No_Precheck) CALL(_trap, T_OVFFLT, r30) DONE(DEBUG_OVERFLOW_BIT) @@ -522,10 +537,12 @@ LABEL(_userbpt) PREP("trace", 131, DEBUG_TRACE_BIT, No_SSBR_Stuff, No_Precheck) CALL(_trap, T_KDB_TRACE, r30) DONE(DEBUG_TRACE_BIT) - LABEL(entry) + + LABEL(_entry) PREP("kdb", 132, DEBUG_KDB_BIT, No_SSBR_Stuff, No_Precheck) CALL(_trap, T_KDB_ENTRY, r30) DONE(DEBUG_KDB_BIT) + #else /* else not DDB */ LABEL(break) PREP("break", 130, DEBUG_BREAK_BIT, No_SSBR_Stuff, No_Precheck) @@ -535,7 +552,7 @@ LABEL(_userbpt) PREP("trace", 131, DEBUG_TRACE_BIT, No_SSBR_Stuff, No_Precheck) CALL(_trap, T_UNKNOWNFLT, r30) DONE(DEBUG_TRACE_BIT) - LABEL(entry) + LABEL(_entry) PREP("unknown", 132, DEBUG_UNKNOWN_BIT, No_SSBR_Stuff, No_Precheck) CALL(_trap, T_UNKNOWNFLT, r30) DONE(DEBUG_KDB_BIT) @@ -555,7 +572,7 @@ LABEL(_userbpt) * We'll not worry about trashing r26-29 here, * since they aren't generally used. */ -LABEL(error_handler) +LABEL(_error_handler) /* pick up the slavestack */ or r26, r0, r31 /* save old stack */ or.u r31, r0, hi16(_intstack_end) @@ -672,6 +689,7 @@ LABEL(error_handler) clr r1, r1, 1<PSR_INTERRUPT_DISABLE_BIT> stcr r1, PSR FLUSH_PIPELINE + LABEL(_error_loop) bsr _error_loop /* never returns*/ @@ -681,6 +699,151 @@ LABEL(_error_loop) bsr _error_loop *---------------------------------------------------------------------------- */ +/*--------------------------------------------------------------------------*/ + +/* + * The reset exception handler. + * The reset exception is raised when the RST signal is asserted (machine + * is reset), the value of VBR is changed after exceptions are enabled, + * or when a jmp, br/bsr to addr 0 (accidents do happen :-) + * + * To tell the difference, you should check the value of r1 and the valid + * bit of SXIP. + * + * Upon a real reset, VBR is set to zero (0), so code must be at addr 0 + * to handle it!!! + * + * This is totaly different than _error_handler. Shadowing might or + * might not be on. + * R1-R31 could tell u alot about what happend, so we'll save them. + * + * We'll not worry about trashing r26-29 here, + * since they aren't generally used. + */ +LABEL(_reset_handler) + /* pick up the slavestack */ + or r26, r0, r31 /* save old stack */ + or.u r31, r0, hi16(_intstack_end) + or r31, r31, lo16(_intstack_end) + + /* zero the stack, so we'll know what we're lookin' at */ + or.u r27, r0, hi16(_intstack) + or r27, r27, lo16(_intstack) + 1: cmp r28, r27, r31 + bb1 ge, r28, 2f /* branch if at the end of the stack */ + st r0, r0, r27 + br.n 1b + addu r27, r27, 4 /* bump up */ + 2: /* stack has been cleared */ + + /* ensure that stack is 8-byte aligned */ + clr r31, r31, 3<0> /* round down to 8-byte boundary */ + + /* create exception frame on stack */ + subu r31, r31, SIZEOF_EF /* r31 now our E.F. */ + + /* save old R31 and other R registers */ + st.d r0 , r31, GENREG_OFF(0) + st.d r2 , r31, GENREG_OFF(2) + st.d r4 , r31, GENREG_OFF(4) + st.d r6 , r31, GENREG_OFF(6) + st.d r8 , r31, GENREG_OFF(8) + st.d r10, r31, GENREG_OFF(10) + st.d r12, r31, GENREG_OFF(12) + st.d r14, r31, GENREG_OFF(14) + st.d r16, r31, GENREG_OFF(16) + st.d r18, r31, GENREG_OFF(18) + st.d r20, r31, GENREG_OFF(20) + st.d r22, r31, GENREG_OFF(22) + st.d r24, r31, GENREG_OFF(24) + st r30, r31, GENREG_OFF(30) + st r26, r31, GENREG_OFF(31) + + /* save shadow registers */ + ldcr r10, SXIP + st r10, r31, REG_OFF(EF_SXIP) + ldcr r10, SFIP + st r10, r31, REG_OFF(EF_SFIP) + ldcr r10, SNIP + st r10, r31, REG_OFF(EF_SNIP) + ldcr r10, SSBR + st r10, r31, REG_OFF(EF_SSBR) + ldcr r10, EPSR + st r10, r31, REG_OFF(EF_EPSR) + + ldcr r10, DMT0 + st r10, r31, REG_OFF(EF_DMT0) + ldcr r11, DMD0 + st r11, r31, REG_OFF(EF_DMD0) + ldcr r12, DMA0 + st r12, r31, REG_OFF(EF_DMA0) + + ldcr r10, DMT1 + st r10, r31, REG_OFF(EF_DMT1) + tb1 0, r0, 0 + ldcr r11, DMD1 + st r11, r31, REG_OFF(EF_DMD1) + ldcr r12, DMA1 + st r12, r31, REG_OFF(EF_DMA1) + + ldcr r10, DMT2 + st r10, r31, REG_OFF(EF_DMT2) + ldcr r11, DMD2 + st r11, r31, REG_OFF(EF_DMD2) + ldcr r12, DMA2 + st r12, r31, REG_OFF(EF_DMA2) + + ldcr r10, SR1 + st r10, r31, REG_OFF(EF_MODE) + + /* shove sr2 into EF_FPLS1 */ + ldcr r10, SR2 + st r10, r31, REG_OFF(EF_FPLS1) + + /* shove sr3 into EF_FPHS2 */ + ldcr r10, SR3 + st r10, r31, REG_OFF(EF_FPHS2) + + /* error vector is zippo numero el'zeroooo */ + st r0, r31, REG_OFF(EF_VECTOR) + + stcr r0, SSBR /* won't want shadow bits bothering us later */ + + /* + * Cheap way to enable FPU and start shadowing again. + */ + ldcr r10, PSR + clr r10, r10, 1<PSR_FPU_DISABLE_BIT> /* enable the FPU */ + clr r10, r10, 1<PSR_SHADOW_FREEZE_BIT> /* also enable shadowing */ + + stcr r10, PSR /* bang */ + FLUSH_PIPELINE + + /* put pointer to regs into r30... r31 will become a simple stack */ + or r30, r31, r0 + + subu r31, r31, 0x10 /* make some breathing space */ + st r30, r31, 0x0c /* store frame pointer on the st */ + st r30, r31, 0x08 /* store again for the debugger to recognize */ + or.u r20, r0, hi16(0x87654321) + or r20, r20, lo16(0x87654321) + st r20, r31, 0x04 + st r20, r31, 0x00 + + CALL(_error_reset, r30, r30) + + /* TURN INTERUPTS back on */ + ldcr r1, PSR + clr r1, r1, 1<PSR_INTERRUPT_DISABLE_BIT> + stcr r1, PSR + FLUSH_PIPELINE + +LABEL(_error_loop2) bsr _error_loop2 + /* never returns*/ + +/* + *---------------------------------------------------------------------------- +*/ /* * This is part of baddadr (below). @@ -862,8 +1025,15 @@ LABEL(setup_phase_one) /* Check if we are coming in from a FPU restart exception. If so, the pcb will be in SR3 */ - bb1.n FLAG_ENABLING_FPU, FLAGS, use_SR3_pcb + NOP xcr r1, r1, SR2 + /*xcr r1, r1, SR2*/ + NOP + NOP + NOP + + bb1 FLAG_ENABLING_FPU, FLAGS, use_SR3_pcb + /*xcr r1, r1, SR0*/ /* are we coming in from user mode? If so, pick up thread pcb */ bb0 FLAG_FROM_KERNEL, FLAGS, pickup_stack @@ -917,7 +1087,7 @@ LABEL(setup_phase_one) * * * * \***************************************************************/ - xcr r30, r30, SR3 /* r30 = old exception frame */ + xcr r30, r30, SR3 /* r30 = old exception frame */ st r1, r30, GENREG_OFF(0) /* free up r1 */ ld r1, r30, REG_OFF(EF_EPSR) /* get back the epsr */ bb0.n PSR_SUPERVISOR_MODE_BIT, r1, 1f /* if user mode */ @@ -1332,7 +1502,7 @@ LABEL(setup_phase_one) LABEL(setup_phase_two) /***************** REGISTER STATUS BLOCK ***********************\ - * SR0: current thread * + * SR0: saved return address to calling exception handler * * SR1: saved copy of exception-time register now holding FLAGS * * SR2: free * * SR3: saved TMP * @@ -1356,23 +1526,37 @@ LABEL(setup_phase_one) * restore the system to the exception-time state (except * * SR3 will be OUR stack pointer) so that we may resart the FPU. * \***************************************************************/ - stcr TMP, SSBR /* done with SSBR, TMP now free */ + /*stcr r1, SR0*/ /* save return address */ + stcr TMP, SSBR /* done with SSBR, TMP now free */ RESTORE_TMP2 /* done with extra temp regs */ RESTORE_TMP3 /* done with extra temp regs */ /* Get the current PSR and modify for the rte to enable the FPU */ +#if 1 ldcr TMP, PSR clr TMP, TMP, 1<PSR_FPU_DISABLE_BIT> /* enable the FPU */ clr TMP, TMP, 1<PSR_SHADOW_FREEZE_BIT> /* also enable shadowing */ stcr TMP, EPSR /* the "+2" below is to set the VALID_BIT */ - or.u TMP, r0, hi16(fpu_enable + 2) - or TMP, TMP, lo16(fpu_enable + 2) + or.u TMP, r0, hi16(fpu_enable +2) + or TMP, TMP, lo16(fpu_enable +2) stcr TMP, SNIP /* jump to here fpu_enable */ addu TMP, TMP, 4 stcr TMP, SFIP /* and then continue after that */ - +#else + ldcr TMP, PSR + or.u TMP, TMP, 0x8000 /* set supervisor mode */ + and TMP, TMP, 0xfff7 /* also enable shadowing */ + stcr TMP, EPSR + stcr r0, SXIP /* clear valid bit */ + stcr r0, SNIP /* clear valid bit */ + or.u TMP, r0, hi16(fpu_enable) + or TMP, TMP, lo16(fpu_enable) + or TMP, TMP, 0x2 /* set the VALID_BIT and clear Exception bit */ + stcr TMP, SFIP /* jump to here fpu_enable */ +#endif + set FLAGS, FLAGS, 1<FLAG_ENABLING_FPU> /* note what we're doing.*/ xcr FLAGS, FLAGS, SR1 st r1, r31, REG_OFF(EF_RET) /* save the return address */ @@ -1404,6 +1588,7 @@ LABEL(setup_phase_one) * Another exception (or exceptions) may be raised in * * this, which is why FLAG_ENABLING_FPU is set in SR1. * \***************************************************************/ + RTE /* jumps to "fpu_enable" on the next line to enable the FPU. */ _LABEL(fpu_enable) diff --git a/sys/arch/mvme88k/mvme88k/locore.S b/sys/arch/mvme88k/mvme88k/locore.S index 72f5313d967..94dc074e894 100644 --- a/sys/arch/mvme88k/mvme88k/locore.S +++ b/sys/arch/mvme88k/mvme88k/locore.S @@ -1,4 +1,5 @@ /* + * Copyright (c) 1998 Steve Murphree, Jr. * Copyright (c) 1996 Nivas Madhur * All rights reserved. * @@ -89,12 +90,10 @@ LABEL(start) br _start_text #if 0 .align 4096 /* VBR points to page aligned list */ - _LABEL(vector_list) /* references memory BELOW this line */ + LABEL(_vector_list) /* references memory BELOW this line */ #include "machine/exception_vectors.h" word END_OF_VECTOR_LIST - _LABEL(_msgsw) - word 0 /* Bits here turn on/off debugging somewhere. */ #endif ENTRY(doboot) @@ -151,17 +150,15 @@ LABEL(_start_text) /* This is the *real* start upon poweron or reset */ /* * Args passed by boot loader * r2 howto - * r3 not used + * r3 boot controler address * r4 esym * r5 start of mini * r6 end miniroot */ or.u r13, r0, hi16(_boothowto) st r2, r13, lo16(_boothowto) -#if 0 - or.u r13, r0, hi16(_bootdev) - st r3, r13, lo16(_bootdev) -#endif + or.u r13, r0, hi16(_bootaddr) + st r3, r13, lo16(_bootaddr) or.u r13, r0, hi16(_first_addr) st r4, r13, lo16(_first_addr) or.u r13, r0, hi16(_esym) @@ -204,18 +201,29 @@ LABEL(_start_text) /* This is the *real* start upon poweron or reset */ * jfriedl@omron.co.jp */ stcr r0, SSBR /* clear this for later */ - +#if 0 + stcr r0, SR0 /* clear "current thread" */ + stcr r0, SR1 /* clear the CPU flags */ +#define PSR_SHADOW_FREEZE_BIT 0 +#define PSR_INTERRUPT_DISABLE_BIT 1 +#define PSR_FPU_DISABLE_BIT 3 +#define PSR_BIG_ENDIAN_MODE 30 +#define PSR_SUPERVISOR_MODE_BIT 31 + set r11, r11, 1<PSR_SHADOW_FREEZE_BIT> + set r11, r11, 1<PSR_FPU_DISABLE_BIT> +#endif set r11, r0, 1<PSR_SUPERVISOR_MODE_BIT> set r11, r11, 1<PSR_INTERRUPT_DISABLE_BIT> stcr r11, PSR FLUSH_PIPELINE - /* shadowing, FPU, misalgined access exception: all enabled now.*/ + #if 0 - or.u r11, r0, hi16(_vector_list) - or r11, r11, lo16(_vector_list) + or.u r11, r0, hi16(_vector_table) + or r11, r11, lo16(_vector_table) stcr r11, VBR -#endif /* 0 */ +#else stcr r0, VBR +#endif /* 0 */ /* * Switch to interrupt stack @@ -267,7 +275,7 @@ LABEL(_start_text) /* This is the *real* start upon poweron or reset */ * XXX nivas */ -#if XXXX +#if XXX bsr.n _setipl or r2, r0, IPL_SOFTCLOCK bsr _enable_interrupt @@ -275,8 +283,11 @@ LABEL(_start_text) /* This is the *real* start upon poweron or reset */ or r2, r0, IPL_HIGH #endif /* make the call: main() */ - bsr.n _main + or.u r2, r0, hi16(UADDR) + or r2, r2,lo16(UADDR) + addu r2, r2, USIZE - 8 subu r31, r31, 40 + bsr _main addu r31, r31, 40 bsr _panic @@ -284,11 +295,16 @@ LABEL(_start_text) /* This is the *real* start upon poweron or reset */ data .align 4096 /* VBR points to page aligned list */ - global _vector_list -_vector_list: /* references memory BELOW this line */ +LABEL(_vector_list) /* references memory BELOW this line */ #include "machine/exception_vectors.h" word END_OF_VECTOR_LIST + .align 4096 /* Vector table is a page aligned list */ +LABEL(_vector_table) /* new vector table location, was addr 0 */ + space (0x1000) /* 16K */ + global _ret_addr +_ret_addr: + word 0 global _msgsw _msgsw: word 0 /* Bits here turn on/off debugging somewhere */ @@ -308,6 +324,7 @@ _intstack_end: * we feel like doing that). * Should be page aligned. */ + .align 4096 global _idle_u _idle_u: space UPAGES * NBPG @@ -317,8 +334,8 @@ _idle_u: * * This must be page aligned */ + .align 4096 global _u0 - align 4096 _u0: space UPAGES * NBPG estack0: @@ -336,6 +353,14 @@ _esym: word 0 #endif /* DDB */ + global _intiobase, _intiolimit, _extiobase +_intiobase: + word 0 | KVA of base of internal IO space +_intiolimit: + word 0 | KVA of end of internal IO space +_extiobase: + word 0 | KVA of base of external IO space + global _proc0paddr /* move to C code */ _proc0paddr: word _u0 /* KVA of proc0 uarea */ diff --git a/sys/arch/mvme88k/mvme88k/locore_asm_routines.S b/sys/arch/mvme88k/mvme88k/locore_asm_routines.S index 25b43bb2583..2f4d92a856e 100644 --- a/sys/arch/mvme88k/mvme88k/locore_asm_routines.S +++ b/sys/arch/mvme88k/mvme88k/locore_asm_routines.S @@ -3,6 +3,7 @@ * Copyright (c) 1993-1992 Carnegie Mellon University * Copyright (c) 1991 OMRON Corporation * Copyright (c) 1996 Nivas Madhur + * Copyright (c) 1998 Steve Murphree, Jr. * All Rights Reserved. * * Permission to use, copy, modify and distribute this software and its @@ -727,6 +728,7 @@ ENTRY(copyinstr) ENTRY(copyout) /* setup fault handler */ +/* tb0 0, r0, 132 entry trap */ or.u r5, r0, hi16(_curpcb) ld r6, r5, lo16(_curpcb) or.u r5, r0, hi16(.Lcoflt) @@ -737,13 +739,13 @@ ENTRY(copyout) /* ;br .Lcodone */ /*;1: ;bcnd lt0, LEN, .Lcoflt ; EFAULT if len < 0 */ /* If it's a small length (less than 8), then do byte-by-byte */ - cmp r9, LEN, 8 - bb1 lt, r9, copyout_byte_only + cmp r9, LEN, 8 + bb1 lt, r9, copyout_byte_only /* If they're not aligned similiarly, use byte only... */ - xor r9, SRC, DEST - mask r8, r9, 0x3 - bcnd ne0, r8, copyout_byte_only + xor r9, SRC, DEST + mask r8, r9, 0x3 + bcnd ne0, r8, copyout_byte_only /* * At this point, we don't know if they're word aligned or not, diff --git a/sys/arch/mvme88k/mvme88k/locore_c_routines.c b/sys/arch/mvme88k/mvme88k/locore_c_routines.c index 483dcb17d5e..9f90844409e 100644 --- a/sys/arch/mvme88k/mvme88k/locore_c_routines.c +++ b/sys/arch/mvme88k/mvme88k/locore_c_routines.c @@ -31,7 +31,7 @@ #include <machine/m88100.h> /* DMT_VALID */ #include <assym.s> /* EF_NREGS, etc. */ -#include <machine/locore.h> /* END_OF_VECTOR_LIST, etc. */ +#include <machine/asm.h> /* END_OF_VECTOR_LIST, etc. */ #ifdef DDB #include <ddb/db_output.h> /* db_printf() */ #endif /* DDB */ @@ -291,7 +291,6 @@ void vector_init( if (vec != PREDEFINED_BY_ROM) SET_VECTOR(num, to, vec); } - while (num < 496) SET_VECTOR(num++, to, sigsys); num++; /* skip 496, BUG ROM vector */ diff --git a/sys/arch/mvme88k/mvme88k/machdep.c b/sys/arch/mvme88k/mvme88k/machdep.c index 0632901a493..177280deeda 100644 --- a/sys/arch/mvme88k/mvme88k/machdep.c +++ b/sys/arch/mvme88k/mvme88k/machdep.c @@ -1,4 +1,5 @@ /* + * Copyright (c) 1998 Steve Murphree, Jr. * Copyright (c) 1996 Nivas Madhur * All rights reserved. * @@ -106,6 +107,7 @@ static int waittime = -1; struct intrhand *intr_handlers[256]; unsigned char *ivec[] = { + (unsigned char *)0xFFFE0003, /* not used, no such thing as int 0 */ (unsigned char *)0xFFFE0007, (unsigned char *)0xFFFE000B, @@ -131,15 +133,15 @@ int cold; vm_offset_t avail_end, avail_start, avail_next; int msgbufmapped = 0; int foodebug = 0; -int longformat = 0; - +int longformat = 1; +int BugWorks = 0; /* * safepri is a safe priority for sleep to set for a spin-wait * during autoconfiguration or after a panic. */ int safepri = 0; -#if XXX_FUTURE +#if 0 /*XXX_FUTURE*/ /* * iomap stuff is for managing chunks of virtual address space that * can be allocated to IO devices. @@ -173,7 +175,7 @@ caddr_t allocsys __P((caddr_t)); /* * Info for CTL_HW */ -char machine[] = "MVME187"; /* cpu "architecture" */ +char machine[] = "mvme88k"; /* cpu "architecture" */ char cpu_model[120]; extern char version[]; @@ -193,7 +195,7 @@ char *esym; int boothowto; /* read in kern/bootstrap */ int cputyp; -int cpuspeed = 25; /* 25 MHZ XXX should be read from NVRAM */ +int cpuspeed = 33; /* 25 MHZ XXX should be read from NVRAM */ #ifndef roundup #define roundup(value, stride) (((unsigned)(value) + (stride) - 1) & ~((stride)-1)) @@ -220,15 +222,19 @@ pcb_t curpcb; extern struct user *proc0paddr; /* XXX this is to fake out the console routines, while booting. */ -void bugttycnputc __P((dev_t, int)); -int bugttycngetc __P((dev_t)); -extern void nullcnpollc __P((dev_t, int)); -void cmmu_init(void); - -static struct consdev bugcons = +#include "bugtty.h" +#if NBUGTTY > 0 + int bugttycnprobe __P((struct consdev *)); + int bugttycninit __P((struct consdev *)); + void bugttycnputc __P((dev_t, int)); + int bugttycngetc __P((dev_t)); + extern void nullcnpollc __P((dev_t, int)); + static struct consdev bugcons = { NULL, NULL, bugttycngetc, bugttycnputc, nullcnpollc, makedev(14,0), 1 }; +#endif /* NBUGTTY */ +void cmmu_init(void); /* * Console initialization: called early on from main, * before vm init or startup. Do enough configuration @@ -238,10 +244,10 @@ void consinit() { extern struct consdev *cn_tab; - /* * Initialize the console before we print anything out. */ + cn_tab = NULL; cninit(); @@ -263,9 +269,9 @@ size_memory(void) volatile unsigned int *look; unsigned int *max; extern char *end; - #define PATTERN 0x5a5a5a5a - #define STRIDE (4*1024) /* 4k at a time */ - #define Roundup(value, stride) (((unsigned)(value) + (stride) - 1) & ~((stride)-1)) +#define PATTERN 0x5a5a5a5a +#define STRIDE (4*1024) /* 4k at a time */ +#define Roundup(value, stride) (((unsigned)(value) + (stride) - 1) & ~((stride)-1)) /* * count it up. @@ -276,8 +282,7 @@ size_memory(void) unsigned save; /* if can't access, we've reached the end */ - if (foodebug) - printf("%x\n", look); + if (foodebug) printf("%x\n", look); if (badwordaddr((vm_offset_t)look)) { #if defined(DEBUG) printf("%x\n", look); @@ -308,7 +313,7 @@ identifycpu() { /* XXX -take this one out. It can be done in m187_bootstrap() */ strcpy(cpu_model, "Motorola M88K"); - printf("Model: %s\n", cpu_model); + printf("\nModel: %s\n", cpu_model); } /* The following two functions assume UPAGES == 3 */ @@ -357,7 +362,6 @@ cpu_startup() int base, residual; vm_offset_t minaddr, maxaddr, uarea_pages; extern vm_offset_t miniroot; - /* * Initialize error message buffer (at end of core). * avail_end was pre-decremented in m1x7_bootstrap(). @@ -496,7 +500,7 @@ cpu_startup() panic("cpu_startup: unable to create phys_map"); } -#if XXX_FUTURE +#if 0 /*XXX_FUTURE*/ iomap_map = vm_map_create(kernel_pmap, IOMAP_MAP_START, IOMAP_MAP_START + IOMAP_SIZE, TRUE); if (iomap_map == NULL) { @@ -534,9 +538,21 @@ cpu_startup() printf("using %d buffers containing %d bytes of memory\n", nbuf, bufpages * CLBYTES); -#if 0 - mfs_initminiroot(miniroot); -#endif /* 0 */ +#ifdef MFS + /* + * Check to see if a mini-root was loaded into memory. It resides + * at the start of the next page just after the end of BSS. + */ + { + extern void *smini; + + if (miniroot && (boothowto & RB_MINIROOT)) { + boothowto |= RB_DFLTROOT; + mfs_initminiroot(miniroot); + } + } +#endif + /* * Set up buffers, so they can be used to read disk labels. */ @@ -616,7 +632,7 @@ allocsys(v) valloc(swbuf, struct buf, nswbuf); valloc(buf, struct buf, nbuf); -#if XXX_FUTURE +#if 0 /*XXX_FUTURE*/ /* * Arbitrarily limit the number of devices mapping * the IO space at a given time to NIOPMAP (= 32, default). @@ -639,6 +655,9 @@ setregs(p, pack, stack, retval) { register struct trapframe *tf = USER_REGS(p); +/* printf("stack at %x\n", stack); + printf("%x - %x\n", USRSTACK - MAXSSIZ, USRSTACK); +*/ /* * The syscall will ``return'' to snip; set it. * argc, argv, envp are placed on the stack by copyregs. @@ -667,7 +686,8 @@ setregs(p, pack, stack, retval) } #endif /* 0 */ bzero((caddr_t)tf, sizeof *tf); - tf->epsr = 0x3f0; /* user mode, interrupts enabled, fp enabled */ + tf->epsr = 0x3f0; /* user mode, interrupts enabled, fp enabled */ +/* tf->epsr = 0x3f4;*/ /* user mode, interrupts enabled, fp enabled, MXM Mask */ /* * We want to start executing at pack->ep_entry. The way to @@ -962,7 +982,7 @@ boot(howto) resettodr(); } splhigh(); /* extreme priority */ - if (howto&RB_HALT) { + if (howto & RB_HALT) { printf("halted\n\n"); bugreturn(); } else { @@ -972,6 +992,7 @@ boot(howto) /*NOTREACHED*/ } /*NOTREACHED*/ + while (1); /* to keep compiler happy, and me from going crazy */ } unsigned dumpmag = 0x8fca0101; /* magic number for savecore */ @@ -1063,7 +1084,16 @@ setupiackvectors() #else vaddr = (u_char *)0xfffe0000; #endif - +#if 0 + (unsigned char *)0xFFFE0003, /* not used, no such thing as int 0 */ + (unsigned char *)0xFFFE0007, + (unsigned char *)0xFFFE000B, + (unsigned char *)0xFFFE000F, + (unsigned char *)0xFFFE0013, + (unsigned char *)0xFFFE0017, + (unsigned char *)0xFFFE001B, + (unsigned char *)0xFFFE001F, +#endif ivec[0] = vaddr + 0x03; ivec[1] = vaddr + 0x07; ivec[2] = vaddr + 0x0b; @@ -1075,6 +1105,64 @@ setupiackvectors() } /* + * find a useable interrupt vector in the range start, end. It starts at + * the end of the range, and searches backwards (to increase the chances + * of not conflicting with more normal users) + */ +int +intr_findvec(start, end) + int start, end; +{ + extern u_long *vector_list[], interrupt_handler, unknown_handler; + int vec; + + if (start < 0 || end > 255 || start > end) + return (-1); + for (vec = end; vec > start; --vec) + if (vector_list[vec] == &unknown_handler +/* || vector_list[vec] == &interrupt_handler */) + return (vec); + return (-1); +} + +/* + * Chain the interrupt handler in. But first check if the vector + * offset chosen is legal. It either must be a badtrap (not allocated + * for a `system' purpose), or it must be a hardtrap (ie. already + * allocated to deal with chained interrupt handlers). + */ +#if 0 + +int +intr_establish(vec, ih) + int vec; + struct intrhand *ih; +{ + extern u_long *vector_list[], interrupt_handler, unknown_handler; + struct intrhand *ihx; + + if (vector_list[vec] != &interrupt_handler && vector_list[vec] != &unknown_handler) { + printf("intr_establish: vec %d unavailable\n", vec); + return (-1); + } + vector_list[vec] = &interrupt_handler; +#if DIAGNOSTIC + printf("assigning vec %x to interrupt_handler\n", vec); +#endif + ih->ih_next = NULL; /* just in case */ + + /* attach at tail */ + if (ihx = intr_handlers[vec]) { + while (ihx->ih_next) + ihx = ihx->ih_next; + ihx->ih_next = ih; + } else + intr_handlers[vec] = ih; + return (INTR_EST_SUCC); +} + +#else +/* * Insert ihand in the list of handlers at vector vec. * Return return different error codes for the different * errors and let the caller decide what to do. @@ -1118,6 +1206,7 @@ intr_establish(int vec, struct intrhand *ihand) return (INTR_EST_SUCC); } +#endif /* * Device interrupt handler @@ -1426,19 +1515,24 @@ myetheraddr(cp) u_char *cp; { struct bugniocall niocall; - + char *cp2 = (char*) 0xFFC1F2C; /* BBRAM Ethernet hw addr */ + niocall.clun = 0; niocall.dlun = 0; niocall.ci = 0; niocall.cd = 0; niocall.cid = NETCTRL_GETHDW; - niocall.memaddr = (unsigned int)cp; + niocall.memaddr = (unsigned long)cp; niocall.nbytes = 6; bugnetctrl(&niocall); + +/* if (cp[0] == '\0') { + strncpy(cp, cp2, 6); + } */ } -netintr() +void netintr() { #ifdef INET if (netisr & (1 << NETISR_ARP)) { @@ -1506,7 +1600,6 @@ spl0() { int x; int level = 0; - x = splsoftclock(); if (ssir) { @@ -1574,32 +1667,32 @@ regdump(struct trapframe *f) printf("dmt2 %x dmd2 %x dma2 %x\n", f->dmt2, f->dmd2, f->dma2); } if (longformat) { - printf("fpsr %x", f->fpsr); - printf("fpcr %x", f->fpcr); - printf("epsr %x", f->epsr); + printf("fpsr %x ", f->fpsr); + printf("fpcr %x ", f->fpcr); + printf("epsr %x ", f->epsr); printf("ssbr %x\n", f->ssbr); - printf("dmt0 %x", f->dmt0); - printf("dmd0 %x", f->dmd0); - printf("dma0 %x", f->dma0); - printf("dmt1 %x", f->dmt1); - printf("dmd1 %x", f->dmd1); - printf("dma1 %x", f->dma1); - printf("dmt2 %x", f->dmt2); - printf("dmd2 %x", f->dmd2); + printf("dmt0 %x ", f->dmt0); + printf("dmd0 %x ", f->dmd0); + printf("dma0 %x ", f->dma0); + printf("dmt1 %x ", f->dmt1); + printf("dmd1 %x ", f->dmd1); + printf("dma1 %x ", f->dma1); + printf("dmt2 %x ", f->dmt2); + printf("dmd2 %x ", f->dmd2); printf("dma2 %x\n", f->dma2); - printf("fpecr %x", f->fpecr); - printf("fphs1 %x", f->fphs1); - printf("fpls1 %x", f->fpls1); - printf("fphs2 %x", f->fphs2); - printf("fpls2 %x", f->fpls2); - printf("fppt %x", f->fppt); - printf("fprh %x", f->fprh); - printf("fprl %x", f->fprl); + printf("fpecr %x ", f->fpecr); + printf("fphs1 %x ", f->fphs1); + printf("fpls1 %x ", f->fpls1); + printf("fphs2 %x ", f->fphs2); + printf("fpls2 %x ", f->fpls2); + printf("fppt %x ", f->fppt); + printf("fprh %x ", f->fprh); + printf("fprl %x ", f->fprl); printf("fpit %x\n", f->fpit); - printf("vector %x", f->vector); - printf("mask %x", f->mask); - printf("mode %x", f->mode); - printf("scratch1 %x", f->scratch1); + printf("vector %x ", f->vector); + printf("mask %x ", f->mask); + printf("mode %x ", f->mode); + printf("scratch1 %x ", f->scratch1); printf("pad %x\n", f->pad); } } @@ -1635,9 +1728,9 @@ m187_bootstrap(void) struct bugbrdid brdid; cold = 1; /* we are still booting */ - +#if NBUGTTY > 0 cn_tab = &bugcons; - +#endif buginit(); bugbrdid(&brdid); @@ -1662,8 +1755,7 @@ m187_bootstrap(void) first_addr = m88k_round_page(first_addr); - if (!no_symbols) - boothowto |= RB_KDB; + if (!no_symbols) boothowto |= RB_KDB; last_addr = size_memory(); @@ -1671,19 +1763,19 @@ m187_bootstrap(void) avail_start = first_addr; avail_end = last_addr; - printf("%s",version); + /*printf("%s",version);*/ printf("M187 boot: memory from 0x%x to 0x%x\n", avail_start, avail_end); + printf("M187 boot: howto 0x%x\n", boothowto); /* * Steal one page at the top of physical memory for msgbuf */ avail_end -= PAGE_SIZE; +#if 1 pmap_bootstrap((vm_offset_t)M88K_TRUNC_PAGE((unsigned)&kernelstart) /* = loadpt */, &avail_start, &avail_end, &virtual_avail, &virtual_end); -#if defined(DEBUG) - printf("returned from pmap_bootstrap\n"); #endif /* @@ -1704,7 +1796,5 @@ m187_bootstrap(void) /* Initialize the "u-area" pages. */ bzero((caddr_t)UADDR, UPAGES*NBPG); -#if defined(DEBUG) - printf("returning from init\n"); -#endif + } diff --git a/sys/arch/mvme88k/mvme88k/pmap.c b/sys/arch/mvme88k/mvme88k/pmap.c index 11d8fa5995e..b26b7a9d783 100644 --- a/sys/arch/mvme88k/mvme88k/pmap.c +++ b/sys/arch/mvme88k/mvme88k/pmap.c @@ -50,11 +50,11 @@ #include <sys/types.h> #include <machine/board.h> -#include <vm/pmap.h> +#include <sys/param.h> #include <machine/m882xx.h> /* CMMU stuff */ +#include <vm/vm.h> #include <vm/vm_kern.h> /* vm/vm_kern.h */ -#include <sys/param.h> #include <sys/proc.h> #include <sys/malloc.h> #include <sys/msgbuf.h> @@ -72,6 +72,9 @@ extern vm_offset_t virtual_avail, virtual_end; extern vm_offset_t pcc2consvaddr; extern vm_offset_t clconsvaddr; +char *iiomapbase; +int iiomapsize; + /* * Static variables, functions and variables for debugging */ @@ -112,7 +115,8 @@ extern vm_offset_t clconsvaddr; #define CD_CHKM 0x4000000 /* check_map */ #define CD_ALL 0x0FFFFFC -int pmap_con_dbg = CD_FULL|CD_NORM; +/*int pmap_con_dbg = CD_ALL | CD_FULL | CD_COW | CD_BOOT;*/ +int pmap_con_dbg = CD_NORM; #else #define STATIC static @@ -279,6 +283,7 @@ boolean_t pmap_initialized = FALSE;/* Has pmap_init completed? */ * These checks are disabled by default; enabled by setting CD_FULL * in pmap_con_dbg. */ + #ifdef DEBUG static void check_pv_list __P((vm_offset_t, pv_entry_t, char *)); @@ -986,9 +991,9 @@ pmap_bootstrap(vm_offset_t load_start, /* IN */ } #endif ptes_per_vm_page = PAGE_SIZE >> M88K_PGSHIFT; - if (ptes_per_vm_page == 0) - panic("pmap_bootstrap: VM page size < MACHINE page size"); - + if (ptes_per_vm_page == 0){ + panic("pmap_bootstrap: VM page size < MACHINE page size"); + } if (!PAGE_ALIGNED(load_start)) { panic("pmap_bootstrap : \"load_start\" not on the m88k page boundary : 0x%x\n", load_start); } @@ -1097,7 +1102,7 @@ pmap_bootstrap(vm_offset_t load_start, /* IN */ 0, 0, 0x10000, - (VM_PROT_READ|VM_PROT_WRITE)|(CACHE_INH <<16)); + (VM_PROT_WRITE | VM_PROT_READ)|(CACHE_INH <<16)); assert(vaddr == M88K_TRUNC_PAGE((unsigned)&kernelstart)); @@ -1280,14 +1285,21 @@ pmap_bootstrap(vm_offset_t load_start, /* IN */ apr_data.field.g = 1; apr_data.field.ci = 0; apr_data.field.te = 1; /* Translation enable */ - +#ifdef DEBUG + if ((pmap_con_dbg & (CD_BOOT | CD_FULL)) == (CD_BOOT | CD_FULL)) { + void show_apr(unsigned value); + show_apr(apr_data.bits); + } +#endif /* Invalidate entire kernel TLB. */ #ifdef DEBUG if ((pmap_con_dbg & (CD_BOOT | CD_FULL)) == (CD_BOOT | CD_FULL)) { printf("invalidating tlb %x\n", apr_data.bits); } #endif + cmmu_flush_remote_tlb(0, 1, 0, -1); + #ifdef DEBUG if ((pmap_con_dbg & (CD_BOOT | CD_FULL)) == (CD_BOOT | CD_FULL)) { printf("done invalidating tlb %x\n", apr_data.bits); @@ -2447,6 +2459,9 @@ pmap_protect(pmap_t pmap, vm_offset_t s, vm_offset_t e, vm_prot_t prot) #endif continue; /* no page mapping */ } +#if 0 + printf("(pmap_protect :%x) pte good\n", curproc); +#endif tva = va; for (i = ptes_per_vm_page; i>0; i--) { diff --git a/sys/arch/mvme88k/mvme88k/process_machdep.c b/sys/arch/mvme88k/mvme88k/process_machdep.c index 62a3ba89dfb..8edc1ffbc7e 100644 --- a/sys/arch/mvme88k/mvme88k/process_machdep.c +++ b/sys/arch/mvme88k/mvme88k/process_machdep.c @@ -93,9 +93,9 @@ process_write_regs(p, regs) struct reg *regs; { #if 0 - int psr = p->p_md.md_tf->tf_psr & ~PSR_ICC; + int psr = p->p_md.md_tf->tf_epsr & ~PSR_ICC; bcopy((caddr_t)regs, p->p_md.md_tf, sizeof(struct reg)); - p->p_md.md_tf->tf_psr = psr | (regs->r_psr & PSR_ICC); + p->p_md.md_tf->tf_epsr = psr | (regs->r_epsr & PSR_ICC); #endif return (0); } diff --git a/sys/arch/mvme88k/mvme88k/swapgeneric.c b/sys/arch/mvme88k/mvme88k/swapgeneric.c index 1172a180ef6..59ea8913a58 100644 --- a/sys/arch/mvme88k/mvme88k/swapgeneric.c +++ b/sys/arch/mvme88k/mvme88k/swapgeneric.c @@ -1,6 +1,8 @@ -/* - * Copyright (c) 1982, 1986 Regents of the University of California. - * All rights reserved. +/* $OpenBSD: swapgeneric.c,v 1.4 1998/12/15 05:11:02 smurph Exp $ */ + +/*- + * Copyright (c) 1994 + * 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 @@ -12,8 +14,8 @@ * 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. + * 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. @@ -30,208 +32,30 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * @(#)swapgeneric.c 7.5 (Berkeley) 5/7/91 - * $Id: swapgeneric.c,v 1.3 1997/03/03 20:21:50 rahnds Exp $ + * @(#)swapgeneric.c 8.2 (Berkeley) 3/21/94 + */ + +/* + * fake swapgeneric.c -- should do this differently. */ #include <sys/param.h> -#include <sys/systm.h> #include <sys/conf.h> -#include <sys/buf.h> -#include <sys/reboot.h> -#include <sys/device.h> -#include <sys/disklabel.h> -#include <sys/fcntl.h> /* XXXX and all that uses it */ -#include <sys/proc.h> /* XXXX and all that uses it */ -#include <sys/disk.h> +#include <machine/disklabel.h> -#include "sd.h" -#include "cd.h" +int (*mountroot) __P((void)) = NULL; /* tells autoconf.c that we are "generic" */ -/* - * Only boot on ufs. (XXX?) - */ -int ffs_mountroot(); -int (*mountroot)() = ffs_mountroot; - -/* - * Generic configuration; all in one - */ dev_t rootdev = NODEV; dev_t dumpdev = NODEV; struct swdevt swdevt[] = { - { NODEV, 1, 0 }, - { NODEV, 0, 0 }, -}; - -#if NSD > 0 -extern struct cfdriver sdcd; -#endif -#if NCD > 0 -extern struct cfdriver cdcd; -#endif - -struct genericconf { - struct cfdriver *gc_driver; - dev_t gc_root; + { makedev(4, 0*MAXPARTITIONS+1), 0, 0 }, /* sd0b */ + { makedev(4, 1*MAXPARTITIONS+1), 0, 0 }, /* sd1b */ + { makedev(4, 2*MAXPARTITIONS+1), 0, 0 }, /* sd2b */ + { makedev(4, 3*MAXPARTITIONS+1), 0, 0 }, /* sd3b */ + { makedev(4, 4*MAXPARTITIONS+1), 0, 0 }, /* sd4b */ + { makedev(4, 5*MAXPARTITIONS+1), 0, 0 }, /* sd5b */ + { makedev(4, 6*MAXPARTITIONS+1), 0, 0 }, /* sd6b */ + { makedev(4, 7*MAXPARTITIONS+1), 0, 0 }, /* sd7b */ + { NODEV, 0, 0 } }; - -/* - * the system will assign rootdev to the first partition 'a' - * found with FS_BSDFFS fstype. so these should be ordered - * in prefernece of boot. however it does walk units backwards - * to remain compatible with the old amiga method of picking - * the last root found. - */ -struct genericconf genericconf[] = { -#if NSD > 0 - {&sdcd, makedev(4, 0)}, -#endif -#if NCD > 0 - {&cdcd, makedev(6, 0)}, -#endif - { 0 }, -}; - -struct genericconf * -getgenconf(bp) - char *bp; -{ - char *cp; - struct genericconf *gc; - - for (;;) { - printf("root device> "); - gets(bp); - for (gc = genericconf; gc->gc_driver; gc++) - if (gc->gc_driver->cd_name[0] == bp[0] && - gc->gc_driver->cd_name[1] == bp[1]) - break; - if (gc->gc_driver == NULL) { - printf("use one of:"); - for (gc = genericconf; gc->gc_driver; gc++) - printf(" %s%%d", gc->gc_driver->cd_name); - printf("\n"); - continue; - } - cp = bp + 2; - if (*cp >= '0' && *cp <= '9') - break; - printf("bad/missing unit number\n"); - } - return(gc); -} - -setconf() -{ - struct dkdevice *dkp; - struct partition *pp; - struct genericconf *gc; - struct bdevsw *bdp; - int unit, swaponroot; - char name[128]; - char *cp; - - swaponroot = 0; - - if (rootdev != NODEV) - goto justdoswap; - - unit = 0; - if (boothowto & RB_ASKNAME) { - gc = getgenconf(name); - cp = name + 2; - while (*cp >= '0' && *cp <= '9') - unit = 10 * unit + *cp++ - '0'; - if (*cp == '*') - swaponroot = 1; - unit &= 0x7; - goto found; - } - for (gc = genericconf; gc->gc_driver; gc++) { - for (unit = gc->gc_driver->cd_ndevs - 1; unit >= 0; unit--) { - if (gc->gc_driver->cd_devs[unit] == NULL) - continue; - /* - * this is a hack these drivers should use - * dk_dev and not another instance directly above. - */ - dkp = (struct dkdevice *) - ((struct device *)gc->gc_driver->cd_devs[unit] + 1); - if (dkp->dk_driver == NULL || - dkp->dk_driver->d_strategy == NULL) - continue; - for (bdp = bdevsw; bdp < (bdevsw + nblkdev); bdp++) - if (bdp->d_strategy == - dkp->dk_driver->d_strategy) - break; - if (bdp->d_open(MAKEDISKDEV(major(gc->gc_root), - unit, 0), FREAD | FNONBLOCK, 0, curproc)) - continue; - bdp->d_close(MAKEDISKDEV(major(gc->gc_root), unit, - 0), FREAD | FNONBLOCK, 0, curproc); - pp = &dkp->dk_label.d_partitions[0]; - if (pp->p_size == 0 || pp->p_fstype != FS_BSDFFS) - continue; - goto found; - } - } - printf("no suitable root\n"); - asm("or r9,r0,0x0063"); - asm("tb0 0,r0,0x1f0"); - /*NOTREACHED*/ -found: - - gc->gc_root = MAKEDISKDEV(major(gc->gc_root), unit, 0); - rootdev = gc->gc_root; - -justdoswap: - swdevt[0].sw_dev = MAKEDISKDEV(major(rootdev), - DISKUNIT(rootdev), 1); - /* - swdevt[0].sw_dev = dumpdev = MAKEDISKDEV(major(rootdev), - DISKUNIT(rootdev), 1); - */ - /* swap size and dumplo set during autoconfigure */ - if (swaponroot) - rootdev = swdevt[0].sw_dev; -} - -gets(cp) - char *cp; -{ - register char *lp; - register c; - - lp = cp; - for (;;) { - cnputc(c = cngetc()); - switch (c) { - case '\n': - case '\r': - *lp = 0; - return; - case '\b': - case '\177': - if (lp > cp) { - lp--; - cnputc(' '); - cnputc('\b'); - } - continue; - case '#': - lp--; - if (lp < cp) - lp = cp; - continue; - case '@': - case 'u'&037: - lp = cp; - cnputc('\n'); - continue; - default: - *lp++ = c; - } - } -} diff --git a/sys/arch/mvme88k/mvme88k/trap.c b/sys/arch/mvme88k/mvme88k/trap.c index bcd339794ca..02a2fc98dc5 100644 --- a/sys/arch/mvme88k/mvme88k/trap.c +++ b/sys/arch/mvme88k/mvme88k/trap.c @@ -1,4 +1,5 @@ /* + * Copyright (c) 1998 Steve Murphree, Jr. * Copyright (c) 1996 Nivas Madhur * All rights reserved. * @@ -43,10 +44,10 @@ */ #include <sys/types.h> +#include <sys/param.h> #include <vm/vm.h> #include <vm/vm_kern.h> /* kernel_map */ -#include <sys/param.h> #include <sys/proc.h> #include <sys/user.h> #include <sys/syscall.h> @@ -102,6 +103,11 @@ char *pbus_exception_type[] = { "Supervisor Violation", "Write Violation", }; +extern ret_addr; +#define NSIR 8 +void (*sir_routines[NSIR])(); +void *sir_args[NSIR]; +u_char next_sir; int trap_types = sizeof trap_type / sizeof trap_type[0]; @@ -181,6 +187,7 @@ trap(unsigned type, struct m88100_saved_state *frame) u_long fault_code; unsigned nss, fault_addr; struct vmspace *vm; + union sigval sv; int result; int sig = 0; @@ -318,9 +325,11 @@ trap(unsigned type, struct m88100_saved_state *frame) if ((frame->dpfsr >> 16 & 0x7) == 0x3) { #ifdef DIAGNOSTIC +#if DDB printf("sxip %x dpfsr %x\n", frame->sxip, frame->dpfsr); gimmeabreak(); #endif +#endif } if ((frame->dpfsr >> 16 & 0x7) == 0x3 && /* bus error */ @@ -408,9 +417,11 @@ trap(unsigned type, struct m88100_saved_state *frame) result = vm_fault(map, va, ftype, FALSE); frame->ipfsr = frame->dpfsr = 0; +/* printf("vm_fault(%x, %x, %x, 0) -> %x\n", + map, va, ftype, result); +*/ } - if ((caddr_t)va >= vm->vm_maxsaddr) { if (result == KERN_SUCCESS) { nss = clrnd(btoc(USRSTACK - va));/* XXX check this */ @@ -445,8 +456,10 @@ trap(unsigned type, struct m88100_saved_state *frame) break; case T_MISALGNFLT+T_USER: +/* DEBUG_MSG("T_MISALGNFLT\n");*/ sig = SIGBUS; fault_type = BUS_ADRALN; +/* panictrap(fault_type, frame);*/ break; case T_PRIVINFLT+T_USER: @@ -521,8 +534,10 @@ trap(unsigned type, struct m88100_saved_state *frame) return; if (sig) { - trapsignal(p, sig, fault_code, fault_type, (caddr_t)fault_addr); - /* +/* trapsignal(p, sig, fault_code, fault_type, (caddr_t)fault_addr); */ + sv.sival_int = fault_addr; + trapsignal(p, sig, fault_code, fault_type, sv); + /* * don't want multiple faults - we are going to * deliver signal. */ @@ -534,14 +549,36 @@ trap(unsigned type, struct m88100_saved_state *frame) } void +test_trap(struct m88100_saved_state *frame) +{ + DEBUG_MSG("\n[test_trap (Good News[tm]) frame 0x%08x]\n", frame); + regdump((struct trapframe*)frame); + bugreturn(); +} +void error_fault(struct m88100_saved_state *frame) { DEBUG_MSG("\n[ERROR FAULT (Bad News[tm]) frame 0x%08x]\n", frame); -#if DDB + +#if DDB gimmeabreak(); DEBUG_MSG("[you really can't restart after an error fault.]\n"); gimmeabreak(); #endif /* DDB */ + bugreturn(); /* This gets us to Bug instead of a loop forever */ +} + +void +error_reset(struct m88100_saved_state *frame) +{ + DEBUG_MSG("\n[ERROR RESET (Really Bad News[tm]) frame 0x%08x]\n", frame); + +#if DDB + gimmeabreak(); + DEBUG_MSG("[It's useless to restart after an error reset. You might as well reboot.]\n"); + gimmeabreak(); +#endif /* DDB */ + bugreturn(); /* This gets us to Bug instead of a loop forever */ } syscall(register_t code, struct m88100_saved_state *tf) @@ -721,3 +758,31 @@ child_return(struct proc *p) ktrsysret(p->p_tracep, SYS_fork, 0, 0); #endif } + +/* + * Allocation routines for software interrupts. + */ +u_long +allocate_sir(proc, arg) + void (*proc)(); + void *arg; +{ + int bit; + + if (next_sir >= NSIR) + panic("allocate_sir: none left"); + bit = next_sir++; + sir_routines[bit] = proc; + sir_args[bit] = arg; + return (1 << bit); +} + +void +init_sir() +{ + extern void netintr(); + + sir_routines[0] = netintr; + sir_routines[1] = softclock; + next_sir = 2; +} diff --git a/sys/arch/mvme88k/mvme88k/vm_machdep.c b/sys/arch/mvme88k/mvme88k/vm_machdep.c index 9436fd59d8a..4f81fb2300a 100644 --- a/sys/arch/mvme88k/mvme88k/vm_machdep.c +++ b/sys/arch/mvme88k/mvme88k/vm_machdep.c @@ -1,4 +1,5 @@ /* + * Copyright (c) 1998 Steve Murphree, Jr. * Copyright (c) 1996 Nivas Madhur * Copyright (c) 1993 Adam Glass * Copyright (c) 1988 University of Utah. @@ -40,13 +41,14 @@ * from: Utah $Hdr: vm_machdep.c 1.21 91/04/06$ * from: @(#)vm_machdep.c 7.10 (Berkeley) 5/7/91 * vm_machdep.c,v 1.3 1993/07/07 07:09:32 cgd Exp - * $Id: vm_machdep.c,v 1.4 1998/07/28 00:13:46 millert Exp $ + * $Id: vm_machdep.c,v 1.5 1998/12/15 05:11:03 smurph Exp $ */ #include <sys/param.h> #include <sys/systm.h> #include <sys/proc.h> #include <sys/malloc.h> +#include <sys/map.h> #include <sys/buf.h> #include <sys/user.h> #include <sys/vnode.h> @@ -56,10 +58,12 @@ #include <vm/vm_map.h> #include <machine/cpu.h> +#include <machine/pte.h> #ifdef XXX_FUTURE extern struct map *iomap; #endif +extern struct map extiomap; /* * Finish a fork operation, with process p2 nearly set up. @@ -96,7 +100,7 @@ cpu_fork(struct proc *p1, struct proc *p2) /*XXX these may not be necessary nivas */ save_u_area(p2, p2->p_addr); -#ifdef notneeded +#ifdef notneeded PMAP_ACTIVATE(&p2->p_vmspace->vm_pmap, &p2->p_addr->u_pcb, 0); #endif /* notneeded */ @@ -104,6 +108,7 @@ cpu_fork(struct proc *p1, struct proc *p2) * Create a switch frame for proc 2 */ p2sf = (struct switchframe *)((char *)p2->p_addr + USPACE - 8) - 1; + p2sf->sf_pc = (u_int)proc_do_uret; p2sf->sf_proc = p2; p2->p_addr->u_pcb.kernel_state.pcb_sp = (u_int)p2sf; @@ -157,7 +162,7 @@ cpu_set_kpc(struct proc *p, void (*func)(struct proc *)) * pcb and stack and never returns. We block memory allocation * until switch_exit has made things safe again. */ -volatile void +void cpu_exit(struct proc *p) { extern volatile void switch_exit(); @@ -279,8 +284,9 @@ vunmapbuf(struct buf *bp, vm_size_t len) bp->b_saveaddr = 0; } -#ifdef XXX_FUTURE -/* + +#if 1 +/* XXX_FUTURE * Map a range [pa, pa+len] in the given map to a kernel address * in iomap space. * @@ -291,23 +297,23 @@ vunmapbuf(struct buf *bp, vm_size_t len) vm_offset_t iomap_mapin(vm_offset_t pa, vm_size_t len, boolean_t canwait) { - vm_offset_t iova, tva, off; + vm_offset_t iova, tva, off, ppa; register int npf, s; if (len == 0) return NULL; - + off = (u_long)pa & PGOFSET; len = round_page(off + len); s = splimp(); for (;;) { - iova = rmalloc(iomap, len); + iova = rmalloc(&extiomap, len); if (iova != 0) break; if (canwait) { - (void)tsleep(iomap, PRIBIO+1, "iomapin", 0); + (void)tsleep(&extiomap, PRIBIO+1, "iomapin", 0); continue; } splx(s); @@ -323,7 +329,7 @@ iomap_mapin(vm_offset_t pa, vm_size_t len, boolean_t canwait) VM_PROT_READ|VM_PROT_WRITE, 1); len -= PAGE_SIZE; tva += PAGE_SIZE; - pa += PAGE_SIZE; + ppa += PAGE_SIZE; } return (iova + off); } @@ -341,14 +347,42 @@ iomap_mapout(vm_offset_t kva, vm_size_t len) kva = trunc_page(kva); len = round_page(off + len); - pmap_remove(pmap_kernel(), kva, kva + len); + pmap_remove(kernel_pmap, kva, kva + len); s = splimp(); - rmfree(iomap, len, kva); - wakeup(iomap); + rmfree(&extiomap, len, kva); + wakeup(&extiomap); splx(s); + return 1; } + #endif /* XXX_FUTURE */ + +/* + * Allocate/deallocate a cache-inhibited range of kernel virtual address + * space mapping the indicated physical address range [pa - pa+size) + */ +void * +mapiodev(pa, size) + void *pa; + int size; +{ + vm_offset_t ppa; + ppa = (vm_offset_t)pa; + return ((void *)iomap_mapin(ppa, size, 0)); +} + +void +unmapiodev(kva, size) + void *kva; + int size; +{ + int ix; + vm_offset_t va; + va = (vm_offset_t)kva; + iomap_mapout(va, size); +} + /* * Map the given physical IO address into the kernel temporarily. * Maps one page. @@ -463,3 +497,40 @@ kvtop(vm_offset_t va) return ((u_int)pmap_extract(kernel_pmap, va)); } + +/* + * Map `size' bytes of physical memory starting at `paddr' into + * kernel VA space at `vaddr'. Read/write and cache-inhibit status + * are specified by `prot'. + */ +#if 0 +physaccess(vaddr, paddr, size, prot) + void *vaddr, *paddr; + register int size, prot; +{ +/* register pt_entry_t *pte;*/ + pte_template_t *pte; + register u_int page; + + pte = kvtopte(vaddr); + page = (u_int)paddr & PG_FRAME; + for (size = btoc(size); size; size--) { + *pte++ = PG_V | prot | page; + page += NBPG; + } + TBIAS(); +} + +physunaccess(vaddr, size) + caddr_t vaddr; + register int size; +{ + register pt_entry_t *pte; + + pte = kvtopte(vaddr); + for (size = btoc(size); size; size--) + *pte++ = PG_NV; + TBIAS(); +} + +#endif |