diff --git a/sys/mips/dev/uart.c b/sys/mips/dev/uart.c index 0b99e687..559fd720 100644 --- a/sys/mips/dev/uart.c +++ b/sys/mips/dev/uart.c @@ -71,6 +71,87 @@ uartstop(tp, flag) // TODO } +/* + * Get a char off the appropriate line via. a busy wait loop. + */ +int +uartGetc(dev) + dev_t dev; +{ + // TODO +#if 1 + return 0; +#else + register uart_regmap_t *regs; + register int c, line; + register unsigned value; + int s; + + line = UARTLINE(dev); + regs = (uart_regmap_t *)uart_softc[UARTUNIT(dev)].uart_pdma[line].p_addr; + if (!regs) + return (0); + s = spltty(); + for (;;) { + value = UART_READ_REG(regs, line, UART_RR0); + if (value & UART_RR0_RX_AVAIL) { + value = UART_READ_REG(regs, line, UART_RR1); + UART_READ_DATA(regs, line, c); + if (value & (UART_RR1_PARITY_ERR | UART_RR1_RX_OVERRUN | + UART_RR1_FRAME_ERR)) { + UART_WRITE_REG(regs, line, UART_WR0, UART_RESET_ERROR); + UART_WRITE_REG(regs, UART_CHANNEL_A, UART_WR0, + UART_RESET_HIGHEST_IUS); + } else { + UART_WRITE_REG(regs, UART_CHANNEL_A, UART_WR0, + UART_RESET_HIGHEST_IUS); + splx(s); + return (unsigned char) c; + } + } else + DELAY(10); + } +#endif +} + +/* + * Send a char on a port, via a busy wait loop. + */ +void +uartPutc(dev, c) + dev_t dev; + int c; +{ + // TODO +#if 0 + register uart_regmap_t *regs; + register int line; + register u_char value; + int s; + + s = spltty(); + line = UARTLINE(dev); + regs = (uart_regmap_t *)uart_softc[UARTUNIT(dev)].uart_pdma[line].p_addr; + + /* + * Wait for transmitter to be not busy. + */ + do { + UART_READ_REG(regs, line, UART_RR0, value); + if (value & UART_RR0_TX_EMPTY) + break; + DELAY(100); + } while (1); + + /* + * Send the char. + */ + UART_WRITE_DATA(regs, line, c); + MachEmptyWriteBuffer(); + splx(s); +#endif +} + /* * Test to see if device is present. * Return true if found and initialized ok. diff --git a/sys/mips/include/cpu.h b/sys/mips/include/cpu.h index 381b1129..33e565d8 100644 --- a/sys/mips/include/cpu.h +++ b/sys/mips/include/cpu.h @@ -42,7 +42,7 @@ #include /* - * Exported definitions unique to pmax/mips cpu support. + * Exported definitions unique to MIPS cpu support. */ /* @@ -80,7 +80,7 @@ struct clockframe { /* * Give a profiling tick to the current process when the user profiling - * buffer pages are invalid. On the PMAX, request an ast to send us + * buffer pages are invalid. On MIPS, request an ast to send us * through trap, marking the proc as needing a profiling tick. */ #define need_proftick(p) { (p)->p_flag |= P_OWEUPC; aston(); } diff --git a/sys/mips/include/param.h b/sys/mips/include/param.h index e7f4caa7..92a2cf9e 100644 --- a/sys/mips/include/param.h +++ b/sys/mips/include/param.h @@ -104,7 +104,7 @@ /* * Size of kernel malloc arena in CLBYTES-sized logical pages - */ + */ #ifndef NKMEMCLUSTERS #define NKMEMCLUSTERS (512*1024/CLBYTES) #endif @@ -136,10 +136,9 @@ /* * Mach derived conversion macros */ -#define pmax_round_page(x) ((((unsigned)(x)) + NBPG - 1) & ~(NBPG-1)) -#define pmax_trunc_page(x) ((unsigned)(x) & ~(NBPG-1)) -#define pmax_btop(x) ((unsigned)(x) >> PGSHIFT) -#define pmax_ptob(x) ((unsigned)(x) << PGSHIFT) +#define mips_round_page(x) ((((unsigned)(x)) + NBPG - 1) & ~(NBPG-1)) +#define mips_btop(x) ((unsigned)(x) >> PGSHIFT) +#define mips_ptob(x) ((unsigned)(x) << PGSHIFT) #ifndef LOCORE #ifdef KERNEL diff --git a/sys/mips/include/pcb.h b/sys/mips/include/pcb.h index 60ed22c4..96a005f0 100644 --- a/sys/mips/include/pcb.h +++ b/sys/mips/include/pcb.h @@ -41,7 +41,7 @@ */ /* - * PMAX process control block + * MIPS process control block */ struct pcb { @@ -53,7 +53,7 @@ struct pcb /* * The pcb is augmented with machine-dependent additional data for - * core dumps. For the PMAX, there is nothing to add. + * core dumps. For MIPS, there is nothing to add. */ struct md_coredump { long md_pad[8]; diff --git a/sys/mips/include/pmap.h b/sys/mips/include/pmap.h index a4976f11..e8acc65e 100644 --- a/sys/mips/include/pmap.h +++ b/sys/mips/include/pmap.h @@ -1,4 +1,4 @@ -/* +/* * Copyright (c) 1987 Carnegie-Mellon University * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. @@ -51,7 +51,7 @@ * The user address space is mapped using a two level structure where * virtual address bits 30..22 are used to index into a segment table which * points to a page worth of PTEs (4096 page can hold 1024 PTEs). - * Bits 21..12 are then used to index a PTE which describes a page within + * Bits 21..12 are then used to index a PTE which describes a page within * a segment. * * The wired entries in the TLB will contain the following: @@ -62,8 +62,7 @@ * dynamically allocated at boot time. */ -#define pmax_trunc_seg(x) ((vm_offset_t)(x) & ~SEGOFSET) -#define pmax_round_seg(x) (((vm_offset_t)(x) + SEGOFSET) & ~SEGOFSET) +#define mips_trunc_seg(x) ((vm_offset_t)(x) & ~SEGOFSET) #define pmap_segmap(m, v) ((m)->pm_segtab->seg_tab[((v) >> SEGSHIFT)]) #define PMAP_SEGTABSIZE 512 diff --git a/sys/mips/include/profile.h b/sys/mips/include/profile.h index c16fc9a7..67508b1e 100644 --- a/sys/mips/include/profile.h +++ b/sys/mips/include/profile.h @@ -68,7 +68,7 @@ /* * The following two macros do splhigh and splx respectively. * They have to be defined this way because these are real - * functions on the PMAX, and we do not want to invoke mcount + * functions on MIPS, and we do not want to invoke mcount * recursively. */ #define MCOUNT_ENTER s = _splhigh() diff --git a/sys/mips/include/ptrace.h b/sys/mips/include/ptrace.h index b96e5543..f1153e99 100644 --- a/sys/mips/include/ptrace.h +++ b/sys/mips/include/ptrace.h @@ -36,5 +36,5 @@ /* * Machine dependent trace commands. * - * None for the pmax at this time. + * None for the MIPS at this time. */ diff --git a/sys/mips/pic32/TODO b/sys/mips/pic32/TODO deleted file mode 100644 index de2a631f..00000000 --- a/sys/mips/pic32/TODO +++ /dev/null @@ -1,13 +0,0 @@ -TODO: - autoconf.c - clock.c - conf.c - cons.c - machdep.c - mem.c - pmap.c - procfs_machdep.c - sys_machdep.c - trap.c - vm_machdep.c - locore.s diff --git a/sys/mips/pic32/autoconf.c b/sys/mips/pic32/autoconf.c index af1e7e9d..73c056e4 100644 --- a/sys/mips/pic32/autoconf.c +++ b/sys/mips/pic32/autoconf.c @@ -59,8 +59,6 @@ #include #include -#include -#include /* * The following several variables are related to @@ -70,8 +68,6 @@ int cold = 1; /* if 1, still working on cold-start */ int dkn; /* number of iostat dk numbers assigned so far */ int cpuspeed = 30; /* approx # instr per usec. */ -extern int pmax_boardtype; -extern tc_option_t tc_slot_info[TC_MAX_LOGICAL_SLOTS]; /* * Determine mass storage and memory configuration for a machine. @@ -87,92 +83,18 @@ configure() /* print what type of CPU and FPU we have */ - /* - * for some reason the Pmax has an R2000 cpu with an implementation - * level of 2 and DEC's R3000s are level 2 as well? - */ - if (pmax_boardtype == DS_PMAX) { - cpu.cpu.cp_imp = MIPS_R2000; - fpu.cpu.cp_imp = MIPS_R2010; - } - - switch (cpu.cpu.cp_imp) { - case MIPS_R2000: - printf("cpu0 (MIPS R2000 revision %d.%d)\n", - cpu.cpu.cp_majrev, cpu.cpu.cp_minrev); - break; - - case MIPS_R3000: - printf("cpu0 (MIPS R3000 revision %d.%d)\n", - cpu.cpu.cp_majrev, cpu.cpu.cp_minrev); - break; - - case MIPS_R4000: - printf("cpu0 (MIPS R4000 revision %d.%d)\n", - cpu.cpu.cp_majrev, cpu.cpu.cp_minrev); - break; - - default: - printf("cpu0 (implementation %d revision %d.%d)\n", - cpu.cpu.cp_imp, cpu.cpu.cp_majrev, cpu.cpu.cp_minrev); - } - switch (fpu.cpu.cp_imp) { - case MIPS_R2010: - printf("fpu0 (MIPS R2010 revision %d.%d)\n", - fpu.cpu.cp_majrev, fpu.cpu.cp_minrev); - break; + printf("cpu0 (MIPS PIC32MZ revision %d.%d)\n", + cpu.cpu.cp_majrev, cpu.cpu.cp_minrev); - case MIPS_R3010: - printf("fpu0 (MIPS R3010 revision %d.%d)\n", - fpu.cpu.cp_majrev, fpu.cpu.cp_minrev); - break; - - case MIPS_R4010: - printf("fpu0 (MIPS R4010 revision %d.%d)\n", - fpu.cpu.cp_majrev, fpu.cpu.cp_minrev); - break; - - default: - printf("fpu0 (implementation %d revision %d.%d)\n", - fpu.cpu.cp_imp, fpu.cpu.cp_majrev, fpu.cpu.cp_minrev); - } printf("data cache size %dK inst cache size %dK\n", machDataCacheSize >> 10, machInstCacheSize >> 10); /* probe and initialize controllers */ for (cp = mips_cinit; drp = cp->mips_driver; cp++) { - switch (pmax_boardtype) { - case DS_PMAX: - if (cp->mips_addr == (char *)QUES) - continue; - if (!(*drp->d_init)(cp)) - continue; - break; -#ifdef DS5000 - case DS_3MAX: - case DS_3MIN: - case DS_MAXINE: - case DS_3MAXPLUS: - /* - * If the device is still in an unknown slot, - * then it was not found by tc_find_all_options(). - */ - if (cp->mips_addr == (char *)QUES) - continue; - if (!(*drp->d_init)(cp)) { - cp->mips_alive = 0; - continue; - } - if (drp->d_intr && (i = cp->mips_pri) >= 0) { - if (tc_slot_info[i].intr) - printf("%s: slot %d already in use\n", - drp->d_name, i); - tc_slot_info[i].intr = drp->d_intr; - tc_slot_info[i].unit = cp->mips_unit; - } - break; -#endif /* DS5000 */ - }; + if (cp->mips_addr == (char *)QUES) + continue; + if (!(*drp->d_init)(cp)) + continue; cp->mips_alive = 1; @@ -193,8 +115,6 @@ configure() } } - setroot(); - swapconf(); cold = 0; } @@ -217,141 +137,3 @@ swapconf() } dumpconf(); } - -#define DOSWAP /* Change swdevt and dumpdev too */ -u_long bootdev; /* should be dev_t, but not until 32 bits */ - -static char devname[][2] = { - 'r','z', /* 0 = rz */ -}; - -#define PARTITIONMASK 0x7 -#define PARTITIONSHIFT 3 - -/* - * 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. - */ -setroot() -{ - register struct scsi_device *dp; - int majdev, mindev, unit, part, controller; - dev_t temp, orootdev; - struct swdevt *swp; - - if (boothowto & RB_DFLTROOT || - (bootdev & B_MAGICMASK) != B_DEVMAGIC) - return; - majdev = B_TYPE(bootdev); - if (majdev >= sizeof(devname) / sizeof(devname[0])) - return; - controller = B_CONTROLLER(bootdev); - part = B_PARTITION(bootdev); - unit = B_UNIT(bootdev); - - for (dp = scsi_dinit; ; dp++) { - if (dp->sd_driver == 0) - return; - if (dp->sd_alive && dp->sd_drive == unit && - dp->sd_ctlr == controller && - dp->sd_driver->d_name[0] == devname[majdev][0] && - dp->sd_driver->d_name[1] == devname[majdev][1]) { - mindev = dp->sd_unit; - break; - } - } - /* - * Form a new rootdev - */ - mindev = (mindev << PARTITIONSHIFT) + part; - orootdev = rootdev; - rootdev = makedev(majdev, mindev); - /* - * If the original rootdev is the same as the one - * just calculated, don't need to adjust the swap configuration. - */ - if (rootdev == orootdev) - return; - - printf("Changing root device to %c%c%d%c\n", - devname[majdev][0], devname[majdev][1], - mindev >> PARTITIONSHIFT, part + 'a'); - -#ifdef DOSWAP - mindev &= ~PARTITIONMASK; - for (swp = swdevt; swp->sw_dev != NODEV; swp++) { - if (majdev == major(swp->sw_dev) && - mindev == (minor(swp->sw_dev) & ~PARTITIONMASK)) { - temp = swdevt[0].sw_dev; - swdevt[0].sw_dev = swp->sw_dev; - swp->sw_dev = temp; - break; - } - } - 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 (temp == dumpdev) - dumpdev = swdevt[0].sw_dev; -#endif -} - -/* - * Look at the string 'cp' and decode the boot device. - * Boot names can be something like 'rz(0,0,0)vmunix' or '5/rz0/vmunix'. - */ -void -makebootdev(cp) - register char *cp; -{ - int majdev, unit, part, ctrl; - - if (*cp >= '0' && *cp <= '9') { - /* XXX should be able to specify controller */ - if (cp[1] != '/' || cp[4] < '0' || cp[4] > '9') - goto defdev; - unit = cp[4] - '0'; - if (cp[5] >= 'a' && cp[5] <= 'h') - part = cp[5] - 'a'; - else - part = 0; - cp += 2; - for (majdev = 0; majdev < sizeof(devname)/sizeof(devname[0]); - majdev++) { - if (cp[0] == devname[majdev][0] && - cp[1] == devname[majdev][1]) { - bootdev = MAKEBOOTDEV(majdev, 0, 0, unit, part); - return; - } - } - goto defdev; - } - for (majdev = 0; majdev < sizeof(devname)/sizeof(devname[0]); majdev++) - if (cp[0] == devname[majdev][0] && - cp[1] == devname[majdev][1] && - cp[2] == '(') - goto fndmaj; -defdev: - bootdev = B_DEVMAGIC; - return; - -fndmaj: - for (ctrl = 0, cp += 3; *cp >= '0' && *cp <= '9'; ) - ctrl = ctrl * 10 + *cp++ - '0'; - if (*cp == ',') - cp++; - for (unit = 0; *cp >= '0' && *cp <= '9'; ) - unit = unit * 10 + *cp++ - '0'; - if (*cp == ',') - cp++; - for (part = 0; *cp >= '0' && *cp <= '9'; ) - part = part * 10 + *cp++ - '0'; - if (*cp != ')') - goto defdev; - bootdev = MAKEBOOTDEV(majdev, 0, ctrl, unit, part); -} diff --git a/sys/mips/pic32/clock.c b/sys/mips/pic32/clock.c index e905e540..579bbfbd 100644 --- a/sys/mips/pic32/clock.c +++ b/sys/mips/pic32/clock.c @@ -44,7 +44,13 @@ #include #include -#include + +#define SECMIN 60U /* seconds per minute */ +#define SECHOUR (60U * SECMIN) /* seconds per hour */ +#define SECDAY (24U * SECHOUR) /* seconds per day */ +#define SECYR (365U * SECDAY) /* seconds per common year */ + +#define LEAPYEAR(year) (((year) % 4) == 0) /* * Machine-dependent clock routines. @@ -74,8 +80,10 @@ cpu_initclocks() hz = 1000000 / 15625; /* 64 Hz */ tickadj = 240000 / (60000000 / 15625); c = Mach_clock_addr; - c->rega = REGA_TIME_BASE | SELECTED_RATE; - c->regb = REGB_PER_INT_ENA | REGB_DATA_MODE | REGB_HOURS_FORMAT; + + // TODO: pic32 + //c->rega = REGA_TIME_BASE | SELECTED_RATE; + //c->regb = REGB_PER_INT_ENA | REGB_DATA_MODE | REGB_HOURS_FORMAT; } /* @@ -112,7 +120,6 @@ void inittodr(base) time_t base; { - register volatile struct chiptime *c; register int days, yr; int sec, min, hour, day, mon, year; long deltat; @@ -126,7 +133,9 @@ inittodr(base) } else badbase = 0; - c = Mach_clock_addr; +#if 0 + // TODO: pic32 + register volatile struct chiptime *c = Mach_clock_addr; /* don't read clock registers while they are being updated */ s = splclock(); while ((c->rega & REGA_UIP) == 1) @@ -138,6 +147,7 @@ inittodr(base) mon = c->mon; year = c->year + YR_OFFSET; splx(s); +#endif /* simple sanity checks */ if (year < 70 || mon < 1 || mon > 12 || day < 1 || day > 31 || @@ -188,7 +198,6 @@ inittodr(base) */ resettodr() { - register volatile struct chiptime *c; register int t, t2; int sec, min, hour, day, mon, year; int s; @@ -218,8 +227,9 @@ resettodr() t %= 3600; min = t / 60; sec = t % 60; - - c = Mach_clock_addr; +#if 0 + // TODO: pic32 + register volatile struct chiptime *c = Mach_clock_addr; s = splclock(); t = c->regb; c->regb = t | REGB_SET_TIME; @@ -233,4 +243,5 @@ resettodr() c->regb = t; MachEmptyWriteBuffer(); splx(s); +#endif } diff --git a/sys/mips/pic32/conf.c b/sys/mips/pic32/conf.c index 5377cc34..d56c3453 100644 --- a/sys/mips/pic32/conf.c +++ b/sys/mips/pic32/conf.c @@ -245,9 +245,15 @@ struct cdevsw cdevsw[] = cdev_ptc_init(NPTY,ptc), /* 5: pseudo-tty master */ cdev_log_init(1,log), /* 6: /dev/klog */ cdev_fd_init(1,fd), /* 7: file descriptor pseudo-dev */ + cdev_notdef(), /* 8: */ cdev_disk_init(NSD,sd), /* 9: SD flash card */ + cdev_notdef(), /* 10: */ cdev_vn_init(NVN,vn), /* 11: vnode disk */ cdev_bpf_init(NBPFILTER,bpf), /* 12: berkeley packet filter */ + cdev_notdef(), /* 13: */ + cdev_notdef(), /* 14: */ + cdev_notdef(), /* 15: */ + cdev_notdef(), /* 16: */ cdev_tty_init(NUART,uart), /* 17: serial UART interface */ }; diff --git a/sys/mips/pic32/cons.c b/sys/mips/pic32/cons.c index 8d59ba2d..d3b42ac9 100644 --- a/sys/mips/pic32/cons.c +++ b/sys/mips/pic32/cons.c @@ -49,35 +49,42 @@ #include #include -#include +extern struct tty *constty; /* virtual console output device */ /* - * Console I/O is redirected to the appropriate device, either a screen and - * keyboard, a serial port, or the "virtual" console. + * Console I/O is redirected to the serial port. */ -#include +#include "uart.h" +#if NUART > 0 +extern int uartGetc(); +extern void uartPutc(); -extern struct tty *constty; /* virtual console output device */ +#define redirect_getc uartGetc +#define redirect_putc uartPutc +#define UARTDEV 17 /* UART device major */ -struct consdev cn_tab = { - 1, - 1, - NODEV, - (struct pmax_fb *)0, - (int (*)())0, - (int (*)())0, - (void (*)())0, - (struct tty *)0, -}; +dev_t cn_dev = makedev(UARTDEV, 0); + +#else +#error Console: cannot redirect +#endif + +/* + * Console initialization: called early on from main, + * before vm init or startup. Do enough configuration + * to choose and initialize a console. + */ +consinit() +{ + // TODO +} cnopen(dev, flag, mode, p) dev_t dev; int flag, mode; struct proc *p; { - if (cn_tab.cn_dev == NODEV) - return (0); - dev = cn_tab.cn_dev; + dev = cn_dev; return ((*cdevsw[major(dev)].d_open)(dev, flag, mode, p)); } @@ -86,9 +93,7 @@ cnclose(dev, flag, mode, p) int flag, mode; struct proc *p; { - if (cn_tab.cn_dev == NODEV) - return (0); - dev = cn_tab.cn_dev; + dev = cn_dev; return ((*cdevsw[major(dev)].d_close)(dev, flag, mode, p)); } @@ -96,9 +101,7 @@ cnread(dev, uio, flag) dev_t dev; struct uio *uio; { - if (cn_tab.cn_dev == NODEV) - return (0); - dev = cn_tab.cn_dev; + dev = cn_dev; return ((*cdevsw[major(dev)].d_read)(dev, uio, flag)); } @@ -108,9 +111,7 @@ cnwrite(dev, uio, flag) { if (constty) return ((*linesw[constty->t_line].l_write)(constty, uio, flag)); - if (cn_tab.cn_dev == NODEV) - return (0); - dev = cn_tab.cn_dev; + dev = cn_dev; return ((*cdevsw[major(dev)].d_write)(dev, uio, flag)); } @@ -140,9 +141,7 @@ cnioctl(dev, cmd, data, flag, p) return (error); } #endif - if (cn_tab.cn_dev == NODEV) - return (0); - dev = cn_tab.cn_dev; + dev = cn_dev; return ((*cdevsw[major(dev)].d_ioctl)(dev, cmd, data, flag, p)); } @@ -152,9 +151,7 @@ cnselect(dev, rw, p) int rw; struct proc *p; { - if (cn_tab.cn_dev == NODEV) - return (1); - return (ttselect(cn_tab.cn_dev, rw, p)); + return (ttselect(cn_dev, rw, p)); } /* @@ -162,11 +159,7 @@ cnselect(dev, rw, p) */ cngetc() { - - /* check to be sure device has been initialized */ - if (cn_tab.cn_dev == NODEV || cn_tab.cn_disabled) - return ((*callv->getchar)()); - return ((*cn_tab.cn_getc)(cn_tab.cn_dev)); + return (redirect_getc(cn_dev)); } /* @@ -177,13 +170,9 @@ cnputc(c) { int s; - if (cn_tab.cn_dev == NODEV || cn_tab.cn_disabled) { - s = splhigh(); - (*callv->printf)("%c", c); - splx(s); - } else if (c) { + if (c) { if (c == '\n') - (*cn_tab.cn_putc)(cn_tab.cn_dev, '\r'); - (*cn_tab.cn_putc)(cn_tab.cn_dev, c); + redirect_putc(cn_dev, '\r'); + redirect_putc(cn_dev, c); } } diff --git a/sys/mips/pic32/locore.s b/sys/mips/pic32/locore.s index 001f3f09..c591c132 100644 --- a/sys/mips/pic32/locore.s +++ b/sys/mips/pic32/locore.s @@ -98,7 +98,7 @@ start: la gp, _gp #endif sw zero, START_FRAME - 4(sp) # Zero out old ra for debugger - jal mach_init # mach_init(argc, argv, envp) + jal mach_init # mach_init() sw zero, START_FRAME - 8(sp) # Zero out old fp for debugger li t0, MACH_SR_COP_1_BIT # Disable interrupts and @@ -200,10 +200,6 @@ onfault_table: .word fswberr #define FSWINTRBERR 4 .word fswintrberr -#ifdef KADB -#define KADBERR 5 - .word kadberr -#endif .text /* @@ -1275,20 +1271,6 @@ SlowFault: NNON_LEAF(MachKernGenException, KERN_EXC_FRAME_SIZE, ra) .set noat -#ifdef KADB - la k0, kdbpcb # save registers for kadb - sw s0, (S0 * 4)(k0) - sw s1, (S1 * 4)(k0) - sw s2, (S2 * 4)(k0) - sw s3, (S3 * 4)(k0) - sw s4, (S4 * 4)(k0) - sw s5, (S5 * 4)(k0) - sw s6, (S6 * 4)(k0) - sw s7, (S7 * 4)(k0) - sw s8, (S8 * 4)(k0) - sw gp, (GP * 4)(k0) - sw sp, (SP * 4)(k0) -#endif subu sp, sp, KERN_EXC_FRAME_SIZE .mask 0x80000000, (STAND_RA_OFFSET - KERN_EXC_FRAME_SIZE) /* @@ -1742,50 +1724,6 @@ NNON_LEAF(MachUserIntr, STAND_FRAME_SIZE, ra) .set at END(MachUserIntr) -#if 0 -/*---------------------------------------------------------------------------- - * - * MachTLBModException -- - * - * Handle a TLB modified exception. - * The BaddVAddr, Context, and EntryHi registers contain the failed - * virtual address. - * - * Results: - * None. - * - * Side effects: - * None. - * - *---------------------------------------------------------------------------- - */ -NLEAF(MachTLBModException) - .set noat - tlbp # find the TLB entry - mfc0 k0, MACH_COP_0_TLB_LOW # get the physical address - mfc0 k1, MACH_COP_0_TLB_INDEX # check to be sure its valid - or k0, k0, VMMACH_TLB_MOD_BIT # update TLB - blt k1, zero, 4f # not found!!! - mtc0 k0, MACH_COP_0_TLB_LOW - li k1, MACH_CACHED_MEMORY_ADDR - subu k0, k0, k1 - srl k0, k0, VMMACH_TLB_PHYS_PAGE_SHIFT - la k1, pmap_attributes - addu k0, k0, k1 - lbu k1, 0(k0) # fetch old value - nop - or k1, k1, 1 # set modified bit - sb k1, 0(k0) # save new value - mfc0 k0, MACH_COP_0_EXC_PC # get return address - nop - j k0 - rfe -4: - break 0 # panic - .set at -END(MachTLBModException) -#endif - /*---------------------------------------------------------------------------- * * MachTLBMissException -- @@ -2072,42 +2010,6 @@ LEAF(MachTLBWriteIndexed) mtc0 v1, MACH_COP_0_STATUS_REG # Restore the status register END(MachTLBWriteIndexed) -#if 0 -/*-------------------------------------------------------------------------- - * - * MachTLBWriteRandom -- - * - * Write the given entry into the TLB at a random location. - * - * MachTLBWriteRandom(highEntry, lowEntry) - * unsigned highEntry; - * unsigned lowEntry; - * - * Results: - * None. - * - * Side effects: - * TLB entry set. - * - *-------------------------------------------------------------------------- - */ -LEAF(MachTLBWriteRandom) - mfc0 v1, MACH_COP_0_STATUS_REG # Save the status register. - mtc0 zero, MACH_COP_0_STATUS_REG # Disable interrupts - mfc0 v0, MACH_COP_0_TLB_HI # Save the current PID. - nop - - mtc0 a0, MACH_COP_0_TLB_HI # Set up entry high. - mtc0 a1, MACH_COP_0_TLB_LOW # Set up entry low. - nop - tlbwr # Write the TLB - - mtc0 v0, MACH_COP_0_TLB_HI # Restore the PID. - j ra - mtc0 v1, MACH_COP_0_STATUS_REG # Restore the status register -END(MachTLBWriteRandom) -#endif - /*-------------------------------------------------------------------------- * * MachSetPID -- @@ -2171,57 +2073,6 @@ LEAF(MachTLBFlush) mtc0 v1, MACH_COP_0_STATUS_REG # Restore the status register END(MachTLBFlush) -#if 0 -/*-------------------------------------------------------------------------- - * - * MachTLBFlushPID -- - * - * Flush all entries with the given PID from the TLB. - * - * MachTLBFlushPID(pid) - * int pid; - * - * Results: - * None. - * - * Side effects: - * All entries corresponding to this PID are flushed. - * - *-------------------------------------------------------------------------- - */ -LEAF(MachTLBFlushPID) - mfc0 v1, MACH_COP_0_STATUS_REG # Save the status register. - mtc0 zero, MACH_COP_0_STATUS_REG # Disable interrupts - mfc0 t0, MACH_COP_0_TLB_HI # Save the current PID - sll a0, a0, VMMACH_TLB_PID_SHIFT # Align the pid to flush. -/* - * Align the starting value (t1) and the upper bound (t2). - */ - li t1, VMMACH_FIRST_RAND_ENTRY << VMMACH_TLB_INDEX_SHIFT - li t2, VMMACH_NUM_TLB_ENTRIES << VMMACH_TLB_INDEX_SHIFT - mtc0 t1, MACH_COP_0_TLB_INDEX # Set the index register -1: - addu t1, t1, 1 << VMMACH_TLB_INDEX_SHIFT # Increment index. - tlbr # Read from the TLB - mfc0 t4, MACH_COP_0_TLB_HI # Fetch the hi register. - nop - and t4, t4, VMMACH_TLB_PID # compare PIDs - bne t4, a0, 2f - li v0, MACH_CACHED_MEMORY_ADDR # invalid address - mtc0 v0, MACH_COP_0_TLB_HI # Mark entry high as invalid - mtc0 zero, MACH_COP_0_TLB_LOW # Zero out low entry. - nop - tlbwi # Write the entry. -2: - bne t1, t2, 1b - mtc0 t1, MACH_COP_0_TLB_INDEX # Set the index register - - mtc0 t0, MACH_COP_0_TLB_HI # restore PID - j ra - mtc0 v1, MACH_COP_0_STATUS_REG # Restore the status register -END(MachTLBFlushPID) -#endif - /*-------------------------------------------------------------------------- * * MachTLBFlushAddr -- @@ -2992,142 +2843,6 @@ LEAF(MachFlushDCache) nop END(MachFlushDCache) -#ifdef KADB -/* - * Read a long and return it. - * Note: addresses can be unaligned! - * - * long -L* kdbpeek(addr) -L* caddt_t addr; -L* { -L* return (*(long *)addr); -L* } - */ -LEAF(kdbpeek) - li v0, KADBERR - sw v0, UADDR+U_PCB_ONFAULT - and v0, a0, 3 # unaligned address? - bne v0, zero, 1f - nop - b 2f - lw v0, (a0) # aligned access -1: - lwr v0, 0(a0) # get next 4 bytes (unaligned) - lwl v0, 3(a0) -2: - j ra # made it w/o errors - sw zero, UADDR+U_PCB_ONFAULT -kadberr: - li v0, 1 # trap sends us here - sw v0, kdbmkfault - j ra - nop -END(kdbpeek) - -/* - * Write a long to 'addr'. - * Note: addresses can be unaligned! - * -L* void -L* kdbpoke(addr, value) -L* caddt_t addr; -L* long value; -L* { -L* *(long *)addr = value; -L* } - */ -LEAF(kdbpoke) - li v0, KADBERR - sw v0, UADDR+U_PCB_ONFAULT - and v0, a0, 3 # unaligned address? - bne v0, zero, 1f - nop - b 2f - sw a1, (a0) # aligned access -1: - swr a1, 0(a0) # store next 4 bytes (unaligned) - swl a1, 3(a0) - and a0, a0, ~3 # align address for cache flush -2: - sw zero, UADDR+U_PCB_ONFAULT - b MachFlushICache # flush instruction cache - li a1, 8 -END(kdbpoke) - -/* - * Save registers and state so we can do a 'kdbreset' (like longjmp) later. - * Always returns zero. - * -L* int kdb_savearea[11]; -L* -L* int -L* kdbsetexit() -L* { -L* kdb_savearea[0] = 0; -L* return (0); -L* } - */ - .comm kdb_savearea, (11 * 4) - -LEAF(kdbsetexit) - la a0, kdb_savearea - sw s0, 0(a0) - sw s1, 4(a0) - sw s2, 8(a0) - sw s3, 12(a0) - sw s4, 16(a0) - sw s5, 20(a0) - sw s6, 24(a0) - sw s7, 28(a0) - sw sp, 32(a0) - sw s8, 36(a0) - sw ra, 40(a0) - j ra - move v0, zero -END(kdbsetexit) - -/* - * Restore registers and state (like longjmp) and return x. - * -L* int -L* kdbreset(x) -L* { -L* return (x); -L* } - */ -LEAF(kdbreset) - la v0, kdb_savearea - lw ra, 40(v0) - lw s0, 0(v0) - lw s1, 4(v0) - lw s2, 8(v0) - lw s3, 12(v0) - lw s4, 16(v0) - lw s5, 20(v0) - lw s6, 24(v0) - lw s7, 28(v0) - lw sp, 32(v0) - lw s8, 36(v0) - j ra - move v0, a0 -END(kdbreset) - -/* - * Trap into the debugger. - * -L* void -L* kdbpanic() -L* { -L* } - */ -LEAF(kdbpanic) - break MACH_BREAK_KDB_VAL - j ra - nop -END(kdbpanic) -#endif /* KADB */ - #ifdef DEBUG LEAF(cpu_getregs) sw sp, 0(a0) diff --git a/sys/mips/pic32/machdep.c b/sys/mips/pic32/machdep.c index 4998418d..6423700d 100644 --- a/sys/mips/pic32/machdep.c +++ b/sys/mips/pic32/machdep.c @@ -73,53 +73,13 @@ #include #include #include -#include - -#include #include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#if NDC > 0 -extern int dcGetc(), dcparam(); -extern void dcPutc(); -#endif -#if NDTOP > 0 -extern int dtopKBDGetc(); -#endif -#if NSCC > 0 -extern int sccGetc(), sccparam(); -extern void sccPutc(); -#endif -extern int KBDGetc(); -extern void fbPutc(); -extern struct consdev cn_tab; - -/* Will scan from max to min, inclusive */ -static int tc_max_slot = KN02_TC_MAX; -static int tc_min_slot = KN02_TC_MIN; -static u_int tc_slot_phys_base [TC_MAX_SLOTS] = { - /* use 3max for default values */ - KN02_PHYS_TC_0_START, KN02_PHYS_TC_1_START, - KN02_PHYS_TC_2_START, KN02_PHYS_TC_3_START, - KN02_PHYS_TC_4_START, KN02_PHYS_TC_5_START, - KN02_PHYS_TC_6_START, KN02_PHYS_TC_7_START -}; - /* the following is used externally (sysctl_hw) */ -char machine[] = "DEC"; /* cpu "architecture" */ +char machine[] = "MIPS"; /* cpu "architecture" */ char cpu_model[30]; vm_map_t buffer_map; @@ -128,32 +88,21 @@ vm_map_t buffer_map; * Declare these as initialized data so we can patch them. */ int nswbuf = 0; -#ifdef NBUF + +#ifndef NBUF +#define NBUF 0 +#endif int nbuf = NBUF; -#else -int nbuf = 0; + +#ifndef BUFPAGES +#define BUFPAGES 0 #endif -#ifdef BUFPAGES int bufpages = BUFPAGES; -#else -int bufpages = 0; -#endif + int msgbufmapped = 0; /* set when safe to use msgbuf */ int maxmem; /* max memory per process */ int physmem; /* max supported memory, changes to actual */ -int pmax_boardtype; /* Mother board type */ -u_long le_iomem; /* 128K for lance chip via. ASIC */ -u_long asc_iomem; /* and 7 * 8K buffers for the scsi */ -u_long asic_base; /* Base address of I/O asic */ -const struct callback *callv; /* pointer to PROM entry points */ - -void (*tc_enable_interrupt)(); -extern int (*pmax_hardware_intr)(); -void pmax_slot_hand_fill(); -int kn02_intr(), kmin_intr(), xine_intr(), pmax_intr(); -#ifdef DS5000_240 -int kn03_intr(); -#endif + extern int Mach_spl0(), Mach_spl1(), Mach_spl2(), Mach_spl3(), splhigh(); int (*Mach_splnet)() = splhigh; int (*Mach_splbio)() = splhigh; @@ -161,24 +110,8 @@ int (*Mach_splimp)() = splhigh; int (*Mach_spltty)() = splhigh; int (*Mach_splclock)() = splhigh; int (*Mach_splstatclock)() = splhigh; -void (*tc_slot_hand_fill)(); -extern volatile struct chiptime *Mach_clock_addr; -u_long kmin_tc3_imask, xine_tc3_imask; -#ifdef DS5000_240 -u_long kn03_tc3_imask; -#endif -tc_option_t tc_slot_info[TC_MAX_LOGICAL_SLOTS]; -static void asic_init(); -extern void RemconsInit(); -#ifdef DS5000 -void kn02_enable_intr(), kn02_slot_hand_fill(), - kmin_enable_intr(), kmin_slot_hand_fill(), - xine_enable_intr(), xine_slot_hand_fill(), - tc_find_all_options(); -#ifdef DS5000_240 -void kn03_enable_intr(), kn03_slot_hand_fill(); -#endif -#endif /* DS5000 */ + +extern dev_t cn_dev; /* * safepri is a safe priority for sleep to set for a spin-wait @@ -191,14 +124,9 @@ struct proc nullproc; /* for use by swtch_exit() */ /* * Do all the stuff that locore normally does before calling main(). - * Process arguments passed to us by the prom monitor. * Return the first page address following the system. */ -mach_init(argc, argv, code, cv) - int argc; - char *argv[]; - u_int code; - const struct callback *cv; +mach_init() { register char *cp; register int i; @@ -210,66 +138,17 @@ mach_init(argc, argv, code, cv) extern char MachException[], MachExceptionEnd[]; /* clear the BSS segment */ - v = (caddr_t)pmax_round_page(_end); + v = (caddr_t)mips_round_page(_end); bzero(_edata, v - _edata); - /* check for direct boot from DS5000 PROM */ - if (argc > 0 && strcmp(argv[0], "boot") == 0) { - argc--; - argv++; - } - - /* look at argv[0] and compute bootdev */ - makebootdev(argv[0]); - - /* - * Look at arguments passed to us and compute boothowto. - */ -#ifdef GENERIC - boothowto = RB_SINGLE | RB_ASKNAME; -#else - boothowto = RB_SINGLE; -#endif -#ifdef KADB - boothowto |= RB_KDB; -#endif - if (argc > 1) { - for (i = 1; i < argc; i++) { - for (cp = argv[i]; *cp; cp++) { - switch (*cp) { - case 'a': /* autoboot */ - boothowto &= ~RB_SINGLE; - break; - - case 'd': /* use compiled in default root */ - boothowto |= RB_DFLTROOT; - break; - - case 'm': /* mini root present in memory */ - boothowto |= RB_MINIROOT; - break; - - case 'n': /* ask for names */ - boothowto |= RB_ASKNAME; - break; - - case 'N': /* don't ask for names */ - boothowto &= ~RB_ASKNAME; - } - } - } - } - -#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. + * Autoboot by default. */ - if (boothowto & RB_MINIROOT) { - boothowto |= RB_DFLTROOT; - v += mfs_initminiroot(v); + boothowto = 0; + if (1) { // TODO + /* Boot to single user mode. */ + boothowto |= RB_SINGLE; } -#endif /* * Init mapping for u page(s) for proc[0], pm_tlbpid 1. @@ -320,195 +199,16 @@ mach_init(argc, argv, code, cv) MachConfigCache(); MachFlushCache(); - /* - * Determine what model of computer we are running on. - */ - callv = cv; - i = (*cv->getsysid)(); - cp = ""; - - /* check for MIPS based platform */ - if (((i >> 24) & 0xFF) != 0x82) { - printf("Unknown System type '%s' 0x%x\n", cp, i); - boot(RB_HALT | RB_NOSYNC); - } - - /* check what model platform we are running on */ - pmax_boardtype = ((i >> 16) & 0xff); - switch (pmax_boardtype) { - case DS_PMAX: /* DS3100 Pmax */ - /* - * Set up interrupt handling and I/O addresses. - */ - pmax_hardware_intr = pmax_intr; - Mach_splnet = Mach_spl1; - Mach_splbio = Mach_spl0; - Mach_splimp = Mach_spl1; - Mach_spltty = Mach_spl2; - Mach_splclock = Mach_spl3; - Mach_splstatclock = Mach_spl3; - Mach_clock_addr = (volatile struct chiptime *) - MACH_PHYS_TO_UNCACHED(KN01_SYS_CLOCK); - pmax_slot_hand_fill(); - strcpy(cpu_model, "3100"); - break; - -#ifdef DS5000 - case DS_3MAX: /* DS5000/200 3max */ - { - volatile int *csr_addr = - (volatile int *)MACH_PHYS_TO_UNCACHED(KN02_SYS_CSR); - - /* - * Enable ECC memory correction, turn off LEDs, and - * disable all TURBOchannel interrupts. - */ - i = *csr_addr; - *csr_addr = (i & ~(KN02_CSR_WRESERVED | KN02_CSR_IOINTEN)) | - KN02_CSR_CORRECT | 0xff; - - tc_slot_hand_fill = kn02_slot_hand_fill; - pmax_hardware_intr = kn02_intr; - tc_enable_interrupt = kn02_enable_intr; - Mach_splnet = Mach_spl0; - Mach_splbio = Mach_spl0; - Mach_splimp = Mach_spl0; - Mach_spltty = Mach_spl0; - Mach_splclock = Mach_spl1; - Mach_splstatclock = Mach_spl1; - Mach_clock_addr = (volatile struct chiptime *) - MACH_PHYS_TO_UNCACHED(KN02_SYS_CLOCK); - - /* - * Probe the TURBOchannel to see what controllers are present. - */ - tc_find_all_options(); - - /* clear any memory errors from probes */ - *(unsigned *)MACH_PHYS_TO_UNCACHED(KN02_SYS_ERRADR) = 0; - } - strcpy(cpu_model, "5000/200"); - break; - - case DS_3MIN: /* DS5000/1xx 3min */ - tc_max_slot = KMIN_TC_MAX; - tc_min_slot = KMIN_TC_MIN; - tc_slot_phys_base[0] = KMIN_PHYS_TC_0_START; - tc_slot_phys_base[1] = KMIN_PHYS_TC_1_START; - tc_slot_phys_base[2] = KMIN_PHYS_TC_2_START; - asic_base = MACH_PHYS_TO_UNCACHED(KMIN_SYS_ASIC); - tc_slot_hand_fill = kmin_slot_hand_fill; - pmax_hardware_intr = kmin_intr; - tc_enable_interrupt = kmin_enable_intr; - kmin_tc3_imask = (KMIN_INTR_CLOCK | KMIN_INTR_PSWARN | - KMIN_INTR_TIMEOUT); - - /* - * Since all the motherboard interrupts come through the - * I/O ASIC, it has to be turned off for all the spls and - * since we don't know what kinds of devices are in the - * turbochannel option slots, just splhigh(). - */ - Mach_splnet = splhigh; - Mach_splbio = splhigh; - Mach_splimp = splhigh; - Mach_spltty = splhigh; - Mach_splclock = splhigh; - Mach_splstatclock = splhigh; - Mach_clock_addr = (volatile struct chiptime *) - MACH_PHYS_TO_UNCACHED(KMIN_SYS_CLOCK); - - /* - * Probe the TURBOchannel to see what controllers are present. - */ - tc_find_all_options(); - - /* - * Initialize interrupts. - */ - *(u_int *)ASIC_REG_IMSK(asic_base) = KMIN_IM0; - *(u_int *)ASIC_REG_INTR(asic_base) = 0; - /* clear any memory errors from probes */ - *(unsigned *)MACH_PHYS_TO_UNCACHED(KMIN_REG_TIMEOUT) = 0; - strcpy(cpu_model, "5000/1xx"); - break; - - case DS_MAXINE: /* DS5000/xx maxine */ - tc_max_slot = XINE_TC_MAX; - tc_min_slot = XINE_TC_MIN; - tc_slot_phys_base[0] = XINE_PHYS_TC_0_START; - tc_slot_phys_base[1] = XINE_PHYS_TC_1_START; - asic_base = MACH_PHYS_TO_UNCACHED(XINE_SYS_ASIC); - tc_slot_hand_fill = xine_slot_hand_fill; - pmax_hardware_intr = xine_intr; - tc_enable_interrupt = xine_enable_intr; - Mach_splnet = Mach_spl3; - Mach_splbio = Mach_spl3; - Mach_splimp = Mach_spl3; - Mach_spltty = Mach_spl3; - Mach_splclock = Mach_spl1; - Mach_splstatclock = Mach_spl1; - Mach_clock_addr = (volatile struct chiptime *) - MACH_PHYS_TO_UNCACHED(XINE_SYS_CLOCK); - - /* - * Probe the TURBOchannel to see what controllers are present. - */ - tc_find_all_options(); - - /* - * Initialize interrupts. - */ - *(u_int *)ASIC_REG_IMSK(asic_base) = XINE_IM0; - *(u_int *)ASIC_REG_INTR(asic_base) = 0; - /* clear any memory errors from probes */ - *(unsigned *)MACH_PHYS_TO_UNCACHED(XINE_REG_TIMEOUT) = 0; - strcpy(cpu_model, "5000/25"); - break; - -#ifdef DS5000_240 - case DS_3MAXPLUS: /* DS5000/240 3max+ UNTESTED!! */ - tc_max_slot = KN03_TC_MAX; - tc_min_slot = KN03_TC_MIN; - tc_slot_phys_base[0] = KN03_PHYS_TC_0_START; - tc_slot_phys_base[1] = KN03_PHYS_TC_1_START; - tc_slot_phys_base[2] = KN03_PHYS_TC_2_START; - asic_base = MACH_PHYS_TO_UNCACHED(KN03_SYS_ASIC); - tc_slot_hand_fill = kn03_slot_hand_fill; - pmax_hardware_intr = kn03_intr; - tc_enable_interrupt = kn03_enable_intr; - kn03_tc3_imask = KN03_INTR_PSWARN; - - Mach_splnet = Mach_spl0; - Mach_splbio = Mach_spl0; - Mach_splimp = Mach_spl0; - Mach_spltty = Mach_spl0; - Mach_splclock = Mach_spl1; - Mach_splstatclock = Mach_spl1; - Mach_clock_addr = (volatile struct chiptime *) - MACH_PHYS_TO_UNCACHED(KN03_SYS_CLOCK); - - /* - * Probe the TURBOchannel to see what controllers are present. - */ - tc_find_all_options(); - - /* - * Initialize interrupts. - */ - *(u_int *)ASIC_REG_IMSK(asic_base) = KN03_IM0; - *(u_int *)ASIC_REG_INTR(asic_base) = 0; - /* clear any memory errors from probes */ - *(unsigned *)MACH_PHYS_TO_UNCACHED(KN03_SYS_ERRADR) = 0; - strcpy(cpu_model, "5000/240"); - break; -#endif /* DS5000_240 */ -#endif /* DS5000 */ - - default: - printf("kernel not configured for systype 0x%x\n", i); - boot(RB_HALT | RB_NOSYNC); - } + /* + * Set up interrupt handling and I/O addresses. + */ + Mach_splnet = Mach_spl1; + Mach_splbio = Mach_spl0; + Mach_splimp = Mach_spl1; + Mach_spltty = Mach_spl2; + Mach_splclock = Mach_spl3; + Mach_splstatclock = Mach_spl3; + strcpy(cpu_model, "pic32mz"); /* * Find out how much memory is available. @@ -536,32 +236,6 @@ mach_init(argc, argv, code, cv) maxmem = physmem; -#if NLE > 0 - /* - * Grab 128K at the top of physical memory for the lance chip - * on machines where it does dma through the I/O ASIC. - * It must be physically contiguous and aligned on a 128K boundary. - */ - if (pmax_boardtype == DS_3MIN || pmax_boardtype == DS_MAXINE || - pmax_boardtype == DS_3MAXPLUS) { - maxmem -= btoc(128 * 1024); - le_iomem = (maxmem << PGSHIFT); - } -#endif /* NLE */ -#if NASC > 0 - /* - * Ditto for the scsi chip. There is probably a way to make asc.c - * do dma without these buffers, but it would require major - * re-engineering of the asc driver. - * They must be 8K in size and page aligned. - */ - if (pmax_boardtype == DS_3MIN || pmax_boardtype == DS_MAXINE || - pmax_boardtype == DS_3MAXPLUS) { - maxmem -= btoc(ASC_NCMD * 8192); - asc_iomem = (maxmem << PGSHIFT); - } -#endif /* NASC */ - /* * Initialize error message buffer (at end of core). */ @@ -624,179 +298,17 @@ mach_init(argc, argv, code, cv) pmap_bootstrap((vm_offset_t)v); } -/* - * Console initialization: called early on from main, - * before vm init or startup. Do enough configuration - * to choose and initialize a console. - */ -consinit() +void +initcpu() { - register int kbd, crt; - register char *oscon; - - /* - * First get the "osconsole" environment variable. - */ - oscon = (*callv->getenv)("osconsole"); - crt = kbd = -1; - if (oscon && *oscon >= '0' && *oscon <= '9') { - kbd = *oscon - '0'; - cn_tab.cn_screen = 0; - while (*++oscon) { - if (*oscon == ',') - cn_tab.cn_screen = 1; - else if (cn_tab.cn_screen && - *oscon >= '0' && *oscon <= '9') { - crt = kbd; - kbd = *oscon - '0'; - break; - } - } - } - if (pmax_boardtype == DS_PMAX && kbd == 1) - cn_tab.cn_screen = 1; - /* - * The boot program uses PMAX ROM entrypoints so the ROM sets - * osconsole to '1' like the PMAX. - */ - if (pmax_boardtype == DS_3MAX && crt == -1 && kbd == 1) { - cn_tab.cn_screen = 1; - crt = 0; - kbd = 7; - } - - /* - * First try the keyboard/crt cases then fall through to the - * remote serial lines. - */ - if (cn_tab.cn_screen) { - switch (pmax_boardtype) { - case DS_PMAX: -#if NDC > 0 && NPM > 0 - if (pminit()) { - cn_tab.cn_dev = makedev(DCDEV, DCKBD_PORT); - cn_tab.cn_getc = KBDGetc; - cn_tab.cn_kbdgetc = dcGetc; - cn_tab.cn_putc = fbPutc; - cn_tab.cn_disabled = 0; - return; - } -#endif /* NDC and NPM */ - goto remcons; - - case DS_MAXINE: -#if NDTOP > 0 - if (kbd == 3) { - cn_tab.cn_dev = makedev(DTOPDEV, 0); - cn_tab.cn_getc = dtopKBDGetc; - cn_tab.cn_putc = fbPutc; - } else -#endif /* NDTOP */ - goto remcons; -#if NXCFB > 0 - if (crt == 3 && xcfbinit()) { - cn_tab.cn_disabled = 0; - return; - } -#endif /* XCFB */ - break; - - case DS_3MAX: -#if NDC > 0 - if (kbd == 7) { - cn_tab.cn_dev = makedev(DCDEV, DCKBD_PORT); - cn_tab.cn_getc = KBDGetc; - cn_tab.cn_kbdgetc = dcGetc; - cn_tab.cn_putc = fbPutc; - } else -#endif /* NDC */ - goto remcons; - break; - - case DS_3MIN: - case DS_3MAXPLUS: -#if NSCC > 0 - if (kbd == 3) { - cn_tab.cn_dev = makedev(SCCDEV, SCCKBD_PORT); - cn_tab.cn_getc = KBDGetc; - cn_tab.cn_kbdgetc = sccGetc; - cn_tab.cn_putc = fbPutc; - } else -#endif /* NSCC */ - goto remcons; - break; - - default: - goto remcons; - }; - - /* - * Check for a suitable turbochannel frame buffer. - */ - if (tc_slot_info[crt].driver_name) { -#if NMFB > 0 - if (strcmp(tc_slot_info[crt].driver_name, "mfb") == 0 && - mfbinit(tc_slot_info[crt].k1seg_address)) { - cn_tab.cn_disabled = 0; - return; - } -#endif /* NMFB */ -#if NCFB > 0 - if (strcmp(tc_slot_info[crt].driver_name, "cfb") == 0 && - cfbinit(tc_slot_info[crt].k1seg_address)) { - cn_tab.cn_disabled = 0; - return; - } -#endif /* NCFB */ - printf("crt: %s not supported as console device\n", - tc_slot_info[crt].driver_name); - } else - printf("No crt console device in slot %d\n", crt); - } -remcons: - /* - * Configure a serial port as a remote console. - */ - cn_tab.cn_screen = 0; - switch (pmax_boardtype) { - case DS_PMAX: -#if NDC > 0 - if (kbd == 4) - cn_tab.cn_dev = makedev(DCDEV, DCCOMM_PORT); - else - cn_tab.cn_dev = makedev(DCDEV, DCPRINTER_PORT); - cn_tab.cn_getc = dcGetc; - cn_tab.cn_putc = dcPutc; -#endif /* NDC */ - break; - - case DS_3MAX: -#if NDC > 0 - cn_tab.cn_dev = makedev(DCDEV, DCPRINTER_PORT); - cn_tab.cn_getc = dcGetc; - cn_tab.cn_putc = dcPutc; -#endif /* NDC */ - break; - - case DS_3MIN: - case DS_3MAXPLUS: -#if NSCC > 0 - cn_tab.cn_dev = makedev(SCCDEV, SCCCOMM3_PORT); - cn_tab.cn_getc = sccGetc; - cn_tab.cn_putc = sccPutc; -#endif /* NSCC */ - break; - - case DS_MAXINE: -#if NSCC > 0 - cn_tab.cn_dev = makedev(SCCDEV, SCCCOMM2_PORT); - cn_tab.cn_getc = sccGetc; - cn_tab.cn_putc = sccPutc; -#endif /* NSCC */ - break; - }; - if (cn_tab.cn_dev == NODEV) - printf("Can't configure console!\n"); + /* disable clock interrupts (until startrtclock()) */ +#if 0 + // TODO: pic32 + register volatile struct chiptime *c = Mach_clock_addr; + c->regb = REGB_DATA_MODE | REGB_HOURS_FORMAT; + (void) c->regc; +#endif + spl0(); /* safe to turn interrupts on now */ } /* @@ -923,8 +435,8 @@ cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p) switch (name[0]) { case CPU_CONSDEV: - return (sysctl_rdstruct(oldp, oldlenp, newp, &cn_tab.cn_dev, - sizeof cn_tab.cn_dev)); + return (sysctl_rdstruct(oldp, oldlenp, newp, &cn_dev, + sizeof cn_dev)); default: return (EOPNOTSUPP); } @@ -1162,13 +674,8 @@ boot(howto) */ if (panicstr == 0) vnode_pager_umount(NULL); -#ifdef notdef -#include "fd.h" -#if NFD > 0 - fdshutdown(); -#endif -#endif sync(p, (void *)NULL, (int *)NULL); + /* * Unmount filesystems */ @@ -1197,11 +704,11 @@ boot(howto) } (void) splhigh(); /* extreme priority */ if (howto & RB_HALT) { - void (*f)() = (void (*)())DEC_PROM_REINIT; + void (*f)() = 0; // TODO: (void (*)())DEC_PROM_REINIT; (*f)(); /* jump back to prom monitor */ } else { - void (*f)() = (void (*)())DEC_PROM_AUTOBOOT; + void (*f)() = 0; // TODO: (void (*)())DEC_PROM_AUTOBOOT; if (howto & RB_DUMP) dumpsys(); @@ -1314,19 +821,6 @@ microtime(tvp) splx(s); } -initcpu() -{ - register volatile struct chiptime *c; - int i; - - /* disable clock interrupts (until startrtclock()) */ - c = Mach_clock_addr; - c->regb = REGB_DATA_MODE | REGB_HOURS_FORMAT; - i = c->regc; - spl0(); /* safe to turn interrupts on now */ - return (i); -} - /* * Convert an ASCII string into an integer. */ @@ -1387,720 +881,3 @@ atoi(s) out: return val; } - -/* - * Fill in the pmax addresses by hand. - */ -static struct pmax_address { - char *pmax_name; - char *pmax_addr; - int pmax_pri; -} pmax_addresses[] = { - { "sii",(char *)MACH_PHYS_TO_UNCACHED(KN01_SYS_SII), 0 }, - { (char *)0, }, -}; - -void -pmax_slot_hand_fill() -{ - register struct mips_ctlr *cp; - register struct driver *drp; - register struct pmax_address *pmap; - - /* - * Find the device driver entry and fill in the address. - */ - for (cp = mips_cinit; drp = cp->mips_driver; cp++) { - for (pmap = pmax_addresses; pmap->pmax_name; pmap++) { - if (strcmp(drp->d_name, pmap->pmax_name)) - continue; - if (cp->mips_addr == (char *)QUES) { - cp->mips_addr = pmap->pmax_addr; - cp->mips_pri = pmap->pmax_pri; - continue; - } - } - } -} - -#ifdef DS5000 -/* - * Mach Operating System - * Copyright (c) 1991,1990,1989 Carnegie Mellon University - * All Rights Reserved. - * - * Permission to use, copy, modify and distribute this software and its - * documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR - * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie the - * rights to redistribute these changes. - */ - - -/* - * Driver map: associates a device driver to an option type. - * Drivers name are (arbitrarily) defined in each driver and - * used in the various config tables. - */ -struct drivers_map { - char module_name[TC_ROM_LLEN]; /* from ROM, literally! */ - char *driver_name; /* in bus_??_init[] tables */ -} tc_drivers_map[] = { - { "KN02 ", "dc"}, /* (*) 3max system board (with DC) */ - { "PMAD-AA ", "le"}, /* Ether */ - { "PMAZ-AA ", "asc"}, /* SCSI */ - { "PMAG-AA ", "mfb"}, /* Mono Frame Buffer */ - { "PMAG-BA ", "cfb"}, /* Color Frame Buffer */ - { "PMAGB-BA", "sfb"}, /* Smart Frame Buffer */ - { "PMAG-CA ", "ga"}, /* 2D graphic board */ - { "PMAG-DA ", "gq"}, /* 3D graphic board (LM) */ - { "PMAG-FA ", "gq"}, /* 3D graphic board (HE) */ - { "PMAG-DV ", "xcfb"}, /* (*) maxine Color Frame Buffer */ - { "Z8530 ", "scc"}, /* (*) 3min/maxine serial lines */ - { "ASIC ", "asic"}, /* (*) 3min/maxine DMA controller */ - { "XINE-FDC", "fdc"}, /* (*) maxine floppy controller */ - { "DTOP ", "dtop"}, /* (*) maxine desktop bus */ - { "AMD79c30", "isdn"}, /* (*) maxine ISDN chip */ - { "XINE-FRC", "frc"}, /* (*) maxine free-running counter */ - { "PMAF-AA ", "fza"}, /* slow FDDI */ - { "T3PKT ", "tt"}, /* DECWRL turbochannel T3 */ - { "T1D4PKT ", "ds"}, /* DECWRL turbochannel T1 */ - { "FORE_ATM", "fa"}, /* Fore t??-100 ATM */ - { "LoFi ", "lofi"}, /* DEC audio board */ - { "AV01A-AA", "lofi"}, /* DEC audio board */ - { "AV01B-AA", "lofi"}, /* DEC audio board */ - { "", 0} /* list end */ -}; - -/* - * Identify an option on the TC. Looks at the mandatory - * info in the option's ROM and checks it. - */ -#ifdef DEBUG -int tc_verbose = 0; -#endif - -static int -tc_identify_option(addr, slot, complain) - tc_rommap_t *addr; - tc_option_t *slot; - int complain; -{ - register int i; - unsigned char width; - char firmwr[TC_ROM_LLEN+1], vendor[TC_ROM_LLEN+1], - module[TC_ROM_LLEN+1], host_type[TC_ROM_SLEN+1]; - - /* - * We do not really use the 'width' info, but take advantage - * of the restriction that the spec impose on the portion - * of the ROM that maps between +0x3e0 and +0x470, which - * is the only piece we need to look at. - */ - width = addr->rom_width.value; - switch (width) { - case 1: - case 2: - case 4: - break; - - default: -#ifdef DEBUG - if (tc_verbose && complain) - printf("%s (x%x) at x%x\n", "Invalid ROM width", - width, addr); -#endif - return (0); - } - - if (addr->rom_stride.value != 4) { -#ifdef DEBUG - if (tc_verbose && complain) - printf("%s (x%x) at x%x\n", "Invalid ROM stride", - addr->rom_stride.value, addr); -#endif - return (0); - } - - if ((addr->test_data[0] != 0x55) || - (addr->test_data[4] != 0x00) || - (addr->test_data[8] != 0xaa) || - (addr->test_data[12] != 0xff)) { -#ifdef DEBUG - if (tc_verbose && complain) - printf("%s x%x\n", "Test pattern failed, option at", - addr); -#endif - return (0); - } - - for (i = 0; i < TC_ROM_LLEN; i++) { - firmwr[i] = addr->firmware_rev[i].value; - vendor[i] = addr->vendor_name[i].value; - module[i] = addr->module_name[i].value; - if (i >= TC_ROM_SLEN) - continue; - host_type[i] = addr->host_firmware_type[i].value; - } - firmwr[TC_ROM_LLEN] = vendor[TC_ROM_LLEN] = - module[TC_ROM_LLEN] = host_type[TC_ROM_SLEN] = '\0'; - -#ifdef DEBUG - if (tc_verbose) - printf("%s %s '%s' at 0x%x\n %s %s %s '%s'\n %s %d %s %d %s\n", - "Found a", vendor, module, addr, - "Firmware rev.", firmwr, - "diagnostics for a", host_type, - "ROM size is", addr->rom_size.value << 3, - "Kbytes, uses", addr->slot_size.value, "TC slot(s)"); -#endif - - bcopy(module, slot->module_name, TC_ROM_LLEN); - bcopy(vendor, slot->module_id, TC_ROM_LLEN); - bcopy(firmwr, &slot->module_id[TC_ROM_LLEN], TC_ROM_LLEN); - slot->slot_size = addr->slot_size.value; - slot->rom_width = width; - - return (1); -} - -/* - * TURBOchannel autoconf procedure. Finds in one sweep what is - * hanging on the bus and fills in the tc_slot_info array. - * This is only the first part of the autoconf scheme, at this - * time we are basically only looking for a graphics board to - * use as system console (all workstations). - */ - -void -tc_find_all_options() -{ - register int i; - u_long addr; - int found; - register tc_option_t *sl; - struct drivers_map *map; - register struct mips_ctlr *cp; - register struct driver *drp; - - /* - * Take a look at the bus - */ - bzero(tc_slot_info, sizeof(tc_slot_info)); - for (i = tc_max_slot; i >= tc_min_slot;) { - addr = MACH_PHYS_TO_UNCACHED(tc_slot_phys_base[i]); - found = tc_probe_slot(addr, &tc_slot_info[i]); - - if (found) { - /* - * Found a slot, make a note of it - */ - tc_slot_info[i].present = 1; - tc_slot_info[i].k1seg_address = addr; - } - - i -= tc_slot_info[i].slot_size; - } - - /* - * Some slots (e.g. the system slot on 3max) might require - * hand-filling. If so, do it now. - */ - if (tc_slot_hand_fill) - (*tc_slot_hand_fill) (tc_slot_info); - - /* - * Now for each alive slot see if we have a device driver that - * handles it. This is done in "priority order", meaning that - * always present devices are at higher slot numbers on all - * current TC machines, and option slots are at lowest numbers. - */ - for (i = TC_MAX_LOGICAL_SLOTS - 1; i >= 0; i--) { - sl = &tc_slot_info[i]; - if (!sl->present) - continue; - found = FALSE; - for (map = tc_drivers_map; map->driver_name; map++) { - if (bcmp(sl->module_name, map->module_name, TC_ROM_LLEN)) - continue; - sl->driver_name = map->driver_name; - found = TRUE; - break; - } - if (!found) { - printf("%s %s %s\n", - "Cannot associate a device driver to", - sl->module_name, ". Will (try to) ignore it."); - sl->present = 0; - continue; - } - - /* - * Find the device driver entry and fill in the address. - */ - for (cp = mips_cinit; drp = cp->mips_driver; cp++) { - if (strcmp(drp->d_name, map->driver_name)) - continue; - if (cp->mips_alive) - continue; - if (cp->mips_addr == (char *)QUES) { - cp->mips_addr = (char *)sl->k1seg_address; - cp->mips_pri = i; - /* - * Only enable interrupts if there is an - * interrupt handler for it. (e.g., PMAG-BA - * can't disable the vertical retrace interrupt - * and we might want to ignore it). - */ - if (drp->d_intr) - (*tc_enable_interrupt)(i, 1); - cp->mips_alive = 1; - break; - } - if (cp->mips_addr != (char *)sl->k1seg_address) { - cp->mips_addr = (char *)QUES; - printf("%s: device not at configued address (expected at %x, found at %x)\n", - drp->d_name, - cp->mips_addr, sl->k1seg_address); - } - } - } -} - -/* - * Probe a slot in the TURBOchannel. Return TRUE if a valid option - * is present, FALSE otherwise. A side-effect is to fill the slot - * descriptor with the size of the option, whether it is - * recognized or not. - */ -int -tc_probe_slot(addr, slot) - caddr_t addr; - tc_option_t *slot; -{ - int i; - static unsigned tc_offset_rom[] = { - TC_OFF_PROTO_ROM, TC_OFF_ROM - }; -#define TC_N_OFFSETS sizeof(tc_offset_rom)/sizeof(unsigned) - - slot->slot_size = 1; - - for (i = 0; i < TC_N_OFFSETS; i++) { - if (badaddr(addr + tc_offset_rom[i], 4)) - continue; - /* complain only on last chance */ - if (tc_identify_option((tc_rommap_t *)(addr + tc_offset_rom[i]), - slot, i == (TC_N_OFFSETS-1))) - return (1); - } - return (0); -#undef TC_N_OFFSETS -} - -/* - * Enable/Disable interrupts for a TURBOchannel slot. - */ -void -kn02_enable_intr(slotno, on) - register int slotno; - int on; -{ - register volatile int *p_csr = - (volatile int *)MACH_PHYS_TO_UNCACHED(KN02_SYS_CSR); - int csr; - int s; - - slotno = 1 << (slotno + KN02_CSR_IOINTEN_SHIFT); - s = Mach_spl0(); - csr = *p_csr & ~(KN02_CSR_WRESERVED | 0xFF); - if (on) - *p_csr = csr | slotno; - else - *p_csr = csr & ~slotno; - splx(s); -} - -/* - * Object: - * kmin_enable_intr EXPORTED function - * - * Enable/Disable interrupts from a TURBOchannel slot. - * - * We pretend we actually have 8 slots even if we really have - * only 4: TCslots 0-2 maps to slots 0-2, TCslot3 maps to - * slots 3-7 (see kmin_slot_hand_fill). - */ -void -kmin_enable_intr(slotno, on) - register unsigned int slotno; - int on; -{ - register unsigned mask; - - switch (slotno) { - case 0: - case 1: - case 2: - return; - case KMIN_SCSI_SLOT: - mask = (KMIN_INTR_SCSI | KMIN_INTR_SCSI_PTR_LOAD | - KMIN_INTR_SCSI_OVRUN | KMIN_INTR_SCSI_READ_E); - break; - case KMIN_LANCE_SLOT: - mask = KMIN_INTR_LANCE; - break; - case KMIN_SCC0_SLOT: - mask = KMIN_INTR_SCC_0; - break; - case KMIN_SCC1_SLOT: - mask = KMIN_INTR_SCC_1; - break; - case KMIN_ASIC_SLOT: - mask = KMIN_INTR_ASIC; - break; - default: - return; - } - if (on) - kmin_tc3_imask |= mask; - else - kmin_tc3_imask &= ~mask; -} - -/* - * Object: - * xine_enable_intr EXPORTED function - * - * Enable/Disable interrupts from a TURBOchannel slot. - * - * We pretend we actually have 11 slots even if we really have - * only 3: TCslots 0-1 maps to slots 0-1, TCslot 2 is used for - * the system (TCslot3), TCslot3 maps to slots 3-10 - * (see xine_slot_hand_fill). - * Note that all these interrupts come in via the IMR. - */ -void -xine_enable_intr(slotno, on) - register unsigned int slotno; - int on; -{ - register unsigned mask; - - switch (slotno) { - case 0: /* a real slot, but */ - mask = XINE_INTR_TC_0; - break; - case 1: /* a real slot, but */ - mask = XINE_INTR_TC_1; - break; - case XINE_FLOPPY_SLOT: - mask = XINE_INTR_FLOPPY; - break; - case XINE_SCSI_SLOT: - mask = (XINE_INTR_SCSI | XINE_INTR_SCSI_PTR_LOAD | - XINE_INTR_SCSI_OVRUN | XINE_INTR_SCSI_READ_E); - break; - case XINE_LANCE_SLOT: - mask = XINE_INTR_LANCE; - break; - case XINE_SCC0_SLOT: - mask = XINE_INTR_SCC_0; - break; - case XINE_DTOP_SLOT: - mask = XINE_INTR_DTOP_RX; - break; - case XINE_ISDN_SLOT: - mask = XINE_INTR_ISDN; - break; - case XINE_ASIC_SLOT: - mask = XINE_INTR_ASIC; - break; - default: - return;/* ignore */ - } - if (on) - xine_tc3_imask |= mask; - else - xine_tc3_imask &= ~mask; -} - -#ifdef DS5000_240 -/* - * UNTESTED!! - * Object: - * kn03_enable_intr EXPORTED function - * - * Enable/Disable interrupts from a TURBOchannel slot. - * - * We pretend we actually have 8 slots even if we really have - * only 4: TCslots 0-2 maps to slots 0-2, TCslot3 maps to - * slots 3-7 (see kn03_slot_hand_fill). - */ -void -kn03_enable_intr(slotno, on) - register unsigned int slotno; - int on; -{ - register unsigned mask; - - switch (slotno) { - case 0: - mask = KN03_INTR_TC_0; - break; - case 1: - mask = KN03_INTR_TC_1; - break; - case 2: - mask = KN03_INTR_TC_2; - break; - case KN03_SCSI_SLOT: - mask = (KN03_INTR_SCSI | KN03_INTR_SCSI_PTR_LOAD | - KN03_INTR_SCSI_OVRUN | KN03_INTR_SCSI_READ_E); - break; - case KN03_LANCE_SLOT: - mask = KN03_INTR_LANCE; - break; - case KN03_SCC0_SLOT: - mask = KN03_INTR_SCC_0; - break; - case KN03_SCC1_SLOT: - mask = KN03_INTR_SCC_1; - break; - case KN03_ASIC_SLOT: - mask = KN03_INTR_ASIC; - break; - default: - return; - } - if (on) - kn03_tc3_imask |= mask; - else - kn03_tc3_imask &= ~mask; -} -#endif /* DS5000_240 */ - -/* - * Object: - * kn02_slot_hand_fill EXPORTED function - * - * Fill in by hand the info for TC slots that are non-standard. - * This is basically just the system slot on a 3max, it does not - * look to me like it follows the TC rules although some of the - * required info is indeed there. - * - */ -void -kn02_slot_hand_fill(slot) - tc_option_t *slot; -{ - slot[7].present = 1; - slot[7].slot_size = 1; - slot[7].rom_width = 1; -#if unsafe - bcopy(0xbffc0410, slot[7].module_name, TC_ROM_LLEN+1); -#endif - bcopy("KN02 ", slot[7].module_name, TC_ROM_LLEN+1); - bcopy("DEC xxxx", slot[7].module_id, TC_ROM_LLEN+1); - slot[7].k1seg_address = MACH_PHYS_TO_UNCACHED(KN02_SYS_DZ); -} - -/* - * Object: - * kmin_slot_hand_fill EXPORTED function - * - * Fill in by hand the info for TC slots that are non-standard. - * This is the system slot on a 3min, which we think of as a - * set of non-regular size TC slots. - * - */ -void -kmin_slot_hand_fill(slot) - tc_option_t *slot; -{ - register int i; - - for (i = KMIN_SCSI_SLOT; i < KMIN_ASIC_SLOT+1; i++) { - slot[i].present = 1; - slot[i].slot_size = 1; - slot[i].rom_width = 1; - slot[i].unit = 0; - bcopy("DEC KMIN", slot[i].module_id, TC_ROM_LLEN+1); - } - - /* scsi */ - bcopy("PMAZ-AA ", slot[KMIN_SCSI_SLOT].module_name, TC_ROM_LLEN+1); - slot[KMIN_SCSI_SLOT].k1seg_address = - MACH_PHYS_TO_UNCACHED(KMIN_SYS_SCSI); - - /* lance */ - bcopy("PMAD-AA ", slot[KMIN_LANCE_SLOT].module_name, TC_ROM_LLEN+1); - slot[KMIN_LANCE_SLOT].k1seg_address = 0; - - /* scc */ - bcopy("Z8530 ", slot[KMIN_SCC0_SLOT].module_name, TC_ROM_LLEN+1); - slot[KMIN_SCC0_SLOT].k1seg_address = - MACH_PHYS_TO_UNCACHED(KMIN_SYS_SCC_0); - - slot[KMIN_SCC1_SLOT].unit = 1; - bcopy("Z8530 ", slot[KMIN_SCC1_SLOT].module_name, TC_ROM_LLEN+1); - slot[KMIN_SCC1_SLOT].k1seg_address = - MACH_PHYS_TO_UNCACHED(KMIN_SYS_SCC_1); - - /* asic */ - bcopy("ASIC ", slot[KMIN_ASIC_SLOT].module_name, TC_ROM_LLEN+1); - slot[KMIN_ASIC_SLOT].k1seg_address = - MACH_PHYS_TO_UNCACHED(KMIN_SYS_ASIC); - asic_init(0); -} - -/* - * Object: - * xine_slot_hand_fill EXPORTED function - * - * Fill in by hand the info for TC slots that are non-standard. - * This is the system slot on a 3min, which we think of as a - * set of non-regular size TC slots. - * - */ -void -xine_slot_hand_fill(slot) - tc_option_t *slot; -{ - register int i; - - for (i = XINE_FLOPPY_SLOT; i < XINE_FRC_SLOT+1; i++) { - slot[i].present = 1; - slot[i].slot_size = 1; - slot[i].rom_width = 1; - slot[i].unit = 0; - bcopy("DEC XINE", slot[i].module_id, TC_ROM_LLEN+1); - } - - /* floppy */ - bcopy("XINE-FDC", slot[XINE_FLOPPY_SLOT].module_name, TC_ROM_LLEN+1); - slot[XINE_FLOPPY_SLOT].k1seg_address = - MACH_PHYS_TO_UNCACHED(XINE_SYS_FLOPPY); - - /* scsi */ - bcopy("PMAZ-AA ", slot[XINE_SCSI_SLOT].module_name, TC_ROM_LLEN+1); - slot[XINE_SCSI_SLOT].k1seg_address = - MACH_PHYS_TO_UNCACHED(XINE_SYS_SCSI); - - /* lance */ - bcopy("PMAD-AA ", slot[XINE_LANCE_SLOT].module_name, TC_ROM_LLEN+1); - slot[XINE_LANCE_SLOT].k1seg_address = - MACH_PHYS_TO_UNCACHED(XINE_SYS_LANCE); - - /* scc */ - bcopy("Z8530 ", slot[XINE_SCC0_SLOT].module_name, TC_ROM_LLEN+1); - slot[XINE_SCC0_SLOT].k1seg_address = - MACH_PHYS_TO_UNCACHED(XINE_SYS_SCC_0); - - /* Desktop */ - bcopy("DTOP ", slot[XINE_DTOP_SLOT].module_name, TC_ROM_LLEN+1); - slot[XINE_DTOP_SLOT].k1seg_address = - MACH_PHYS_TO_UNCACHED(XINE_SYS_DTOP+0x20000); /* why? */ - - /* ISDN */ - bcopy("AMD79c30", slot[XINE_ISDN_SLOT].module_name, TC_ROM_LLEN+1); - slot[XINE_ISDN_SLOT].k1seg_address = - MACH_PHYS_TO_UNCACHED(XINE_SYS_ISDN); - - /* Video */ - bcopy("PMAG-DV ", slot[XINE_CFB_SLOT].module_name, TC_ROM_LLEN+1); - slot[XINE_CFB_SLOT].k1seg_address = - MACH_PHYS_TO_CACHED(XINE_PHYS_CFB_START); - - /* asic */ - bcopy("ASIC ", slot[XINE_ASIC_SLOT].module_name, TC_ROM_LLEN+1); - slot[XINE_ASIC_SLOT].k1seg_address = - MACH_PHYS_TO_UNCACHED(XINE_SYS_ASIC); - - /* free-running counter (high resolution mapped time) */ - bcopy("XINE-FRC", slot[XINE_FRC_SLOT].module_name, TC_ROM_LLEN+1); - slot[XINE_FRC_SLOT].k1seg_address = - MACH_PHYS_TO_UNCACHED(XINE_REG_FCTR); - asic_init(1); -} - -#ifdef DS5000_240 -/* - * UNTESTED!! - * Object: - * kn03_slot_hand_fill EXPORTED function - * - * Fill in by hand the info for TC slots that are non-standard. - * This is the system slot on a 3max+, which we think of as a - * set of non-regular size TC slots. - * - */ -void -kn03_slot_hand_fill(slot) - tc_option_t *slot; -{ - register int i; - - for (i = KN03_SCSI_SLOT; i < KN03_ASIC_SLOT+1; i++) { - slot[i].present = 1; - slot[i].slot_size = 1; - slot[i].rom_width = 1; - slot[i].unit = 0; - bcopy("DEC KN03", slot[i].module_id, TC_ROM_LLEN+1); - } - - /* scsi */ - bcopy("PMAZ-AA ", slot[KN03_SCSI_SLOT].module_name, TC_ROM_LLEN+1); - slot[KN03_SCSI_SLOT].k1seg_address = - MACH_PHYS_TO_UNCACHED(KN03_SYS_SCSI); - - /* lance */ - bcopy("PMAD-AA ", slot[KN03_LANCE_SLOT].module_name, TC_ROM_LLEN+1); - slot[KN03_LANCE_SLOT].k1seg_address = 0; - - /* scc */ - bcopy("Z8530 ", slot[KN03_SCC0_SLOT].module_name, TC_ROM_LLEN+1); - slot[KN03_SCC0_SLOT].k1seg_address = - MACH_PHYS_TO_UNCACHED(KN03_SYS_SCC_0); - - slot[KN03_SCC1_SLOT].unit = 1; - bcopy("Z8530 ", slot[KN03_SCC1_SLOT].module_name, TC_ROM_LLEN+1); - slot[KN03_SCC1_SLOT].k1seg_address = - MACH_PHYS_TO_UNCACHED(KN03_SYS_SCC_1); - - /* asic */ - bcopy("ASIC ", slot[KN03_ASIC_SLOT].module_name, TC_ROM_LLEN+1); - slot[KN03_ASIC_SLOT].k1seg_address = - MACH_PHYS_TO_UNCACHED(KN03_SYS_ASIC); - asic_init(0); -} -#endif /* DS5000_240 */ - -/* - * Initialize the I/O asic - */ -static void -asic_init(isa_maxine) - int isa_maxine; -{ - volatile u_int *decoder; - - /* These are common between 3min and maxine */ - decoder = (volatile u_int *)ASIC_REG_LANCE_DECODE(asic_base); - *decoder = KMIN_LANCE_CONFIG; -} -#endif /* DS5000 */ diff --git a/sys/mips/pic32/pmap.c b/sys/mips/pic32/pmap.c index fb5f6fb4..9f5cc233 100644 --- a/sys/mips/pic32/pmap.c +++ b/sys/mips/pic32/pmap.c @@ -1,4 +1,4 @@ -/* +/* * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. * @@ -150,7 +150,7 @@ vm_offset_t avail_end; /* PA of last available physical page */ vm_size_t mem_size; /* memory size in bytes */ vm_offset_t virtual_avail; /* VA of first avail page (after kernel bss)*/ vm_offset_t virtual_end; /* VA of last avail page (end of kernel AS) */ -int pmaxpagesperpage; /* PAGE_SIZE / NBPG */ +int pagesperpage; /* PAGE_SIZE / NBPG */ #ifdef ATTR char *pmap_attributes; /* reference and modify bits */ #endif @@ -196,23 +196,23 @@ pmap_bootstrap(firstaddr) * phys_start and phys_end but its better to use kseg0 addresses * rather than kernel virtual addresses mapped through the TLB. */ - i = maxmem - pmax_btop(MACH_CACHED_TO_PHYS(firstaddr)); + i = maxmem - mips_btop(MACH_CACHED_TO_PHYS(firstaddr)); valloc(pv_table, struct pv_entry, i); /* * Clear allocated memory. */ - firstaddr = pmax_round_page(firstaddr); + firstaddr = mips_round_page(firstaddr); bzero((caddr_t)start, firstaddr - start); avail_start = MACH_CACHED_TO_PHYS(firstaddr); - avail_end = pmax_ptob(maxmem); + avail_end = mips_ptob(maxmem); mem_size = avail_end - avail_start; virtual_avail = VM_MIN_KERNEL_ADDRESS; virtual_end = VM_MIN_KERNEL_ADDRESS + Sysmapsize * NBPG; /* XXX need to decide how to set cnt.v_page_size */ - pmaxpagesperpage = 1; + pagesperpage = 1; simple_lock_init(&kernel_pmap_store.pm_lock); kernel_pmap_store.pm_count = 1; @@ -335,7 +335,7 @@ pmap_pinit(pmap) pmap_zero_page(VM_PAGE_TO_PHYS(mem)); pmap->pm_segtab = stp = (struct segtab *) MACH_PHYS_TO_CACHED(VM_PAGE_TO_PHYS(mem)); - i = pmaxpagesperpage * (NBPG / sizeof(struct segtab)); + i = pagesperpage * (NBPG / sizeof(struct segtab)); s = splimp(); while (--i != 0) { stp++; @@ -515,7 +515,7 @@ pmap_remove(pmap, sva, eva) panic("pmap_remove: uva not in range"); #endif while (sva < eva) { - nssva = pmax_trunc_seg(sva) + NBSEG; + nssva = mips_trunc_seg(sva) + NBSEG; if (nssva == 0 || nssva > eva) nssva = eva; /* @@ -683,7 +683,7 @@ pmap_protect(pmap, sva, eva, prot) panic("pmap_protect: uva not in range"); #endif while (sva < eva) { - nssva = pmax_trunc_seg(sva) + NBSEG; + nssva = mips_trunc_seg(sva) + NBSEG; if (nssva == 0 || nssva > eva) nssva = eva; /* @@ -897,10 +897,10 @@ pmap_enter(pmap, va, pa, prot, wired) pte = kvtopte(va); npte |= pa | PG_V | PG_G; if (wired) { - pmap->pm_stats.wired_count += pmaxpagesperpage; + pmap->pm_stats.wired_count += pagesperpage; npte |= PG_WIRED; } - i = pmaxpagesperpage; + i = pagesperpage; do { if (!(pte->pt_entry & PG_V)) { pmap->pm_stats.resident_count++; @@ -933,11 +933,11 @@ pmap_enter(pmap, va, pa, prot, wired) /* * Now validate mapping with desired protection/wiring. * Assume uniform modified and referenced status for all - * PMAX pages in a MACH page. + * MIPS pages in a MACH page. */ npte |= pa | PG_V; if (wired) { - pmap->pm_stats.wired_count += pmaxpagesperpage; + pmap->pm_stats.wired_count += pagesperpage; npte |= PG_WIRED; } #ifdef DEBUG @@ -948,7 +948,7 @@ pmap_enter(pmap, va, pa, prot, wired) printf("\n"); } #endif - i = pmaxpagesperpage; + i = pagesperpage; do { pte->pt_entry = npte; if (pmap->pm_tlbgen == tlbpid_gen) @@ -1002,7 +1002,7 @@ pmap_change_wiring(pmap, va, wired) pte += (va >> PGSHIFT) & (NPTEPG - 1); } - i = pmaxpagesperpage; + i = pagesperpage; if (!(pte->pt_entry & PG_WIRED) && p) pmap->pm_stats.wired_count += i; else if ((pte->pt_entry & PG_WIRED) && !p) @@ -1285,7 +1285,7 @@ pmap_phys_address(ppn) if (pmapdebug & PDB_FOLLOW) printf("pmap_phys_address(%x)\n", ppn); #endif - return (pmax_ptob(ppn)); + return (mips_ptob(ppn)); } /* diff --git a/sys/mips/pic32/trap.c b/sys/mips/pic32/trap.c index 80f803a8..be4bd579 100644 --- a/sys/mips/pic32/trap.c +++ b/sys/mips/pic32/trap.c @@ -64,17 +64,6 @@ #include #include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - struct proc *machFPCurProcPtr; /* pointer to last proc to use FP */ extern void MachKernGenException(); @@ -159,19 +148,6 @@ struct trapdebug { /* trap history buffer for debugging */ u_int intr_level; /* number of nested interrupts */ #endif -static void pmax_errintr(); -static void kn02_errintr(), kn02ba_errintr(); -#ifdef DS5000_240 -static void kn03_errintr(); -#endif -static unsigned kn02ba_recover_erradr(); -extern tc_option_t tc_slot_info[TC_MAX_LOGICAL_SLOTS]; -extern u_long kmin_tc3_imask, xine_tc3_imask; -extern const struct callback *callv; -#ifdef DS5000_240 -extern u_long kn03_tc3_imask; -#endif -int (*pmax_hardware_intr)() = (int (*)())0; extern volatile struct chiptime *Mach_clock_addr; extern long intrcnt[]; @@ -582,10 +558,6 @@ trap(statusReg, causeReg, vadr, pc, args) printf("trap: %s (%d) breakpoint %x at %x: (adr %x ins %x)\n", p->p_comm, p->p_pid, instr, pc, p->p_md.md_ss_addr, p->p_md.md_ss_instr); /* XXX */ -#endif -#ifdef KADB - if (instr == MACH_BREAK_BRKPT || instr == MACH_BREAK_SSTEP) - goto err; #endif if (p->p_md.md_ss_addr != va || instr != MACH_BREAK_SSTEP) { i = SIGTRAP; @@ -647,45 +619,8 @@ trap(statusReg, causeReg, vadr, pc, args) default: err: -#ifdef KADB - { - extern struct pcb kdbpcb; - - if (USERMODE(statusReg)) - kdbpcb = p->p_addr->u_pcb; - else { - kdbpcb.pcb_regs[ZERO] = 0; - kdbpcb.pcb_regs[AST] = ((int *)&args)[2]; - kdbpcb.pcb_regs[V0] = ((int *)&args)[3]; - kdbpcb.pcb_regs[V1] = ((int *)&args)[4]; - kdbpcb.pcb_regs[A0] = ((int *)&args)[5]; - kdbpcb.pcb_regs[A1] = ((int *)&args)[6]; - kdbpcb.pcb_regs[A2] = ((int *)&args)[7]; - kdbpcb.pcb_regs[A3] = ((int *)&args)[8]; - kdbpcb.pcb_regs[T0] = ((int *)&args)[9]; - kdbpcb.pcb_regs[T1] = ((int *)&args)[10]; - kdbpcb.pcb_regs[T2] = ((int *)&args)[11]; - kdbpcb.pcb_regs[T3] = ((int *)&args)[12]; - kdbpcb.pcb_regs[T4] = ((int *)&args)[13]; - kdbpcb.pcb_regs[T5] = ((int *)&args)[14]; - kdbpcb.pcb_regs[T6] = ((int *)&args)[15]; - kdbpcb.pcb_regs[T7] = ((int *)&args)[16]; - kdbpcb.pcb_regs[T8] = ((int *)&args)[17]; - kdbpcb.pcb_regs[T9] = ((int *)&args)[18]; - kdbpcb.pcb_regs[RA] = ((int *)&args)[19]; - kdbpcb.pcb_regs[MULLO] = ((int *)&args)[21]; - kdbpcb.pcb_regs[MULHI] = ((int *)&args)[22]; - kdbpcb.pcb_regs[PC] = pc; - kdbpcb.pcb_regs[SR] = statusReg; - bzero((caddr_t)&kdbpcb.pcb_regs[F0], 33 * sizeof(int)); - } - if (kdb(causeReg, vadr, p, !USERMODE(statusReg))) - return (kdbpcb.pcb_regs[PC]); - } -#else #ifdef DEBUG trapDump("trap"); -#endif #endif panic("trap"); } @@ -760,8 +695,8 @@ interrupt(statusReg, causeReg, pc) cnt.v_intr++; mask = causeReg & statusReg; /* pending interrupts & enable mask */ - if (pmax_hardware_intr) - splx((*pmax_hardware_intr)(mask, pc, statusReg, causeReg)); + splx(pic32_intr(mask, pc, statusReg, causeReg)); + if (mask & MACH_INT_MASK_5) { intrcnt[7]++; if (!USERMODE(statusReg)) { @@ -815,24 +750,27 @@ interrupt(statusReg, causeReg, pc) } /* - * Handle pmax (DECstation 2100/3100) interrupts. + * Handle pic32 interrupts. */ -pmax_intr(mask, pc, statusReg, causeReg) +pic32_intr(mask, pc, statusReg, causeReg) unsigned mask; unsigned pc; unsigned statusReg; unsigned causeReg; { - register volatile struct chiptime *c = Mach_clock_addr; struct clockframe cf; int temp; /* handle clock interrupts ASAP */ if (mask & MACH_INT_MASK_3) { intrcnt[6]++; +#if 0 + // TODO + register volatile struct chiptime *c = Mach_clock_addr; temp = c->regc; /* XXX clear interrupt bits */ cf.pc = pc; cf.sr = statusReg; +#endif hardclock(&cf); /* keep clock interrupts enabled */ causeReg &= ~MACH_INT_MASK_3; @@ -857,383 +795,10 @@ pmax_intr(mask, pc, statusReg, causeReg) dcintr(0); } #endif - if (mask & MACH_INT_MASK_4) { - intrcnt[5]++; - pmax_errintr(); - } return ((statusReg & ~causeReg & MACH_HARD_INT_MASK) | MACH_SR_INT_ENA_CUR); } -/* - * Handle hardware interrupts for the KN02. (DECstation 5000/200) - * Returns spl value. - */ -kn02_intr(mask, pc, statusReg, causeReg) - unsigned mask; - unsigned pc; - unsigned statusReg; - unsigned causeReg; -{ - register unsigned i, m; - register volatile struct chiptime *c = Mach_clock_addr; - register unsigned csr; - int temp; - struct clockframe cf; - static int warned = 0; - - /* handle clock interrupts ASAP */ - if (mask & MACH_INT_MASK_1) { - csr = *(unsigned *)MACH_PHYS_TO_UNCACHED(KN02_SYS_CSR); - if ((csr & KN02_CSR_PSWARN) && !warned) { - warned = 1; - printf("WARNING: power supply is overheating!\n"); - } else if (warned && !(csr & KN02_CSR_PSWARN)) { - warned = 0; - printf("WARNING: power supply is OK again\n"); - } - intrcnt[6]++; - - temp = c->regc; /* XXX clear interrupt bits */ - cf.pc = pc; - cf.sr = statusReg; - hardclock(&cf); - - /* keep clock interrupts enabled */ - causeReg &= ~MACH_INT_MASK_1; - } - /* Re-enable clock interrupts */ - splx(MACH_INT_MASK_1 | MACH_SR_INT_ENA_CUR); - if (mask & MACH_INT_MASK_0) { - static int map[8] = { 8, 8, 8, 8, 8, 4, 3, 2 }; - - csr = *(unsigned *)MACH_PHYS_TO_UNCACHED(KN02_SYS_CSR); - m = csr & (csr >> KN02_CSR_IOINTEN_SHIFT) & KN02_CSR_IOINT; -#if 0 - *(unsigned *)MACHPHYS_TO_UNCACHED(KN02_SYS_CSR) = - (csr & ~(KN02_CSR_WRESERVED | 0xFF)) | - (m << KN02_CSR_IOINTEN_SHIFT); -#endif - for (i = 0; m; i++, m >>= 1) { - if (!(m & 1)) - continue; - intrcnt[map[i]]++; - if (tc_slot_info[i].intr) - (*tc_slot_info[i].intr)(tc_slot_info[i].unit); - else - printf("spurious interrupt %d\n", i); - } -#if 0 - *(unsigned *)MACH_PHYS_TO_UNCACHED(KN02_SYS_CSR) = - csr & ~(KN02_CSR_WRESERVED | 0xFF); -#endif - } - if (mask & MACH_INT_MASK_3) { - intrcnt[5]++; - kn02_errintr(); - } - return ((statusReg & ~causeReg & MACH_HARD_INT_MASK) | - MACH_SR_INT_ENA_CUR); -} - -/* - * 3min hardware interrupts. (DECstation 5000/1xx) - */ -kmin_intr(mask, pc, statusReg, causeReg) - unsigned mask; - unsigned pc; - unsigned statusReg; - unsigned causeReg; -{ - register u_int intr; - register volatile struct chiptime *c = Mach_clock_addr; - volatile u_int *imaskp = - (volatile u_int *)MACH_PHYS_TO_UNCACHED(KMIN_REG_IMSK); - volatile u_int *intrp = - (volatile u_int *)MACH_PHYS_TO_UNCACHED(KMIN_REG_INTR); - unsigned int old_mask; - struct clockframe cf; - int temp; - static int user_warned = 0; - - old_mask = *imaskp & kmin_tc3_imask; - *imaskp = old_mask; - - if (mask & MACH_INT_MASK_4) - (*callv->halt)((int *)0, 0); - if (mask & MACH_INT_MASK_3) { - intr = *intrp; - /* masked interrupts are still observable */ - intr &= old_mask; - - if (intr & KMIN_INTR_SCSI_PTR_LOAD) { - *intrp &= ~KMIN_INTR_SCSI_PTR_LOAD; -#ifdef notdef - asc_dma_intr(); -#endif - } - - if (intr & (KMIN_INTR_SCSI_OVRUN | KMIN_INTR_SCSI_READ_E)) - *intrp &= ~(KMIN_INTR_SCSI_OVRUN | KMIN_INTR_SCSI_READ_E); - - if (intr & KMIN_INTR_LANCE_READ_E) - *intrp &= ~KMIN_INTR_LANCE_READ_E; - - if (intr & KMIN_INTR_TIMEOUT) - kn02ba_errintr(); - - if (intr & KMIN_INTR_CLOCK) { - temp = c->regc; /* XXX clear interrupt bits */ - cf.pc = pc; - cf.sr = statusReg; - hardclock(&cf); - } - - if ((intr & KMIN_INTR_SCC_0) && - tc_slot_info[KMIN_SCC0_SLOT].intr) - (*(tc_slot_info[KMIN_SCC0_SLOT].intr)) - (tc_slot_info[KMIN_SCC0_SLOT].unit); - - if ((intr & KMIN_INTR_SCC_1) && - tc_slot_info[KMIN_SCC1_SLOT].intr) - (*(tc_slot_info[KMIN_SCC1_SLOT].intr)) - (tc_slot_info[KMIN_SCC1_SLOT].unit); - - if ((intr & KMIN_INTR_SCSI) && - tc_slot_info[KMIN_SCSI_SLOT].intr) - (*(tc_slot_info[KMIN_SCSI_SLOT].intr)) - (tc_slot_info[KMIN_SCSI_SLOT].unit); - - if ((intr & KMIN_INTR_LANCE) && - tc_slot_info[KMIN_LANCE_SLOT].intr) - (*(tc_slot_info[KMIN_LANCE_SLOT].intr)) - (tc_slot_info[KMIN_LANCE_SLOT].unit); - - if (user_warned && ((intr & KMIN_INTR_PSWARN) == 0)) { - printf("%s\n", "Power supply ok now."); - user_warned = 0; - } - if ((intr & KMIN_INTR_PSWARN) && (user_warned < 3)) { - user_warned++; - printf("%s\n", "Power supply overheating"); - } - } - if ((mask & MACH_INT_MASK_0) && tc_slot_info[0].intr) - (*tc_slot_info[0].intr)(tc_slot_info[0].unit); - if ((mask & MACH_INT_MASK_1) && tc_slot_info[1].intr) - (*tc_slot_info[1].intr)(tc_slot_info[1].unit); - if ((mask & MACH_INT_MASK_2) && tc_slot_info[2].intr) - (*tc_slot_info[2].intr)(tc_slot_info[2].unit); - return ((statusReg & ~causeReg & MACH_HARD_INT_MASK) | - MACH_SR_INT_ENA_CUR); -} - -/* - * Maxine hardware interrupts. (Personal DECstation 5000/xx) - */ -xine_intr(mask, pc, statusReg, causeReg) - unsigned mask; - unsigned pc; - unsigned statusReg; - unsigned causeReg; -{ - register u_int intr; - register volatile struct chiptime *c = Mach_clock_addr; - volatile u_int *imaskp = (volatile u_int *) - MACH_PHYS_TO_UNCACHED(XINE_REG_IMSK); - volatile u_int *intrp = (volatile u_int *) - MACH_PHYS_TO_UNCACHED(XINE_REG_INTR); - u_int old_mask; - struct clockframe cf; - int temp; - - old_mask = *imaskp & xine_tc3_imask; - *imaskp = old_mask; - - if (mask & MACH_INT_MASK_4) - (*callv->halt)((int *)0, 0); - - /* handle clock interrupts ASAP */ - if (mask & MACH_INT_MASK_1) { - temp = c->regc; /* XXX clear interrupt bits */ - cf.pc = pc; - cf.sr = statusReg; - hardclock(&cf); - causeReg &= ~MACH_INT_MASK_1; - /* reenable clock interrupts */ - splx(MACH_INT_MASK_1 | MACH_SR_INT_ENA_CUR); - } - if (mask & MACH_INT_MASK_3) { - intr = *intrp; - /* masked interrupts are still observable */ - intr &= old_mask; - - if (intr & XINE_INTR_SCSI_PTR_LOAD) { - *intrp &= ~XINE_INTR_SCSI_PTR_LOAD; -#ifdef notdef - asc_dma_intr(); -#endif - } - - if (intr & (XINE_INTR_SCSI_OVRUN | XINE_INTR_SCSI_READ_E)) - *intrp &= ~(XINE_INTR_SCSI_OVRUN | XINE_INTR_SCSI_READ_E); - - if (intr & XINE_INTR_LANCE_READ_E) - *intrp &= ~XINE_INTR_LANCE_READ_E; - - if ((intr & XINE_INTR_SCC_0) && - tc_slot_info[XINE_SCC0_SLOT].intr) - (*(tc_slot_info[XINE_SCC0_SLOT].intr)) - (tc_slot_info[XINE_SCC0_SLOT].unit); - - if ((intr & XINE_INTR_DTOP_RX) && - tc_slot_info[XINE_DTOP_SLOT].intr) - (*(tc_slot_info[XINE_DTOP_SLOT].intr)) - (tc_slot_info[XINE_DTOP_SLOT].unit); - - if ((intr & XINE_INTR_FLOPPY) && - tc_slot_info[XINE_FLOPPY_SLOT].intr) - (*(tc_slot_info[XINE_FLOPPY_SLOT].intr)) - (tc_slot_info[XINE_FLOPPY_SLOT].unit); - - if ((intr & XINE_INTR_TC_0) && - tc_slot_info[0].intr) - (*(tc_slot_info[0].intr)) - (tc_slot_info[0].unit); - - if ((intr & XINE_INTR_TC_1) && - tc_slot_info[1].intr) - (*(tc_slot_info[1].intr)) - (tc_slot_info[1].unit); - - if ((intr & XINE_INTR_ISDN) && - tc_slot_info[XINE_ISDN_SLOT].intr) - (*(tc_slot_info[XINE_ISDN_SLOT].intr)) - (tc_slot_info[XINE_ISDN_SLOT].unit); - - if ((intr & XINE_INTR_SCSI) && - tc_slot_info[XINE_SCSI_SLOT].intr) - (*(tc_slot_info[XINE_SCSI_SLOT].intr)) - (tc_slot_info[XINE_SCSI_SLOT].unit); - - if ((intr & XINE_INTR_LANCE) && - tc_slot_info[XINE_LANCE_SLOT].intr) - (*(tc_slot_info[XINE_LANCE_SLOT].intr)) - (tc_slot_info[XINE_LANCE_SLOT].unit); - - } - if (mask & MACH_INT_MASK_2) - kn02ba_errintr(); - return ((statusReg & ~causeReg & MACH_HARD_INT_MASK) | - MACH_SR_INT_ENA_CUR); -} - -#ifdef DS5000_240 -/* - * 3Max+ hardware interrupts. (DECstation 5000/240) UNTESTED!! - */ -kn03_intr(mask, pc, statusReg, causeReg) - unsigned mask; - unsigned pc; - unsigned statusReg; - unsigned causeReg; -{ - register u_int intr; - register volatile struct chiptime *c = Mach_clock_addr; - volatile u_int *imaskp = (volatile u_int *) - MACH_PHYS_TO_UNCACHED(KN03_REG_IMSK); - volatile u_int *intrp = (volatile u_int *) - MACH_PHYS_TO_UNCACHED(KN03_REG_INTR); - u_int old_mask; - struct clockframe cf; - int temp; - static int user_warned = 0; - - old_mask = *imaskp & kn03_tc3_imask; - *imaskp = old_mask; - - if (mask & MACH_INT_MASK_4) - (*callv->halt)((int *)0, 0); - - /* handle clock interrupts ASAP */ - if (mask & MACH_INT_MASK_1) { - temp = c->regc; /* XXX clear interrupt bits */ - cf.pc = pc; - cf.sr = statusReg; - hardclock(&cf); - causeReg &= ~MACH_INT_MASK_1; - /* reenable clock interrupts */ - splx(MACH_INT_MASK_1 | MACH_SR_INT_ENA_CUR); - } - if (mask & MACH_INT_MASK_0) { - intr = *intrp; - /* masked interrupts are still observable */ - intr &= old_mask; - - if (intr & KN03_INTR_SCSI_PTR_LOAD) { - *intrp &= ~KN03_INTR_SCSI_PTR_LOAD; -#ifdef notdef - asc_dma_intr(); -#endif - } - - if (intr & (KN03_INTR_SCSI_OVRUN | KN03_INTR_SCSI_READ_E)) - *intrp &= ~(KN03_INTR_SCSI_OVRUN | KN03_INTR_SCSI_READ_E); - - if (intr & KN03_INTR_LANCE_READ_E) - *intrp &= ~KN03_INTR_LANCE_READ_E; - - if ((intr & KN03_INTR_SCC_0) && - tc_slot_info[KN03_SCC0_SLOT].intr) - (*(tc_slot_info[KN03_SCC0_SLOT].intr)) - (tc_slot_info[KN03_SCC0_SLOT].unit); - - if ((intr & KN03_INTR_SCC_1) && - tc_slot_info[KN03_SCC1_SLOT].intr) - (*(tc_slot_info[KN03_SCC1_SLOT].intr)) - (tc_slot_info[KN03_SCC1_SLOT].unit); - - if ((intr & KN03_INTR_TC_0) && - tc_slot_info[0].intr) - (*(tc_slot_info[0].intr)) - (tc_slot_info[0].unit); - - if ((intr & KN03_INTR_TC_1) && - tc_slot_info[1].intr) - (*(tc_slot_info[1].intr)) - (tc_slot_info[1].unit); - - if ((intr & KN03_INTR_TC_2) && - tc_slot_info[2].intr) - (*(tc_slot_info[2].intr)) - (tc_slot_info[2].unit); - - if ((intr & KN03_INTR_SCSI) && - tc_slot_info[KN03_SCSI_SLOT].intr) - (*(tc_slot_info[KN03_SCSI_SLOT].intr)) - (tc_slot_info[KN03_SCSI_SLOT].unit); - - if ((intr & KN03_INTR_LANCE) && - tc_slot_info[KN03_LANCE_SLOT].intr) - (*(tc_slot_info[KN03_LANCE_SLOT].intr)) - (tc_slot_info[KN03_LANCE_SLOT].unit); - - if (user_warned && ((intr & KN03_INTR_PSWARN) == 0)) { - printf("%s\n", "Power supply ok now."); - user_warned = 0; - } - if ((intr & KN03_INTR_PSWARN) && (user_warned < 3)) { - user_warned++; - printf("%s\n", "Power supply overheating"); - } - } - if (mask & MACH_INT_MASK_3) - kn03_errintr(); - return ((statusReg & ~causeReg & MACH_HARD_INT_MASK) | - MACH_SR_INT_ENA_CUR); -} -#endif /* DS5000_240 */ - /* * This is called from MachUserIntr() if astpending is set. * This is very similar to the tail of trap(). @@ -1305,134 +870,6 @@ trapDump(msg) } #endif -/* - *---------------------------------------------------------------------- - * - * MemErrorInterrupts -- - * pmax_errintr - for the DS2100/DS3100 - * kn02_errintr - for the DS5000/200 - * kn02ba_errintr - for the DS5000/1xx and DS5000/xx - * - * Handler an interrupt for the control register. - * - * Results: - * None. - * - * Side effects: - * None. - * - *---------------------------------------------------------------------- - */ -static void -pmax_errintr() -{ - volatile u_short *sysCSRPtr = - (u_short *)MACH_PHYS_TO_UNCACHED(KN01_SYS_CSR); - u_short csr; - - csr = *sysCSRPtr; - - if (csr & KN01_CSR_MERR) { - printf("Memory error at 0x%x\n", - *(unsigned *)MACH_PHYS_TO_UNCACHED(KN01_SYS_ERRADR)); - panic("Mem error interrupt"); - } - *sysCSRPtr = (csr & ~KN01_CSR_MBZ) | 0xff; -} - -static void -kn02_errintr() -{ - u_int erradr, chksyn, physadr; - int i; - - erradr = *(u_int *)MACH_PHYS_TO_UNCACHED(KN02_SYS_ERRADR); - chksyn = *(u_int *)MACH_PHYS_TO_UNCACHED(KN02_SYS_CHKSYN); - *(u_int *)MACH_PHYS_TO_UNCACHED(KN02_SYS_ERRADR) = 0; - MachEmptyWriteBuffer(); - - if (!(erradr & KN02_ERR_VALID)) - return; - /* extract the physical word address and compensate for pipelining */ - physadr = erradr & KN02_ERR_ADDRESS; - if (!(erradr & KN02_ERR_WRITE)) - physadr = (physadr & ~0xfff) | ((physadr & 0xfff) - 5); - physadr <<= 2; - printf("%s memory %s %s error at 0x%x\n", - (erradr & KN02_ERR_CPU) ? "CPU" : "DMA", - (erradr & KN02_ERR_WRITE) ? "write" : "read", - (erradr & KN02_ERR_ECCERR) ? "ECC" : "timeout", - physadr); - if (erradr & KN02_ERR_ECCERR) { - *(u_int *)MACH_PHYS_TO_UNCACHED(KN02_SYS_CHKSYN) = 0; - MachEmptyWriteBuffer(); - printf("ECC 0x%x\n", chksyn); - - /* check for a corrected, single bit, read error */ - if (!(erradr & KN02_ERR_WRITE)) { - if (physadr & 0x4) { - /* check high word */ - if (chksyn & KN02_ECC_SNGHI) - return; - } else { - /* check low word */ - if (chksyn & KN02_ECC_SNGLO) - return; - } - } - } - panic("Mem error interrupt"); -} - -#ifdef DS5000_240 -static void -kn03_errintr() -{ - - printf("erradr %x\n", *(unsigned *)MACH_PHYS_TO_UNCACHED(KN03_SYS_ERRADR)); - *(unsigned *)MACH_PHYS_TO_UNCACHED(KN03_SYS_ERRADR) = 0; - MachEmptyWriteBuffer(); -} -#endif /* DS5000_240 */ - -static void -kn02ba_errintr() -{ - register int mer, adr, siz; - static int errintr_cnt = 0; - - siz = *(volatile int *)MACH_PHYS_TO_UNCACHED(KMIN_REG_MSR); - mer = *(volatile int *)MACH_PHYS_TO_UNCACHED(KMIN_REG_MER); - adr = *(volatile int *)MACH_PHYS_TO_UNCACHED(KMIN_REG_AER); - - /* clear interrupt bit */ - *(unsigned int *)MACH_PHYS_TO_UNCACHED(KMIN_REG_TIMEOUT) = 0; - - errintr_cnt++; - printf("(%d)%s%x [%x %x %x]\n", errintr_cnt, - "Bad memory chip at phys ", - kn02ba_recover_erradr(adr, mer), - mer, siz, adr); -} - -static unsigned -kn02ba_recover_erradr(phys, mer) - register unsigned phys, mer; -{ - /* phys holds bits 28:2, mer knows which byte */ - switch (mer & KMIN_MER_LASTBYTE) { - case KMIN_LASTB31: - mer = 3; break; - case KMIN_LASTB23: - mer = 2; break; - case KMIN_LASTB15: - mer = 1; break; - case KMIN_LASTB07: - mer = 0; break; - } - return ((phys & KMIN_AER_ADDR_MASK) | mer); -} - /* * Return the resulting PC as if the branch was executed. */ diff --git a/sys/mips/pmax/machdep.c b/sys/mips/pmax/machdep.c index f3a96797..5473cca1 100644 --- a/sys/mips/pmax/machdep.c +++ b/sys/mips/pmax/machdep.c @@ -220,7 +220,7 @@ mach_init(argc, argv, code, cv) extern char MachException[], MachExceptionEnd[]; /* clear the BSS segment */ - v = (caddr_t)pmax_round_page(end); + v = (caddr_t)mips_round_page(end); bzero(edata, v - edata); /* check for direct boot from DS5000 PROM */ diff --git a/sys/mips/pmax/pmap.c b/sys/mips/pmax/pmap.c index fb5f6fb4..9e8c59be 100644 --- a/sys/mips/pmax/pmap.c +++ b/sys/mips/pmax/pmap.c @@ -1,4 +1,4 @@ -/* +/* * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. * @@ -196,17 +196,17 @@ pmap_bootstrap(firstaddr) * phys_start and phys_end but its better to use kseg0 addresses * rather than kernel virtual addresses mapped through the TLB. */ - i = maxmem - pmax_btop(MACH_CACHED_TO_PHYS(firstaddr)); + i = maxmem - mips_btop(MACH_CACHED_TO_PHYS(firstaddr)); valloc(pv_table, struct pv_entry, i); /* * Clear allocated memory. */ - firstaddr = pmax_round_page(firstaddr); + firstaddr = mips_round_page(firstaddr); bzero((caddr_t)start, firstaddr - start); avail_start = MACH_CACHED_TO_PHYS(firstaddr); - avail_end = pmax_ptob(maxmem); + avail_end = mips_ptob(maxmem); mem_size = avail_end - avail_start; virtual_avail = VM_MIN_KERNEL_ADDRESS; @@ -515,7 +515,7 @@ pmap_remove(pmap, sva, eva) panic("pmap_remove: uva not in range"); #endif while (sva < eva) { - nssva = pmax_trunc_seg(sva) + NBSEG; + nssva = mips_trunc_seg(sva) + NBSEG; if (nssva == 0 || nssva > eva) nssva = eva; /* @@ -683,7 +683,7 @@ pmap_protect(pmap, sva, eva, prot) panic("pmap_protect: uva not in range"); #endif while (sva < eva) { - nssva = pmax_trunc_seg(sva) + NBSEG; + nssva = mips_trunc_seg(sva) + NBSEG; if (nssva == 0 || nssva > eva) nssva = eva; /* @@ -1285,7 +1285,7 @@ pmap_phys_address(ppn) if (pmapdebug & PDB_FOLLOW) printf("pmap_phys_address(%x)\n", ppn); #endif - return (pmax_ptob(ppn)); + return (mips_ptob(ppn)); } /*