diff options
48 files changed, 1527 insertions, 760 deletions
diff --git a/sys/conf/Makefile.pc98 b/sys/conf/Makefile.pc98 index 10f5742..03e5ac7 100644 --- a/sys/conf/Makefile.pc98 +++ b/sys/conf/Makefile.pc98 @@ -3,7 +3,7 @@ # Makefile.i386 -- with config changes. # Copyright 1990 W. Jolitz # from: @(#)Makefile.i386 7.1 5/10/91 -# $Id: Makefile.pc98,v 1.4 1996/09/03 10:23:11 asami Exp $ +# $Id: Makefile.pc98,v 1.5 1996/09/07 02:13:25 asami Exp $ # # Makefile for FreeBSD # @@ -40,8 +40,7 @@ CWARNFLAGS?= -W -Wreturn-type -Wcomment -Wredundant-decls -Wimplicit \ # of material assistance. # COPTFLAGS?=-O -# Not ready for -I- yet. #include "foo.h" where foo.h is in the srcdir fails. -INCLUDES= -nostdinc -I. -I$S -I$S/sys +INCLUDES= -nostdinc -I- -I. -I$S # This hack is to allow kernel compiles to succeed on machines w/out srcdist .if exists($S/../include) INCLUDES+= -I$S/../include diff --git a/sys/conf/options.pc98 b/sys/conf/options.pc98 index 98c7223..9a589f3 100644 --- a/sys/conf/options.pc98 +++ b/sys/conf/options.pc98 @@ -1,4 +1,4 @@ -# $Id: options.pc98,v 1.3 1996/09/10 09:37:14 asami Exp $ +# $Id: options.pc98,v 1.4 1996/09/12 11:09:21 asami Exp $ BOUNCEPAGES opt_bounce.h USER_LDT MATH_EMULATE opt_math_emulate.h @@ -23,11 +23,15 @@ PCVT_FREEBSD opt_pcvt.h PCVT_SCANSET opt_pcvt.h XSERVER opt_pcvt.h +AHC_TAGENABLE opt_aic7xxx.h +AHC_SCBPAGING_ENABLE opt_aic7xxx.h + CLK_CALIBRATION_LOOP opt_clock.h CLK_USE_I8254_CALIBRATION opt_clock.h CLK_USE_I586_CALIBRATION opt_clock.h SC_KBD_PROBE_WORKS opt_syscons.h +SC_SPLASH_SCREEN opt_syscons.h MAXCONS opt_syscons.h SLOW_VGA opt_syscons.h XT_KEYBOARD opt_syscons.h @@ -37,3 +41,4 @@ ATAPI_STATIC opt_atapi.h USERCONFIG opt_userconfig.h VISUAL_USERCONFIG opt_userconfig.h +USERCONFIG_BOOT opt_userconfig.h diff --git a/sys/i386/isa/sound/sb.h b/sys/i386/isa/sound/sb.h index bb8ae12..e21c7c8 100644 --- a/sys/i386/isa/sound/sb.h +++ b/sys/i386/isa/sound/sb.h @@ -1,3 +1,17 @@ +#ifdef PC98 +#define DSP_RESET (sbc_base + 0x600) +#define DSP_READ (sbc_base + 0xA00) +#define DSP_WRITE (sbc_base + 0xC00) +#define DSP_COMMAND (sbc_base + 0xC00) +#define DSP_STATUS (sbc_base + 0xC00) +#define DSP_DATA_AVAIL (sbc_base + 0xE00) +#define DSP_DATA_AVL16 (sbc_base + 0xF00) +#define MIXER_ADDR (sbc_base + 0x400) +#define MIXER_DATA (sbc_base + 0x500) +#define OPL3_LEFT (sbc_base + 0x000) +#define OPL3_RIGHT (sbc_base + 0x200) +#define OPL3_BOTH (sbc_base + 0x800) +#else #define DSP_RESET (sbc_base + 0x6) #define DSP_READ (sbc_base + 0xA) #define DSP_WRITE (sbc_base + 0xC) @@ -10,6 +24,7 @@ #define OPL3_LEFT (sbc_base + 0x0) #define OPL3_RIGHT (sbc_base + 0x2) #define OPL3_BOTH (sbc_base + 0x8) +#endif /* DSP Commands */ #define DSP_CMD_SPKON 0xD1 diff --git a/sys/pc98/boot/biosboot/boot.c b/sys/pc98/boot/biosboot/boot.c index e7ba59d..f0253a9 100644 --- a/sys/pc98/boot/biosboot/boot.c +++ b/sys/pc98/boot/biosboot/boot.c @@ -24,7 +24,7 @@ * the rights to redistribute these changes. * * from: Mach, [92/04/03 16:51:14 rvb] - * $Id: boot.c,v 1.3 1996/08/31 15:06:21 asami Exp $ + * $Id: boot.c,v 1.4 1996/09/12 11:08:45 asami Exp $ */ @@ -64,6 +64,7 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #ifdef NAMEBLOCK char *dflt_name; #endif +char *name; char namebuf[NAMEBUF_LEN]; struct bootinfo bootinfo; int loadflags; @@ -158,7 +159,7 @@ boot(int drive) } else #endif /*NAMEBLOCK*/ loadstart: - name = dflname; /* re-initialize in case of loop */ + name = "/kernel"; /* print this all each time.. (saves space to do so) */ /* If we have looped, use the previous entries as defaults */ printf("\n>> FreeBSD BOOT @ 0x%x: %d/%d k of memory\n" diff --git a/sys/pc98/boot/biosboot/boot.h b/sys/pc98/boot/biosboot/boot.h index 305955e..c9ab1b2 100644 --- a/sys/pc98/boot/biosboot/boot.h +++ b/sys/pc98/boot/biosboot/boot.h @@ -24,21 +24,21 @@ * the rights to redistribute these changes. * * from: Mach, Revision 2.2 92/04/04 11:35:03 rpd - * $Id: boot.h,v 1.1.1.1 1996/06/14 10:04:37 asami Exp $ + * $Id: boot.h,v 1.13 1996/09/14 07:38:14 bde Exp $ */ -#include <sys/types.h> #include <sys/param.h> #include <sys/time.h> -#include <ufs/ufs/quota.h> + #include <ufs/ffs/fs.h> +#include <ufs/ufs/quota.h> #include <ufs/ufs/inode.h> -extern char *devs[], *iodest; -extern char *name, dflname[]; +extern char *devs[]; +extern char *name; extern struct fs *fs; extern struct inode inode; -extern int dosdev, unit, slice, part, maj, boff, poff, bnum, cnt; +extern int dosdev, unit, slice, part, maj, boff, poff; extern unsigned long tw_chars; extern int loadflags; extern struct disklabel disklabel; diff --git a/sys/pc98/boot/biosboot/disk.c b/sys/pc98/boot/biosboot/disk.c index 348757e..ef6239f 100644 --- a/sys/pc98/boot/biosboot/disk.c +++ b/sys/pc98/boot/biosboot/disk.c @@ -24,7 +24,7 @@ * the rights to redistribute these changes. * * from: Mach, Revision 2.2 92/04/04 11:35:49 rpd - * $Id: disk.c,v 1.2 1996/07/23 07:45:36 asami Exp $ + * $Id: disk.c,v 1.3 1996/09/12 11:08:53 asami Exp $ */ /* @@ -65,7 +65,7 @@ int spt, spc; struct fs *fs; struct inode inode; -int dosdev, unit, slice, part, maj, boff, poff; +int dosdev, unit, slice, part, maj, boff; /*#define EMBEDDED_DISKLABEL 1*/ @@ -86,13 +86,14 @@ devopen(void) struct dos_partition *dptr; struct disklabel *dl; char *p; - int i, sector = 0, di; + int i, sector = 0, di, dosdev_copy; - di = get_diskinfo(dosdev); + dosdev_copy = dosdev; + di = get_diskinfo(dosdev_copy); spc = (spt = SPT(di)) * HEADS(di); #ifndef RAWBOOT - if ((dosdev & 0xf0) == 0x90) + if ((dosdev_copy & 0xf0) == 0x90) { boff = 0; part = (spt == 15 ? 0 : 1); @@ -103,8 +104,8 @@ devopen(void) dl = &disklabel; #else EMBEDDED_DISKLABEL #ifdef PC98 - p = Bread(dosdev, 1); - dptr = (struct dos_partition *)0; + p = Bread(dosdev_copy, 1); + dptr = (struct dos_partition *)p; slice = WHOLE_DISK_SLICE; for (i = 0; i < NDOSPART; i++, dptr++) if (dptr->dp_mid == DOSPTYP_386BSD) { @@ -112,11 +113,11 @@ devopen(void) sector = dptr->dp_scyl * spc; break; } - Bread(dosdev, sector + LABELSECTOR); - dl=((struct disklabel *)0); + p = Bread(dosdev, sector + LABELSECTOR); + dl=((struct disklabel *)p); disklabel = *dl; /* structure copy (maybe useful later)*/ #else - p = Bread(dosdev, 0); + p = Bread(dosdev_copy, 0); dptr = (struct dos_partition *)(p+DOSPARTOFF); slice = WHOLE_DISK_SLICE; for (i = 0; i < NDOSPART; i++, dptr++) @@ -125,7 +126,7 @@ devopen(void) sector = dptr->dp_start; break; } - p = Bread(dosdev, sector + LABELSECTOR); + p = Bread(dosdev_copy, sector + LABELSECTOR); dl=((struct disklabel *)p); disklabel = *dl; /* structure copy (maybe useful later)*/ #endif /* PC98 */ @@ -184,7 +185,7 @@ devopen(void) do_bad144 = 0; do { /* XXX: what if the "DOS sector" < 512 bytes ??? */ - p = Bread(dosdev, dkbbnum + i); + p = Bread(dosdev_copy, dkbbnum + i); dkbptr = (struct dkbad *) p; /* XXX why is this not in <sys/dkbad.h> ??? */ #define DKBAD_MAGIC 0x4321 @@ -216,10 +217,12 @@ devread(char *iodest, int sector, int cnt) { int offset; char *p; + int dosdev_copy; for (offset = 0; offset < cnt; offset += BPS) { - p = Bread(dosdev, badsect(dosdev, sector++)); + dosdev_copy = dosdev; + p = Bread(dosdev_copy, badsect(dosdev_copy, sector++)); bcopy(p, iodest+offset, BPS); } } diff --git a/sys/pc98/boot/biosboot/io.c b/sys/pc98/boot/biosboot/io.c index d127580..437bc35 100644 --- a/sys/pc98/boot/biosboot/io.c +++ b/sys/pc98/boot/biosboot/io.c @@ -24,7 +24,7 @@ * the rights to redistribute these changes. * * from: Mach, Revision 2.2 92/04/04 11:35:57 rpd - * $Id: io.c,v 1.19 1996/04/30 23:43:25 bde Exp $ + * $Id: io.c,v 1.3 1996/09/12 11:08:55 asami Exp $ */ #include "boot.h" @@ -325,9 +325,12 @@ void putc(int c) } if (crtat >= Crtat + col * row) { - for (i = 1; i < row; i++) - bcopy((void*)(Crtat+col*i), (void*)(Crtat+col*(i-1)), col*2); - for (i = 0, cp = Crtat + col * (row - 1); i < col*2; i++) { + cp = Crtat; + for (i = 1; i < row; i++) { + bcopy((void *)(cp+col), (void *)cp, col*2); + cp += col; + } + for (i = 0; i < col; i++) { *cp++ = ' '; } crtat -= col; diff --git a/sys/pc98/boot/biosboot/sys.c b/sys/pc98/boot/biosboot/sys.c index 5d90b91..2d597b3 100644 --- a/sys/pc98/boot/biosboot/sys.c +++ b/sys/pc98/boot/biosboot/sys.c @@ -24,7 +24,7 @@ * the rights to redistribute these changes. * * from: Mach, Revision 2.2 92/04/04 11:36:34 rpd - * $Id: sys.c,v 1.3 1996/09/12 11:09:00 asami Exp $ + * $Id: sys.c,v 1.4 1996/09/12 11:36:09 asami Exp $ */ /* @@ -32,7 +32,7 @@ */ #include "boot.h" -#include <sys/dir.h> +#include <sys/dirent.h> #include <sys/reboot.h> #ifdef 0 @@ -51,6 +51,8 @@ char buf[BUFSIZE], fsbuf[BUFSIZE], iobuf[BUFSIZE]; char mapbuf[MAPBUFSIZE]; int mapblock; +int poff; + #ifdef RAWBOOT #define STARTBYTE 8192 /* Where on the media the kernel starts */ #endif @@ -135,7 +137,7 @@ find(char *path) { char *rest, ch; int block, off, loc, ino = ROOTINO; - struct direct *dp; + struct dirent *dp; char list_only; list_only = (path[0] == '?' && path[1] == '\0'); @@ -167,12 +169,12 @@ loop: devread(iobuf, fsbtodb(fs, block_map(block)) + boff, blksize(fs, &inode, block)); } - dp = (struct direct *)(iobuf + off); + dp = (struct dirent *)(iobuf + off); loc += dp->d_reclen; - if (dp->d_ino && list_only) + if (dp->d_fileno && list_only) printf("%s ", dp->d_name); - } while (!dp->d_ino || strcmp(path, dp->d_name)); - ino = dp->d_ino; + } while (!dp->d_fileno || strcmp(path, dp->d_name)); + ino = dp->d_fileno; *(path = rest) = ch; goto loop; } @@ -195,8 +197,8 @@ block_map(int file_block) int openrd(void) { - char **devp, *cp = name; - int biosdrive, ret; + char **devp, *name0 = name, *cp = name0; + int biosdrive, dosdev_copy, ret; #ifdef PC98 int i; @@ -210,7 +212,7 @@ openrd(void) cp++; if (!*cp) { - cp = name; + cp = name0; } else { @@ -219,16 +221,16 @@ openrd(void) * by a colon). */ biosdrivedigit = '\0'; - if (*(name + 1) == ':' && *name >= '0' && *name <= '9') { - biosdrivedigit = *name; - name += 2; + if (*(name0 + 1) == ':' && *name0 >= '0' && *name0 <= '9') { + biosdrivedigit = *name0; + name0 += 2; } - if (cp++ != name) + if (cp++ != name0) { for (devp = devs; *devp; devp++) - if (name[0] == (*devp)[0] && - name[1] == (*devp)[1]) + if (name0[0] == (*devp)[0] && + name0[1] == (*devp)[1]) break; if (!*devp) { @@ -271,29 +273,30 @@ openrd(void) { case 4: /* sd */ #ifdef PC98 - dosdev = unit | 0xa0; + dosdev_copy = unit | 0xa0; disk_equips = *(unsigned char *)0x11482; unit = 0; for (i = 0; i < unit; i++) unit += ((disk_equips >> i) & 0x01); #else /* IBM-PC */ - dosdev = biosdrive | 0x80; + dosdev_copy = biosdrive | 0x80; #endif break; case 0: case 2: #ifdef PC98 - dosdev = (maj << 3) | unit | 0x80; + dosdev_copy = (maj << 3) | unit | 0x80; #else - dosdev = biosdrive; + dosdev_copy = biosdrive; #endif break; case 3: printf("Unknown device\n"); return 1; } - printf("dosdev = %x, biosdrive = %d, unit = %d, maj = %d\n", - dosdev, biosdrive, unit, maj); + dosdev = dosdev_copy; + printf("dosdev= %x, biosdrive = %d, unit = %d, maj = %d\n", + dosdev_copy, biosdrive, unit, maj); /***********************************************\ * Now we know the disk unit and part, * diff --git a/sys/pc98/boot/biosboot/table.c b/sys/pc98/boot/biosboot/table.c index 3bc501a..7ab5f96 100644 --- a/sys/pc98/boot/biosboot/table.c +++ b/sys/pc98/boot/biosboot/table.c @@ -24,7 +24,7 @@ * the rights to redistribute these changes. * * from: Mach, Revision 2.2 92/04/04 11:36:43 rpd - * $Id: table.c,v 1.10 1996/04/07 14:28:05 bde Exp $ + * $Id: table.c,v 1.1.1.1 1996/06/14 10:04:37 asami Exp $ */ /* @@ -146,6 +146,4 @@ struct pseudo_desc Idtr_real = { 0x400 - 1, 0x0, 0x0 }; * fragmentation. */ char *devs[] = { "wd", "dk", "fd", "wt", "sd", 0 }; -char dflname[] = "/kernel"; -char *name = dflname; unsigned long tw_chars = 0x5C2D2F7C; /* "\-/|" */ diff --git a/sys/pc98/cbus/cbus.h b/sys/pc98/cbus/cbus.h index edc9033..5d79e74 100644 --- a/sys/pc98/cbus/cbus.h +++ b/sys/pc98/cbus/cbus.h @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)isa.h 5.7 (Berkeley) 5/9/91 - * $Id: pc98.h,v 1.3 1996/09/10 09:38:21 asami Exp $ + * $Id: pc98.h,v 1.4 1996/09/12 11:09:54 asami Exp $ */ #ifndef _PC98_PC98_PC98_H_ @@ -265,6 +265,8 @@ epson_outsw(u_int port, void *addr, size_t cnt) /* * Obtained from NetBSD/pc98 */ -#define MADDRUNK -1 +#define MADDRUNK -1 +#define IRQUNK 0 +#define DRQUNK -1 #endif /* !_PC98_PC98_PC98_H_ */ diff --git a/sys/pc98/cbus/clock.c b/sys/pc98/cbus/clock.c index 6ca472a..d9b34d1 100644 --- a/sys/pc98/cbus/clock.c +++ b/sys/pc98/cbus/clock.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)clock.c 7.2 (Berkeley) 5/12/91 - * $Id: clock.c,v 1.5 1996/09/07 02:13:39 asami Exp $ + * $Id: clock.c,v 1.6 1996/10/09 19:47:43 bde Exp $ */ /* @@ -46,13 +46,13 @@ /* * modified for PC98 - * $Id: clock.c,v 1.5 1996/09/07 02:13:39 asami Exp $ + * $Id: clock.c,v 1.6 1996/10/09 19:47:43 bde Exp $ */ /* * Primitive clock interrupt routines. */ -#include "opt_ddb.h" + #include "opt_clock.h" #include "opt_cpu.h" @@ -414,16 +414,18 @@ rtcintr(struct clockframe frame) } } +#include "opt_ddb.h" #ifdef DDB -static void -DDB_printrtc(void) +#include <ddb/ddb.h> + +DB_SHOW_COMMAND(rtc, rtc) { printf("%02x/%02x/%02x %02x:%02x:%02x, A = %02x, B = %02x, C = %02x\n", rtcin(RTC_YEAR), rtcin(RTC_MONTH), rtcin(RTC_DAY), rtcin(RTC_HRS), rtcin(RTC_MIN), rtcin(RTC_SEC), rtcin(RTC_STATUSA), rtcin(RTC_STATUSB), rtcin(RTC_INTR)); } -#endif +#endif /* DDB */ #endif /* for PC98 */ static int @@ -768,7 +770,7 @@ startrtclock() if (bootverbose) { printf( "Press a key on the console to abort clock calibration\n"); - while (!cncheckc()) + while (cncheckc() == -1) calibrate_clocks(); } #endif diff --git a/sys/pc98/cbus/pcrtc.c b/sys/pc98/cbus/pcrtc.c index 6ca472a..d9b34d1 100644 --- a/sys/pc98/cbus/pcrtc.c +++ b/sys/pc98/cbus/pcrtc.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)clock.c 7.2 (Berkeley) 5/12/91 - * $Id: clock.c,v 1.5 1996/09/07 02:13:39 asami Exp $ + * $Id: clock.c,v 1.6 1996/10/09 19:47:43 bde Exp $ */ /* @@ -46,13 +46,13 @@ /* * modified for PC98 - * $Id: clock.c,v 1.5 1996/09/07 02:13:39 asami Exp $ + * $Id: clock.c,v 1.6 1996/10/09 19:47:43 bde Exp $ */ /* * Primitive clock interrupt routines. */ -#include "opt_ddb.h" + #include "opt_clock.h" #include "opt_cpu.h" @@ -414,16 +414,18 @@ rtcintr(struct clockframe frame) } } +#include "opt_ddb.h" #ifdef DDB -static void -DDB_printrtc(void) +#include <ddb/ddb.h> + +DB_SHOW_COMMAND(rtc, rtc) { printf("%02x/%02x/%02x %02x:%02x:%02x, A = %02x, B = %02x, C = %02x\n", rtcin(RTC_YEAR), rtcin(RTC_MONTH), rtcin(RTC_DAY), rtcin(RTC_HRS), rtcin(RTC_MIN), rtcin(RTC_SEC), rtcin(RTC_STATUSA), rtcin(RTC_STATUSB), rtcin(RTC_INTR)); } -#endif +#endif /* DDB */ #endif /* for PC98 */ static int @@ -768,7 +770,7 @@ startrtclock() if (bootverbose) { printf( "Press a key on the console to abort clock calibration\n"); - while (!cncheckc()) + while (cncheckc() == -1) calibrate_clocks(); } #endif diff --git a/sys/pc98/cbus/sio.c b/sys/pc98/cbus/sio.c index aacf54c..bcd8f13 100644 --- a/sys/pc98/cbus/sio.c +++ b/sys/pc98/cbus/sio.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)com.c 7.5 (Berkeley) 5/16/91 - * $Id: sio.c,v 1.6 1996/09/10 09:38:34 asami Exp $ + * $Id: sio.c,v 1.7 1996/09/12 11:09:56 asami Exp $ */ #include "opt_comconsole.h" @@ -875,7 +875,7 @@ sioprobe(dev) * XXX what about the UART bug avoided by waiting in comparam()? * We don't want to to wait long enough to drain at 2 bps. */ - outb(iobase + com_cfcr, CFCR_DLAB); + outb(iobase + com_cfcr, CFCR_DLAB | CFCR_8BITS); outb(iobase + com_dlbl, COMBRD(9600) & 0xff); outb(iobase + com_dlbh, (u_int) COMBRD(9600) >> 8); outb(iobase + com_cfcr, CFCR_8BITS); @@ -1299,7 +1299,6 @@ determined_type: ; dev = makedev(CDEV_MAJOR, 0); cdevsw_add(&dev, &sio_cdevsw, NULL); #ifdef DEVFS - /* devsw, minor, type, uid, gid, perm, fmt, ... */ com->devfs_token_ttyd = devfs_add_devswf(&sio_cdevsw, unit, DV_CHR, UID_ROOT, GID_WHEEL, 0600, "ttyd%n", unit); @@ -2401,6 +2400,8 @@ comparam(tp, t) int cflag; struct com_s *com; int divisor; + u_char dlbh; + u_char dlbl; int error; Port_t iobase; int s; @@ -2562,8 +2563,18 @@ retry: #endif if (divisor != 0) { outb(iobase + com_cfcr, cfcr | CFCR_DLAB); - outb(iobase + com_dlbl, divisor & 0xFF); - outb(iobase + com_dlbh, (u_int) divisor >> 8); + /* + * Only set the divisor registers if they would change, + * since on some 16550 incompatibles (UMC8669F), setting + * them while input is arriving them loses sync until + * data stops arriving. + */ + dlbl = divisor & 0xFF; + if (inb(iobase + com_dlbl) != dlbl) + outb(iobase + com_dlbl, dlbl); + dlbh = (u_int) divisor >> 8; + if (inb(iobase + com_dlbh) != dlbh) + outb(iobase + com_dlbh, dlbh); } outb(iobase + com_cfcr, com->cfcr_image = cfcr); #ifdef PC98 @@ -3035,6 +3046,8 @@ siocnopen(sp) struct siocnstate *sp; { int divisor; + u_char dlbh; + u_char dlbl; Port_t iobase; /* @@ -3047,12 +3060,22 @@ siocnopen(sp) outb(iobase + com_ier, 0); /* spltty() doesn't stop siointr() */ siocntxwait(); sp->cfcr = inb(iobase + com_cfcr); - outb(iobase + com_cfcr, CFCR_DLAB); + outb(iobase + com_cfcr, CFCR_DLAB | CFCR_8BITS); sp->dlbl = inb(iobase + com_dlbl); sp->dlbh = inb(iobase + com_dlbh); + /* + * Only set the divisor registers if they would change, since on + * some 16550 incompatibles (Startech), setting them clears the + * data input register. This also reduces the effects of the + * UMC8669F bug. + */ divisor = ttspeedtab(comdefaultrate, comspeedtab); - outb(iobase + com_dlbl, divisor & 0xFF); - outb(iobase + com_dlbh, (u_int) divisor >> 8); + dlbl = divisor & 0xFF; + if (sp->dlbl != dlbl) + outb(iobase + com_dlbl, dlbl); + dlbh = (u_int) divisor >> 8; + if (sp->dlbh != dlbh) + outb(iobase + com_dlbh, dlbh); outb(iobase + com_cfcr, CFCR_8BITS); sp->mcr = inb(iobase + com_mcr); /* @@ -3074,9 +3097,11 @@ siocnclose(sp) */ siocntxwait(); iobase = siocniobase; - outb(iobase + com_cfcr, CFCR_DLAB); - outb(iobase + com_dlbl, sp->dlbl); - outb(iobase + com_dlbh, sp->dlbh); + outb(iobase + com_cfcr, CFCR_DLAB | CFCR_8BITS); + if (sp->dlbl != inb(iobase + com_dlbl)) + outb(iobase + com_dlbl, sp->dlbl); + if (sp->dlbh != inb(iobase + com_dlbh)) + outb(iobase + com_dlbh, sp->dlbh); outb(iobase + com_cfcr, sp->cfcr); /* * XXX damp oscillations of MCR_DTR and MCR_RTS by not restoring them. @@ -3128,7 +3153,7 @@ siocncheckc(dev) if (inb(iobase + com_lsr) & LSR_RXRDY) c = inb(iobase + com_data); else - c = 0; + c = -1; siocnclose(&sp); splx(s); return (c); diff --git a/sys/pc98/conf/GENERIC b/sys/pc98/conf/GENERIC index d8d3024..d33ece9 100644 --- a/sys/pc98/conf/GENERIC +++ b/sys/pc98/conf/GENERIC @@ -11,7 +11,7 @@ # device lines is present in the ./LINT configuration file. If you are # in doubt as to the purpose or necessity of a line, check first in LINT. # -# $Id: GENERIC98,v 1.4 1996/09/07 02:13:23 asami Exp $ +# $Id: GENERIC98,v 1.5 1996/09/12 11:09:16 asami Exp $ # GENERIC98 -- Generic PC98 machine with WD/SBIC55 disks @@ -25,7 +25,6 @@ maxusers 10 options "PC98" #PC98 options MATH_EMULATE #Support for x87 emulation -#options GPL_MATH_EMULATE #GPL-licensed emulator options INET #InterNETworking options FFS #Berkeley Fast Filesystem options NFS #Network Filesystem @@ -33,18 +32,20 @@ options MSDOSFS #MSDOS Filesystem options "CD9660" #ISO 9660 Filesystem options PROCFS #Process filesystem options "COMPAT_43" #Compatible with BSD 4.3 [KEEP THIS!] -options SYSVSHM -options SYSVSEM -options SYSVMSG -options UCONSOLE #Allow users to grab the console -options FAILSAFE #Be conservative -options USERCONFIG #boot -c editor -options VISUAL_USERCONFIG #visual boot -c editor -options "MAXCONS=4" #4 virtual consoles +options SCSI_DELAY=15 #Be pessimistic about Joe SCSI device options BOUNCE_BUFFERS #include support for DMA bounce buffers options EPSON_BOUNCEDMA #use bounce buufer for 15-16M #options EPSON_MEMWIN #EPSON memory window support +options UCONSOLE #Allow users to grab the console options "LINE30" +options FAILSAFE #Be conservative +options USERCONFIG #boot -c editor +options VISUAL_USERCONFIG #visual boot -c editor + +options SYSVSHM +options SYSVSEM +options SYSVMSG + options AUTO_CLOCK options COM_MULTIPORT @@ -102,6 +103,7 @@ device wcd #IDE CD-ROM # for any number of installed devices. controller ncr0 controller ahc0 + controller sbic0 at isa? port "IO_SCSI" bio irq 5 drq 3 vector sbicintr #controller sbic0 at isa? port "IO_SCSI" bio irq 5 drq 3 flags 0xff vector sbicintr controller aic0 at isa? port 0x1840 bio irq 5 vector aicintr @@ -116,6 +118,8 @@ device cd0 #Only need one of these, the code dynamically grows device od0 +device mcd0 at isa? port 0x300 bio irq 10 vector mcdintr + controller matcd0 at isa? port? bio # syscons is the default console driver, resembling an SCO console @@ -161,18 +165,22 @@ device vx0 # ed5: SIC-98 # ed6: PC-9801-108 # ed7: LA-98 +# ed8: C-NET(98) +# ed9: C-NET(98)E/L # device ed0 at isa? port 0x00d0 net irq 6 vector edintr -device ed1 at isa? port 0x00d8 net irq 6 flags 0x20000 vector edintr -device ed2 at isa? port 0x00d8 net irq 6 flags 0x30000 vector edintr -device ed3 at isa? port 0x00d8 net irq 6 flags 0x40000 vector edintr -device ed4 at isa? port 0x56d0 net irq 5 flags 0x50000 vector edintr -device ed5 at isa? port 0x00d0 net irq 6 iomem 0xd0000 iosiz 16384 flags 0x60000 vector edintr -device ed6 at isa? port 0x00d0 net irq 6 flags 0x80000 vector edintr -device ed7 at isa? port 0x00d0 net irq 6 flags 0x90000 vector edintr +device ed1 at isa? port 0x00d8 net irq 6 flags 0x200000 vector edintr +device ed2 at isa? port 0x00d8 net irq 6 flags 0x300000 vector edintr +device ed3 at isa? port 0x00d8 net irq 6 flags 0x400000 vector edintr +device ed4 at isa? port 0x56d0 net irq 5 flags 0x500000 vector edintr +device ed5 at isa? port 0x00d0 net irq 6 iomem 0xd0000 iosiz 16384 flags 0x600000 vector edintr +device ed6 at isa? port 0x00d0 net irq 6 flags 0x800000 vector edintr +device ed7 at isa? port 0x00d0 net irq 6 flags 0x900000 vector edintr +device ed8 at isa? port 0x00d0 net irq 6 flags 0xa00000 vector edintr +device ed9 at isa? port 0x00d0 net irq 6 flags 0xb00000 vector edintr device fe0 at isa? port 0x00d0 net irq 3 vector feintr -device zp0 at isa? port 0x0300 net irq 10 iomem 0xe0000 vector zpintr +device zp0 at isa? port 0x00d0 net irq 10 iomem 0xe0000 vector zpintr device ep0 at isa? port 0x00d0 net irq 6 vector epintr #controller snd0 @@ -180,9 +188,7 @@ device ep0 at isa? port 0x00d0 net irq 6 vector epintr #device sbxvi0 at isa? drq 3 #device sbmidi0 at isa? port 0x80d2 #device opl0 at isa? port 0x28d2 - #device pcm0 at isa? port 0xa460 irq 12 vector pcmintr - #device mss0 at isa? port 0xf40 irq12 drq 1 vectro adintr pseudo-device loop diff --git a/sys/pc98/conf/GENERIC98 b/sys/pc98/conf/GENERIC98 index d8d3024..d33ece9 100644 --- a/sys/pc98/conf/GENERIC98 +++ b/sys/pc98/conf/GENERIC98 @@ -11,7 +11,7 @@ # device lines is present in the ./LINT configuration file. If you are # in doubt as to the purpose or necessity of a line, check first in LINT. # -# $Id: GENERIC98,v 1.4 1996/09/07 02:13:23 asami Exp $ +# $Id: GENERIC98,v 1.5 1996/09/12 11:09:16 asami Exp $ # GENERIC98 -- Generic PC98 machine with WD/SBIC55 disks @@ -25,7 +25,6 @@ maxusers 10 options "PC98" #PC98 options MATH_EMULATE #Support for x87 emulation -#options GPL_MATH_EMULATE #GPL-licensed emulator options INET #InterNETworking options FFS #Berkeley Fast Filesystem options NFS #Network Filesystem @@ -33,18 +32,20 @@ options MSDOSFS #MSDOS Filesystem options "CD9660" #ISO 9660 Filesystem options PROCFS #Process filesystem options "COMPAT_43" #Compatible with BSD 4.3 [KEEP THIS!] -options SYSVSHM -options SYSVSEM -options SYSVMSG -options UCONSOLE #Allow users to grab the console -options FAILSAFE #Be conservative -options USERCONFIG #boot -c editor -options VISUAL_USERCONFIG #visual boot -c editor -options "MAXCONS=4" #4 virtual consoles +options SCSI_DELAY=15 #Be pessimistic about Joe SCSI device options BOUNCE_BUFFERS #include support for DMA bounce buffers options EPSON_BOUNCEDMA #use bounce buufer for 15-16M #options EPSON_MEMWIN #EPSON memory window support +options UCONSOLE #Allow users to grab the console options "LINE30" +options FAILSAFE #Be conservative +options USERCONFIG #boot -c editor +options VISUAL_USERCONFIG #visual boot -c editor + +options SYSVSHM +options SYSVSEM +options SYSVMSG + options AUTO_CLOCK options COM_MULTIPORT @@ -102,6 +103,7 @@ device wcd #IDE CD-ROM # for any number of installed devices. controller ncr0 controller ahc0 + controller sbic0 at isa? port "IO_SCSI" bio irq 5 drq 3 vector sbicintr #controller sbic0 at isa? port "IO_SCSI" bio irq 5 drq 3 flags 0xff vector sbicintr controller aic0 at isa? port 0x1840 bio irq 5 vector aicintr @@ -116,6 +118,8 @@ device cd0 #Only need one of these, the code dynamically grows device od0 +device mcd0 at isa? port 0x300 bio irq 10 vector mcdintr + controller matcd0 at isa? port? bio # syscons is the default console driver, resembling an SCO console @@ -161,18 +165,22 @@ device vx0 # ed5: SIC-98 # ed6: PC-9801-108 # ed7: LA-98 +# ed8: C-NET(98) +# ed9: C-NET(98)E/L # device ed0 at isa? port 0x00d0 net irq 6 vector edintr -device ed1 at isa? port 0x00d8 net irq 6 flags 0x20000 vector edintr -device ed2 at isa? port 0x00d8 net irq 6 flags 0x30000 vector edintr -device ed3 at isa? port 0x00d8 net irq 6 flags 0x40000 vector edintr -device ed4 at isa? port 0x56d0 net irq 5 flags 0x50000 vector edintr -device ed5 at isa? port 0x00d0 net irq 6 iomem 0xd0000 iosiz 16384 flags 0x60000 vector edintr -device ed6 at isa? port 0x00d0 net irq 6 flags 0x80000 vector edintr -device ed7 at isa? port 0x00d0 net irq 6 flags 0x90000 vector edintr +device ed1 at isa? port 0x00d8 net irq 6 flags 0x200000 vector edintr +device ed2 at isa? port 0x00d8 net irq 6 flags 0x300000 vector edintr +device ed3 at isa? port 0x00d8 net irq 6 flags 0x400000 vector edintr +device ed4 at isa? port 0x56d0 net irq 5 flags 0x500000 vector edintr +device ed5 at isa? port 0x00d0 net irq 6 iomem 0xd0000 iosiz 16384 flags 0x600000 vector edintr +device ed6 at isa? port 0x00d0 net irq 6 flags 0x800000 vector edintr +device ed7 at isa? port 0x00d0 net irq 6 flags 0x900000 vector edintr +device ed8 at isa? port 0x00d0 net irq 6 flags 0xa00000 vector edintr +device ed9 at isa? port 0x00d0 net irq 6 flags 0xb00000 vector edintr device fe0 at isa? port 0x00d0 net irq 3 vector feintr -device zp0 at isa? port 0x0300 net irq 10 iomem 0xe0000 vector zpintr +device zp0 at isa? port 0x00d0 net irq 10 iomem 0xe0000 vector zpintr device ep0 at isa? port 0x00d0 net irq 6 vector epintr #controller snd0 @@ -180,9 +188,7 @@ device ep0 at isa? port 0x00d0 net irq 6 vector epintr #device sbxvi0 at isa? drq 3 #device sbmidi0 at isa? port 0x80d2 #device opl0 at isa? port 0x28d2 - #device pcm0 at isa? port 0xa460 irq 12 vector pcmintr - #device mss0 at isa? port 0xf40 irq12 drq 1 vectro adintr pseudo-device loop diff --git a/sys/pc98/conf/Makefile.pc98 b/sys/pc98/conf/Makefile.pc98 index 10f5742..03e5ac7 100644 --- a/sys/pc98/conf/Makefile.pc98 +++ b/sys/pc98/conf/Makefile.pc98 @@ -3,7 +3,7 @@ # Makefile.i386 -- with config changes. # Copyright 1990 W. Jolitz # from: @(#)Makefile.i386 7.1 5/10/91 -# $Id: Makefile.pc98,v 1.4 1996/09/03 10:23:11 asami Exp $ +# $Id: Makefile.pc98,v 1.5 1996/09/07 02:13:25 asami Exp $ # # Makefile for FreeBSD # @@ -40,8 +40,7 @@ CWARNFLAGS?= -W -Wreturn-type -Wcomment -Wredundant-decls -Wimplicit \ # of material assistance. # COPTFLAGS?=-O -# Not ready for -I- yet. #include "foo.h" where foo.h is in the srcdir fails. -INCLUDES= -nostdinc -I. -I$S -I$S/sys +INCLUDES= -nostdinc -I- -I. -I$S # This hack is to allow kernel compiles to succeed on machines w/out srcdist .if exists($S/../include) INCLUDES+= -I$S/../include diff --git a/sys/pc98/conf/options.pc98 b/sys/pc98/conf/options.pc98 index 98c7223..9a589f3 100644 --- a/sys/pc98/conf/options.pc98 +++ b/sys/pc98/conf/options.pc98 @@ -1,4 +1,4 @@ -# $Id: options.pc98,v 1.3 1996/09/10 09:37:14 asami Exp $ +# $Id: options.pc98,v 1.4 1996/09/12 11:09:21 asami Exp $ BOUNCEPAGES opt_bounce.h USER_LDT MATH_EMULATE opt_math_emulate.h @@ -23,11 +23,15 @@ PCVT_FREEBSD opt_pcvt.h PCVT_SCANSET opt_pcvt.h XSERVER opt_pcvt.h +AHC_TAGENABLE opt_aic7xxx.h +AHC_SCBPAGING_ENABLE opt_aic7xxx.h + CLK_CALIBRATION_LOOP opt_clock.h CLK_USE_I8254_CALIBRATION opt_clock.h CLK_USE_I586_CALIBRATION opt_clock.h SC_KBD_PROBE_WORKS opt_syscons.h +SC_SPLASH_SCREEN opt_syscons.h MAXCONS opt_syscons.h SLOW_VGA opt_syscons.h XT_KEYBOARD opt_syscons.h @@ -37,3 +41,4 @@ ATAPI_STATIC opt_atapi.h USERCONFIG opt_userconfig.h VISUAL_USERCONFIG opt_userconfig.h +USERCONFIG_BOOT opt_userconfig.h diff --git a/sys/pc98/i386/locore.s b/sys/pc98/i386/locore.s index c2c1edd..b39d0e9 100644 --- a/sys/pc98/i386/locore.s +++ b/sys/pc98/i386/locore.s @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)locore.s 7.3 (Berkeley) 5/13/91 - * $Id: locore.s,v 1.2 1996/07/23 07:45:53 asami Exp $ + * $Id: locore.s,v 1.3 1996/10/09 19:47:37 bde Exp $ * * originally from: locore.s, by William F. Jolitz * @@ -46,6 +46,7 @@ #include "apm.h" #include "opt_cpu.h" #include "opt_ddb.h" +#include "opt_userconfig.h" #include <sys/errno.h> #include <sys/syscall.h> @@ -196,6 +197,14 @@ NON_GPROF_ENTRY(btext) .org 0x400 _pc98_system_parameter: .space 0x240 /* skip over warm boot shit */ +1: + /* save SYSTEM PARAMETER for resume (NS/T or other) */ + movl $0xa1000,%esi + movl $0x100000,%edi + movl $0x0630,%ecx + cld + rep + movsb #else /* IBM-PC */ #ifdef BDE_DEBUGGER #ifdef BIOS_STEALS_3K @@ -212,9 +221,6 @@ _pc98_system_parameter: movw $0x1234,0x472 #endif /* PC98 */ -#ifdef PC98 -1: -#endif /* Set up a real frame in case the double return in newboot is executed. */ pushl %ebp movl %esp, %ebp @@ -223,16 +229,6 @@ _pc98_system_parameter: pushl $PSL_KERNEL popfl -#ifdef PC98 - /* save SYSTEM PARAMETER for resume (NS/T or other) */ - movl $0xa1000,%esi - movl $0x100000,%edi - movl $0x0630,%ecx - cld - rep - movsb -#endif - /* * Don't trust what the BIOS gives for %fs and %gs. Trust the bootstrap * to set %cs, %ds, %es and %ss. @@ -338,31 +334,6 @@ _pc98_system_parameter: /* now running relocated at KERNBASE where the system is linked to run */ begin: -#ifdef PC98 - /* BIOS $401:available Protect Memory (/128KB)*/ - xorl %eax,%eax - movb _pc98_system_parameter+0x401-0x400,%al - shll $17,%eax - addl $0x100000,%eax - shrl $12,%eax - movl %eax,_Maxmem /* Maxmem=(%ax*128K+1M)/4096 */ - movl %eax,_Maxmem_under16M - /* BIOS $594:available Protect Memory over 16M (/1MB) */ - xorl %edx,%edx - movw _pc98_system_parameter+0x594-0x400,%dx - cmpl $0,%edx - je 1f - - addl $16,%edx - shll $8,%edx - movl %edx,_Maxmem /* Maxmem=(%dx*1M+16M)/4096 */ -1: - - testb $8,_pc98_system_parameter+0x501-0x400 /* hireso check */ - jz 1f - movb $0xff,_hireso /* set hireso */ -1: -#endif /* PC98 */ /* set up bootstrap stack */ movl $_kstack+UPAGES*PAGE_SIZE,%esp /* bootstrap stack end location */ @@ -719,6 +690,15 @@ olddiskboot: movl 12(%ebp),%eax movl %eax,R(_bootdev) +#if defined(USERCONFIG_BOOT) && defined(USERCONFIG) + movl $0x10200, %esi + movl $R(_userconfig_from_boot),%edi + movl $512,%ecx + cld + rep + movsb +#endif /* USERCONFIG_BOOT */ + ret diff --git a/sys/pc98/i386/machdep.c b/sys/pc98/i386/machdep.c index d1b723d..01b3b48 100644 --- a/sys/pc98/i386/machdep.c +++ b/sys/pc98/i386/machdep.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: @(#)machdep.c 7.4 (Berkeley) 6/3/91 - * $Id: machdep.c,v 1.7 1996/09/10 09:37:35 asami Exp $ + * $Id: machdep.c,v 1.8 1996/09/12 11:09:26 asami Exp $ */ #include "npx.h" @@ -387,6 +387,10 @@ again: for (i = 1; i < ncallout; i++) callout[i-1].c_next = &callout[i]; +#if defined(USERCONFIG_BOOT) && defined(USERCONFIG) + boothowto |= RB_CONFIG; +#endif + if (boothowto & RB_CONFIG) { #ifdef USERCONFIG userconfig(); @@ -1000,7 +1004,7 @@ init386(first) /* * Initialize DMAC */ - init_pc98_dmac(); + pc98_init_dmac(); #endif /* @@ -1096,9 +1100,7 @@ init386(first) #endif #ifdef PC98 -#ifdef EPSON_MEMWIN - init_epson_memwin(); -#endif + pc98_getmemsize(); biosbasemem = 640; /* 640KB */ biosextmem = (Maxmem * PAGE_SIZE - 0x100000)/1024; /* extent memory */ #else /* IBM-PC */ @@ -1226,12 +1228,6 @@ init386(first) pa_indx++; } -#ifdef PC98 -#ifdef notyet - init_cpu_accel_mem(); -#endif -#endif - for (target_page = avail_start; target_page < ptoa(Maxmem); target_page += PAGE_SIZE) { int tmp, page_bad = FALSE; @@ -1245,7 +1241,7 @@ init386(first) * map page into kernel: valid, read/write, non-cacheable */ *(int *)CMAP1 = PG_V | PG_RW | PG_N | target_page; - pmap_update(); + invltlb(); tmp = *(int *)CADDR1; /* @@ -1315,7 +1311,7 @@ init386(first) } *(int *)CMAP1 = 0; - pmap_update(); + invltlb(); /* * XXX @@ -1373,6 +1369,9 @@ init386(first) gdp->gd_p = 1; gdp->gd_hioffset = ((int) &IDTVEC(syscall)) >>16; + /* XXX does this work? */ + ldt[LBSDICALLS_SEL] = ldt[LSYS5CALLS_SEL]; + /* transfer to user mode */ _ucodesel = LSEL(LUCODE_SEL, SEL_UPL); diff --git a/sys/pc98/i386/pmap.c b/sys/pc98/i386/pmap.c index 3d5254d..842004d 100644 --- a/sys/pc98/i386/pmap.c +++ b/sys/pc98/i386/pmap.c @@ -39,7 +39,7 @@ * SUCH DAMAGE. * * from: @(#)pmap.c 7.7 (Berkeley) 5/12/91 - * $Id: pmap.c,v 1.3 1996/09/12 11:09:34 asami Exp $ + * $Id: pmap.c,v 1.4 1996/10/09 19:47:39 bde Exp $ */ /* @@ -294,7 +294,7 @@ pmap_bootstrap(firstaddr, loadaddr) virtual_avail = va; *(int *) CMAP1 = *(int *) CMAP2 = *(int *) PTD = 0; - pmap_update(); + invltlb(); } @@ -407,32 +407,28 @@ pmap_track_modified( vm_offset_t va) { return 0; } -/* - * The below are finer grained pmap_update routines. These eliminate - * the gratuitious tlb flushes on non-i386 architectures. - */ static PMAP_INLINE void -pmap_update_1pg( vm_offset_t va) { -#if defined(I386_CPU) || defined(CYRIX_486DLC) - /* CYRIX Bug? */ - if (cpu_class == CPUCLASS_386 || cpu == CPU_486DLC) - pmap_update(); - else +invltlb_1pg( vm_offset_t va) { +#if defined(I386_CPU) + if (cpu_class == CPUCLASS_386) { + invltlb(); + } else #endif - __asm __volatile(".byte 0xf,0x1,0x38": :"a" (va)); + { + invlpg(va); + } } static PMAP_INLINE void -pmap_update_2pg( vm_offset_t va1, vm_offset_t va2) { -#if defined(I386_CPU) || defined(CYRIX_486DLC) - /* CYRIX Bug? */ - if (cpu_class == CPUCLASS_386 || cpu == CPU_486DLC) { - pmap_update(); +invltlb_2pg( vm_offset_t va1, vm_offset_t va2) { +#if defined(I386_CPU) + if (cpu_class == CPUCLASS_386) { + invltlb(); } else #endif { - __asm __volatile(".byte 0xf,0x1,0x38": :"a" (va1)); - __asm __volatile(".byte 0xf,0x1,0x38": :"a" (va2)); + invlpg(va1); + invlpg(va2); } } @@ -501,7 +497,7 @@ get_ptbase(pmap) /* otherwise, we are alternate address space */ if (frame != (((unsigned) APTDpde) & PG_FRAME)) { APTDpde = (pd_entry_t) (frame | PG_RW | PG_V); - pmap_update(); + invltlb(); } return (unsigned *) APTmap; } @@ -527,9 +523,9 @@ pmap_pte(pmap, va) /* * Super fast pmap_pte routine best used when scanning * the pv lists. This eliminates many coarse-grained - * pmap_update calls. Note that many of the pv list + * invltlb calls. Note that many of the pv list * scans are across different pmaps. It is very wasteful - * to do an entire pmap_update for checking a single mapping. + * to do an entire invltlb for checking a single mapping. */ unsigned * @@ -549,7 +545,7 @@ pmap_pte_quick(pmap, va) newpf = pde & PG_FRAME; if ( ((* (unsigned *) PMAP1) & PG_FRAME) != newpf) { * (unsigned *) PMAP1 = newpf | PG_RW | PG_V; - pmap_update_1pg((vm_offset_t) PADDR1); + invltlb_1pg((vm_offset_t) PADDR1); } return PADDR1 + ((unsigned) index & (NPTEPG - 1)); } @@ -630,7 +626,7 @@ pmap_qenter(va, m, count) opte = *pte; *pte = npte; if (opte) - pmap_update_1pg(tva); + invltlb_1pg(tva); } } @@ -649,7 +645,7 @@ pmap_qremove(va, count) for (i = 0; i < count; i++) { pte = (unsigned *)vtopte(va); *pte = 0; - pmap_update_1pg(va); + invltlb_1pg(va); va += PAGE_SIZE; } } @@ -657,7 +653,7 @@ pmap_qremove(va, count) /* * add a wired page to the kva * note that in order for the mapping to take effect -- you - * should do a pmap_update after doing the pmap_kenter... + * should do a invltlb after doing the pmap_kenter... */ PMAP_INLINE void pmap_kenter(va, pa) @@ -672,7 +668,7 @@ pmap_kenter(va, pa) opte = *pte; *pte = npte; if (opte) - pmap_update_1pg(va); + invltlb_1pg(va); } /* @@ -686,7 +682,7 @@ pmap_kremove(va) pte = (unsigned *)vtopte(va); *pte = 0; - pmap_update_1pg(va); + invltlb_1pg(va); } static vm_page_t @@ -755,11 +751,11 @@ pmap_unwire_pte_hold(pmap_t pmap, vm_page_t m) { if ((((unsigned)pmap->pm_pdir[PTDPTDI]) & PG_FRAME) == (((unsigned) PTDpde) & PG_FRAME)) { /* - * Do a pmap_update to make the invalidated mapping + * Do a invltlb to make the invalidated mapping * take effect immediately. */ pteva = UPT_MIN_ADDRESS + i386_ptob(m->pindex); - pmap_update_1pg(pteva); + invltlb_1pg(pteva); } #if defined(PTPHINT) @@ -1110,7 +1106,6 @@ retry: kmem_free(kernel_map, (vm_offset_t) pmap->pm_pdir, PAGE_SIZE); } pmap->pm_pdir = 0; - pmap_update(); } /* @@ -1458,7 +1453,7 @@ pmap_remove_page(pmap, va) ptq = get_ptbase(pmap) + i386_btop(va); if (*ptq) { (void) pmap_remove_pte(pmap, ptq, va); - pmap_update_1pg(va); + invltlb_1pg(va); } return; } @@ -1546,7 +1541,7 @@ pmap_remove(pmap, sva, eva) } if (anyvalid) { - pmap_update(); + invltlb(); } pmap_unlock(pmap); } @@ -1592,29 +1587,31 @@ pmap_remove_all(pa) while ((pv = TAILQ_FIRST(&ppv->pv_list)) != NULL) { pmap_lock(pv->pv_pmap); pte = pmap_pte_quick(pv->pv_pmap, pv->pv_va); - if (tpte = *pte) { - pv->pv_pmap->pm_stats.resident_count--; - *pte = 0; - if (tpte & PG_W) - pv->pv_pmap->pm_stats.wired_count--; - /* - * Update the vm_page_t clean and reference bits. - */ - if (tpte & PG_M) { + + pv->pv_pmap->pm_stats.resident_count--; + + tpte = *pte; + *pte = 0; + if (tpte & PG_W) + pv->pv_pmap->pm_stats.wired_count--; + /* + * Update the vm_page_t clean and reference bits. + */ + if (tpte & PG_M) { #if defined(PMAP_DIAGNOSTIC) - if (pmap_nw_modified((pt_entry_t) tpte)) { - printf("pmap_remove_all: modified page not writable: va: 0x%lx, pte: 0x%lx\n", pv->pv_va, tpte); - } -#endif - if (pmap_track_modified(pv->pv_va)) - ppv->pv_vm_page->dirty = VM_PAGE_BITS_ALL; - } - if (!update_needed && - ((!curproc || (&curproc->p_vmspace->vm_pmap == pv->pv_pmap)) || - (pv->pv_pmap == kernel_pmap))) { - update_needed = 1; + if (pmap_nw_modified((pt_entry_t) tpte)) { + printf("pmap_remove_all: modified page not writable: va: 0x%lx, pte: 0x%lx\n", pv->pv_va, tpte); } +#endif + if (pmap_track_modified(pv->pv_va)) + ppv->pv_vm_page->dirty = VM_PAGE_BITS_ALL; } + if (!update_needed && + ((!curproc || (&curproc->p_vmspace->vm_pmap == pv->pv_pmap)) || + (pv->pv_pmap == kernel_pmap))) { + update_needed = 1; + } + TAILQ_REMOVE(&pv->pv_pmap->pm_pvlist, pv, pv_plist); TAILQ_REMOVE(&ppv->pv_list, pv, pv_list); --ppv->pv_list_count; @@ -1624,7 +1621,7 @@ pmap_remove_all(pa) } if (update_needed) - pmap_update(); + invltlb(); splx(s); return; } @@ -1700,7 +1697,7 @@ pmap_protect(pmap, sva, eva, prot) } pmap_unlock(pmap); if (anychanged) - pmap_update(); + invltlb(); } /* @@ -1848,7 +1845,7 @@ validate: if ((origpte & ~(PG_M|PG_A)) != newpte) { *pte = newpte; if (origpte) - pmap_update_1pg(va); + invltlb_1pg(va); } pmap_unlock(pmap); } @@ -2206,7 +2203,7 @@ pmap_copy(dst_pmap, src_pmap, dst_addr, len, src_addr) dst_frame = ((unsigned) dst_pmap->pm_pdir[PTDPTDI]) & PG_FRAME; if (dst_frame != (((unsigned) APTDpde) & PG_FRAME)) { APTDpde = (pd_entry_t) (dst_frame | PG_RW | PG_V); - pmap_update(); + invltlb(); } for(addr = src_addr; addr < end_addr; addr = pdnxt) { @@ -2300,7 +2297,7 @@ pmap_zero_page(phys) *(int *) CMAP2 = PG_V | PG_RW | (phys & PG_FRAME); bzero(CADDR2, PAGE_SIZE); *(int *) CMAP2 = 0; - pmap_update_1pg((vm_offset_t) CADDR2); + invltlb_1pg((vm_offset_t) CADDR2); } /* @@ -2324,7 +2321,7 @@ pmap_copy_page(src, dst) *(int *) CMAP1 = 0; *(int *) CMAP2 = 0; - pmap_update_2pg( (vm_offset_t) CADDR1, (vm_offset_t) CADDR2); + invltlb_2pg( (vm_offset_t) CADDR1, (vm_offset_t) CADDR2); } @@ -2384,12 +2381,14 @@ pmap_page_exists(pmap, pa) return (FALSE); } -#ifdef NOT_USED_YET #define PMAP_REMOVE_PAGES_CURPROC_ONLY /* * Remove all pages from specified address space * this aids process exit speeds. Also, this code - * is special cased for current process only. + * is special cased for current process only, but + * can have the more generic (and slightly slower) + * mode enabled. This is much faster than pmap_remove + * in the case of running down an entire address space. */ void pmap_remove_pages(pmap, sva, eva) @@ -2452,10 +2451,9 @@ pmap_remove_pages(pmap, sva, eva) free_pv_entry(pv); } splx(s); - pmap_update(); + invltlb(); pmap_unlock(pmap); } -#endif /* * pmap_testbit tests bits in pte's @@ -2530,7 +2528,6 @@ pmap_changebit(pa, bit, setem) register pv_entry_t pv; pv_table_t *ppv; register unsigned *pte; - vm_offset_t va; int changed; int s; @@ -2549,8 +2546,6 @@ pmap_changebit(pa, bit, setem) pv; pv = TAILQ_NEXT(pv, pv_list)) { - va = pv->pv_va; - /* * don't write protect pager mappings */ @@ -2561,13 +2556,13 @@ pmap_changebit(pa, bit, setem) #if defined(PMAP_DIAGNOSTIC) if (!pv->pv_pmap) { - printf("Null pmap (cb) at va: 0x%lx\n", va); + printf("Null pmap (cb) at va: 0x%lx\n", pv->pv_va); continue; } #endif pmap_lock(pv->pv_pmap); - pte = pmap_pte_quick(pv->pv_pmap, va); + pte = pmap_pte_quick(pv->pv_pmap, pv->pv_va); if (pte == NULL) { pmap_unlock(pv->pv_pmap); continue; @@ -2593,7 +2588,7 @@ pmap_changebit(pa, bit, setem) } splx(s); if (changed) - pmap_update(); + invltlb(); } /* @@ -2729,7 +2724,7 @@ pmap_ts_referenced(vm_offset_t pa) } splx(s); if (rtval) { - pmap_update(); + invltlb(); } return (rtval); } @@ -2766,17 +2761,6 @@ pmap_clear_reference(vm_offset_t pa) pmap_changebit((pa), PG_A, FALSE); } -#if 0 -void -pmap_update_map(pmap_t pmap) { - unsigned frame = (unsigned) pmap->pm_pdir[PTDPTDI] & PG_FRAME; - if ((pmap == kernel_pmap) || - (frame == (((unsigned) PTDpde) & PG_FRAME))) { - pmap_update(); - } -} -#endif - /* * Miscellaneous support routines follow */ @@ -2838,7 +2822,7 @@ pmap_mapdev(pa, size) tmpva += PAGE_SIZE; pa += PAGE_SIZE; } - pmap_update(); + invltlb(); return ((void *) va); } @@ -2985,10 +2969,12 @@ static void pmap_pvdump(pa) vm_offset_t pa; { + pv_table_t *ppv; register pv_entry_t pv; printf("pa %x", pa); - for (pv = TAILQ_FIRST(pa_to_pvh(pa)); + ppv = pa_to_pvh(pa); + for (pv = TAILQ_FIRST(&ppv->pv_list); pv; pv = TAILQ_NEXT(pv, pv_list)) { #ifdef used_to_be diff --git a/sys/pc98/i386/userconfig.c b/sys/pc98/i386/userconfig.c index 48f989d..6bccd74 100644 --- a/sys/pc98/i386/userconfig.c +++ b/sys/pc98/i386/userconfig.c @@ -46,7 +46,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: userconfig.c,v 1.5 1996/09/10 09:37:38 asami Exp $ + ** $Id: userconfig.c,v 1.6 1996/09/12 11:09:38 asami Exp $ **/ /** @@ -79,28 +79,27 @@ ** - That the only tunable parameter for PCI devices are their flags. ** - That flags are _always_ editable. ** - ** Devices marked as disabled are imported as such. It is possible to move - ** a PCI device onto the inactive list, but it is not possible to actually - ** prevent the device from being probed. The ability to move is considered - ** desirable in that people will complain otherwise 8) + ** Devices marked as disabled are imported as such. PCI devices are + ** listed under a seperate heading for informational purposes only. + ** To date, there is no means for changing the behaviour of PCI drivers + ** from UserConfig. + ** + ** Note that some EISA devices probably fall into this category as well, + ** and in fact the actual bus supported by some drivers is less than clear. + ** A longer-term goal might be to list drivers by instance rather than + ** per bus-presence. ** ** For this tool to be useful, the list of devices below _MUST_ be updated ** when a new driver is brought into the kernel. It is not possible to - ** extract this information from the drivers in the kernel, as the devconf - ** structure for the device is not registered until the device is probed, - ** which is too late. + ** extract this information from the drivers in the kernel. ** ** XXX - TODO: ** - ** - FIX OPERATION WITH PCVT! - ** ** - Display _what_ a device conflicts with. ** - Implement page up/down (as what?) ** - Wizard mode (no restrictions) ** - Find out how to put syscons back into low-intensity mode so that the ** !b escape is useful on the console. - ** - The min and max values used for editing parameters are probably - ** very bogus - fix? ** ** - Only display headings with devices under them. (difficult) **/ @@ -109,30 +108,56 @@ * PC-9801 port by KATO Takenori <kato@eclogite.eps.nagoya-u.ac.jp> */ +#include "opt_userconfig.h" +#include "pci.h" + #include <sys/param.h> #include <sys/systm.h> #include <sys/kernel.h> #include <sys/malloc.h> #include <machine/clock.h> -#include <machine/cons.h> #include <machine/md_var.h> #include <i386/isa/isa_device.h> #include <pci/pcivar.h> -#include <opt_userconfig.h> - static struct isa_device *isa_devlist; /* list read by dset to extract changes */ +#ifdef USERCONFIG_BOOT +char userconfig_from_boot[512] = ""; + +static int +getchar(void) +{ + static char *next = userconfig_from_boot; + + if (next == userconfig_from_boot) { + if (strncmp(next, "USERCONFIG\n", 11)) { + next++; + strcpy(next, "quit\n"); + } else { + next += 11; + } + } + if (*next) { + return (*next++); + } else { + return cngetc(); + } +} +#else /* !USERCONFIG_BOOT */ +#define getchar() cngetc() +#endif /* USERCONFIG_BOOT */ + +#define putchar(x) cnputc(x) + #ifdef VISUAL_USERCONFIG static struct isa_device *devtabs[] = { isa_devtab_bio, isa_devtab_tty, isa_devtab_net, isa_devtab_null, NULL }; -#define putchar(x) cnputc(x) -#define getchar() cngetc() #ifndef FALSE @@ -164,6 +189,7 @@ typedef struct #define CLS_COMMS 3 /* serial, parallel ports */ #define CLS_INPUT 4 /* user input : mice, keyboards, joysticks etc */ #define CLS_MMEDIA 5 /* "multimedia" devices (sound, video, etc) */ +#define CLS_PCI 254 /* PCI devices */ #define CLS_MISC 255 /* none of the above */ @@ -179,6 +205,7 @@ static DEVCLASS_INFO devclass_names[] = { { "Communications : ", CLS_COMMS}, { "Input : ", CLS_INPUT}, { "Multimedia : ", CLS_MMEDIA}, +{ "PCI : ", CLS_PCI}, { "Miscellaneous : ", CLS_MISC}, { "",0}}; @@ -187,9 +214,10 @@ static DEVCLASS_INFO devclass_names[] = { /** Notes : ** - ** - PCI devices should be marked FLG_FIXED, not FLG_IMMUTABLE. Whilst - ** it's impossible to disable them, it should be possible to move them - ** from one list to another for peace of mind. + ** - PCI devices should be marked FLG_IMMUTABLE. They should not be movable + ** or editable, and have no attributes. This is handled in getdevs() and + ** devinfo(), so drivers that have a presence on busses other than PCI + ** should have appropriate flags set below. ** - Devices that shouldn't be seen or removed should be marked FLG_INVISIBLE. ** - XXX The list below should be reviewed by the driver authors to verify ** that the correct flags have been set for each driver, and that the @@ -206,14 +234,22 @@ static DEV_INFO device_info[] = { {"ncr", "NCR 53C810 SCSI controller", FLG_FIXED, CLS_STORAGE}, {"wdc", "IDE/ESDI/MFM disk controller", 0, CLS_STORAGE}, {"fdc", "Floppy disk controller", FLG_FIXED, CLS_STORAGE}, -{"scd", "Sony CD-ROM", 0, CLS_STORAGE}, {"mcd", "Mitsumi CD-ROM", 0, CLS_STORAGE}, +{"scd", "Sony CD-ROM", 0, CLS_STORAGE}, {"matcdc", "Matsushita/Panasonic/Creative CDROM", 0, CLS_STORAGE}, {"ed", "NS8390 Ethernet adapters", 0, CLS_NETWORK}, {"el", "3C501 Ethernet adapter", 0, CLS_NETWORK}, {"ep", "3C509 Ethernet adapter", 0, CLS_NETWORK}, {"fe", "Fujitsu MD86960A/MB869685A Ethernet adapters", 0, CLS_NETWORK}, +{"fea", "DEC DEFEA EISA FDDI adapter", 0, CLS_NETWORK}, +{"fxp", "Intel EtherExpress Pro/100B Ethernet adapter", 0, CLS_NETWORK}, +{"ie", "AT&T Starlan 10 and EN100, 3C507, NI5210 Ethernet adapters",0,CLS_NETWORK}, +{"ix", "Intel EtherExpress Ethernet adapter", 0, CLS_NETWORK}, +{"le", "DEC Etherworks 2 and 3 Ethernet adapters", 0, CLS_NETWORK}, +{"lnc", "Isolan, Novell NE2100/NE32-VL Ethernet adapters", 0,CLS_NETWORK}, +{"vx", "3COM 3C590/3C595 Ethernet adapters", 0, CLS_NETWORK}, +{"ze", "IBM/National Semiconductor PCMCIA Ethernet adapter",0, CLS_NETWORK}, {"zp", "3COM PCMCIA Etherlink III Ethernet adapter", 0, CLS_NETWORK}, {"de", "DEC DC21040 Ethernet adapter", FLG_FIXED, CLS_NETWORK}, {"fpa", "DEC DEFPA PCI FDDI adapter", FLG_FIXED, CLS_NETWORK}, @@ -221,6 +257,7 @@ static DEV_INFO device_info[] = { {"sio", "8250/16450/16550 Serial port", 0, CLS_COMMS}, {"lpt", "Parallel printer port", 0, CLS_COMMS}, + {"mse", "PC-9801 Bus Mouse", 0, CLS_INPUT}, {"sc", "Syscons console driver", FLG_FIXED, CLS_INPUT}, @@ -261,10 +298,12 @@ static DEV_INFO device_info[] = { {"ep", "3C509 Ethernet adapter", 0, CLS_NETWORK}, {"fe", "Fujitsu MD86960A/MB869685A Ethernet adapters", 0, CLS_NETWORK}, {"fea", "DEC DEFEA EISA FDDI adapter", 0, CLS_NETWORK}, +{"fxp", "Intel EtherExpress Pro/100B Ethernet adapter", 0, CLS_NETWORK}, {"ie", "AT&T Starlan 10 and EN100, 3C507, NI5210 Ethernet adapters",0,CLS_NETWORK}, {"ix", "Intel EtherExpress Ethernet adapter", 0, CLS_NETWORK}, {"le", "DEC Etherworks 2 and 3 Ethernet adapters", 0, CLS_NETWORK}, {"lnc", "Isolan, Novell NE2100/NE32-VL Ethernet adapters", 0,CLS_NETWORK}, +{"vx", "3COM 3C590/3C595 Ethernet adapters", 0, CLS_NETWORK}, {"ze", "IBM/National Semiconductor PCMCIA Ethernet adapter",0, CLS_NETWORK}, {"zp", "3COM PCMCIA Etherlink III Ethernet adapter", 0, CLS_NETWORK}, {"de", "DEC DC21040 Ethernet adapter", FLG_FIXED, CLS_NETWORK}, @@ -377,7 +416,7 @@ static char spaces[] = " static void setdev(DEV_LIST *dev, int enabled) { - if (!dev->device) /* PCI device */ + if (dev->iobase == -2) /* PCI device */ return; dev->device->id_iobase = dev->iobase; /* copy happy */ dev->device->id_irq = (u_short)(dev->irq < 16 ? 1<<dev->irq : 0); /* IRQ is bitfield */ @@ -428,23 +467,23 @@ getdevs(void) { if (pcidevice_set.ls_items[i]) { - if (((struct pci_device *)pcidevice_set.ls_items[i])->pd_name) + if (((const struct pci_device *)pcidevice_set.ls_items[i])->pd_name) { - strcpy(scratch.dev,((struct pci_device *)pcidevice_set.ls_items[i])->pd_name); + strcpy(scratch.dev,((const struct pci_device *)pcidevice_set.ls_items[i])->pd_name); scratch.iobase = -2; /* mark as PCI for future reference */ scratch.irq = -2; scratch.drq = -2; scratch.maddr = -2; scratch.msize = -2; scratch.flags = 0; - scratch.conflict_ok = 0; /* shouldn't conflict */ - scratch.comment = DEV_DEVICE; /* is a device */ - scratch.unit = 0; /* arbitrary number of them */ + scratch.conflict_ok = 0; /* shouldn't conflict */ + scratch.comment = DEV_DEVICE; /* is a device */ + scratch.unit = 0; /* arbitrary number of them */ scratch.conflicts = 0; scratch.device = NULL; scratch.changed = 0; - if (!devinfo(&scratch)) + if (!devinfo(&scratch)) /* look up name, set class and flags */ insdev(&scratch,active); /* always active */ } } @@ -461,6 +500,9 @@ getdevs(void) ** ** If the device is marked "invisible", return nonzero; the caller should ** not insert any such device into either list. + ** + ** PCI devices are always inserted into CLS_PCI, regardless of the class associated + ** with the driver type. **/ static int devinfo(DEV_LIST *dev) @@ -471,11 +513,16 @@ devinfo(DEV_LIST *dev) { if (!strcmp(dev->dev,device_info[i].dev)) { - if (device_info[i].attrib & FLG_INVISIBLE) + if (device_info[i].attrib & FLG_INVISIBLE) /* forget we ever saw this one */ return(1); - strcpy(dev->name,device_info[i].name); - dev->attrib = device_info[i].attrib; - dev->class = device_info[i].class; + strcpy(dev->name,device_info[i].name); /* get the name */ + if (dev->iobase == -2) { /* is this a PCI device? */ + dev->attrib = FLG_IMMUTABLE; /* dark green ones up the back... */ + dev->class = CLS_PCI; + } else { + dev->attrib = device_info[i].attrib; /* light green ones up the front */ + dev->class = device_info[i].class; + } return(0); } } @@ -538,37 +585,42 @@ addev(DEV_LIST *dev, DEV_LIST **list) static DEV_LIST * findspot(DEV_LIST *dev, DEV_LIST *list) { - DEV_LIST *ap; + DEV_LIST *ap = NULL; - for (ap = list; ap; ap = ap->next) + /* search for a previous instance of the same device */ + if (dev->iobase != -2) /* avoid PCI devices grouping with non-PCI devices */ { - if (ap->comment != DEV_DEVICE) /* ignore comments */ - continue; - if (!strcmp(dev->dev,ap->dev)) /* same base device */ + for (ap = list; ap; ap = ap->next) { - if ((dev->unit <= ap->unit) /* belongs before (equal is bad) */ - || !ap->next) /* or end of list */ - { - ap = ap->prev; /* back up one */ - break; /* done here */ - } - if (ap->next) /* if the next item exists */ + if (ap->comment != DEV_DEVICE) /* ignore comments */ + continue; + if (!strcmp(dev->dev,ap->dev)) /* same base device */ { - if (ap->next->comment != DEV_DEVICE) /* next is a comment */ - break; - if (strcmp(dev->dev,ap->next->dev)) /* next is a different device */ - break; + if ((dev->unit <= ap->unit) /* belongs before (equal is bad) */ + || !ap->next) /* or end of list */ + { + ap = ap->prev; /* back up one */ + break; /* done here */ + } + if (ap->next) /* if the next item exists */ + { + if (ap->next->comment != DEV_DEVICE) /* next is a comment */ + break; + if (strcmp(dev->dev,ap->next->dev)) /* next is a different device */ + break; + } } } } - if (!ap) + if (!ap) /* not sure yet */ { + /* search for a class that the device might belong to */ for (ap = list; ap; ap = ap->next) { if (ap->comment != DEV_DEVICE) /* look for simlar devices */ continue; - if (dev->class != ap->class) /* of same class too 8) */ + if (dev->class != ap->class) /* of same class too 8) */ continue; if (strcmp(dev->dev,ap->dev) < 0) /* belongs before the current entry */ { @@ -637,7 +689,7 @@ movedev(DEV_LIST *dev, DEV_LIST *list) dev->prev = ap; /* point new to current */ ap->next = dev; /* and current to new */ } - + /** ** Initlist @@ -813,12 +865,17 @@ findconflict(DEV_LIST *list) { if (dp->comment != DEV_DEVICE) /* comments don't usually conflict */ continue; + if (dp->iobase == -2) /* it's a PCI device, not interested */ + continue; dp->conflicts = 0; /* assume the best */ for (sp = list; sp; sp = sp->next) /* scan the entire list for conflicts */ { if (sp->comment != DEV_DEVICE) /* likewise */ continue; + if (dp->iobase == -2) /* it's a PCI device, not interested */ + continue; + if (sp == dp) /* always conflict with itself */ continue; if (sp->conflict_ok && dp->conflict_ok) @@ -1403,7 +1460,11 @@ showparams(DEV_LIST *dev) { sprintf(buf,"Port address : 0x%x",dev->iobase); putxy(1,18,buf); + } else { + if (dev->iobase == -2) /* a PCI device */ + putmsg(" PCI devices are automatically configured."); } + if (dev->irq > 0) { sprintf(buf,"IRQ number : %d",dev->irq); @@ -1565,6 +1626,8 @@ editval(int x, int y, int width, int hex, int min, int max, int *val, int ro) VetRet(KEY_UP); break; + case '\r': + case '\n': case 596: VetRet(KEY_DOWN); break; @@ -2036,12 +2099,14 @@ visuserconfig(void) { if (dp->comment == DEV_DEVICE) /* can't edit comments, zoom? */ { - masterhelp(" [!bTAB!n] Change fields [!bQ!n] Save device parameters"); - editparams(dp); - masterhelp(" [!bTAB!n] Change fields [!bQ!n] Save and Exit"); - putxy(0,17,lines); - conflicts = findconflict(active); /* update conflict tags */ - + if (dp->iobase != -2) /* can't edit PCI devices */ + { + masterhelp(" [!bTAB!n] Change fields [!bQ!n] Save device parameters"); + editparams(dp); + masterhelp(" [!bTAB!n] Change fields [!bQ!n] Save and Exit"); + putxy(0,17,lines); + conflicts = findconflict(active); /* update conflict tags */ + } }else{ /* DO on comment = zoom */ switch(dp->comment) /* Depends on current state */ { @@ -2163,8 +2228,8 @@ visuserconfig(void) } } } - #endif /* VISUAL_USERCONFIG */ + /* * Copyright (c) 1991 Regents of the University of California. * All rights reserved. @@ -2207,7 +2272,7 @@ visuserconfig(void) * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: userconfig.c,v 1.5 1996/09/10 09:37:38 asami Exp $ + * $Id: userconfig.c,v 1.6 1996/09/12 11:09:38 asami Exp $ */ #include "scbus.h" @@ -2241,7 +2306,7 @@ static void lsscsi(void); static int list_scsi(CmdParm *); #endif -static void lsdevtab(struct isa_device *); +static int lsdevtab(struct isa_device *); static struct isa_device *find_device(char *, int); static struct isa_device *search_devtable(struct isa_device *, char *, int); static void cngets(char *, int); @@ -2261,6 +2326,9 @@ static int set_device_enable(CmdParm *); static int set_device_disable(CmdParm *); static int quitfunc(CmdParm *); static int helpfunc(CmdParm *); +#if defined(USERCONFIG_BOOT) && defined(VISUAL_USERCONFIG) +static int introfunc(CmdParm *); +#endif static int lineno; @@ -2289,6 +2357,9 @@ static Cmd CmdList[] = { { "ex", quitfunc, NULL }, /* exit (quit) */ { "f", set_device_flags, int_parms }, /* flags dev mask */ { "h", helpfunc, NULL }, /* help */ +#if defined(USERCONFIG_BOOT) && defined(VISUAL_USERCONFIG) + { "intro", introfunc, NULL }, /* intro screen */ +#endif { "iom", set_device_mem, addr_parms }, /* iomem dev addr */ { "ios", set_device_iosize, int_parms }, /* iosize dev size */ { "ir", set_device_irq, int_parms }, /* irq dev # */ @@ -2312,16 +2383,15 @@ userconfig(void) int rval; Cmd *cmd; -#ifdef PC98 - printf("\nFreeBSD(98) Kernel Configuration Utility - Version 1.0\n" - " Type \"help\" for help or \"visual\" to go to the visual\n" - " configuration interface.\n"); -#else - printf("\nFreeBSD Kernel Configuration Utility - Version 1.0\n" - " Type \"help\" for help or \"visual\" to go to the visual\n" + printf("\nFreeBSD Kernel Configuration Utility - Version 1.1\n" + " Type \"help\" for help" +#ifdef VISUAL_USERCONFIG + " or \"visual\" to go to the visual\n" " configuration interface (requires MGA/VGA display or\n" - " serial terminal capable of displaying ANSI graphics).\n"); + " serial terminal capable of displaying ANSI graphics)" #endif + ".\n"); + while (1) { printf("config> "); @@ -2429,10 +2499,10 @@ static int list_devices(CmdParm *parms) { lineno = 0; - lsdevtab(&isa_devtab_bio[0]); - lsdevtab(&isa_devtab_tty[0]); - lsdevtab(&isa_devtab_net[0]); - lsdevtab(&isa_devtab_null[0]); + if (lsdevtab(&isa_devtab_bio[0])) return 0; + if (lsdevtab(&isa_devtab_tty[0])) return 0; + if (lsdevtab(&isa_devtab_net[0])) return 0; + if (lsdevtab(&isa_devtab_null[0])) return 0; return 0; } @@ -2544,13 +2614,53 @@ helpfunc(CmdParm *parms) printf("disable <devname>\tDisable device (will not be probed)\n"); printf("quit\t\t\tExit this configuration utility\n"); printf("reset\t\t\tReset CPU\n"); +#ifdef VISUAL_USERCONFIG printf("visual\t\t\tGo to fullscreen mode.\n"); +#endif printf("help\t\t\tThis message\n\n"); printf("Commands may be abbreviated to a unique prefix\n"); return 0; } +#if defined(USERCONFIG_BOOT) && defined(VISUAL_USERCONFIG) + static void +center(int y, char *str) +{ + putxy((80 - strlen(str)) / 2, y, str); +} + +static int +introfunc(CmdParm *parms) +{ + int y = 3; + + clear(); + center(y, "!iKernel Configuration Editor!n"); + y += 2; + putxy(2, y++, "In this next screen, you will be shown a full list of all the device"); + putxy(2, y++, "drivers which are available in this copy of the OS kernel. This is"); + putxy(2, y++, "!inot!n a list of devices which you necessarily have, simply those"); + putxy(2, y++, "which this kernel is capable of supporting."); + ++y; + putxy(2, y++, "You should go through each device category and delete all entries"); + putxy(2, y++, "(using the DELETE key) for devices that you do not have. This is an"); + putxy(2, y++, "important step since it minimizes the chance of conflicts and also"); + putxy(2, y++, "makes the kernel boot faster since there's no time wasted in trying to"); + putxy(2, y++, "detect non-existant hardware. If you see an entry for a device which you"); + putxy(2, y++, "you !ido!n have and it's not a PCI device (which will be auto-configured),"); + putxy(2, y++, "be sure that its configuration parameters match your actual hardware."); + putxy(2, y++, "To edit a device's configuration, simply press ENTER while over it."); + putxy(2, y++, "Once you are satisfied with your device configuration, press Q to"); + putxy(2, y++, "proceed with the booting process."); + ++y; + center(y, "!iPress a key to continue!n"); + cngetc(); + return 0; +} +#endif + +static int lsdevtab(struct isa_device *dt) { for (; dt->id_id != 0; dt++) { @@ -2559,7 +2669,10 @@ lsdevtab(struct isa_device *dt) if (lineno >= 23) { printf("<More> "); - (void)cngetc(); + if (getchar() == 'q') { + printf("quit\n"); + return (1); + } printf("\n"); lineno = 0; } @@ -2594,6 +2707,7 @@ lsdevtab(struct isa_device *dt) printf("%s\n", line); ++lineno; } + return(0); } static struct isa_device * @@ -2629,7 +2743,7 @@ cngets(char *input, int maxin) int c, nchars = 0; while (1) { - c = cngetc(); + c = getchar(); /* Treat ^H or ^? as backspace */ if ((c == '\010' || c == '\177')) { if (nchars) { diff --git a/sys/pc98/i386/vm_machdep.c b/sys/pc98/i386/vm_machdep.c index 408af5a..3f5eb39 100644 --- a/sys/pc98/i386/vm_machdep.c +++ b/sys/pc98/i386/vm_machdep.c @@ -38,7 +38,7 @@ * * from: @(#)vm_machdep.c 7.3 (Berkeley) 5/13/91 * Utah $Hdr: vm_machdep.c 1.16.1.1 89/06/23$ - * $Id: vm_machdep.c,v 1.3 1996/09/03 10:23:21 asami Exp $ + * $Id: vm_machdep.c,v 1.4 1996/09/12 11:09:41 asami Exp $ */ #include "npx.h" @@ -779,7 +779,7 @@ cpu_reset() { bzero((caddr_t) PTD, PAGE_SIZE); /* "good night, sweet prince .... <THUNK!>" */ - pmap_update(); + invltlb(); #endif /* NOTREACHED */ while(1); diff --git a/sys/pc98/pc98/atcompat_diskslice.c b/sys/pc98/pc98/atcompat_diskslice.c index 33db0b1..6fd1d02 100644 --- a/sys/pc98/pc98/atcompat_diskslice.c +++ b/sys/pc98/pc98/atcompat_diskslice.c @@ -35,7 +35,7 @@ * * from: @(#)ufs_disksubr.c 7.16 (Berkeley) 5/4/91 * from: ufs_disksubr.c,v 1.8 1994/06/07 01:21:39 phk Exp $ - * $Id: diskslice_machdep.c,v 1.20 1996/04/07 17:32:09 bde Exp $ + * $Id: atcompat_diskslice.c,v 1.1.1.1 1996/06/14 10:04:42 asami Exp $ */ /* @@ -47,6 +47,7 @@ #include <stddef.h> #include <sys/param.h> #include <sys/buf.h> +#include <sys/conf.h> #ifdef PC98 #undef PC98 #endif diff --git a/sys/pc98/pc98/clock.c b/sys/pc98/pc98/clock.c index 6ca472a..d9b34d1 100644 --- a/sys/pc98/pc98/clock.c +++ b/sys/pc98/pc98/clock.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)clock.c 7.2 (Berkeley) 5/12/91 - * $Id: clock.c,v 1.5 1996/09/07 02:13:39 asami Exp $ + * $Id: clock.c,v 1.6 1996/10/09 19:47:43 bde Exp $ */ /* @@ -46,13 +46,13 @@ /* * modified for PC98 - * $Id: clock.c,v 1.5 1996/09/07 02:13:39 asami Exp $ + * $Id: clock.c,v 1.6 1996/10/09 19:47:43 bde Exp $ */ /* * Primitive clock interrupt routines. */ -#include "opt_ddb.h" + #include "opt_clock.h" #include "opt_cpu.h" @@ -414,16 +414,18 @@ rtcintr(struct clockframe frame) } } +#include "opt_ddb.h" #ifdef DDB -static void -DDB_printrtc(void) +#include <ddb/ddb.h> + +DB_SHOW_COMMAND(rtc, rtc) { printf("%02x/%02x/%02x %02x:%02x:%02x, A = %02x, B = %02x, C = %02x\n", rtcin(RTC_YEAR), rtcin(RTC_MONTH), rtcin(RTC_DAY), rtcin(RTC_HRS), rtcin(RTC_MIN), rtcin(RTC_SEC), rtcin(RTC_STATUSA), rtcin(RTC_STATUSB), rtcin(RTC_INTR)); } -#endif +#endif /* DDB */ #endif /* for PC98 */ static int @@ -768,7 +770,7 @@ startrtclock() if (bootverbose) { printf( "Press a key on the console to abort clock calibration\n"); - while (!cncheckc()) + while (cncheckc() == -1) calibrate_clocks(); } #endif diff --git a/sys/pc98/pc98/diskslice_machdep.c b/sys/pc98/pc98/diskslice_machdep.c index aa6f48d..168bd9b 100644 --- a/sys/pc98/pc98/diskslice_machdep.c +++ b/sys/pc98/pc98/diskslice_machdep.c @@ -35,7 +35,7 @@ * * from: @(#)ufs_disksubr.c 7.16 (Berkeley) 5/4/91 * from: ufs_disksubr.c,v 1.8 1994/06/07 01:21:39 phk Exp $ - * $Id: diskslice_machdep.c,v 1.1.1.1 1996/06/14 10:04:43 asami Exp $ + * $Id: diskslice_machdep.c,v 1.2 1996/07/23 07:46:09 asami Exp $ */ /* @@ -45,6 +45,7 @@ #include <stddef.h> #include <sys/param.h> #include <sys/buf.h> +#include <sys/conf.h> #include <sys/disklabel.h> #ifndef PC98 #define DOSPTYP_EXTENDED 5 diff --git a/sys/pc98/pc98/if_ed.c b/sys/pc98/pc98/if_ed.c index 5f11724..ebb4749 100644 --- a/sys/pc98/pc98/if_ed.c +++ b/sys/pc98/pc98/if_ed.c @@ -24,7 +24,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: if_ed.c,v 1.6 1996/09/07 02:13:48 asami Exp $ + * $Id: if_ed.c,v 1.7 1996/09/10 09:38:04 asami Exp $ */ /* @@ -48,6 +48,7 @@ * NEC PC-9801-108 * MELCO LPC-TJ, LPC-TS, LGY-98, LGH-98, IND-SP, IND-SS, EGY-98 * PLANET SMART COM CREDITCARD/2000 PCMCIA, EN-2298 + * Contec C-NET(98), C-NET(98)E, C-NET(98)L, C-NET(98)E-A, C-NET(98)L-A * * Modified for FreeBSD(98) 2.2 by KATO T. of Nagoya University. * @@ -181,6 +182,8 @@ static int ed_probe_Novell __P((struct isa_device *)); static int ed_probe_Novell_generic __P((struct ed_softc *, int, int, int)); #ifdef PC98 static int ed_probe_SIC98 __P((struct isa_device *)); +static int ed_probe_CNET98 __P((struct isa_device *)); +static int ed_probe_CNET98EL __P((struct isa_device *)); #endif static int ed_probe_HP_pclanp __P((struct isa_device *)); @@ -404,6 +407,10 @@ ed_probe(isa_dev) { int nports; +#ifdef PC98 + ed_softc[isa_dev->id_unit].unit = isa_dev->id_unit; +#endif + #if NCRD > 0 /* * If PC-Card probe required, then register driver with @@ -419,9 +426,8 @@ ed_probe(isa_dev) * PLANET SMART COM CREDITCARD/2000 PCMCIA * IO-DATA PCLA/T */ - if ((ED_TYPE98(isa_dev) == ED_TYPE98_GENERIC) || - (ED_TYPE98(isa_dev) == ED_TYPE98_LPC)) { - ed_softc[isa_dev->id_unit].unit = isa_dev->id_unit; + if ((ED_TYPE98(isa_dev->id_flags) == ED_TYPE98_GENERIC) || + (ED_TYPE98(isa_dev->id_flags) == ED_TYPE98_LPC)) { ed_softc[isa_dev->id_unit].type = ED_TYPE98_LPC; pc98_set_register(isa_dev, isa_dev->id_unit, ED_TYPE98_LPC); nports = ed_probe_Novell(isa_dev); @@ -436,7 +442,7 @@ ed_probe(isa_dev) ed_softc[isa_dev->id_unit].type = ED_TYPE98_GENERIC; pc98_set_register(isa_dev, isa_dev->id_unit, ED_TYPE98_GENERIC); - if (ED_TYPE98(isa_dev) == ED_TYPE98_GENERIC) { + if (ED_TYPE98(isa_dev->id_flags) == ED_TYPE98_GENERIC) { #endif nports = ed_probe_WD80x3(isa_dev); if (nports) @@ -455,8 +461,8 @@ ed_probe(isa_dev) /* * Allied Telesis SIC-98 */ - if ((ED_TYPE98(isa_dev) == ED_TYPE98_GENERIC) || - (ED_TYPE98(isa_dev) == ED_TYPE98_SIC)) { + if ((ED_TYPE98(isa_dev->id_flags) == ED_TYPE98_GENERIC) || + (ED_TYPE98(isa_dev->id_flags) == ED_TYPE98_SIC)) { ed_softc[isa_dev->id_unit].type = ED_TYPE98_SIC; pc98_set_register(isa_dev, isa_dev->id_unit, ED_TYPE98_SIC); nports = ed_probe_SIC98(isa_dev); @@ -468,8 +474,8 @@ ed_probe(isa_dev) * ELECOM LANEED LD-BDN * PLANET SMART COM 98 EN-2298 */ - if ((ED_TYPE98(isa_dev) == ED_TYPE98_GENERIC) || - (ED_TYPE98(isa_dev) == ED_TYPE98_BDN)) { + if ((ED_TYPE98(isa_dev->id_flags) == ED_TYPE98_GENERIC) || + (ED_TYPE98(isa_dev->id_flags) == ED_TYPE98_BDN)) { /* LD-BDN */ ed_softc[isa_dev->id_unit].type = ED_TYPE98_BDN; pc98_set_register(isa_dev, isa_dev->id_unit, ED_TYPE98_BDN); @@ -482,8 +488,8 @@ ed_probe(isa_dev) * MELCO LGY-98, IND-SP, IND-SS * MACNICA NE2098 */ - if ((ED_TYPE98(isa_dev) == ED_TYPE98_GENERIC) || - (ED_TYPE98(isa_dev) == ED_TYPE98_LGY)) { + if ((ED_TYPE98(isa_dev->id_flags) == ED_TYPE98_GENERIC) || + (ED_TYPE98(isa_dev->id_flags) == ED_TYPE98_LGY)) { /* LGY-98 */ ed_softc[isa_dev->id_unit].type = ED_TYPE98_LGY; pc98_set_register(isa_dev, isa_dev->id_unit, ED_TYPE98_LGY); @@ -496,8 +502,8 @@ ed_probe(isa_dev) * ICM DT-ET-25, DT-ET-T5, IF-2766ET, IF-2771ET * D-Link DE-298P, DE-298 */ - if ((ED_TYPE98(isa_dev) == ED_TYPE98_GENERIC) || - (ED_TYPE98(isa_dev) == ED_TYPE98_ICM)) { + if ((ED_TYPE98(isa_dev->id_flags) == ED_TYPE98_GENERIC) || + (ED_TYPE98(isa_dev->id_flags) == ED_TYPE98_ICM)) { /* ICM */ ed_softc[isa_dev->id_unit].type = ED_TYPE98_ICM; pc98_set_register(isa_dev, isa_dev->id_unit, ED_TYPE98_ICM); @@ -508,9 +514,10 @@ ed_probe(isa_dev) /* * MELCO EGY-98 + * Contec C-NET(98)E-A, C-NET(98)L-A */ - if ((ED_TYPE98(isa_dev) == ED_TYPE98_GENERIC) || - (ED_TYPE98(isa_dev) == ED_TYPE98_EGY)) { + if ((ED_TYPE98(isa_dev->id_flags) == ED_TYPE98_GENERIC) || + (ED_TYPE98(isa_dev->id_flags) == ED_TYPE98_EGY)) { /* EGY-98 */ ed_softc[isa_dev->id_unit].type = ED_TYPE98_EGY; pc98_set_register(isa_dev, isa_dev->id_unit, ED_TYPE98_EGY); @@ -522,8 +529,8 @@ ed_probe(isa_dev) /* * IO-DATA LA/T-98 */ - if ((ED_TYPE98(isa_dev) == ED_TYPE98_GENERIC) || - (ED_TYPE98(isa_dev) == ED_TYPE98_LA98)) { + if ((ED_TYPE98(isa_dev->id_flags) == ED_TYPE98_GENERIC) || + (ED_TYPE98(isa_dev->id_flags) == ED_TYPE98_LA98)) { /* LA-98 */ ed_softc[isa_dev->id_unit].type = ED_TYPE98_LA98; pc98_set_register(isa_dev, isa_dev->id_unit, ED_TYPE98_LA98); @@ -535,8 +542,8 @@ ed_probe(isa_dev) /* * NEC PC-9801-108 */ - if ((ED_TYPE98(isa_dev) == ED_TYPE98_GENERIC) || - (ED_TYPE98(isa_dev) == ED_TYPE98_108)) { + if ((ED_TYPE98(isa_dev->id_flags) == ED_TYPE98_GENERIC) || + (ED_TYPE98(isa_dev->id_flags) == ED_TYPE98_108)) { /* PC-9801-108 */ ed_softc[isa_dev->id_unit].type = ED_TYPE98_108; pc98_set_register(isa_dev, isa_dev->id_unit, ED_TYPE98_108); @@ -544,6 +551,32 @@ ed_probe(isa_dev) if (nports) return (nports); } + + /* + * Contec C-NET(98)E/L + */ + if ((ED_TYPE98(isa_dev->id_flags) == ED_TYPE98_GENERIC) || + (ED_TYPE98(isa_dev->id_flags) == ED_TYPE98_CNET98EL)) { + /* C-NET(98)E/L */ + ed_softc[isa_dev->id_unit].type = ED_TYPE98_CNET98EL; + pc98_set_register(isa_dev, isa_dev->id_unit, ED_TYPE98_CNET98EL); + nports = ed_probe_CNET98EL(isa_dev); + if (nports) + return (nports); + } + + /* + * Contec C-NET(98) + */ + if ((ED_TYPE98(isa_dev->id_flags) == ED_TYPE98_GENERIC) || + (ED_TYPE98(isa_dev->id_flags) == ED_TYPE98_CNET98)) { + /* C-NET(98) */ + ed_softc[isa_dev->id_unit].type = ED_TYPE98_CNET98; + pc98_set_register(isa_dev, isa_dev->id_unit, ED_TYPE98_CNET98); + nports = ed_probe_CNET98(isa_dev); + if (nports) + return (nports); + } #endif nports = ed_probe_HP_pclanp(isa_dev); @@ -598,9 +631,11 @@ ed_probe_generic8390(sc) return (0); #ifdef PC98 } -#endif + inb(sc->nic_addr + ED_P0_ISR); +#else if ((inb(sc->nic_addr + ED_P0_ISR) & ED_ISR_RST) != ED_ISR_RST) return (0); +#endif return (1); } @@ -2058,6 +2093,329 @@ static int ed_probe_SIC98(struct isa_device* pc98_dev) return (1); } + +/* + * Probe and vendor-specific initialization routine for CNET98 boards + */ +static int +ed_probe_CNET98(isa_dev) + struct isa_device *isa_dev; + +{ + struct ed_softc *sc = &ed_softc[isa_dev->id_unit]; + int i; + u_char sum; + + /* + * Setup card RAM area and i/o addresses + * Kernel Virtual to segment C0000-DFFFF????? + */ + + sc->isa16bit = 0; /* 16bit mode off = 0 */ + sc->cr_proto = ED_CR_RD2; + sc->vendor = ED_VENDOR_MISC; /* vendor name */ + sc->asic_addr = isa_dev->id_iobase; + sc->nic_addr = sc->asic_addr; /* 0xa3d0 */ + sc->is790 = 0; /* special chip */ + sc->mem_start = (caddr_t)isa_dev->id_maddr; + sc->mem_end = sc->mem_start + isa_dev->id_msize; + sc->mem_ring = sc->mem_start + (ED_PAGE_SIZE * ED_TXBUF_SIZE); + sc->mem_size = isa_dev->id_msize; /* 16kbyte */ + sc->mem_shared = 1; /* sharedmemory on=1,off=0 */ + sc->txb_cnt = 1; /* tx buffer counter 1 */ + sc->tx_page_start = 0; /* page offset 0 */ + sc->rec_page_start = ED_TXBUF_SIZE; /* page offset 6 */ + sc->rec_page_stop = isa_dev->id_msize / ED_PAGE_SIZE; + /* page offset 40 */ + + if (sc->asic_addr == 0xa3d0) { + /* + * reset card to force it into a known state. + */ + outb(ED_CNET98_INIT_ADDR, 0x00); /* Request */ + DELAY(5000); + outb(ED_CNET98_INIT_ADDR, 0x01); /* Cancel */ + DELAY(5000); + /* + * set i/o address and cpu type + */ + sc->asic_addr = (0xf000 & sc->asic_addr) >> 8; + sc->asic_addr = sc->asic_addr & 0xf0; + sc->asic_addr = sc->asic_addr | 0x09; + /* debug printf(" Board status %x \n",sc->asic_addr); */ + outb((ED_CNET98_INIT_ADDR + 2), sc->asic_addr); + DELAY(1000); + sc->asic_addr = sc->nic_addr; + /* + * set window ethernet address area + * board memory base 0x480000 data 256byte + * window base 0xc40000 + * + * FreeBSD address 0xf00c4000 + */ + outb((sc->asic_addr + ED_CNET98_MAP_REG0L),0x00); + DELAY(10); + outb((sc->asic_addr + ED_CNET98_MAP_REG0H),0x48); + DELAY(10); + outb((sc->asic_addr + ED_CNET98_MAP_REG1L),0x00); + DELAY(10); + outb((sc->asic_addr + ED_CNET98_MAP_REG1H),0x41); + DELAY(10); + outb((sc->asic_addr + ED_CNET98_MAP_REG2L),0x00); + DELAY(10); + outb((sc->asic_addr + ED_CNET98_MAP_REG2H),0x42); + DELAY(10); + outb((sc->asic_addr + ED_CNET98_MAP_REG3L),0x00); + DELAY(10); + outb((sc->asic_addr + ED_CNET98_MAP_REG3H),0x43); + DELAY(10); + + outb((sc->asic_addr + ED_CNET98_WIN_REG),0xc4); + DELAY(10); + /* + * CNET98 checksum code + * + * for (sum = 0, i = 0; i < ETHER_ADDR_LEN; ++i) + * sum ^= *((caddr_t)(isa_dev -> id_maddr + i)); + * printf(" checkusum = %x \n",sum); + */ + + /* + * Get station address from on-board ROM + */ + for (i = 0; i < ETHER_ADDR_LEN; ++i) + sc->arpcom.ac_enaddr[i] = *((caddr_t)(isa_dev -> id_maddr + i)); + + outb((sc->asic_addr + ED_CNET98_WIN_REG),0x44); + DELAY(10); + + /* + * set window buffer memory area + * board memory base 0x400000 data 16kbyte + * window base 0xc40000 + * + * FreeBSD address 0xf00c4000 + */ + outb((sc->asic_addr + ED_CNET98_MAP_REG0L),0x00); + DELAY(10); + outb((sc->asic_addr + ED_CNET98_MAP_REG0H),0x40); + DELAY(10); + outb((sc->asic_addr + ED_CNET98_MAP_REG1L),0x00); + DELAY(10); + outb((sc->asic_addr + ED_CNET98_MAP_REG1H),0x41); + DELAY(10); + outb((sc->asic_addr + ED_CNET98_MAP_REG2L),0x00); + DELAY(10); + outb((sc->asic_addr + ED_CNET98_MAP_REG2H),0x42); + DELAY(10); + outb((sc->asic_addr + ED_CNET98_MAP_REG3L),0x00); + DELAY(10); + outb((sc->asic_addr + ED_CNET98_MAP_REG3H),0x43); + DELAY(10); + + outb((sc->asic_addr + ED_CNET98_WIN_REG),0xc4); + DELAY(10); + + /* + * clear interface memory, then sum to make sure its valid + */ + for (i = 0; i < sc->mem_size; ++i) + sc->mem_start[i] = 0x0; + for (sum = 0, i = 0; i < sc->mem_size; ++i) + sum |= sc->mem_start[i]; + if (sum != 0x0) { + printf("ed%d: CNET98 dual port RAM address error\n", + isa_dev->id_unit); + return (0); + } + /* + * interrupt set + * irq 12 set + */ + /* int 5 set */ + outb((sc->asic_addr + ED_CNET98_INT_MASK),0x7e); + DELAY(1000); + outb((sc->asic_addr + ED_CNET98_INT_LEV),0x20); + DELAY(1000); + + return (32); /* 0xa3d0 -- 0xa3df , 0xa7d0 -- 0xa7df */ + + } else { + return(0); /* error no board */ + } +} + + +static int ed_probe_CNET98EL(struct isa_device* isa_dev) +{ + struct ed_softc *sc = &ed_softc[isa_dev->id_unit]; + u_int memsize, n; + u_char romdata[ETHER_ADDR_LEN * 2], tmp; + static char test_pattern[32] = "THIS is A memory TEST pattern"; + char test_buffer[32]; + u_short init_addr = ED_CNET98EL_INIT; + int unit = isa_dev->id_unit; + + sc->asic_addr = isa_dev->id_iobase + ED_NOVELL_ASIC_OFFSET; + sc->nic_addr = isa_dev->id_iobase + ED_NOVELL_NIC_OFFSET; + + /* Choice initial register address */ + if (ED_TYPE98SUB(isa_dev->id_flags) != 0) { + init_addr = ED_CNET98EL_INIT2; + } +#ifdef ED_DEBUG + printf("ed%d: initial register=%x\n", isa_dev->id_unit, init_addr); +#endif + + /* Check i/o address. CNET98E/L only allows ?3d0h */ + if ((sc->nic_addr & (u_short) 0x0fff) != 0x03d0) { + printf("ed%d: Invalid i/o port configuration (%x) must be " + "?3d0h for CNET98E/L\n", + isa_dev->id_unit, sc->nic_addr); + return (0); + } + + /* + * Reset the board to force it into a known state. + */ + outb(init_addr, 0x00); /* request */ + DELAY(5000); + outb(init_addr, 0x01); /* cancel */ + + /* + * Set i/o address(A15-12) and cpu type + */ + tmp = (sc->nic_addr & (u_short) 0xf000) >> 8; + tmp |= (0x08 | 0x01); + /* + * bit0 is 1:above 80286 or 0:not. + * But FreeBSD runs under i386 or higher. + * Therefore bit0 must be 1. + */ +#ifdef ED_DEBUG + printf("ed%d: outb(%x, %x)\n", isa_dev->id_unit, init_addr + 2, tmp); +#endif + outb(init_addr + 2, tmp); + + /* Make sure that we really have a DL9800 board */ + outb(sc->nic_addr + ED_P0_CR, ED_CR_RD2 | ED_CR_STP); + DELAY(5000); + tmp = inb(sc->nic_addr + ED_P0_CR); +#ifdef ED_DEBUG + printf("ed%d: inb(%x) = %x\n", isa_dev->id_unit, sc->nic_addr + ED_P0_CR, + tmp); +#endif + if ((tmp & ~ED_CR_STA) != (ED_CR_RD2 | ED_CR_STP)) + return (0); + if ((inb(sc->nic_addr + ED_P0_ISR) & ED_ISR_RST) != ED_ISR_RST) + return (0); + + sc->vendor = ED_VENDOR_NOVELL; + sc->mem_shared = 0; + sc->cr_proto = ED_CR_RD2; + isa_dev->id_maddr = 0; + + /* Test the ability to read and write to the NIC memory. */ + + /* + * This prevents packets from being stored in the NIC memory when the + * readmem routine turns on the start bit in the CR. + */ + outb(sc->nic_addr + ED_P0_RCR, ED_RCR_MON); + + /* initialize DCR for word operations */ + outb(sc->nic_addr + ED_P0_DCR, ED_DCR_WTS | ED_DCR_FT1 | ED_DCR_LS); + + sc->isa16bit = 1; + + /* CNET98E/L board has 16k of memory */ + memsize = 16384; + + /* NIC memory start at zero on a CNET98E/L board */ + sc->mem_start = (char *) ED_CNET98EL_PAGE_OFFSET; + sc->mem_end = sc->mem_start + memsize; + sc->tx_page_start = ED_CNET98EL_PAGE_OFFSET / ED_PAGE_SIZE; + + /* + * Write a test pattern in word mode. If failure page is not 16k, then + * we don't know what this board is. + */ + for (n = ED_CNET98EL_PAGE_OFFSET; n < 65536; n += 1024) { + ed_pio_writemem(sc, test_pattern, n, sizeof(test_pattern)); + ed_pio_readmem(sc, n, test_buffer, sizeof(test_pattern)); + + if (bcmp(test_pattern, test_buffer, sizeof(test_pattern))) + break; + } + if (n != (ED_CNET98EL_PAGE_OFFSET + memsize)) { +#ifdef ED_DEBUG + printf("ed%d: CNET98E/L memory failure at %x\n", isa_dev->id_unit, n); +#endif + return (0); /* not a CNET98E/L */ + } + + /* + * Set IRQ. CNET98E/L only allows a choice of irq 3,5,6. + */ + switch (isa_dev->id_irq) { + case IRQ3: + outb(sc->asic_addr + ED_CNET98EL_ICR, ED_CNET98EL_ICR_IRQ3); + break; + case IRQ5: + outb(sc->asic_addr + ED_CNET98EL_ICR, ED_CNET98EL_ICR_IRQ5); + break; + case IRQ6: + outb(sc->asic_addr + ED_CNET98EL_ICR, ED_CNET98EL_ICR_IRQ6); + break; +#if 0 + case IRQ12: + outb(sc->asic_addr + ED_CNET98EL_ICR, ED_CNET98EL_ICR_IRQ12); + break; +#endif + default: + printf( + "ed%d: Invalid irq configuration (%d) must be 3,5,6 for CNET98E/L\n", + isa_dev->id_unit, ffs(isa_dev->id_irq) - 1); + return (0); + } + outb(sc->asic_addr + ED_CNET98EL_IMR, 0x7e); + + sc->type_str = "CNET98E/L"; + +#if 0 /* probably not useful - NE boards only come two ways */ + /* allow kernel config file overrides */ + if (isa_dev->id_msize) + memsize = isa_dev->id_msize; +#endif + + sc->mem_size = memsize; + + /* + * Use one xmit buffer if < 16k, two buffers otherwise (if not told + * otherwise). + */ + if ((memsize < 16384) || (isa_dev->id_flags & ED_FLAGS_NO_MULTI_BUFFERING)) + sc->txb_cnt = 1; + else + sc->txb_cnt = 2; + + sc->rec_page_start = sc->tx_page_start + sc->txb_cnt * ED_TXBUF_SIZE; + sc->rec_page_stop = sc->tx_page_start + memsize / ED_PAGE_SIZE; + + sc->mem_ring = sc->mem_start + sc->txb_cnt * ED_PAGE_SIZE * ED_TXBUF_SIZE; + + /* + * Get station address from on-board ROM + */ + ed_pio_readmem(sc, 16384, romdata, sizeof(romdata)); + for (n = 0; n < ETHER_ADDR_LEN; n++) + sc->arpcom.ac_enaddr[n] = romdata[n * (sc->isa16bit + 1)]; + + /* clear any pending interrupts that might have occurred above */ + outb(sc->nic_addr + ED_P0_ISR, 0xff); + + return (ED_CNET98EL_IO_PORTS); +} #endif /* @@ -3244,8 +3602,8 @@ ed_pio_readmem(sc, src, dst, amount) } else insb(sc->asic_addr + ED_NOVELL_DATA, dst, amount); #ifdef PC98 - if (sc->type == ED_TYPE98_LPC) - LPCT_1d0_OFF(); + if (sc->type == ED_TYPE98_LPC) + LPCT_1d0_OFF(); #endif } @@ -3286,8 +3644,8 @@ ed_pio_writemem(sc, src, dst, len) outb(sc->nic_addr + ED_P0_CR, ED_CR_RD1 | ED_CR_STA); #ifdef PC98 - if (sc->type == ED_TYPE98_LPC) - LPCT_1d0_ON(); + if (sc->type == ED_TYPE98_LPC) + LPCT_1d0_ON(); #endif if (sc->isa16bit) @@ -3296,8 +3654,8 @@ ed_pio_writemem(sc, src, dst, len) outsb(sc->asic_addr + ED_NOVELL_DATA, src, len); #ifdef PC98 - if (sc->type == ED_TYPE98_LPC) - LPCT_1d0_OFF(); + if (sc->type == ED_TYPE98_LPC) + LPCT_1d0_OFF(); #endif /* diff --git a/sys/pc98/pc98/if_ed98.h b/sys/pc98/pc98/if_ed98.h index eae7273..9924e36 100644 --- a/sys/pc98/pc98/if_ed98.h +++ b/sys/pc98/pc98/if_ed98.h @@ -77,16 +77,18 @@ static void pc98_set_register __P((struct isa_device *dev, * Card type * * Type Card - * 0 Allied Telesis CenterCom LA-98-T - * 1 MELCO LPC-TJ, LPC-TS / IO-DATA PCLA/T - * 2 PLANET SMART COM 98 EN-2298 / ELECOM LANEED LD-BDN[123]A - * 3 MELCO EGY-98 - * 4 MELCO LGY-98, IND-SP, IND-SS / MACNICA NE2098(XXX) - * 5 ICM DT-ET-25, DT-ET-T5, IF-2766ET, IF-2771ET / + * 0x00 Allied Telesis CenterCom LA-98-T + * 0x10 MELCO LPC-TJ, LPC-TS / IO-DATA PCLA/T + * 0x20 PLANET SMART COM 98 EN-2298 / ELECOM LANEED LD-BDN[123]A + * 0x30 MELCO EGY-98 / Contec C-NET(98)E-A/L-A + * 0x40 MELCO LGY-98, IND-SP, IND-SS / MACNICA NE2098(XXX) + * 0x50 ICM DT-ET-25, DT-ET-T5, IF-2766ET, IF-2771ET / * D-Link DE-298P{T,CAT}, DE-298{T,TP,CAT} - * 6 Allied Telesis SIC-98 - * 8 NEC PC-9801-108 - * 9 IO-DATA LA-98 + * 0x60 Allied Telesis SIC-98 + * 0x80 NEC PC-9801-108 + * 0x90 IO-DATA LA-98 + * 0xa0 Contec C-NET(98) + * 0xb0 Contec C-NET(98)E/L */ #define ED_TYPE98_BASE 0x10 @@ -99,8 +101,13 @@ static void pc98_set_register __P((struct isa_device *dev, #define ED_TYPE98_SIC 0x16 #define ED_TYPE98_108 0x18 #define ED_TYPE98_LA98 0x19 +#define ED_TYPE98_CNET98 0x1a +#define ED_TYPE98_CNET98EL 0x1b +#define ED_TYPE98_UE2212 0x1c + +#define ED_TYPE98(x) (((x & 0xffff0000) >> 20) | ED_TYPE98_BASE) +#define ED_TYPE98SUB(x) ((x & 0xf0000) >> 16) -#define ED_TYPE98(x) (((x->id_flags & 0xffff0000) >> 16) | ED_TYPE98_BASE) /* * Page 0 register offsets @@ -269,6 +276,68 @@ static void pc98_set_register __P((struct isa_device *dev, } +/* + * C-NET(98) + */ +#define ED_CNET98_INIT_ADDR 0xaaed /* 0xaaed reset register */ + /* 0xaaef i/o address set */ +/* offset NIC address */ +#define ED_CNET98_MAP_REG0L 1 /* MAPPING register0 Low */ +#define ED_CNET98_MAP_REG1L 3 /* MAPPING register1 Low */ +#define ED_CNET98_MAP_REG2L 5 /* MAPPING register2 Low */ +#define ED_CNET98_MAP_REG3L 7 /* MAPPING register3 Low */ +#define ED_CNET98_MAP_REG0H 9 /* MAPPING register0 Hi */ +#define ED_CNET98_MAP_REG1H 11 /* MAPPING register1 Hi */ +#define ED_CNET98_MAP_REG2H 13 /* MAPPING register2 Hi */ +#define ED_CNET98_MAP_REG3H 15 /* MAPPING register3 Hi */ +#define ED_CNET98_WIN_REG (0x400 + 1) /* window register */ +#define ED_CNET98_INT_LEV (0x400 + 3) /* init level register */ +#define ED_CNET98_INT_REQ (0x400 + 5) /* init request register */ +#define ED_CNET98_INT_MASK (0x400 + 7) /* init mask register */ +#define ED_CNET98_INT_STAT (0x400 + 9) /* init status register */ +#define ED_CNET98_INT_CLR (0x400 + 9) /* init clear register */ +#define ED_CNET98_RESERVE1 (0x400 + 11) +#define ED_CNET98_RESERVE2 (0x400 + 13) +#define ED_CNET98_RESERVE3 (0x400 + 15) + + +/* + * C-NET(98)E/L + */ +/* + * NIC Initial Register(on board JP1) + */ +#define ED_CNET98EL_INIT 0xaaed +#define ED_CNET98EL_INIT2 0x55ed + +#define ED_CNET98EL_NIC_OFFSET 0 +#define ED_CNET98EL_ASIC_OFFSET 0x400 /* offset to nic i/o regs */ +#define ED_CNET98EL_PAGE_OFFSET 0x0000 /* page offset for NIC access to mem */ +/* + * XXX - The I/O address range is fragmented in the CNET98E/L; this is the + * number of regs at iobase. + */ +#define ED_CNET98EL_IO_PORTS 16 /* # of i/o addresses used */ +/* + * Interrupt Configuration Register (offset from ASIC base) + */ +#define ED_CNET98EL_ICR 0x02 + +#define ED_CNET98EL_ICR_IRQ3 0x01 /* Interrupt request 3 select */ +#define ED_CNET98EL_ICR_IRQ5 0x02 /* Interrupt request 5 select */ +#define ED_CNET98EL_ICR_IRQ6 0x04 /* Interrupt request 6 select */ +#define ED_CNET98EL_ICR_IRQ12 0x20 /* Interrupt request 12 select */ +/* + * Interrupt Mask Register (offset from ASIC base) + */ +#define ED_CNET98EL_IMR 0x04 +/* + * Interrupt Status Register (offset from ASIC base) + */ +#define ED_CNET98EL_ISR 0x05 + + + /* register offsets */ static unsigned int *edp[NED]; static unsigned int pc98_io_skip[NED]; @@ -280,7 +349,7 @@ static int ed_pc_misc[NED]; static int ed_pc_reset[NED]; -/* NE2000, LGY-98, ICM, LPC-T */ +/* NE2000, LGY-98, ICM, LPC-T, C-NET(98)E/L */ static unsigned int edp_generic[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }; @@ -315,6 +384,13 @@ static unsigned int edp_nec108[16] = { 0x1000, 0x1002, 0x1004, 0x1006, 0x1008, 0x100a, 0x100c, 0x100e }; +/* Contec C-NET(98) */ +static unsigned int edp_cnet98[16] = { + 0x0000, 0x0002, 0x0004, 0x0006, 0x0008, 0x000a, 0x000c, 0x000e, + 0x0400, 0x0402, 0x0404, 0x0406, 0x0408, 0x040a, 0x040c, 0x040e +}; + + static void pc98_set_register(struct isa_device *dev, int unit, int type) { int adj; @@ -419,6 +495,26 @@ static void pc98_set_register(struct isa_device *dev, int unit, int type) ED_PC_MISC = 0x18; ED_PC_RESET = 0x1f; break; + + case ED_TYPE98_CNET98EL: + edp[unit] = edp_generic; + pc98_io_skip[unit] = 1; + ED_NOVELL_NIC_OFFSET = 0; + ED_NOVELL_ASIC_OFFSET = 0x0400; + ED_NOVELL_DATA = 0x000e; + ED_NOVELL_RESET = 0x0000; /* dummy */ + ED_PC_RESET = 0x1f; + break; + + case ED_TYPE98_CNET98: + edp[unit] = edp_cnet98; + pc98_io_skip[unit] = 2; + ED_NOVELL_NIC_OFFSET = 0; + ED_NOVELL_ASIC_OFFSET = 0x0400; + ED_NOVELL_DATA = 0x000e; + ED_NOVELL_RESET = 0x0000; /* dummy */ + ED_PC_RESET = 0x1f; + break; } } diff --git a/sys/pc98/pc98/if_fe.c b/sys/pc98/pc98/if_fe.c index 85f8033..856b1c5 100644 --- a/sys/pc98/pc98/if_fe.c +++ b/sys/pc98/pc98/if_fe.c @@ -21,7 +21,7 @@ */ /* - * $Id: if_fe.c,v 1.7 1996/09/10 09:38:08 asami Exp $ + * $Id: if_fe.c,v 1.8 1996/09/12 11:09:48 asami Exp $ * * Device driver for Fujitsu MB86960A/MB86965A based Ethernet cards. * To be used with FreeBSD 2.x @@ -230,7 +230,6 @@ static struct fe_softc { u_short txb_free; /* free bytes in TX buffer */ u_char txb_count; /* number of packets in TX buffer */ u_char txb_sched; /* number of scheduled packets */ - u_char txb_padding; /* number of delayed padding bytes */ /* Multicast address filter management. */ u_char filter_change; /* MARs must be changed ASAP. */ @@ -2822,14 +2821,6 @@ fe_get_packet ( struct fe_softc * sc, u_short len ) * Packets shorter than Ethernet minimum are legal, and we pad them * before sending out. An exception is "partial" packets which are * shorter than mandatory Ethernet header. - * - * I wrote a code for an experimental "delayed padding" technique. - * When employed, it postpones the padding process for short packets. - * If xmit() occurred at the moment, the padding process is omitted, and - * garbage is sent as pad data. If next packet is stored in the - * transmission buffer before xmit(), write_mbuf() pads the previous - * packet before transmitting new packet. This *may* gain the - * system performance (slightly). */ static void fe_write_mbufs ( struct fe_softc *sc, struct mbuf *m ) @@ -2841,6 +2832,8 @@ fe_write_mbufs ( struct fe_softc *sc, struct mbuf *m ) u_short savebyte; /* WARNING: Architecture dependent! */ #define NO_PENDING_BYTE 0xFFFF + static u_char padding [ ETHER_MIN_LEN - ETHER_CRC_LEN - ETHER_HDR_LEN ]; + #if FE_DEBUG >= 2 /* First, count up the total number of bytes to copy */ length = 0; @@ -2863,9 +2856,9 @@ fe_write_mbufs ( struct fe_softc *sc, struct mbuf *m ) * it should be a bug of upper layer. We just ignore it. * ... Partial (too short) packets, neither. */ - if ( ETHER_IS_VALID_LEN(length + ETHER_CRC_LEN)) { + if ( ! ETHER_IS_VALID_LEN(length + ETHER_CRC_LEN)) { log( LOG_ERR, - "fe%d: got a out-of-spes packet (%u bytes) to send\n", + "fe%d: got an out-of-spec packet (%u bytes) to send\n", sc->sc_unit, length ); sc->sc_if.if_oerrors++; return; @@ -2931,6 +2924,11 @@ fe_write_mbufs ( struct fe_softc *sc, struct mbuf *m ) if ( savebyte != NO_PENDING_BYTE ) { outw( addr_bmpr8, savebyte ); } + + /* Pad to the Ethernet minimum length, if the packet is too short. */ + if ( length < ETHER_MIN_LEN - ETHER_CRC_LEN ) { + outsw( addr_bmpr8, padding, ( ETHER_MIN_LEN - ETHER_CRC_LEN - length ) >> 1); + } } /* diff --git a/sys/pc98/pc98/machdep.c b/sys/pc98/pc98/machdep.c index d1b723d..01b3b48 100644 --- a/sys/pc98/pc98/machdep.c +++ b/sys/pc98/pc98/machdep.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: @(#)machdep.c 7.4 (Berkeley) 6/3/91 - * $Id: machdep.c,v 1.7 1996/09/10 09:37:35 asami Exp $ + * $Id: machdep.c,v 1.8 1996/09/12 11:09:26 asami Exp $ */ #include "npx.h" @@ -387,6 +387,10 @@ again: for (i = 1; i < ncallout; i++) callout[i-1].c_next = &callout[i]; +#if defined(USERCONFIG_BOOT) && defined(USERCONFIG) + boothowto |= RB_CONFIG; +#endif + if (boothowto & RB_CONFIG) { #ifdef USERCONFIG userconfig(); @@ -1000,7 +1004,7 @@ init386(first) /* * Initialize DMAC */ - init_pc98_dmac(); + pc98_init_dmac(); #endif /* @@ -1096,9 +1100,7 @@ init386(first) #endif #ifdef PC98 -#ifdef EPSON_MEMWIN - init_epson_memwin(); -#endif + pc98_getmemsize(); biosbasemem = 640; /* 640KB */ biosextmem = (Maxmem * PAGE_SIZE - 0x100000)/1024; /* extent memory */ #else /* IBM-PC */ @@ -1226,12 +1228,6 @@ init386(first) pa_indx++; } -#ifdef PC98 -#ifdef notyet - init_cpu_accel_mem(); -#endif -#endif - for (target_page = avail_start; target_page < ptoa(Maxmem); target_page += PAGE_SIZE) { int tmp, page_bad = FALSE; @@ -1245,7 +1241,7 @@ init386(first) * map page into kernel: valid, read/write, non-cacheable */ *(int *)CMAP1 = PG_V | PG_RW | PG_N | target_page; - pmap_update(); + invltlb(); tmp = *(int *)CADDR1; /* @@ -1315,7 +1311,7 @@ init386(first) } *(int *)CMAP1 = 0; - pmap_update(); + invltlb(); /* * XXX @@ -1373,6 +1369,9 @@ init386(first) gdp->gd_p = 1; gdp->gd_hioffset = ((int) &IDTVEC(syscall)) >>16; + /* XXX does this work? */ + ldt[LBSDICALLS_SEL] = ldt[LSYS5CALLS_SEL]; + /* transfer to user mode */ _ucodesel = LSEL(LUCODE_SEL, SEL_UPL); diff --git a/sys/pc98/pc98/npx.c b/sys/pc98/pc98/npx.c index dda9896..ddff97d 100644 --- a/sys/pc98/pc98/npx.c +++ b/sys/pc98/pc98/npx.c @@ -32,7 +32,7 @@ * SUCH DAMAGE. * * from: @(#)npx.c 7.2 (Berkeley) 5/12/91 - * $Id: npx.c,v 1.5 1996/09/07 02:14:03 asami Exp $ + * $Id: npx.c,v 1.6 1996/09/10 09:38:17 asami Exp $ */ #include "npx.h" @@ -307,6 +307,15 @@ npxprobe1(dvp) */ control &= ~(1 << 2); /* enable divide by 0 trap */ fldcw(&control); +#ifdef FPU_ERROR_BROKEN + /* + * FPU error signal doesn't work on some CPU + * accelerator board. + */ + npx_ex16 = 1; + dvp->id_irq = 0; + return (-1); +#endif npx_traps_while_probing = npx_intrs_while_probing = 0; fp_divide_by_0(); if (npx_traps_while_probing != 0) { diff --git a/sys/pc98/pc98/pc98.c b/sys/pc98/pc98/pc98.c index b77aa8c..fa07580 100644 --- a/sys/pc98/pc98/pc98.c +++ b/sys/pc98/pc98/pc98.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)isa.c 7.2 (Berkeley) 5/13/91 - * $Id: pc98.c,v 1.6 1996/09/10 09:38:19 asami Exp $ + * $Id: pc98.c,v 1.7 1996/09/12 11:09:51 asami Exp $ */ /* @@ -76,7 +76,7 @@ #include "vector.h" #ifdef PC98 -unsigned char hireso; +unsigned char hireso = 0; #endif /* diff --git a/sys/pc98/pc98/pc98.h b/sys/pc98/pc98/pc98.h index edc9033..5d79e74 100644 --- a/sys/pc98/pc98/pc98.h +++ b/sys/pc98/pc98/pc98.h @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)isa.h 5.7 (Berkeley) 5/9/91 - * $Id: pc98.h,v 1.3 1996/09/10 09:38:21 asami Exp $ + * $Id: pc98.h,v 1.4 1996/09/12 11:09:54 asami Exp $ */ #ifndef _PC98_PC98_PC98_H_ @@ -265,6 +265,8 @@ epson_outsw(u_int port, void *addr, size_t cnt) /* * Obtained from NetBSD/pc98 */ -#define MADDRUNK -1 +#define MADDRUNK -1 +#define IRQUNK 0 +#define DRQUNK -1 #endif /* !_PC98_PC98_PC98_H_ */ diff --git a/sys/pc98/pc98/pc98_machdep.c b/sys/pc98/pc98/pc98_machdep.c index cea08da..ef476da 100644 --- a/sys/pc98/pc98/pc98_machdep.c +++ b/sys/pc98/pc98/pc98_machdep.c @@ -50,9 +50,9 @@ void init_cpu_accel_mem __P((void)); void init_pc98_dmac __P((void)); #ifdef EPSON_MEMWIN -void init_epson_memwin __P((void)); +static void init_epson_memwin __P((void)); -void init_epson_memwin(void) +static void init_epson_memwin(void) { if (pc98_machine_type & M_EPSON_PC98) { if (Maxmem > 3840) { @@ -122,7 +122,7 @@ void init_cpu_accel_mem(void) int tmp, page_bad = FALSE, OrigMaxmem = Maxmem; *(int *)CMAP1 = PG_V | PG_RW | PG_N | target_page; - pmap_update(); + invltlb(); tmp = *(int *)CADDR1; /* @@ -161,30 +161,18 @@ void init_cpu_accel_mem(void) */ *(int *)CADDR1 = tmp; if (page_bad == TRUE) { - if (target_page > ptoa(4096)) - Maxmem = atop(target_page); - else - Maxmem = OrigMaxmem; - + Maxmem = atop(target_page) + 256; + } else break; - } } *(int *)CMAP1 = 0; - pmap_update(); - - /* XXX */ - if (Maxmem > 3840) { - Maxmem_under16M = 3840; - if (Maxmem < 4096) { - Maxmem = 3840; - } - } + invltlb(); } } int dma_init_flag = 1; /* dummy */ -void init_pc98_dmac(void) +void pc98_init_dmac(void) { outb(0x439, (inb(0x439) & 0xfb)); /* DMA Accsess Control over 1MB */ outb(0x29, (0x0c | 0)); /* Bank Mode Reg. 16M mode */ @@ -193,3 +181,22 @@ void init_pc98_dmac(void) outb(0x29, (0x0c | 3)); /* Bank Mode Reg. 16M mode */ outb(0x11, 0x50); /* PC98 must be 0x40 */ } + + +void pc98_getmemsize(void) +{ + unsigned char under16, over16; + + /* available protected memory size under 16MB / 128KB */ + under16 = PC98_SYSTEM_PARAMETER(0x401); + /* available protected memory size over 16MB / 1MB */ + over16 = PC98_SYSTEM_PARAMETER(0x594); + /* add conventional memory size (1024KB / 128KB = 8) */ + under16 += 8; + + Maxmem = Maxmem_under16M = under16 * 128 * 1024 / PAGE_SIZE; + Maxmem += (over16 * 1024 * 1024 / PAGE_SIZE); +#ifdef EPSON_MEMWIN + init_epson_memwin(); +#endif +} diff --git a/sys/pc98/pc98/pc98_machdep.h b/sys/pc98/pc98/pc98_machdep.h index 6528029..0c5d977 100644 --- a/sys/pc98/pc98/pc98_machdep.h +++ b/sys/pc98/pc98/pc98_machdep.h @@ -28,10 +28,7 @@ #ifndef __PC98_PC98_PC98_MACHDEP_H__ #define __PC98_PC98_PC98_MACHDEP_H__ -#ifdef EPSON_MEMWIN -void init_epson_memwin __P((void)); -#endif -void init_cpu_accel_mem __P((void)); -void init_pc98_dmac __P((void)); +void pc98_init_dmac __P((void)); +void pc98_getmemsize __P((void)); #endif /* __PC98_PC98_PC98_MACHDEP_H__ */ diff --git a/sys/pc98/pc98/pcaudio.c b/sys/pc98/pc98/pcaudio.c index 232867d..10d5232 100644 --- a/sys/pc98/pc98/pcaudio.c +++ b/sys/pc98/pc98/pcaudio.c @@ -25,7 +25,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: pcaudio.c,v 1.4 1996/09/03 10:23:50 asami Exp $ + * $Id: pcaudio.c,v 1.5 1996/09/10 09:38:24 asami Exp $ */ #include "pca.h" @@ -54,6 +54,7 @@ #include <i386/isa/isa_device.h> #include <i386/isa/timerreg.h> +#define DSP_ULAW_NOT_WANTED #include <i386/isa/sound/ulaw.h> #endif diff --git a/sys/pc98/pc98/random_machdep.c b/sys/pc98/pc98/random_machdep.c index 202ce18..0c7f797 100644 --- a/sys/pc98/pc98/random_machdep.c +++ b/sys/pc98/pc98/random_machdep.c @@ -1,7 +1,7 @@ /* * random_machdep.c -- A strong random number generator * - * $Id: random_machdep.c,v 1.5 1996/09/07 02:14:17 asami Exp $ + * $Id: random_machdep.c,v 1.6 1996/10/09 19:47:44 bde Exp $ * * Version 0.95, last modified 18-Oct-95 * @@ -48,6 +48,8 @@ #include <sys/param.h> #include <sys/systm.h> #include <sys/kernel.h> +#include <sys/select.h> +#include <sys/fcntl.h> #include <machine/clock.h> #include <machine/random.h> @@ -97,6 +99,7 @@ struct random_bucket { u_int entropy_count; int input_rotate; u_int32_t *pool; + struct selinfo rsel; }; /* There is one of these per entropy source */ @@ -130,6 +133,8 @@ rand_initialize(void) random_state.entropy_count = 0; random_state.pool = random_pool; random_wait = NULL; + random_state.rsel.si_flags = 0; + random_state.rsel.si_pid = 0; } /* @@ -237,6 +242,9 @@ add_timer_randomness(struct random_bucket *r, struct timer_rand_state *state, /* Prevent overflow */ if (r->entropy_count > POOLBITS) r->entropy_count = POOLBITS; + + if (r->entropy_count >= 8) + selwakeup(&random_state.rsel); } void @@ -491,3 +499,24 @@ write_random(const char *buf, u_int nbytes) return nbytes; } #endif /* notused */ + +int +random_select(dev_t dev, int rw, struct proc *p) +{ + int s, ret; + + if (rw == FWRITE) + return 1; /* heh. */ + + s = splhigh(); + if (random_state.entropy_count >= 8) + ret = 1; + else { + selrecord(p, &random_state.rsel); + ret = 0; + } + splx(s); + + return ret; +} + diff --git a/sys/pc98/pc98/sbic55.c b/sys/pc98/pc98/sbic55.c index 9e96abe..2bcaf17 100644 --- a/sys/pc98/pc98/sbic55.c +++ b/sys/pc98/pc98/sbic55.c @@ -26,7 +26,7 @@ #include <pc98/pc98/pc98.h> #include <i386/isa/isa_device.h> #include <i386/isa/icu.h> -#include <pc98/pc98/ic/i8237.h> +#include <i386/isa/ic/i8237.h> #include <pc98/pc98/scsireg.h> #include <scsi/scsi_all.h> #include <scsi/scsiconf.h> diff --git a/sys/pc98/pc98/sbic55.c.new b/sys/pc98/pc98/sbic55.c.new index 990546d..349bfd6 100644 --- a/sys/pc98/pc98/sbic55.c.new +++ b/sys/pc98/pc98/sbic55.c.new @@ -72,7 +72,7 @@ #include <i386/isa/icu.h> #include <pc98/pc98/pc98.h> #include <i386/isa/isa_device.h> -#include <pc98/pc98/ic/i8237.h> +#include <i386/isa/ic/i8237.h> #include <scsi/scsi_all.h> #include <scsi/scsiconf.h> diff --git a/sys/pc98/pc98/sio.c b/sys/pc98/pc98/sio.c index aacf54c..bcd8f13 100644 --- a/sys/pc98/pc98/sio.c +++ b/sys/pc98/pc98/sio.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)com.c 7.5 (Berkeley) 5/16/91 - * $Id: sio.c,v 1.6 1996/09/10 09:38:34 asami Exp $ + * $Id: sio.c,v 1.7 1996/09/12 11:09:56 asami Exp $ */ #include "opt_comconsole.h" @@ -875,7 +875,7 @@ sioprobe(dev) * XXX what about the UART bug avoided by waiting in comparam()? * We don't want to to wait long enough to drain at 2 bps. */ - outb(iobase + com_cfcr, CFCR_DLAB); + outb(iobase + com_cfcr, CFCR_DLAB | CFCR_8BITS); outb(iobase + com_dlbl, COMBRD(9600) & 0xff); outb(iobase + com_dlbh, (u_int) COMBRD(9600) >> 8); outb(iobase + com_cfcr, CFCR_8BITS); @@ -1299,7 +1299,6 @@ determined_type: ; dev = makedev(CDEV_MAJOR, 0); cdevsw_add(&dev, &sio_cdevsw, NULL); #ifdef DEVFS - /* devsw, minor, type, uid, gid, perm, fmt, ... */ com->devfs_token_ttyd = devfs_add_devswf(&sio_cdevsw, unit, DV_CHR, UID_ROOT, GID_WHEEL, 0600, "ttyd%n", unit); @@ -2401,6 +2400,8 @@ comparam(tp, t) int cflag; struct com_s *com; int divisor; + u_char dlbh; + u_char dlbl; int error; Port_t iobase; int s; @@ -2562,8 +2563,18 @@ retry: #endif if (divisor != 0) { outb(iobase + com_cfcr, cfcr | CFCR_DLAB); - outb(iobase + com_dlbl, divisor & 0xFF); - outb(iobase + com_dlbh, (u_int) divisor >> 8); + /* + * Only set the divisor registers if they would change, + * since on some 16550 incompatibles (UMC8669F), setting + * them while input is arriving them loses sync until + * data stops arriving. + */ + dlbl = divisor & 0xFF; + if (inb(iobase + com_dlbl) != dlbl) + outb(iobase + com_dlbl, dlbl); + dlbh = (u_int) divisor >> 8; + if (inb(iobase + com_dlbh) != dlbh) + outb(iobase + com_dlbh, dlbh); } outb(iobase + com_cfcr, com->cfcr_image = cfcr); #ifdef PC98 @@ -3035,6 +3046,8 @@ siocnopen(sp) struct siocnstate *sp; { int divisor; + u_char dlbh; + u_char dlbl; Port_t iobase; /* @@ -3047,12 +3060,22 @@ siocnopen(sp) outb(iobase + com_ier, 0); /* spltty() doesn't stop siointr() */ siocntxwait(); sp->cfcr = inb(iobase + com_cfcr); - outb(iobase + com_cfcr, CFCR_DLAB); + outb(iobase + com_cfcr, CFCR_DLAB | CFCR_8BITS); sp->dlbl = inb(iobase + com_dlbl); sp->dlbh = inb(iobase + com_dlbh); + /* + * Only set the divisor registers if they would change, since on + * some 16550 incompatibles (Startech), setting them clears the + * data input register. This also reduces the effects of the + * UMC8669F bug. + */ divisor = ttspeedtab(comdefaultrate, comspeedtab); - outb(iobase + com_dlbl, divisor & 0xFF); - outb(iobase + com_dlbh, (u_int) divisor >> 8); + dlbl = divisor & 0xFF; + if (sp->dlbl != dlbl) + outb(iobase + com_dlbl, dlbl); + dlbh = (u_int) divisor >> 8; + if (sp->dlbh != dlbh) + outb(iobase + com_dlbh, dlbh); outb(iobase + com_cfcr, CFCR_8BITS); sp->mcr = inb(iobase + com_mcr); /* @@ -3074,9 +3097,11 @@ siocnclose(sp) */ siocntxwait(); iobase = siocniobase; - outb(iobase + com_cfcr, CFCR_DLAB); - outb(iobase + com_dlbl, sp->dlbl); - outb(iobase + com_dlbh, sp->dlbh); + outb(iobase + com_cfcr, CFCR_DLAB | CFCR_8BITS); + if (sp->dlbl != inb(iobase + com_dlbl)) + outb(iobase + com_dlbl, sp->dlbl); + if (sp->dlbh != inb(iobase + com_dlbh)) + outb(iobase + com_dlbh, sp->dlbh); outb(iobase + com_cfcr, sp->cfcr); /* * XXX damp oscillations of MCR_DTR and MCR_RTS by not restoring them. @@ -3128,7 +3153,7 @@ siocncheckc(dev) if (inb(iobase + com_lsr) & LSR_RXRDY) c = inb(iobase + com_data); else - c = 0; + c = -1; siocnclose(&sp); splx(s); return (c); diff --git a/sys/pc98/pc98/sound/ad1848.c b/sys/pc98/pc98/sound/ad1848.c index 73e0edc..0dc5464 100644 --- a/sys/pc98/pc98/sound/ad1848.c +++ b/sys/pc98/pc98/sound/ad1848.c @@ -480,7 +480,11 @@ static struct audio_operations ad1848_pcm_operations[MAX_AUDIO_DEV] = { { "Generic AD1848 codec", +#ifdef PC98 + NEEDS_RESTART, +#else DMA_AUTOMODE, +#endif AFMT_U8, /* Will be set later */ NULL, ad1848_open, diff --git a/sys/pc98/pc98/sound/os.h b/sys/pc98/pc98/sound/os.h index ce1ad07..3881e37 100644 --- a/sys/pc98/pc98/sound/os.h +++ b/sys/pc98/pc98/sound/os.h @@ -24,6 +24,7 @@ #include <sys/proc.h> #include <sys/conf.h> #include <sys/file.h> +#include <sys/filio.h> #include <sys/uio.h> #include <sys/kernel.h> #include <sys/syslog.h> diff --git a/sys/pc98/pc98/sound/pas2_pcm.c b/sys/pc98/pc98/sound/pas2_pcm.c index 97ae76c..db91165 100644 --- a/sys/pc98/pc98/sound/pas2_pcm.c +++ b/sys/pc98/pc98/sound/pas2_pcm.c @@ -377,7 +377,11 @@ pas_pcm_prepare_for_output (int dev, int bsize, int bcount) static struct audio_operations pas_pcm_operations = { "Pro Audio Spectrum", +#ifdef PC98 + NEEDS_RESTART, +#else DMA_AUTOMODE, +#endif AFMT_U8 | AFMT_S16_LE, NULL, pas_pcm_open, diff --git a/sys/pc98/pc98/sound/sb.h b/sys/pc98/pc98/sound/sb.h deleted file mode 100644 index e21c7c8..0000000 --- a/sys/pc98/pc98/sound/sb.h +++ /dev/null @@ -1,43 +0,0 @@ -#ifdef PC98 -#define DSP_RESET (sbc_base + 0x600) -#define DSP_READ (sbc_base + 0xA00) -#define DSP_WRITE (sbc_base + 0xC00) -#define DSP_COMMAND (sbc_base + 0xC00) -#define DSP_STATUS (sbc_base + 0xC00) -#define DSP_DATA_AVAIL (sbc_base + 0xE00) -#define DSP_DATA_AVL16 (sbc_base + 0xF00) -#define MIXER_ADDR (sbc_base + 0x400) -#define MIXER_DATA (sbc_base + 0x500) -#define OPL3_LEFT (sbc_base + 0x000) -#define OPL3_RIGHT (sbc_base + 0x200) -#define OPL3_BOTH (sbc_base + 0x800) -#else -#define DSP_RESET (sbc_base + 0x6) -#define DSP_READ (sbc_base + 0xA) -#define DSP_WRITE (sbc_base + 0xC) -#define DSP_COMMAND (sbc_base + 0xC) -#define DSP_STATUS (sbc_base + 0xC) -#define DSP_DATA_AVAIL (sbc_base + 0xE) -#define DSP_DATA_AVL16 (sbc_base + 0xF) -#define MIXER_ADDR (sbc_base + 0x4) -#define MIXER_DATA (sbc_base + 0x5) -#define OPL3_LEFT (sbc_base + 0x0) -#define OPL3_RIGHT (sbc_base + 0x2) -#define OPL3_BOTH (sbc_base + 0x8) -#endif -/* DSP Commands */ - -#define DSP_CMD_SPKON 0xD1 -#define DSP_CMD_SPKOFF 0xD3 -#define DSP_CMD_DMAON 0xD0 -#define DSP_CMD_DMAOFF 0xD4 - -#define IMODE_NONE 0 -#define IMODE_OUTPUT 1 -#define IMODE_INPUT 2 -#define IMODE_INIT 3 -#define IMODE_MIDI 4 - -#define NORMAL_MIDI 0 -#define UART_MIDI 1 - diff --git a/sys/pc98/pc98/sound/sb16_dsp.c b/sys/pc98/pc98/sound/sb16_dsp.c index 4057774..5e84e67 100644 --- a/sys/pc98/pc98/sound/sb16_dsp.c +++ b/sys/pc98/pc98/sound/sb16_dsp.c @@ -84,7 +84,11 @@ static void dsp_cleanup (void); static struct audio_operations sb16_dsp_operations = { "SoundBlaster 16", +#ifdef PC98 + NEEDS_RESTART, +#else DMA_AUTOMODE, +#endif AFMT_U8 | AFMT_S16_LE, NULL, sb16_dsp_open, diff --git a/sys/pc98/pc98/sound/ulaw.h b/sys/pc98/pc98/sound/ulaw.h index be9f92d..4a071dd 100644 --- a/sys/pc98/pc98/sound/ulaw.h +++ b/sys/pc98/pc98/sound/ulaw.h @@ -33,6 +33,7 @@ static unsigned char ulaw_dsp[] = { 129, 129, 129, 129, 128, 128, 128, 128, }; +#ifndef DSP_ULAW_NOT_WANTED static unsigned char dsp_ulaw[] = { 31, 31, 31, 32, 32, 32, 32, 33, 33, 33, 33, 34, 34, 34, 34, 35, @@ -67,3 +68,4 @@ static unsigned char dsp_ulaw[] = { 163, 163, 162, 162, 162, 162, 161, 161, 161, 161, 160, 160, 160, 160, 159, 159, }; +#endif /* !DSP_ULAW_NOT_WANTED */ diff --git a/sys/pc98/pc98/syscons.c b/sys/pc98/pc98/syscons.c index 87ada76..53b70ed 100644 --- a/sys/pc98/pc98/syscons.c +++ b/sys/pc98/pc98/syscons.c @@ -25,7 +25,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: syscons.c,v 1.8 1996/09/10 09:38:39 asami Exp $ + * $Id: syscons.c,v 1.9 1996/09/12 11:10:00 asami Exp $ */ #include "sc.h" @@ -81,7 +81,7 @@ #endif #if defined(PC98) && defined(LINE30) -#include "30line.h" +#include <pc98/pc98/30line.h> #endif #if !defined(MAXCONS) @@ -90,7 +90,6 @@ #define COLD 0 #define WARM 1 -#define RUNNING 2 /* this may break on older VGA's but is usefull on real 32 bit systems */ #define bcopyw bcopy @@ -123,6 +122,8 @@ static term_stat kernel_console; static default_attr *current_default; static int flags = 0; static char init_done = COLD; +static u_short buffer[ROW*COL]; +static char in_debugger = FALSE; static char switch_in_progress = FALSE; static char write_in_progress = FALSE; static char blink_in_progress = FALSE; @@ -148,19 +149,22 @@ static long scrn_time_stamp; u_char scr_map[256]; u_char scr_rmap[256]; char *video_mode_ptr = NULL; -static char *cut_buffer; -static u_short mouse_and_mask[16] = { - 0xc000, 0xe000, 0xf000, 0xf800, 0xfc00, 0xfe00, 0xff00, 0xff80, - 0xfe00, 0x1e00, 0x1f00, 0x0f00, 0x0f00, 0x0000, 0x0000, 0x0000 -}; -static u_short mouse_or_mask[16] = { - 0x0000, 0x4000, 0x6000, 0x7000, 0x7800, 0x7c00, 0x7e00, 0x6800, - 0x0c00, 0x0c00, 0x0600, 0x0600, 0x0000, 0x0000, 0x0000, 0x0000 -}; - -static void none_saver(int blank) { } - -void (*current_saver) __P((int blank)) = none_saver; +static char *cut_buffer; +static u_short mouse_and_mask[16] = { + 0xc000, 0xe000, 0xf000, 0xf800, + 0xfc00, 0xfe00, 0xff00, 0xff80, + 0xfe00, 0x1e00, 0x1f00, 0x0f00, + 0x0f00, 0x0000, 0x0000, 0x0000 + }; +static u_short mouse_or_mask[16] = { + 0x0000, 0x4000, 0x6000, 0x7000, + 0x7800, 0x7c00, 0x7e00, 0x6800, + 0x0c00, 0x0c00, 0x0600, 0x0600, + 0x0000, 0x0000, 0x0000, 0x0000 + }; + +static void none_saver(int blank) { } +void (*current_saver) __P((int blank)) = none_saver; /* OS specific stuff */ #ifdef not_yet_done @@ -219,12 +223,13 @@ static void draw_cursor_image(scr_stat *scp); static void remove_cursor_image(scr_stat *scp); static void ansi_put(scr_stat *scp, u_char *buf, int len); static u_char *get_fstr(u_int c, u_int *len); -static void update_leds(int which); static void history_to_screen(scr_stat *scp); static int history_up_line(scr_stat *scp); static int history_down_line(scr_stat *scp); +static int mask2attr(struct term_stat *term); static void kbd_wait(void); static void kbd_cmd(u_char command); +static void update_leds(int which); static void set_vgaregs(char *modetable); static void set_font_mode(void); static void set_normal_mode(void); @@ -240,6 +245,9 @@ static void remove_cutmarking(scr_stat *scp); static void save_palette(void); static void do_bell(scr_stat *scp, int pitch, int duration); static void blink_screen(scr_stat *scp); +#ifdef SC_SPLASH_SCREEN +static void toggle_splash_screen(scr_stat *scp); +#endif struct isa_driver scdriver = { scprobe, scattach, "sc", 1 @@ -296,32 +304,85 @@ unsigned int at2pc98(unsigned int attr) #endif /* - * Calculate hardware attributes word using logical attributes mask and - * hardware colors + * These functions need to be before calls to them so they can be inlined. */ +static inline void +draw_cursor_image(scr_stat *scp) +{ + u_short cursor_image, *ptr; +#ifdef PC98 + int pos = scp->cursor_pos - scp->scr_buf; + while((inb(TEXT_GDC + 0) & 0x04) == 0) {} + outb(TEXT_GDC + 2, 0x49); /* CSRW */ + outb(TEXT_GDC + 0, pos & 0xff); /* EADl */ + outb(TEXT_GDC + 0, pos >> 8); /* EADh */ +#else + ptr = Crtat + (scp->cursor_pos - scp->scr_buf); -static int -mask2attr(struct term_stat *term) + /* do we have a destructive cursor ? */ + if (flags & CHAR_CURSOR) { + cursor_image = *scp->cursor_pos; + scp->cursor_saveunder = cursor_image; + /* modify cursor_image */ + if (!(flags & BLINK_CURSOR)||((flags & BLINK_CURSOR)&&(blinkrate & 4))){ + set_destructive_cursor(scp); + cursor_image &= 0xff00; + cursor_image |= DEAD_CHAR; + } + } + else { + cursor_image = (*(ptr) & 0x00ff) | *(scp->cursor_pos) & 0xff00; + scp->cursor_saveunder = cursor_image; + if (!(flags & BLINK_CURSOR)||((flags & BLINK_CURSOR)&&(blinkrate & 4))){ + if ((cursor_image & 0x7000) == 0x7000) { + cursor_image &= 0x8fff; + if(!(cursor_image & 0x0700)) + cursor_image |= 0x0700; + } else { + cursor_image |= 0x7000; + if ((cursor_image & 0x0700) == 0x0700) + cursor_image &= 0xf0ff; + } + } + } + *ptr = cursor_image; +#endif +} + +static inline void +remove_cursor_image(scr_stat *scp) { - int attr, mask = term->attr_mask; +#ifndef PC98 +/* + u_short cursor_image, *ptr; - if (mask & REVERSE_ATTR) { - attr = ((mask & FOREGROUND_CHANGED) ? - ((term->cur_color & 0xF000) >> 4) : - (term->rev_color & 0x0F00)) | - ((mask & BACKGROUND_CHANGED) ? - ((term->cur_color & 0x0F00) << 4) : - (term->rev_color & 0xF000)); - } else - attr = term->cur_color; + ptr = Crtat + (scp->cursor_oldpos - scp->scr_buf); - /* XXX: underline mapping for Hercules adapter can be better */ - if (mask & (BOLD_ATTR | UNDERLINE_ATTR)) - attr ^= 0x0800; - if (mask & BLINK_ATTR) - attr ^= 0x8000; + cursor_image = scp->cursor_saveunder; + *ptr = cursor_image; +SOS */ - return attr; + *(Crtat + (scp->cursor_oldpos - scp->scr_buf)) = scp->cursor_saveunder; +#endif +} + +static inline void +move_crsr(scr_stat *scp, int x, int y) +{ + if (x < 0) + x = 0; + if (y < 0) + y = 0; + if (x >= scp->xsize) + x = scp->xsize-1; + if (y >= scp->ysize) + y = scp->ysize-1; + scp->xpos = x; + scp->ypos = y; + scp->cursor_pos = scp->scr_buf + scp->ypos * scp->xsize + scp->xpos; +#ifdef PC98 + scp->cursor_atr = scp->atr_buf + scp->ypos * scp->xsize + scp->xpos; +#endif } static int @@ -401,88 +462,6 @@ scresume(void *dummy) } #endif -/* - * These functions need to be before calls to them so they can be inlined. - */ -static inline void -draw_cursor_image(scr_stat *scp) -{ - u_short cursor_image, *ptr; -#ifdef PC98 - int pos = scp->cursor_pos - scp->scr_buf; - while((inb(TEXT_GDC + 0) & 0x04) == 0) {} - outb(TEXT_GDC + 2, 0x49); /* CSRW */ - outb(TEXT_GDC + 0, pos & 0xff); /* EADl */ - outb(TEXT_GDC + 0, pos >> 8); /* EADh */ -#else - ptr = Crtat + (scp->cursor_pos - scp->scr_buf); - - /* do we have a destructive cursor ? */ - if (flags & CHAR_CURSOR) { - cursor_image = *scp->cursor_pos; - scp->cursor_saveunder = cursor_image; - /* modify cursor_image */ - if (!(flags & BLINK_CURSOR)||((flags & BLINK_CURSOR)&&(blinkrate & 4))){ - set_destructive_cursor(scp); - cursor_image &= 0xff00; - cursor_image |= DEAD_CHAR; - } - } - else { - cursor_image = (*(ptr) & 0x00ff) | *(scp->cursor_pos) & 0xff00; - scp->cursor_saveunder = cursor_image; - if (!(flags & BLINK_CURSOR)||((flags & BLINK_CURSOR)&&(blinkrate & 4))){ - if ((cursor_image & 0x7000) == 0x7000) { - cursor_image &= 0x8fff; - if(!(cursor_image & 0x0700)) - cursor_image |= 0x0700; - } else { - cursor_image |= 0x7000; - if ((cursor_image & 0x0700) == 0x0700) - cursor_image &= 0xf0ff; - } - } - } - *ptr = cursor_image; -#endif -} - -static inline void -remove_cursor_image(scr_stat *scp) -{ -#ifndef PC98 -/* - u_short cursor_image, *ptr; - - ptr = Crtat + (scp->cursor_oldpos - scp->scr_buf); - - cursor_image = scp->cursor_saveunder; - *ptr = cursor_image; -SOS */ - - *(Crtat + (scp->cursor_oldpos - scp->scr_buf)) = scp->cursor_saveunder; -#endif -} - -static inline void -move_crsr(scr_stat *scp, int x, int y) -{ - if (x < 0) - x = 0; - if (y < 0) - y = 0; - if (x >= scp->xsize) - x = scp->xsize-1; - if (y >= scp->ysize) - y = scp->ysize-1; - scp->xpos = x; - scp->ypos = y; - scp->cursor_pos = scp->scr_buf + scp->ypos * scp->xsize + scp->xpos; -#ifdef PC98 - scp->cursor_atr = scp->atr_buf + scp->ypos * scp->xsize + scp->xpos; -#endif -} - static int scattach(struct isa_device *dev) { @@ -518,7 +497,7 @@ scattach(struct isa_device *dev) M_DEVBUF, M_NOWAIT); #endif /* copy screen to buffer */ - bcopyw(Crtat, scp->scr_buf, scp->xsize * scp->ysize * sizeof(u_short)); + bcopyw(buffer, scp->scr_buf, scp->xsize * scp->ysize * sizeof(u_short)); #ifdef PC98 bcopyw(Atrat, scp->atr_buf, scp->xsize * scp->ysize * sizeof(u_short)); #endif @@ -528,7 +507,7 @@ scattach(struct isa_device *dev) scp->cursor_atr = scp->atr_buf + scp->xpos + scp->ypos * scp->xsize; #endif - scp->mouse_pos = scp->scr_buf; + scp->mouse_pos = scp->mouse_oldpos = scp->scr_buf; /* initialize history buffer & pointers */ scp->history_head = scp->history_pos = scp->history = @@ -543,9 +522,11 @@ scattach(struct isa_device *dev) #endif /* initialize cursor stuff */ - draw_cursor_image(scp); - if (crtc_vga && (flags & CHAR_CURSOR)) - set_destructive_cursor(scp); + if (!(scp->status & UNKNOWN_MODE)) { + draw_cursor_image(scp); + if (crtc_vga && (flags & CHAR_CURSOR)) + set_destructive_cursor(scp); + } /* get screen update going */ scrn_timer(); @@ -603,28 +584,6 @@ struct tty return VIRTUAL_TTY(unit); } -static scr_stat -*get_scr_stat(dev_t dev) -{ - int unit = minor(dev); - - if (unit == SC_CONSOLE) - return console[0]; - if (unit >= MAXCONS || unit < 0) - return(NULL); - return console[unit]; -} - -static int -get_scr_num() -{ - int i = 0; - - while ((i < MAXCONS) && (cur_console != console[i])) - i++; - return i < MAXCONS ? i : 0; -} - int scopen(dev_t dev, int flag, int mode, struct proc *p) { @@ -650,9 +609,10 @@ scopen(dev_t dev, int flag, int mode, struct proc *p) else if (tp->t_state & TS_XCLUDE && p->p_ucred->cr_uid != 0) return(EBUSY); - if (minor(dev) < MAXCONS && !console[minor(dev)]) + if (minor(dev) < MAXCONS && !console[minor(dev)]) { console[minor(dev)] = alloc_scp(); - return((*linesw[tp->t_line].l_open)(dev, tp)); + } + return ((*linesw[tp->t_line].l_open)(dev, tp)); } int @@ -725,8 +685,7 @@ scintr(int unit) scrn_time_stamp = time.tv_sec; if (scrn_blanked) { (*current_saver)(FALSE); - cur_console->start = 0; - cur_console->end = cur_console->xsize * cur_console->ysize; + mark_all(cur_console); } c = scgetc(1); @@ -934,8 +893,8 @@ scioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p) break; case MOUSE_ACTION: - /* this should maybe only be settable from /dev/mouse SOS */ - /* send out mouse event on /dev/mouse */ + /* this should maybe only be settable from /dev/consolectl SOS */ + /* send out mouse event on /dev/sysmouse */ if ((MOUSE_TTY)->t_state & TS_ISOPEN) { u_char buf[5]; int i; @@ -963,7 +922,7 @@ scioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p) psignal(cur_console->mouse_proc, cur_console->mouse_signal); } else { - /* process button presses*/ + /* process button presses */ if (cur_console->mouse_buttons != mouse->u.data.buttons) { cur_console->mouse_buttons = mouse->u.data.buttons; if (!(scp->status & UNKNOWN_MODE)) { @@ -971,7 +930,8 @@ scioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p) mouse_cut_start(cur_console); else mouse_cut_end(cur_console); - if (cur_console->mouse_buttons & RIGHT_BUTTON) + if (cur_console->mouse_buttons & RIGHT_BUTTON || + cur_console->mouse_buttons & MIDDLE_BUTTON) mouse_paste(cur_console); } } @@ -988,8 +948,7 @@ scioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p) scrn_time_stamp = time.tv_sec; if (scrn_blanked) { (*current_saver)(FALSE); - cur_console->start = 0; - cur_console->end = cur_console->xsize * cur_console->ysize; + mark_all(scp); } } return 0; @@ -1036,28 +995,38 @@ scioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p) scp->ysize = LINE30_ROW; break; #endif + default: + return EINVAL; } scp->mode = cmd & 0xff; - scp->status &= ~UNKNOWN_MODE; /* text mode */ free(scp->scr_buf, M_DEVBUF); - scp->scr_buf = (u_short *)malloc(scp->xsize * scp->ysize * - sizeof(u_short),M_DEVBUF, M_WAITOK); -#ifdef PC98 + scp->scr_buf = (u_short *) + malloc(scp->xsize*scp->ysize*sizeof(u_short), M_DEVBUF, M_WAITOK); + scp->cursor_pos = scp->cursor_oldpos = + scp->scr_buf + scp->xpos + scp->ypos * scp->xsize; + scp->mouse_pos = scp->mouse_oldpos = + scp->scr_buf + ((scp->mouse_ypos/scp->font_size)*scp->xsize + + scp->mouse_xpos/8); free(scp->atr_buf, M_DEVBUF); - scp->atr_buf = (u_short *)malloc(scp->xsize * scp->ysize * - sizeof(u_short),M_DEVBUF, M_WAITOK); -#endif + scp->atr_buf = (u_short *) + malloc(scp->xsize*scp->ysize*sizeof(u_short),M_DEVBUF, M_WAITOK); + scp->cursor_atr = + scp->atr_buf + scp->xpos + scp->ypos * scp->xsize; + free(cut_buffer, M_DEVBUF); + cut_buffer = (char *)malloc(scp->xsize*scp->ysize, M_DEVBUF, M_NOWAIT); + cut_buffer[0] = 0x00; if (scp == cur_console) set_mode(scp); - clear_screen(scp); + scp->status &= ~UNKNOWN_MODE; + clear_screen(scp); if (tp->t_winsize.ws_col != scp->xsize || tp->t_winsize.ws_row != scp->ysize) { tp->t_winsize.ws_col = scp->xsize; tp->t_winsize.ws_row = scp->ysize; pgsignal(tp->t_pgrp, SIGWINCH, 1); } - return 0; -#else + return 0; +#else /* IBM-PC */ /* VGA TEXT MODES */ case SW_VGA_C40x25: case SW_VGA_C80x25: case SW_VGA_M80x25: @@ -1104,20 +1073,20 @@ scioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p) break; } scp->mode = cmd & 0xff; - scp->status &= ~UNKNOWN_MODE; free(scp->scr_buf, M_DEVBUF); - scp->scr_buf = (u_short *)malloc(scp->xsize*scp->ysize*sizeof(u_short), - M_DEVBUF, M_WAITOK); -#ifdef PC98 - free(scp->scr_atr, M_DEVBUF); - scp->scr_atr = (u_short *)malloc(scp->xsize*scp->ysize*sizeof(u_short), - M_DEVBUF, M_WAITOK); -#endif + scp->scr_buf = (u_short *) + malloc(scp->xsize*scp->ysize*sizeof(u_short), M_DEVBUF, M_WAITOK); + scp->cursor_pos = scp->cursor_oldpos = + scp->scr_buf + scp->xpos + scp->ypos * scp->xsize; + scp->mouse_pos = scp->mouse_oldpos = + scp->scr_buf + ((scp->mouse_ypos/scp->font_size)*scp->xsize + + scp->mouse_xpos/8); free(cut_buffer, M_DEVBUF); cut_buffer = (char *)malloc(scp->xsize*scp->ysize, M_DEVBUF, M_NOWAIT); cut_buffer[0] = 0x00; if (scp == cur_console) set_mode(scp); + scp->status &= ~UNKNOWN_MODE; clear_screen(scp); if (tp->t_winsize.ws_col != scp->xsize || tp->t_winsize.ws_row != scp->ysize) { @@ -1136,17 +1105,18 @@ scioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p) if (!crtc_vga || video_mode_ptr == NULL) return ENXIO; scp->mode = cmd & 0xFF; - scp->status |= UNKNOWN_MODE; /* graphics mode */ - scp->xsize = (*(video_mode_ptr + (scp->mode*64))) * 8; - scp->ysize = (*(video_mode_ptr + (scp->mode*64) + 1) + 1) * + scp->xpixel = (*(video_mode_ptr + (scp->mode*64))) * 8; + scp->ypixel = (*(video_mode_ptr + (scp->mode*64) + 1) + 1) * (*(video_mode_ptr + (scp->mode*64) + 2)); - set_mode(scp); + if (scp == cur_console) + set_mode(scp); + scp->status |= UNKNOWN_MODE; /* graphics mode */ /* clear_graphics();*/ - if (tp->t_winsize.ws_xpixel != scp->xsize - || tp->t_winsize.ws_ypixel != scp->ysize) { - tp->t_winsize.ws_xpixel = scp->xsize; - tp->t_winsize.ws_ypixel = scp->ysize; + if (tp->t_winsize.ws_xpixel != scp->xpixel + || tp->t_winsize.ws_ypixel != scp->ypixel) { + tp->t_winsize.ws_xpixel = scp->xpixel; + tp->t_winsize.ws_ypixel = scp->ypixel; pgsignal(tp->t_pgrp, SIGWINCH, 1); } return 0; @@ -1249,6 +1219,7 @@ scioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p) case KDSETMODE: /* set current mode of this (virtual) console */ switch (*data) { case KD_TEXT: /* switch to TEXT (known) mode */ +#ifndef PC98 /* restore fonts & palette ! */ if (crtc_vga) { if (fonts_loaded & FONT_8) @@ -1262,14 +1233,16 @@ scioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p) load_palette(); } /* FALL THROUGH */ - +#endif case KD_TEXT1: /* switch to TEXT (known) mode */ /* no restore fonts & palette */ +#ifdef PC98 scp->status &= ~UNKNOWN_MODE; -#ifndef PC98 +#else if (crtc_vga && video_mode_ptr) #endif set_mode(scp); + scp->status &= ~UNKNOWN_MODE; clear_screen(scp); return 0; @@ -1607,7 +1580,8 @@ sccnputc(dev_t dev, int c) scp->term = kernel_console; current_default = &kernel_default; - if (scp->scr_buf == Crtat) { + if ((scp->scr_buf == buffer || in_debugger) && + !(scp->status & UNKNOWN_MODE)) { remove_cursor_image(scp); } buf[0] = c; @@ -1616,8 +1590,8 @@ sccnputc(dev_t dev, int c) current_default = &user_default; scp->term = save; s = splclock(); - if (/* timers_not_running && */ scp == cur_console) { - if (scp->scr_buf != Crtat && (scp->start <= scp->end)) { + if (scp == cur_console && !(scp->status & UNKNOWN_MODE)) { + if (/* timer not running && */ (scp->start <= scp->end)) { bcopyw(scp->scr_buf + scp->start, Crtat + scp->start, (1 + scp->end - scp->start) * sizeof(u_short)); #ifdef PC98 @@ -1645,13 +1619,41 @@ sccngetc(dev_t dev) int sccncheckc(dev_t dev) { - return (scgetc(1) & 0xff); + int c, s; + + s = spltty(); + c = scgetc(1); + splx(s); + return(c == NOKEY ? -1 : c); /* c == -1 can't happen */ +} + +static scr_stat +*get_scr_stat(dev_t dev) +{ + int unit = minor(dev); + + if (unit == SC_CONSOLE) + return console[0]; + if (unit >= MAXCONS || unit < 0) + return(NULL); + return console[unit]; +} + +static int +get_scr_num() +{ + int i = 0; + + while ((i < MAXCONS) && (cur_console != console[i])) + i++; + return i < MAXCONS ? i : 0; } static void scrn_timer() { scr_stat *scp = cur_console; + int s = spltty(); /* should we just return ? */ if ((scp->status&UNKNOWN_MODE) || blink_in_progress || switch_in_progress) { @@ -1724,9 +1726,10 @@ scrn_timer() scp->end = 0; scp->start = scp->xsize*scp->ysize; } - if (scrn_blank_time && (time.tv_sec>scrn_time_stamp+scrn_blank_time)) + if (scrn_blank_time && (time.tv_sec > scrn_time_stamp+scrn_blank_time)) (*current_saver)(TRUE); timeout((timeout_func_t)scrn_timer, 0, hz/25); + splx(s); } static void @@ -1822,12 +1825,6 @@ exchange_scr(void) move_crsr(new_scp, new_scp->xpos, new_scp->ypos); #ifndef PC98 if ((old_scp->status & UNKNOWN_MODE) && crtc_vga) { - if (fonts_loaded & FONT_8) - copy_font(LOAD, FONT_8, font_8); - if (fonts_loaded & FONT_14) - copy_font(LOAD, FONT_14, font_14); - if (fonts_loaded & FONT_16) - copy_font(LOAD, FONT_16, font_16); if (flags & CHAR_CURSOR) set_destructive_cursor(new_scp); load_palette(); @@ -2710,16 +2707,12 @@ ansi_put(scr_stat *scp, u_char *buf, int len) u_short i, kanji_code; #endif - if (scp->status & UNKNOWN_MODE) - return; - /* make screensaver happy */ if (scp == cur_console) { scrn_time_stamp = time.tv_sec; if (scrn_blanked) { (*current_saver)(FALSE); - cur_console->start = 0; - cur_console->end = cur_console->xsize * cur_console->ysize; + mark_all(scp); } } write_in_progress++; @@ -3064,8 +3057,8 @@ scinit(void) current_default = &user_default; console[0] = &main_console; init_scp(console[0]); - console[0]->scr_buf = console[0]->mouse_pos = Crtat; - console[0]->cursor_pos = console[0]->cursor_oldpos = Crtat + hw_cursor; + console[0]->scr_buf = console[0]->mouse_pos = buffer; + console[0]->cursor_pos = console[0]->cursor_oldpos = buffer + hw_cursor; #ifdef PC98 console[0]->atr_buf = Atrat; console[0]->cursor_atr = Atrat + hw_cursor; @@ -3113,10 +3106,12 @@ static scr_stat M_DEVBUF, M_WAITOK); bzero(scp->his_atr_head, scp->history_size*sizeof(u_short)); #endif +/* SOS #ifndef PC98 if (crtc_vga && video_mode_ptr) #endif set_mode(scp); +*/ clear_screen(scp); return scp; } @@ -3191,27 +3186,6 @@ static u_char } static void -update_leds(int which) -{ -#ifndef PC98 - int s; - static u_char xlate_leds[8] = { 0, 4, 2, 6, 1, 5, 3, 7 }; - - /* replace CAPS led with ALTGR led for ALTGR keyboards */ - if (key_map.n_keys > ALTGR_OFFSET) { - if (which & ALKED) - which |= CLKED; - else - which &= ~CLKED; - } - s = spltty(); - kbd_cmd(KB_SETLEDS); - kbd_cmd(xlate_leds[which & LED_MASK]); - splx(s); -#endif -} - -static void history_to_screen(scr_stat *scp) { int i; @@ -3269,7 +3243,7 @@ history_down_line(scr_stat *scp) * If noblock = 0 wait until a key is pressed. * Else return NOKEY. */ -u_int +static u_int scgetc(int noblock) { u_char scancode, keycode; @@ -3280,7 +3254,7 @@ scgetc(int noblock) next_code: kbd_wait(); - /* First see if there is something in the keyboard port */ + /* first see if there is something in the keyboard port */ if (inb(KB_STAT) & KB_BUF_FULL) #ifdef PC98 { @@ -3295,6 +3269,7 @@ next_code: else goto next_code; + /* do the /dev/random device a favour */ add_keyboard_randomness(scancode); if (cur_console->status & KBD_RAW_MODE) @@ -3304,7 +3279,7 @@ next_code: switch (esc_flag) { case 0x00: /* normal scancode */ switch(scancode) { - case 0xB8: /* left alt (compose key) */ + case 0xB8: /* left alt (compose key) */ if (compose) { compose = 0; if (chr > 255) { @@ -3619,6 +3594,9 @@ next_code: switch (action) { /* LOCKING KEYS */ case NLK: +#ifdef SC_SPLASH_SCREEN + toggle_splash_screen(cur_console); /* SOS XXX */ +#endif if (!nlkcnt) { nlkcnt++; if (cur_console->status & NLKED) @@ -3708,6 +3686,11 @@ next_code: /* NON-LOCKING KEYS */ case NOP: break; + case SPSC: +#ifdef SC_SPLASH_SCREEN + toggle_splash_screen(cur_console); +#endif + break; case RBT: shutdown_nice(); break; @@ -3722,7 +3705,9 @@ next_code: if (cur_console->smode.mode == VT_AUTO && console[0]->smode.mode == VT_AUTO) switch_scr(cur_console, 0); + in_debugger = TRUE; Debugger("manual escape to debugger"); + in_debugger = FALSE; return(NOKEY); #else printf("No debugger in kernel\n"); @@ -3776,6 +3761,32 @@ next_code: goto next_code; } +#ifdef SC_SPLASH_SCREEN +static void +toggle_splash_screen(scr_stat *scp) +{ + static int toggle = 0; + static u_char save_mode; + int s = splhigh(); + + if (toggle) { + scp->mode = save_mode; + scp->status &= ~UNKNOWN_MODE; + set_mode(scp); + toggle = 0; + } + else { + save_mode = scp->mode; + scp->mode = M_VGA_CG320; + scp->status |= UNKNOWN_MODE; + set_mode(scp); + /* load image */ + toggle = 1; + } + splx(s); +} +#endif + int scmmap(dev_t dev, int offset, int nprot) { @@ -3788,6 +3799,35 @@ scmmap(dev_t dev, int offset, int nprot) return i386_btop((VIDEOMEM + offset)); } +/* + * Calculate hardware attributes word using logical attributes mask and + * hardware colors + */ + +static int +mask2attr(struct term_stat *term) +{ + int attr, mask = term->attr_mask; + + if (mask & REVERSE_ATTR) { + attr = ((mask & FOREGROUND_CHANGED) ? + ((term->cur_color & 0xF000) >> 4) : + (term->rev_color & 0x0F00)) | + ((mask & BACKGROUND_CHANGED) ? + ((term->cur_color & 0x0F00) << 4) : + (term->rev_color & 0xF000)); + } else + attr = term->cur_color; + + /* XXX: underline mapping for Hercules adapter can be better */ + if (mask & (BOLD_ATTR | UNDERLINE_ATTR)) + attr ^= 0x0800; + if (mask & BLINK_ATTR) + attr ^= 0x8000; + + return attr; +} + static void kbd_wait(void) { @@ -3828,6 +3868,27 @@ kbd_cmd(u_char command) } #endif +static void +update_leds(int which) +{ +#ifndef PC98 + int s; + static u_char xlate_leds[8] = { 0, 4, 2, 6, 1, 5, 3, 7 }; + + /* replace CAPS led with ALTGR led for ALTGR keyboards */ + if (key_map.n_keys > ALTGR_OFFSET) { + if (which & ALKED) + which |= CLKED; + else + which &= ~CLKED; + } + s = spltty(); + kbd_cmd(KB_SETLEDS); + kbd_cmd(xlate_leds[which & LED_MASK]); + splx(s); +#endif +} + void set_mode(scr_stat *scp) { @@ -3863,22 +3924,22 @@ set_mode(scr_stat *scp) #else switch (scp->mode) { case M_VGA_M80x60: - bcopyw(video_mode_ptr+(64*M_VGA_M80x25),&special_modetable, 64); + bcopyw(video_mode_ptr+(64*M_VGA_M80x25), &special_modetable, 64); goto special_80x60; case M_VGA_C80x60: - bcopyw(video_mode_ptr+(64*M_VGA_C80x25),&special_modetable, 64); + bcopyw(video_mode_ptr+(64*M_VGA_C80x25), &special_modetable, 64); special_80x60: special_modetable[2] = 0x08; special_modetable[19] = 0x47; goto special_480l; case M_VGA_M80x30: - bcopyw(video_mode_ptr+(64*M_VGA_M80x25),&special_modetable, 64); + bcopyw(video_mode_ptr+(64*M_VGA_M80x25), &special_modetable, 64); goto special_80x30; case M_VGA_C80x30: - bcopyw(video_mode_ptr+(64*M_VGA_C80x25),&special_modetable, 64); + bcopyw(video_mode_ptr+(64*M_VGA_C80x25), &special_modetable, 64); special_80x30: special_modetable[19] = 0x4f; special_480l: @@ -3893,21 +3954,21 @@ special_480l: goto setup_mode; case M_ENH_B80x43: - bcopyw(video_mode_ptr+(64*M_ENH_B80x25),&special_modetable, 64); + bcopyw(video_mode_ptr+(64*M_ENH_B80x25), &special_modetable, 64); goto special_80x43; case M_ENH_C80x43: - bcopyw(video_mode_ptr+(64*M_ENH_C80x25),&special_modetable, 64); + bcopyw(video_mode_ptr+(64*M_ENH_C80x25), &special_modetable, 64); special_80x43: special_modetable[28] = 87; goto special_80x50; case M_VGA_M80x50: - bcopyw(video_mode_ptr+(64*M_VGA_M80x25),&special_modetable, 64); + bcopyw(video_mode_ptr+(64*M_VGA_M80x25), &special_modetable, 64); goto special_80x50; case M_VGA_C80x50: - bcopyw(video_mode_ptr+(64*M_VGA_C80x25),&special_modetable, 64); + bcopyw(video_mode_ptr+(64*M_VGA_C80x25), &special_modetable, 64); special_80x50: special_modetable[2] = 8; special_modetable[19] = 7; @@ -3928,14 +3989,21 @@ setup_mode: /* set font type (size) */ if (scp->font_size < FONT_14) { + if (fonts_loaded & FONT_8) + copy_font(LOAD, FONT_8, font_8); outb(TSIDX, 0x03); outb(TSREG, 0x0A); /* font 2 */ } else if (scp->font_size >= FONT_16) { + if (fonts_loaded & FONT_16) + copy_font(LOAD, FONT_16, font_16); outb(TSIDX, 0x03); outb(TSREG, 0x00); /* font 0 */ } else { + if (fonts_loaded & FONT_14) + copy_font(LOAD, FONT_14, font_14); outb(TSIDX, 0x03); outb(TSREG, 0x05); /* font 1 */ } if (flags & CHAR_CURSOR) set_destructive_cursor(scp); + mark_all(scp); break; case M_BG320: case M_CG320: case M_BG640: @@ -4004,7 +4072,7 @@ set_vgaregs(char *modetable) outb(GDCREG, modetable[i+55]); } inb(crtc_addr+6); /* reset flip-flop */ - outb(ATC ,0x20); /* enable palette */ + outb(ATC, 0x20); /* enable palette */ splx(s); } @@ -4012,8 +4080,10 @@ static void set_font_mode() { /* setup vga for loading fonts (graphics plane mode) */ - inb(crtc_addr+6); - outb(ATC, 0x30); outb(ATC, 0x01); + inb(crtc_addr+6); /* reset flip-flop */ + outb(ATC, 0x10); outb(ATC, 0x01); + inb(crtc_addr+6); /* reset flip-flop */ + outb(ATC, 0x20); /* enable palette */ #if SLOW_VGA outb(TSIDX, 0x02); outb(TSREG, 0x04); outb(TSIDX, 0x04); outb(TSREG, 0x06); @@ -4032,31 +4102,64 @@ set_font_mode() static void set_normal_mode() { + char *modetable; int s = splhigh(); + switch (cur_console->mode) { + case M_VGA_M80x60: + case M_VGA_M80x50: + case M_VGA_M80x30: + modetable = video_mode_ptr + (64*M_VGA_M80x25); + break; + + case M_VGA_C80x60: + case M_VGA_C80x50: + case M_VGA_C80x30: + modetable = video_mode_ptr + (64*M_VGA_C80x25); + break; + + case M_ENH_B80x43: + modetable = video_mode_ptr + (64*M_ENH_B80x25); + break; + + case M_ENH_C80x43: + modetable = video_mode_ptr + (64*M_ENH_C80x25); + break; + + case M_VGA_C40x25: case M_VGA_C80x25: + case M_VGA_M80x25: + case M_B40x25: case M_C40x25: + case M_B80x25: case M_C80x25: + case M_ENH_B40x25: case M_ENH_C40x25: + case M_ENH_B80x25: case M_ENH_C80x25: + + case M_BG320: case M_CG320: case M_BG640: + case M_CG320_D: case M_CG640_E: + case M_CG640x350: case M_ENH_CG640: + case M_BG640x480: case M_CG640x480: case M_VGA_CG320: + modetable = video_mode_ptr + (cur_console->mode * 64); + + default: + modetable = video_mode_ptr + (64*M_VGA_C80x25); + } + /* setup vga for normal operation mode again */ - inb(crtc_addr+6); - outb(ATC, 0x30); outb(ATC, 0x0C); + inb(crtc_addr+6); /* reset flip-flop */ + outb(ATC, 0x10); outb(ATC, modetable[0x10+35]); + inb(crtc_addr+6); /* reset flip-flop */ + outb(ATC, 0x20); /* enable palette */ #if SLOW_VGA - outb(TSIDX, 0x02); outb(TSREG, 0x03); - outb(TSIDX, 0x04); outb(TSREG, 0x02); - outb(GDCIDX, 0x04); outb(GDCREG, 0x00); - outb(GDCIDX, 0x05); outb(GDCREG, 0x10); - if (crtc_addr == MONO_BASE) { - outb(GDCIDX, 0x06); outb(GDCREG, 0x0A); /* addr = b0000, 32kb */ - } - else { - outb(GDCIDX, 0x06); outb(GDCREG, 0x0E); /* addr = b8000, 32kb */ - } + outb(TSIDX, 0x02); outb(TSREG, modetable[0x02+4]); + outb(TSIDX, 0x04); outb(TSREG, modetable[0x04+4]); + outb(GDCIDX, 0x04); outb(GDCREG, modetable[0x04+55]); + outb(GDCIDX, 0x05); outb(GDCREG, modetable[0x05+55]); + outb(GDCIDX, 0x06); outb(GDCREG, modetable[0x06+55]); #else - outw(TSIDX, 0x0302); - outw(TSIDX, 0x0204); - outw(GDCIDX, 0x0004); - outw(GDCIDX, 0x1005); - if (crtc_addr == MONO_BASE) - outw(GDCIDX, 0x0A06); /* addr = b0000, 32kb */ - else - outw(GDCIDX, 0x0E06); /* addr = b8000, 32kb */ + outw(TSIDX, 0x0002 | (modetable[0x02+4]<<8)); + outw(TSIDX, 0x0004 | (modetable[0x04+4]<<8)); + outw(GDCIDX, 0x0004 | (modetable[0x04+55]<<8)); + outw(GDCIDX, 0x0005 | (modetable[0x05+55]<<8)); + outw(GDCIDX, 0x0006 | (modetable[0x06+55]<<8)); #endif splx(s); } @@ -4069,6 +4172,10 @@ copy_font(int operation, int font_type, char* font_image) int ch, line, segment, fontsize; u_char val; + /* dont mess with console we dont know video mode on */ + if (cur_console->status & UNKNOWN_MODE) + return; + switch (font_type) { default: case FONT_8: @@ -4430,6 +4537,14 @@ do_bell(scr_stat *scp, int pitch, int duration) pitch *= 2; sysbeep(pitch, duration); } + +#ifdef SC_SPLASH_SCREEN + /* + * Now put up a graphics image, and maybe cycle a + * couble of palette entries for simple animation. + */ + toggle_splash_screen(cur_console); +#endif } static void diff --git a/sys/pc98/pc98/syscons.h b/sys/pc98/pc98/syscons.h index 74b6209..5504b48 100644 --- a/sys/pc98/pc98/syscons.h +++ b/sys/pc98/pc98/syscons.h @@ -25,7 +25,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: syscons.h,v 1.2 1996/07/23 07:46:42 asami Exp $ + * $Id: syscons.h,v 1.3 1996/09/04 09:52:31 asami Exp $ */ #ifndef _PC98_PC98_SYSCONS_H_ @@ -168,8 +168,10 @@ typedef struct scr_stat { #endif int xpos; /* current X position */ int ypos; /* current Y position */ - int xsize; /* X size */ - int ysize; /* Y size */ + int xsize; /* X text size */ + int ysize; /* Y text size */ + int xpixel; /* X graphics size */ + int ypixel; /* Y graphics size */ int font_size; /* fontsize in Y direction */ int start; /* modified area start */ int end; /* modified area end */ diff --git a/sys/pc98/pc98/wd.c b/sys/pc98/pc98/wd.c index 3b3f896..192e5a4 100644 --- a/sys/pc98/pc98/wd.c +++ b/sys/pc98/pc98/wd.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)wd.c 7.2 (Berkeley) 5/9/91 - * $Id: wd.c,v 1.6 1996/09/03 10:24:02 asami Exp $ + * $Id: wd.c,v 1.7 1996/09/10 09:38:45 asami Exp $ */ /* TODO: @@ -1952,7 +1952,7 @@ wddump(dev_t dev) static int wddoingadump = 0; /* Toss any characters present prior to dump. */ - while (cncheckc()) + while (cncheckc() != -1) ; /* Check for acceptable device. */ @@ -2116,7 +2116,7 @@ out: blknum = blknext; /* Operator aborting dump? */ - if (cncheckc()) + if (cncheckc() != -1) return (EINTR); } return (0); |