diff options
author | asami <asami@FreeBSD.org> | 1996-12-04 04:21:30 +0000 |
---|---|---|
committer | asami <asami@FreeBSD.org> | 1996-12-04 04:21:30 +0000 |
commit | 4d75d96d6e8b3a6ef3d9dcc16b1e9414af327f0e (patch) | |
tree | 831132bfb2b67db35a39dbefea550540aed9f2e5 /sys | |
parent | 9f9a264468b750a54926044aeb6ce697f0dedb87 (diff) | |
download | FreeBSD-src-4d75d96d6e8b3a6ef3d9dcc16b1e9414af327f0e.zip FreeBSD-src-4d75d96d6e8b3a6ef3d9dcc16b1e9414af327f0e.tar.gz |
Synchronize with the RELENG_2_2 branch.
Definite 2.2 candidate.
Submitted by: The FreeBSD(98) Development Team
Diffstat (limited to 'sys')
31 files changed, 861 insertions, 459 deletions
diff --git a/sys/alpha/include/console.h b/sys/alpha/include/console.h index de049da..0a5956b 100644 --- a/sys/alpha/include/console.h +++ b/sys/alpha/include/console.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: console.h,v 1.25 1996/09/30 23:00:23 sos Exp $ + * $Id: console.h,v 1.26 1996/11/14 22:18:31 sos Exp $ */ #ifndef _MACHINE_CONSOLE_H_ @@ -272,14 +272,6 @@ typedef struct ssaver ssaver_t; #define MKEY 0x400 /* meta key marker (prepend ESC)*/ #define BKEY 0x800 /* backtab (ESC [ Z) */ -#ifdef PC98 -#define KB_DATA 0x41 /* kbd data port */ -#define KB_STAT 0x43 /* kbd status port */ -#define KB_BUF_FULL 0x02 /* kbd has char pending */ -#define KB_READY 0x02 /* kbd ready for command */ -#define KB_WRITE 0x43 /* kbd write command */ -#endif - /* video mode definitions */ #ifdef PC98 #define M_PC98_80x25 98 /* PC98 80x25 */ diff --git a/sys/conf/files.pc98 b/sys/conf/files.pc98 index e93ff11..201b07d 100644 --- a/sys/conf/files.pc98 +++ b/sys/conf/files.pc98 @@ -3,7 +3,7 @@ # # modified for PC-9801 # -# $Id: files.pc98,v 1.10 1996/11/02 10:38:45 asami Exp $ +# $Id: files.pc98,v 1.11 1996/11/09 00:39:19 asami Exp $ # aic7xxx_asm optional ahc device-driver \ dependency "$S/dev/aic7xxx/aic7xxx_asm.c" \ @@ -84,11 +84,10 @@ i386/ibcs2/ibcs2_sysent.c optional ibcs2 i386/ibcs2/ibcs2_sysvec.c optional ibcs2 i386/ibcs2/imgact_coff.c optional ibcs2 pc98/pc98/pc98_machdep.c standard -pc98/pc98/bs/bs.c optional bs device-driver -pc98/pc98/bs/bsfunc.c optional bs device-driver -pc98/pc98/bs/bshw.c optional bs device-driver -pc98/pc98/bs/bsif.c optional bs device-driver -pc98/pc98/sbic55.c optional sbic device-driver +i386/isa/bs/bs.c optional bs device-driver +i386/isa/bs/bsfunc.c optional bs device-driver +i386/isa/bs/bshw.c optional bs device-driver +i386/isa/bs/bsif.c optional bs device-driver #i386/pc98/aha1542.c optional aha device-driver i386/isa/aic6360.c optional aic device-driver pc98/pc98/b004.c optional bqu device-driver @@ -124,6 +123,8 @@ i386/isa/if_zp.c optional zp device-driver pc98/pc98/pc98.c optional isa device-driver pc98/isa/istallion.c optional stli device-driver pc98/isa/joy.c optional joy device-driver +i386/isa/kbdio.c optional psm device-driver +i386/isa/kbdio.c optional sc device-driver pc98/pc98/labpc.c optional labpc device-driver pc98/pc98/lpt.c optional lpt device-driver pc98/pc98/mcd.c optional mcd device-driver @@ -198,6 +199,7 @@ i386/isa/sound/midi_synth.c optional uart device-driver i386/isa/sound/midibuf.c optional uart device-driver i386/isa/sound/trix.c optional trix device-driver i386/isa/sound/sscape.c optional sscape device-driver +i386/isa/sound/awe_wave.c optional awe device-driver pc98/isa/spigot.c optional spigot device-driver pc98/pc98/spkr.c optional speaker device-driver pc98/isa/stallion.c optional stl device-driver diff --git a/sys/conf/options.pc98 b/sys/conf/options.pc98 index 0d622c9..27e45f9 100644 --- a/sys/conf/options.pc98 +++ b/sys/conf/options.pc98 @@ -1,4 +1,4 @@ -# $Id: options.pc98,v 1.9 1996/11/02 10:38:48 asami Exp $ +# $Id: options.pc98,v 1.10 1996/11/13 02:00:14 asami Exp $ BOUNCEPAGES opt_bounce.h USER_LDT MATH_EMULATE opt_math_emulate.h @@ -42,13 +42,9 @@ I486_CPU opt_cpu.h I586_CPU opt_cpu.h I686_CPU opt_cpu.h -I586_OPTIMIZED_BCOPY opt_temporary.h -I586_OPTIMIZED_BZERO opt_temporary.h - SC_SPLASH_SCREEN opt_syscons.h MAXCONS opt_syscons.h SLOW_VGA opt_syscons.h -XT_KEYBOARD opt_syscons.h ATAPI opt_atapi.h ATAPI_STATIC opt_atapi.h diff --git a/sys/i386/include/console.h b/sys/i386/include/console.h index de049da..0a5956b 100644 --- a/sys/i386/include/console.h +++ b/sys/i386/include/console.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: console.h,v 1.25 1996/09/30 23:00:23 sos Exp $ + * $Id: console.h,v 1.26 1996/11/14 22:18:31 sos Exp $ */ #ifndef _MACHINE_CONSOLE_H_ @@ -272,14 +272,6 @@ typedef struct ssaver ssaver_t; #define MKEY 0x400 /* meta key marker (prepend ESC)*/ #define BKEY 0x800 /* backtab (ESC [ Z) */ -#ifdef PC98 -#define KB_DATA 0x41 /* kbd data port */ -#define KB_STAT 0x43 /* kbd status port */ -#define KB_BUF_FULL 0x02 /* kbd has char pending */ -#define KB_READY 0x02 /* kbd ready for command */ -#define KB_WRITE 0x43 /* kbd write command */ -#endif - /* video mode definitions */ #ifdef PC98 #define M_PC98_80x25 98 /* PC98 80x25 */ diff --git a/sys/i386/isa/kbdio.c b/sys/i386/isa/kbdio.c index 797dcff..214e1d9 100644 --- a/sys/i386/isa/kbdio.c +++ b/sys/i386/isa/kbdio.c @@ -26,14 +26,18 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: kbdio.c,v 1.1 1996/11/14 22:19:06 sos Exp $ + * $Id: kbdio.c,v 1.2 1996/12/01 19:05:44 sos Exp $ */ #include <sys/param.h> #include <sys/systm.h> #include <sys/syslog.h> #include <machine/clock.h> +#ifdef PC98 +#include <pc98/pc98/pc98.h> +#else #include <i386/isa/isa.h> +#endif #include <i386/isa/isa_device.h> #include <i386/isa/kbdio.h> @@ -46,18 +50,25 @@ static int verbose = KBDIO_DEBUG; /* * device I/O routines */ + + int wait_while_controller_busy(int port) { +#ifdef PC98 + DELAY(KBDC_DELAYTIME); + return TRUE; +#else /* CPU will stay inside the loop for 100msec at most */ int retry = 5000; while (inb(port + KBD_STATUS_PORT) & KBDS_INPUT_BUFFER_FULL) { - DELAY(20); + DELAY(KBDC_DELAYTIME); if (--retry < 0) return FALSE; } return TRUE; +#endif } /* @@ -71,11 +82,11 @@ wait_for_data(int port) int retry = 10000; while ((inb(port + KBD_STATUS_PORT) & KBDS_ANY_BUFFER_FULL) == 0) { - DELAY(20); + DELAY(KBDC_DELAYTIME); if (--retry < 0) return FALSE; } - DELAY(7); + DELAY(KBDD_DELAYTIME); return TRUE; } @@ -88,11 +99,11 @@ wait_for_kbd_data(int port) while ((inb(port + KBD_STATUS_PORT) & KBDS_BUFFER_FULL) != KBDS_KBD_BUFFER_FULL) { - DELAY(20); + DELAY(KBDC_DELAYTIME); if (--retry < 0) return FALSE; } - DELAY(7); + DELAY(KBDD_DELAYTIME); return TRUE; } @@ -105,11 +116,11 @@ wait_for_aux_data(int port) while ((inb(port + KBD_STATUS_PORT) & KBDS_BUFFER_FULL) != KBDS_AUX_BUFFER_FULL) { - DELAY(20); + DELAY(KBDC_DELAYTIME); if (--retry < 0) return FALSE; } - DELAY(7); + DELAY(KBDD_DELAYTIME); return TRUE; } @@ -254,6 +265,9 @@ read_kbd_data(int port) { if (!wait_for_kbd_data(port)) return -1; /* timeout */ +#ifdef PC98 + DELAY(KBDC_DELAYTIME); +#endif return inb(port + KBD_DATA_PORT); } @@ -266,7 +280,7 @@ read_kbd_data_no_wait(int port) if ((inb(port + KBD_STATUS_PORT) & KBDS_BUFFER_FULL) != KBDS_KBD_BUFFER_FULL) return -1; /* no data */ - DELAY(7); + DELAY(KBDD_DELAYTIME); return inb(port + KBD_DATA_PORT); } @@ -290,7 +304,7 @@ empty_kbd_buffer(int port, int t) for (; t > 0; t -= delta) { if ((inb(port + KBD_STATUS_PORT) & KBDS_BUFFER_FULL) == KBDS_KBD_BUFFER_FULL) { - DELAY(7); + DELAY(KBDD_DELAYTIME); b = inb(port + KBD_DATA_PORT); ++c; } @@ -311,7 +325,7 @@ empty_aux_buffer(int port, int t) for (; t > 0; t -= delta) { if ((inb(port + KBD_STATUS_PORT) & KBDS_BUFFER_FULL) == KBDS_AUX_BUFFER_FULL) { - DELAY(7); + DELAY(KBDD_DELAYTIME); b = inb(port + KBD_DATA_PORT); ++c; } @@ -331,7 +345,7 @@ empty_both_buffers(int port, int t) for (; t > 0; t -= delta) { if (inb(port + KBD_STATUS_PORT) & KBDS_ANY_BUFFER_FULL) { - DELAY(7); + DELAY(KBDD_DELAYTIME); b = inb(port + KBD_DATA_PORT); ++c; } diff --git a/sys/i386/isa/kbdio.h b/sys/i386/isa/kbdio.h index 5833b86..950d3e9 100644 --- a/sys/i386/isa/kbdio.h +++ b/sys/i386/isa/kbdio.h @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: kbdio.h,v 1.1 1996/11/14 22:19:09 sos Exp $ + * $Id: kbdio.h,v 1.2 1996/12/01 19:05:45 sos Exp $ */ #ifndef _I386_ISA_KBDIO_H_ @@ -35,11 +35,19 @@ /* constants */ /* I/O ports */ +#ifdef PC98 +#define KBD_STATUS_PORT 2 /* status port, read */ +#define KBD_COMMAND_PORT 2 /* controller command port, write */ +#define KBD_DATA_PORT 0 /* data port, read/write + also used as keyboard command + and mouse command port */ +#else #define KBD_STATUS_PORT 4 /* status port, read */ #define KBD_COMMAND_PORT 4 /* controller command port, write */ #define KBD_DATA_PORT 0 /* data port, read/write also used as keyboard command and mouse command port */ +#endif /* PC98 */ /* FIXME: `IO_PSMSIZE' should really be in `isa.h'. */ #define IO_PSMSIZE (KBD_COMMAND_PORT - KBD_DATA_PORT + 1) /* 5 */ @@ -110,10 +118,17 @@ #define PSMD_MAX_RATE 255 /* FIXME: not sure if it's possible */ /* status bits (KBD_STATUS_PORT) */ +#ifdef PC98 +#define KBDS_BUFFER_FULL 0x0002 +#define KBDS_ANY_BUFFER_FULL 0x0002 +#define KBDS_KBD_BUFFER_FULL 0x0002 +#define KBDS_AUX_BUFFER_FULL 0x0002 +#else #define KBDS_BUFFER_FULL 0x0021 #define KBDS_ANY_BUFFER_FULL 0x0001 #define KBDS_KBD_BUFFER_FULL 0x0001 #define KBDS_AUX_BUFFER_FULL 0x0021 +#endif #define KBDS_INPUT_BUFFER_FULL 0x0002 /* return code */ @@ -152,6 +167,15 @@ #define KBD_MAXWAIT 5 /* wait 5 times at most after reset */ #endif +/* I/O recovery time */ +#ifdef PC98 +#define KBDC_DELAYTIME 37 +#define KBDD_DELAYTIME 37 +#else +#define KBDC_DELAYTIME 20 +#define KBDD_DELAYTIME 7 +#endif + /* debugging */ /* #define KBDIO_DEBUG produces debugging output */ diff --git a/sys/isa/kbdio.c b/sys/isa/kbdio.c index 797dcff..214e1d9 100644 --- a/sys/isa/kbdio.c +++ b/sys/isa/kbdio.c @@ -26,14 +26,18 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: kbdio.c,v 1.1 1996/11/14 22:19:06 sos Exp $ + * $Id: kbdio.c,v 1.2 1996/12/01 19:05:44 sos Exp $ */ #include <sys/param.h> #include <sys/systm.h> #include <sys/syslog.h> #include <machine/clock.h> +#ifdef PC98 +#include <pc98/pc98/pc98.h> +#else #include <i386/isa/isa.h> +#endif #include <i386/isa/isa_device.h> #include <i386/isa/kbdio.h> @@ -46,18 +50,25 @@ static int verbose = KBDIO_DEBUG; /* * device I/O routines */ + + int wait_while_controller_busy(int port) { +#ifdef PC98 + DELAY(KBDC_DELAYTIME); + return TRUE; +#else /* CPU will stay inside the loop for 100msec at most */ int retry = 5000; while (inb(port + KBD_STATUS_PORT) & KBDS_INPUT_BUFFER_FULL) { - DELAY(20); + DELAY(KBDC_DELAYTIME); if (--retry < 0) return FALSE; } return TRUE; +#endif } /* @@ -71,11 +82,11 @@ wait_for_data(int port) int retry = 10000; while ((inb(port + KBD_STATUS_PORT) & KBDS_ANY_BUFFER_FULL) == 0) { - DELAY(20); + DELAY(KBDC_DELAYTIME); if (--retry < 0) return FALSE; } - DELAY(7); + DELAY(KBDD_DELAYTIME); return TRUE; } @@ -88,11 +99,11 @@ wait_for_kbd_data(int port) while ((inb(port + KBD_STATUS_PORT) & KBDS_BUFFER_FULL) != KBDS_KBD_BUFFER_FULL) { - DELAY(20); + DELAY(KBDC_DELAYTIME); if (--retry < 0) return FALSE; } - DELAY(7); + DELAY(KBDD_DELAYTIME); return TRUE; } @@ -105,11 +116,11 @@ wait_for_aux_data(int port) while ((inb(port + KBD_STATUS_PORT) & KBDS_BUFFER_FULL) != KBDS_AUX_BUFFER_FULL) { - DELAY(20); + DELAY(KBDC_DELAYTIME); if (--retry < 0) return FALSE; } - DELAY(7); + DELAY(KBDD_DELAYTIME); return TRUE; } @@ -254,6 +265,9 @@ read_kbd_data(int port) { if (!wait_for_kbd_data(port)) return -1; /* timeout */ +#ifdef PC98 + DELAY(KBDC_DELAYTIME); +#endif return inb(port + KBD_DATA_PORT); } @@ -266,7 +280,7 @@ read_kbd_data_no_wait(int port) if ((inb(port + KBD_STATUS_PORT) & KBDS_BUFFER_FULL) != KBDS_KBD_BUFFER_FULL) return -1; /* no data */ - DELAY(7); + DELAY(KBDD_DELAYTIME); return inb(port + KBD_DATA_PORT); } @@ -290,7 +304,7 @@ empty_kbd_buffer(int port, int t) for (; t > 0; t -= delta) { if ((inb(port + KBD_STATUS_PORT) & KBDS_BUFFER_FULL) == KBDS_KBD_BUFFER_FULL) { - DELAY(7); + DELAY(KBDD_DELAYTIME); b = inb(port + KBD_DATA_PORT); ++c; } @@ -311,7 +325,7 @@ empty_aux_buffer(int port, int t) for (; t > 0; t -= delta) { if ((inb(port + KBD_STATUS_PORT) & KBDS_BUFFER_FULL) == KBDS_AUX_BUFFER_FULL) { - DELAY(7); + DELAY(KBDD_DELAYTIME); b = inb(port + KBD_DATA_PORT); ++c; } @@ -331,7 +345,7 @@ empty_both_buffers(int port, int t) for (; t > 0; t -= delta) { if (inb(port + KBD_STATUS_PORT) & KBDS_ANY_BUFFER_FULL) { - DELAY(7); + DELAY(KBDD_DELAYTIME); b = inb(port + KBD_DATA_PORT); ++c; } diff --git a/sys/isa/kbdio.h b/sys/isa/kbdio.h index 5833b86..950d3e9 100644 --- a/sys/isa/kbdio.h +++ b/sys/isa/kbdio.h @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: kbdio.h,v 1.1 1996/11/14 22:19:09 sos Exp $ + * $Id: kbdio.h,v 1.2 1996/12/01 19:05:45 sos Exp $ */ #ifndef _I386_ISA_KBDIO_H_ @@ -35,11 +35,19 @@ /* constants */ /* I/O ports */ +#ifdef PC98 +#define KBD_STATUS_PORT 2 /* status port, read */ +#define KBD_COMMAND_PORT 2 /* controller command port, write */ +#define KBD_DATA_PORT 0 /* data port, read/write + also used as keyboard command + and mouse command port */ +#else #define KBD_STATUS_PORT 4 /* status port, read */ #define KBD_COMMAND_PORT 4 /* controller command port, write */ #define KBD_DATA_PORT 0 /* data port, read/write also used as keyboard command and mouse command port */ +#endif /* PC98 */ /* FIXME: `IO_PSMSIZE' should really be in `isa.h'. */ #define IO_PSMSIZE (KBD_COMMAND_PORT - KBD_DATA_PORT + 1) /* 5 */ @@ -110,10 +118,17 @@ #define PSMD_MAX_RATE 255 /* FIXME: not sure if it's possible */ /* status bits (KBD_STATUS_PORT) */ +#ifdef PC98 +#define KBDS_BUFFER_FULL 0x0002 +#define KBDS_ANY_BUFFER_FULL 0x0002 +#define KBDS_KBD_BUFFER_FULL 0x0002 +#define KBDS_AUX_BUFFER_FULL 0x0002 +#else #define KBDS_BUFFER_FULL 0x0021 #define KBDS_ANY_BUFFER_FULL 0x0001 #define KBDS_KBD_BUFFER_FULL 0x0001 #define KBDS_AUX_BUFFER_FULL 0x0021 +#endif #define KBDS_INPUT_BUFFER_FULL 0x0002 /* return code */ @@ -152,6 +167,15 @@ #define KBD_MAXWAIT 5 /* wait 5 times at most after reset */ #endif +/* I/O recovery time */ +#ifdef PC98 +#define KBDC_DELAYTIME 37 +#define KBDD_DELAYTIME 37 +#else +#define KBDC_DELAYTIME 20 +#define KBDD_DELAYTIME 7 +#endif + /* debugging */ /* #define KBDIO_DEBUG produces debugging output */ diff --git a/sys/pc98/boot/biosboot/Makefile b/sys/pc98/boot/biosboot/Makefile index 8da7910..e412b42 100644 --- a/sys/pc98/boot/biosboot/Makefile +++ b/sys/pc98/boot/biosboot/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.5 1996/11/02 10:38:25 asami Exp $ +# $Id: Makefile,v 1.6 1996/11/09 00:17:43 asami Exp $ # PROG= boot @@ -11,6 +11,7 @@ BINMODE= 444 CFLAGS= -O2 -malign-functions=0 -malign-jumps=0 -malign-loops=0 \ -DPC98 -DBOOTWAIT=${BOOTWAIT} -DTIMEOUT=${TIMEOUT} CFLAGS+= -DBOOTSEG=${BOOTSEG} -DBOOTSTACK=${BOOTSTACK} +CFLAGS+= -I${.CURDIR}/../../.. CFLAGS+= ${CWARNFLAGS} # Probe the keyboard and use the serial console if the keyboard isn't found. diff --git a/sys/pc98/boot/biosboot/bios.S b/sys/pc98/boot/biosboot/bios.S index 85c7a41..74a602c 100644 --- a/sys/pc98/boot/biosboot/bios.S +++ b/sys/pc98/boot/biosboot/bios.S @@ -24,7 +24,7 @@ * the rights to redistribute these changes. * * from: Mach, Revision 2.2 92/04/04 11:34:26 rpd - * $Id: bios.S,v 1.1.1.1 1996/06/14 10:04:37 asami Exp $ + * $Id: bios.S,v 1.2 1996/11/09 00:17:49 asami Exp $ */ /* @@ -79,6 +79,8 @@ ENTRY(biosread) mov %esp, %ebp push %ebx + push %esi + push %edi push %ecx push %edx push %es @@ -132,6 +134,8 @@ ENTRY(biosread) pop %es pop %edx pop %ecx + pop %edi + pop %esi pop %ebx pop %ebp @@ -150,6 +154,8 @@ ENTRY(getc) push %ebp mov %esp, %ebp push %ebx /* save %ebx */ + push %esi + push %edi call EXT(prot_to_real) @@ -164,6 +170,8 @@ ENTRY(getc) xor %eax, %eax movb %bl, %al + pop %edi + pop %esi pop %ebx pop %ebp ret @@ -184,6 +192,8 @@ ENTRY(ischar) push %ebp mov %esp, %ebp push %ebx + push %esi + push %edi call EXT(prot_to_real) /* enter real mode */ @@ -202,6 +212,8 @@ nochar: xor %eax, %eax movb %bl, %al + pop %edi + pop %esi pop %ebx pop %ebp ret @@ -218,6 +230,8 @@ ENTRY(get_diskinfo) mov %esp, %ebp push %es push %ebx + push %esi + push %edi push %ecx push %edx @@ -269,6 +283,8 @@ ok: pop %edx pop %ecx + pop %edi + pop %esi pop %ebx pop %es pop %ebp @@ -286,6 +302,10 @@ ENTRY(memsize) push %ebp mov %esp, %ebp push %ebx + push %esi + push %edi + push %esi + push %edi mov 8(%ebp), %ebx @@ -308,6 +328,8 @@ memcnv: shll $7, %eax xdone: + pop %edi + pop %esi pop %ebx pop %ebp ret diff --git a/sys/pc98/cbus/fdc.c b/sys/pc98/cbus/fdc.c index dd5bd79..c7fdef8 100644 --- a/sys/pc98/cbus/fdc.c +++ b/sys/pc98/cbus/fdc.c @@ -43,7 +43,7 @@ * SUCH DAMAGE. * * from: @(#)fd.c 7.4 (Berkeley) 5/25/91 - * $Id: fd.c,v 1.8 1996/11/02 10:39:13 asami Exp $ + * $Id: fd.c,v 1.9 1996/11/09 00:39:52 asami Exp $ * */ @@ -352,6 +352,7 @@ static int volatile fd_debug = 0; #endif /* DEBUG */ /* autoconfig structure */ + struct isa_driver fdcdriver = { fdprobe, fdattach, "fdc", }; @@ -1140,10 +1141,9 @@ in_fdc(fdcu_t fdcu) int baseport = fdc_data[fdcu].baseport; int i, j = 1000000; while ((i = inb(baseport+FDSTS) & (NE7_DIO|NE7_RQM)) - != (NE7_DIO|NE7_RQM) && j-- > 0) { + != (NE7_DIO|NE7_RQM) && j-- > 0) if (i == NE7_RQM) return fdc_err(fdcu, "ready for output in input\n"); - } if (j <= 0) return fdc_err(fdcu, bootverbose? "input ready timeout\n": 0); #ifdef DEBUG diff --git a/sys/pc98/cbus/sio.c b/sys/pc98/cbus/sio.c index c72f7b8..e84a4cd 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.8 1996/10/09 21:46:46 asami Exp $ + * $Id: sio.c,v 1.9 1996/11/02 10:39:44 asami Exp $ */ #include "opt_comconsole.h" @@ -2120,6 +2120,10 @@ sioioctl(dev, cmd, data, flag, p) case TIOCCDTR: (void)commctl(com, TIOCM_DTR, DMBIC); break; + /* + * XXX should disallow changing MCR_RTS if CS_RTS_IFLOW is set. The + * changes get undone on the next call to comparam(). + */ case TIOCMSET: (void)commctl(com, *(int *)data, DMSET); break; @@ -2278,13 +2282,6 @@ repeat: * of input, so enable RTS if it is now disabled and * there is room in the high-level buffer. */ - /* - * XXX this used not to look at CS_RTS_IFLOW. The - * change is to allow full control of MCR_RTS via - * ioctls after turning CS_RTS_IFLOW off. Check - * for races. We shouldn't allow the ioctls while - * CS_RTS_IFLOW is on. - */ #ifdef PC98 if(IS_8251(com->pc98_if_type)) tmp = com_tiocm_get(com) & TIOCM_RTS; @@ -2586,10 +2583,22 @@ retry: #endif if (!(tp->t_state & TS_TTSTOP)) com->state |= CS_TTGO; - if (cflag & CRTS_IFLOW) - com->state |= CS_RTS_IFLOW; /* XXX - secondary changes? */ - else + if (cflag & CRTS_IFLOW) { + com->state |= CS_RTS_IFLOW; + /* + * If CS_RTS_IFLOW just changed from off to on, the change + * needs to be propagated to MCR_RTS. This isn't urgent, + * so do it later by calling comstart() instead of repeating + * a lot of code from comstart() here. + */ + } else if (com->state & CS_RTS_IFLOW) { com->state &= ~CS_RTS_IFLOW; + /* + * CS_RTS_IFLOW just changed from on to off. Force MCR_RTS + * on here, since comstart() won't do it later. + */ + outb(com->modem_ctl_port, com->mcr_image |= MCR_RTS); + } /* * Set up state to handle output flow control. @@ -2624,6 +2633,7 @@ retry: enable_intr(); splx(s); + comstart(tp); return (0); } @@ -2663,19 +2673,16 @@ comstart(tp) #endif outb(com->modem_ctl_port, com->mcr_image &= ~MCR_RTS); } else { - /* - * XXX don't raise MCR_RTS if CTS_RTS_IFLOW is off. Set it - * appropriately in comparam() if RTS-flow is being changed. - * Check for races. - */ #ifdef PC98 if(IS_8251(com->pc98_if_type)) tmp = com_tiocm_get(com) & TIOCM_RTS; else tmp = com->mcr_image & MCR_RTS; - if (!(tmp) && com->iptr < com->ihighwater) + if (!(tmp) && com->iptr < com->ihighwater + && com->state & CS_RTS_IFLOW) #else - if (!(com->mcr_image & MCR_RTS) && com->iptr < com->ihighwater) + if (!(com->mcr_image & MCR_RTS) && com->iptr < com->ihighwater + && com->state & CS_RTS_IFLOW) #endif #ifdef PC98 if(IS_8251(com->pc98_if_type)) diff --git a/sys/pc98/conf/files.pc98 b/sys/pc98/conf/files.pc98 index e93ff11..201b07d 100644 --- a/sys/pc98/conf/files.pc98 +++ b/sys/pc98/conf/files.pc98 @@ -3,7 +3,7 @@ # # modified for PC-9801 # -# $Id: files.pc98,v 1.10 1996/11/02 10:38:45 asami Exp $ +# $Id: files.pc98,v 1.11 1996/11/09 00:39:19 asami Exp $ # aic7xxx_asm optional ahc device-driver \ dependency "$S/dev/aic7xxx/aic7xxx_asm.c" \ @@ -84,11 +84,10 @@ i386/ibcs2/ibcs2_sysent.c optional ibcs2 i386/ibcs2/ibcs2_sysvec.c optional ibcs2 i386/ibcs2/imgact_coff.c optional ibcs2 pc98/pc98/pc98_machdep.c standard -pc98/pc98/bs/bs.c optional bs device-driver -pc98/pc98/bs/bsfunc.c optional bs device-driver -pc98/pc98/bs/bshw.c optional bs device-driver -pc98/pc98/bs/bsif.c optional bs device-driver -pc98/pc98/sbic55.c optional sbic device-driver +i386/isa/bs/bs.c optional bs device-driver +i386/isa/bs/bsfunc.c optional bs device-driver +i386/isa/bs/bshw.c optional bs device-driver +i386/isa/bs/bsif.c optional bs device-driver #i386/pc98/aha1542.c optional aha device-driver i386/isa/aic6360.c optional aic device-driver pc98/pc98/b004.c optional bqu device-driver @@ -124,6 +123,8 @@ i386/isa/if_zp.c optional zp device-driver pc98/pc98/pc98.c optional isa device-driver pc98/isa/istallion.c optional stli device-driver pc98/isa/joy.c optional joy device-driver +i386/isa/kbdio.c optional psm device-driver +i386/isa/kbdio.c optional sc device-driver pc98/pc98/labpc.c optional labpc device-driver pc98/pc98/lpt.c optional lpt device-driver pc98/pc98/mcd.c optional mcd device-driver @@ -198,6 +199,7 @@ i386/isa/sound/midi_synth.c optional uart device-driver i386/isa/sound/midibuf.c optional uart device-driver i386/isa/sound/trix.c optional trix device-driver i386/isa/sound/sscape.c optional sscape device-driver +i386/isa/sound/awe_wave.c optional awe device-driver pc98/isa/spigot.c optional spigot device-driver pc98/pc98/spkr.c optional speaker device-driver pc98/isa/stallion.c optional stl device-driver diff --git a/sys/pc98/conf/options.pc98 b/sys/pc98/conf/options.pc98 index 0d622c9..27e45f9 100644 --- a/sys/pc98/conf/options.pc98 +++ b/sys/pc98/conf/options.pc98 @@ -1,4 +1,4 @@ -# $Id: options.pc98,v 1.9 1996/11/02 10:38:48 asami Exp $ +# $Id: options.pc98,v 1.10 1996/11/13 02:00:14 asami Exp $ BOUNCEPAGES opt_bounce.h USER_LDT MATH_EMULATE opt_math_emulate.h @@ -42,13 +42,9 @@ I486_CPU opt_cpu.h I586_CPU opt_cpu.h I686_CPU opt_cpu.h -I586_OPTIMIZED_BCOPY opt_temporary.h -I586_OPTIMIZED_BZERO opt_temporary.h - SC_SPLASH_SCREEN opt_syscons.h MAXCONS opt_syscons.h SLOW_VGA opt_syscons.h -XT_KEYBOARD opt_syscons.h ATAPI opt_atapi.h ATAPI_STATIC opt_atapi.h diff --git a/sys/pc98/i386/locore.s b/sys/pc98/i386/locore.s index 12fe5b4..d098f5a 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.5 1996/10/23 07:24:59 asami Exp $ + * $Id: locore.s,v 1.6 1996/11/09 00:39:35 asami Exp $ * * originally from: locore.s, by William F. Jolitz * @@ -164,9 +164,10 @@ _bdb_exists: .long 0 * prot = protection bits */ #define fillkpt(base, prot) \ - shll $2, %ebx ; \ - addl base, %ebx ; \ - orl $PG_V+prot, %eax ; \ + shll $2,%ebx ; \ + addl base,%ebx ; \ + orl $PG_V,%eax ; \ + orl prot,%eax ; \ 1: movl %eax,(%ebx) ; \ addl $PAGE_SIZE,%eax ; /* increment physical address */ \ addl $4,%ebx ; /* next pte */ \ @@ -376,6 +377,7 @@ begin: 1: #endif #if defined(IBM_486SLC) && defined(I486_CPU) +/* optimization */ cli movl %cr0,%eax orl $0x40000000,%eax # disable cache @@ -433,29 +435,27 @@ begin: outb %al,$0x23 movb $0x0e8,%al # CCR4 outb %al,$0x22 + movb $0x18, %al # DTE_EN, MEM_BYP #ifdef FASTER_5X86_FPU - movb $0x38,%al # DTE_EN,MEM_BYP,no clock delay - # UNDOCUMENTED OPTION (20H) + orb $0x20, %al # UNDOCUMENTED OPTION +#endif +#ifdef CX586_IO + orb $CX586_IO, %al #else - movb $0x18,%al # DTE_EN,MEM_BYP,no clock delay + orb $0x02, %al # 4-clock I/O delay #endif outb %al,$0x23 movb $0x020,%al # PCR0 outb %al,$0x22 + movb $0x02, %al # BTB_EN +#ifndef DISALBE_5X86_LSSER + orb $0x80, %al # LSSER +#endif #ifdef RSTK_EN -#define RSTK_EN_BIT 1 -#else -#define RSTK_EN_BIT 0 + orb $0x01, %al #endif #ifdef LOOP_EN -#define LOOP_EN_BIT 4 -#else -#define LOOP_EN_BIT 0 -#endif -#ifdef DISABLE_5X86_LSSER - movb $(0x02 | RSTK_EN_BIT | LOOP_EN_BIT) ,%al # BTB_EN -#else - movb $(0x82 | RSTK_EN_BIT | LOOP_EN_BIT),%al # BTB_EN,LSSER + orb $0x04, %al #endif outb %al,$0x23 movb $0x0c3,%al # CCR3 @@ -690,7 +690,11 @@ olddiskboot: movl %eax,R(_bootdev) #if defined(USERCONFIG_BOOT) && defined(USERCONFIG) +#ifdef PC98 movl $0x90200, %esi +#else + movl $0x10200, %esi +#endif movl $R(_userconfig_from_boot),%edi movl $512,%ecx cld @@ -866,6 +870,13 @@ identify_cpu: create_pagetables: + testl $CPUID_PGE, R(_cpu_feature) + jz 1f + movl %cr4, %eax + orl $CR4_PGE, %eax + movl %eax, %cr4 +1: + /* Find end of kernel image (rounded up to a page boundary). */ movl $R(_end),%esi @@ -911,70 +922,80 @@ over_symalloc: cmpl $0,R(_bdb_exists) jne map_read_write #endif - movl $R(_etext),%ecx + xorl %edx,%edx + testl $CPUID_PGE, R(_cpu_feature) + jz 2f + orl $PG_G,%edx + +2: movl $R(_etext),%ecx addl $PAGE_MASK,%ecx shrl $PAGE_SHIFT,%ecx - fillkptphys(0) + fillkptphys(%edx) /* Map read-write, data, bss and symbols */ movl $R(_etext),%eax addl $PAGE_MASK, %eax andl $~PAGE_MASK, %eax map_read_write: - movl R(_KERNend),%ecx + movl $PG_RW,%edx + testl $CPUID_PGE, R(_cpu_feature) + jz 1f + orl $PG_G,%edx + +1: movl R(_KERNend),%ecx subl %eax,%ecx shrl $PAGE_SHIFT,%ecx - fillkptphys(PG_RW) + fillkptphys(%edx) /* Map page directory. */ movl R(_IdlePTD), %eax movl $1, %ecx - fillkptphys(PG_RW) + fillkptphys($PG_RW) /* Map proc0's page table for the UPAGES. */ movl R(p0upt), %eax movl $1, %ecx - fillkptphys(PG_RW) + fillkptphys($PG_RW) /* Map proc0's UPAGES in the physical way ... */ movl R(p0upa), %eax movl $UPAGES, %ecx - fillkptphys(PG_RW) + fillkptphys($PG_RW) /* Map ISA hole */ movl $ISA_HOLE_START, %eax movl $ISA_HOLE_LENGTH>>PAGE_SHIFT, %ecx - fillkptphys(PG_RW|PG_N) + fillkptphys($PG_RW|PG_N) /* Map proc0s UPAGES in the special page table for this purpose ... */ movl R(p0upa), %eax movl $KSTKPTEOFF, %ebx movl $UPAGES, %ecx - fillkpt(R(p0upt), PG_RW) + fillkpt(R(p0upt), $PG_RW) /* ... and put the page table in the pde. */ movl R(p0upt), %eax movl $KSTKPTDI, %ebx movl $1, %ecx - fillkpt(R(_IdlePTD), PG_RW) + fillkpt(R(_IdlePTD), $PG_RW) /* install a pde for temporary double map of bottom of VA */ movl R(_KPTphys), %eax xorl %ebx, %ebx movl $1, %ecx - fillkpt(R(_IdlePTD), PG_RW) + fillkpt(R(_IdlePTD), $PG_RW) /* install pde's for pt's */ movl R(_KPTphys), %eax movl $KPTDI, %ebx movl $NKPT, %ecx - fillkpt(R(_IdlePTD), PG_RW) + fillkpt(R(_IdlePTD), $PG_RW) /* install a pde recursively mapping page directory as a page table */ movl R(_IdlePTD), %eax movl $PTDPTDI, %ebx movl $1,%ecx - fillkpt(R(_IdlePTD), PG_RW) + fillkpt(R(_IdlePTD), $PG_RW) ret diff --git a/sys/pc98/i386/machdep.c b/sys/pc98/i386/machdep.c index 90f493f..78bcb06 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.13 1996/11/13 02:00:17 asami Exp $ + * $Id: machdep.c,v 1.14 1996/12/01 16:34:25 bde Exp $ */ #include "npx.h" @@ -1201,6 +1201,10 @@ init386(first) Maxmem = MAXMEM/4; #endif + idp = find_isadev(isa_devtab_null, &npxdriver, 0); + if (idp != NULL && idp->id_msize != 0) + Maxmem = idp->id_msize / 4; + /* call pmap initialization to make new kernel address space */ pmap_bootstrap (first, 0); diff --git a/sys/pc98/i386/userconfig.c b/sys/pc98/i386/userconfig.c index df69c93..e317127 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.11 1996/11/02 10:39:03 asami Exp $ + ** $Id: userconfig.c,v 1.12 1996/11/09 00:39:38 asami Exp $ **/ /** @@ -153,18 +153,14 @@ getchar(void) #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 }; - - - - #ifndef FALSE #define FALSE (0) #define TRUE (!FALSE) #endif +#ifdef VISUAL_USERCONFIG +static struct isa_device *devtabs[] = { isa_devtab_bio, isa_devtab_tty, isa_devtab_net, + isa_devtab_null, NULL }; typedef struct { @@ -281,6 +277,11 @@ static DEV_INFO device_info[] = { {"cx", "Cronyx/Sigma multiport sync/async adapter",0, CLS_COMMS}, {"rc", "RISCom/8 multiport async adapter", 0, CLS_COMMS}, {"cy", "Cyclades multiport async adapter", 0, CLS_COMMS}, +{"cyy", "Cyclades Ye/PCI multiport async adapter",FLG_INVISIBLE,CLS_COMMS}, +{"dgb", "Digiboard PC/Xe, PC/Xi async adapter", 0, CLS_COMMS}, +{"si", "Specialix SI/XIO async adapter", 0, CLS_COMMS}, +{"stl", "Stallion EasyIO/Easy Connection 8/32 async adapter",0, CLS_COMMS}, +{"stli", "Stallion intelligent async adapter" ,0, CLS_COMMS}, #endif {"lpt", "Parallel printer port", 0, CLS_COMMS}, #ifndef PC98 @@ -314,7 +315,9 @@ static DEV_INFO device_info[] = { {"pca", "PC speaker PCM audio driver", FLG_FIXED, CLS_MMEDIA}, {"ctx", "Coretex-I frame grabber", 0, CLS_MMEDIA}, {"spigot", "Creative Labs Video Spigot video capture", 0, CLS_MMEDIA}, +{"scc", "IBM Smart Capture Card", 0, CLS_MMEDIA}, {"gsc", "Genius GS-4500 hand scanner", 0, CLS_MMEDIA}, +{"asc", "AmiScan scanner", 0, CLS_MMEDIA}, {"qcam", "QuickCam parallel port camera", 0, CLS_MMEDIA}, {"apm", "Advanced Power Management", FLG_FIXED, CLS_MISC}, @@ -705,11 +708,10 @@ savelist(DEV_LIST *list, int active) while (list) { - if ((list->comment == DEV_DEVICE) && list->changed) - { - if ((list->iobase == -2) || /* is a PCI device; can't save */ - (list->device == NULL)) /* no isa_device associated at all?! */ - continue; + if ((list->comment == DEV_DEVICE) && /* is a device */ + (list->changed) && /* has been changed */ + (list->iobase != -2) && /* is not a PCI device */ + (list->device != NULL)) { /* has an isa_device structure */ setdev(list,active); /* set the device itself */ @@ -1510,7 +1512,7 @@ static int editval(int x, int y, int width, int hex, int min, int max, int *val, int ro) { int i = *val; /* work with copy of the value */ - char buf[10],tc[8]; /* display buffer, text copy */ + char buf[2+11+1],tc[11+1]; /* display buffer, text copy */ int xp = 0; /* cursor offset into text copy */ int delta = 1; /* force redraw first time in */ int c; @@ -1599,7 +1601,7 @@ editval(int x, int y, int width, int hex, int min, int max, int *val, int ro) } if (xp) /* still something left to delete */ { - i = i / (hex?0x10:10); /* strip last digit */ + i = (hex ? i/0x10u : i/10); /* strip last digit */ delta = 1; /* force update */ } break; @@ -1751,7 +1753,7 @@ editparams(DEV_LIST *dev) } ep_flags: puthelp(" Device-specific flag values."); - ret = editval(18,20,5,1,0x0,0xffff,&(dev->flags),0); + ret = editval(18,20,8,1,INT_MIN,INT_MAX,&(dev->flags),0); switch(ret) { case KEY_EXIT: @@ -2254,7 +2256,7 @@ visuserconfig(void) * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: userconfig.c,v 1.11 1996/11/02 10:39:03 asami Exp $ + * $Id: userconfig.c,v 1.12 1996/11/09 00:39:38 asami Exp $ */ #include "scbus.h" @@ -2308,7 +2310,7 @@ 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) +#if defined(USERCONFIG_BOOT) static int introfunc(CmdParm *); #endif @@ -2339,7 +2341,7 @@ 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) +#if defined(USERCONFIG_BOOT) { "intro", introfunc, NULL }, /* intro screen */ #endif { "iom", set_device_mem, addr_parms }, /* iomem dev addr */ @@ -2604,17 +2606,20 @@ helpfunc(CmdParm *parms) return 0; } -#if defined(USERCONFIG_BOOT) && defined(VISUAL_USERCONFIG) +#if defined(USERCONFIG_BOOT) +#if defined (VISUAL_USERCONFIG) static void center(int y, char *str) { putxy((80 - strlen(str)) / 2, y, str); } +#endif static int introfunc(CmdParm *parms) { +#if defined (VISUAL_USERCONFIG) int curr_item, first_time; static char *choices[] = { " Skip kernel configuration and continue with installation ", @@ -2708,6 +2713,7 @@ introfunc(CmdParm *parms) } } } +#endif } #endif diff --git a/sys/pc98/pc98/diskslice_machdep.c b/sys/pc98/pc98/diskslice_machdep.c index c5b98c3..f1fdb62 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.3 1996/10/09 21:46:15 asami Exp $ + * $Id: diskslice_machdep.c,v 1.4 1996/11/09 00:39:48 asami Exp $ */ /* @@ -300,7 +300,6 @@ reread_mbr: sp->ds_offset = 0; sp->ds_size = lp->d_secperunit; sp->ds_type = DOSPTYP_386BSD; - sp->ds_subtype = 0xc4; error = 0; ssp->dss_nslices = BASE_SLICE + 1; goto done; @@ -330,7 +329,6 @@ reread_mbr: sp->ds_offset = 0; sp->ds_size = lp->d_secperunit; sp->ds_type = 0xa0; /* XXX */ - sp->ds_subtype = 0x81; /* XXX */ error = 0; ssp->dss_nslices = BASE_SLICE + 1; goto done; @@ -493,8 +491,6 @@ reread_mbr: sp->ds_offset = pc98_start; sp->ds_size = pc98_size; sp->ds_type = dp->dp_mid; - sp->ds_subtype = dp->dp_sid; - strncpy(sp->ds_name, dp->dp_name, 16); #else sp->ds_offset = mbr_offset + dp->dp_start; sp->ds_size = dp->dp_size; @@ -631,8 +627,6 @@ extended(dname, dev, strat, lp, ssp, ext_offset, ext_size, base_ext_offset, sp->ds_offset = ext_offset + pc98_start; sp->ds_size = pc98_size; sp->ds_type = dp->dp_mid; - sp->ds_subtype = dp->dp_sid; - strncpy(sp->ds_name, dp->dp_name, 16); #else sp->ds_offset = ext_offset + dp->dp_start; sp->ds_size = dp->dp_size; diff --git a/sys/pc98/pc98/fd.c b/sys/pc98/pc98/fd.c index dd5bd79..c7fdef8 100644 --- a/sys/pc98/pc98/fd.c +++ b/sys/pc98/pc98/fd.c @@ -43,7 +43,7 @@ * SUCH DAMAGE. * * from: @(#)fd.c 7.4 (Berkeley) 5/25/91 - * $Id: fd.c,v 1.8 1996/11/02 10:39:13 asami Exp $ + * $Id: fd.c,v 1.9 1996/11/09 00:39:52 asami Exp $ * */ @@ -352,6 +352,7 @@ static int volatile fd_debug = 0; #endif /* DEBUG */ /* autoconfig structure */ + struct isa_driver fdcdriver = { fdprobe, fdattach, "fdc", }; @@ -1140,10 +1141,9 @@ in_fdc(fdcu_t fdcu) int baseport = fdc_data[fdcu].baseport; int i, j = 1000000; while ((i = inb(baseport+FDSTS) & (NE7_DIO|NE7_RQM)) - != (NE7_DIO|NE7_RQM) && j-- > 0) { + != (NE7_DIO|NE7_RQM) && j-- > 0) if (i == NE7_RQM) return fdc_err(fdcu, "ready for output in input\n"); - } if (j <= 0) return fdc_err(fdcu, bootverbose? "input ready timeout\n": 0); #ifdef DEBUG diff --git a/sys/pc98/pc98/ft.c b/sys/pc98/pc98/ft.c index c3d0c39..5f3efa9 100644 --- a/sys/pc98/pc98/ft.c +++ b/sys/pc98/pc98/ft.c @@ -17,7 +17,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * ft.c - QIC-40/80 floppy tape driver - * $Id: ft.c,v 1.5 1996/09/10 09:37:55 asami Exp $ + * $Id: ft.c,v 1.6 1996/11/02 10:39:25 asami Exp $ * * 01/19/95 ++sg * Cleaned up recalibrate/seek code at attach time for FreeBSD 2.x. @@ -278,7 +278,7 @@ static struct ft_data { int moving; /* TRUE if tape is moving */ int rid[7]; /* read_id return values */ -} ft_data[NFT]; +} *ft_data[NFT]; /***********************************************************************\ * Throughout this file the following conventions will be used: * @@ -420,7 +420,8 @@ ftattach(isadev, fdup, unithasfd) char *manu; if (ftu >= NFT) return 0; - ft = &ft_data[ftu]; + ft = ft_data[ftu] = malloc(sizeof *ft, M_DEVBUF, M_NOWAIT); + bzero(ft, sizeof *ft); /* Probe for tape */ ft->attaching = 1; @@ -540,7 +541,7 @@ out: */ static void async_cmd(ftu_t ftu) { - ft_p ft = &ft_data[ftu]; + ft_p ft = ft_data[ftu]; fdcu_t fdcu = ft->fdc->fdcu; int cmd, i, st0, st3, pcn; static int bitn, retval, retpos, nbits, newcn; @@ -975,7 +976,7 @@ complete: static void async_req(ftu_t ftu, int from) { - ft_p ft = &ft_data[ftu]; + ft_p ft = ft_data[ftu]; SegReq *sp; static int over_async, lastreq; int cmd; @@ -1104,7 +1105,7 @@ restate: static void async_read(ftu_t ftu, int from) { - ft_p ft = &ft_data[ftu]; + ft_p ft = ft_data[ftu]; fdcu_t fdcu = ft->fdc->fdcu; /* fdc active unit */ int i, rddta[7]; int where; @@ -1229,7 +1230,7 @@ restate: static void async_write(ftu_t ftu, int from) { - ft_p ft = &ft_data[ftu]; + ft_p ft = ft_data[ftu]; fdcu_t fdcu = ft->fdc->fdcu; /* fdc active unit */ int i, rddta[7]; int where; @@ -1358,7 +1359,7 @@ int ftintr(ftu_t ftu) { int st0, pcn, i; - ft_p ft = &ft_data[ftu]; + ft_p ft = ft_data[ftu]; fdcu_t fdcu = ft->fdc->fdcu; /* fdc active unit */ int s = splbio(); @@ -1436,7 +1437,7 @@ ft_timeout(void *arg1) { int s; ftu_t ftu = (ftu_t)arg1; - ft_p ft = &ft_data[ftu]; + ft_p ft = ft_data[ftu]; s = splbio(); if (ft->active) { @@ -1463,7 +1464,7 @@ static int ftintr_wait(ftu_t ftu, int cmd, int ticks) { int retries, st0, pcn; - ft_p ft = &ft_data[ftu]; + ft_p ft = ft_data[ftu]; fdcu_t fdcu = ft->fdc->fdcu; /* fdc active unit */ ft->cmd_wait = cmd; @@ -1525,7 +1526,7 @@ static int tape_recal(ftu_t ftu, int totape) { int s; - ft_p ft = &ft_data[ftu]; + ft_p ft = ft_data[ftu]; fdcu_t fdcu = ft->fdc->fdcu; /* fdc active unit */ DPRT(("tape_recal start\n")); @@ -1603,7 +1604,7 @@ tape_cmd(ftu_t ftu, int cmd) int newcn; int retries = 0; int s; - ft_p ft = &ft_data[ftu]; + ft_p ft = ft_data[ftu]; fdcu_t fdcu = ft->fdc->fdcu; /* fdc active unit */ DPRT(("===> tape_cmd: %d\n",cmd)); @@ -1648,7 +1649,7 @@ static int tape_status(ftu_t ftu) { int r, err, tries; - ft_p ft = &ft_data[ftu]; + ft_p ft = ft_data[ftu]; int max = (ft->attaching) ? 2 : 3; for (r = -1, tries = 0; r < 0 && tries < max; tries++) @@ -1693,7 +1694,7 @@ recheck: static void tape_start(ftu_t ftu, int motor) { - ft_p ft = &ft_data[ftu]; + ft_p ft = ft_data[ftu]; fdc_p fdc = ft->fdc; int s, mbits; #ifndef PC98 @@ -1743,7 +1744,7 @@ tape_start(ftu_t ftu, int motor) static void tape_end(ftu_t ftu) { - ft_p ft = &ft_data[ftu]; + ft_p ft = ft_data[ftu]; fdc_p fdc = ft->fdc; int s; @@ -1787,7 +1788,7 @@ tape_end(ftu_t ftu) static void tape_inactive(ftu_t ftu) { - ft_p ft = &ft_data[ftu]; + ft_p ft = ft_data[ftu]; int s = splbio(); if (ft->segh != NULL) { @@ -1820,7 +1821,7 @@ ftgetgeom(ftu_t ftu) int r, i, tries; int cfg, qic80, ext; int sts, fmt, len; - ft_p ft = &ft_data[ftu]; + ft_p ft = ft_data[ftu]; r = tape_status(ftu); @@ -1914,7 +1915,7 @@ static int set_fdcmode(dev_t dev, int newmode) { ftu_t ftu = FDUNIT(minor(dev)); - ft_p ft = &ft_data[ftu]; + ft_p ft = ft_data[ftu]; fdc_p fdc = ft->fdc; static int havebufs = 0; int i; @@ -2050,7 +2051,7 @@ static int qic_status(ftu_t ftu, int cmd, int nbits) { int st3, r, i; - ft_p ft = &ft_data[ftu]; + ft_p ft = ft_data[ftu]; fdcu_t fdcu = ft->fdc->fdcu; /* fdc active unit */ if (tape_cmd(ftu, cmd)) { @@ -2118,8 +2119,8 @@ ftopen(dev_t dev, int arg2) { /* check bounds */ if (ftu >= NFT) return(ENXIO); - fdc = ft_data[ftu].fdc; - if ((fdc == NULL) || (ft_data[ftu].type == NO_TYPE)) + fdc = ft_data[ftu]->fdc; + if ((fdc == NULL) || (ft_data[ftu]->type == NO_TYPE)) return(ENXIO); /* check for controller already busy with tape */ if (fdc->flags & FDC_TAPE_BUSY) @@ -2140,7 +2141,7 @@ int ftclose(dev_t dev, int flags) { ftu_t ftu = FDUNIT(minor(dev)); - ft_p ft = &ft_data[ftu]; + ft_p ft = ft_data[ftu]; /* Wait for any remaining I/O activity to complete. */ @@ -2164,7 +2165,7 @@ ftreq_rw(ftu_t ftu, int cmd, QIC_Segment *sr, struct proc *p) int s; long blk, bad, seg; unsigned char *cp, *cp2; - ft_p ft = &ft_data[ftu]; + ft_p ft = ft_data[ftu]; if (!ft->active && ft->segh == NULL) { r = tape_status(ftu); @@ -2316,7 +2317,7 @@ rddone: static int ftreq_rewind(ftu_t ftu) { - ft_p ft = &ft_data[ftu]; + ft_p ft = ft_data[ftu]; tape_inactive(ftu); tape_cmd(ftu, QC_STOP); @@ -2339,7 +2340,7 @@ static int ftreq_trkpos(ftu_t ftu, int req) { int curtrk, r, cmd; - ft_p ft = &ft_data[ftu]; + ft_p ft = ft_data[ftu]; tape_inactive(ftu); tape_cmd(ftu, QC_STOP); @@ -2371,7 +2372,7 @@ static int ftreq_trkset(ftu_t ftu, int *trk) { int r; - ft_p ft = &ft_data[ftu]; + ft_p ft = ft_data[ftu]; tape_inactive(ftu); tape_cmd(ftu, QC_STOP); @@ -2397,7 +2398,7 @@ ftreq_trkset(ftu_t ftu, int *trk) static int ftreq_lfwd(ftu_t ftu) { - ft_p ft = &ft_data[ftu]; + ft_p ft = ft_data[ftu]; tape_inactive(ftu); tape_cmd(ftu, QC_STOP); @@ -2414,7 +2415,7 @@ ftreq_lfwd(ftu_t ftu) static int ftreq_stop(ftu_t ftu) { - ft_p ft = &ft_data[ftu]; + ft_p ft = ft_data[ftu]; tape_inactive(ftu); tape_cmd(ftu, QC_STOP); @@ -2431,7 +2432,7 @@ static int ftreq_setmode(ftu_t ftu, int cmd) { int r; - ft_p ft = &ft_data[ftu]; + ft_p ft = ft_data[ftu]; tape_inactive(ftu); r = tape_status(ftu); @@ -2462,7 +2463,7 @@ ftreq_setmode(ftu_t ftu, int cmd) static int ftreq_status(ftu_t ftu, int cmd, int *sts, struct proc *p) { - ft_p ft = &ft_data[ftu]; + ft_p ft = ft_data[ftu]; if (ft->active) *sts = ft->laststs & ~QS_READY; @@ -2479,7 +2480,7 @@ static int ftreq_config(ftu_t ftu, int cmd, int *cfg, struct proc *p) { int r, tries; - ft_p ft = &ft_data[ftu]; + ft_p ft = ft_data[ftu]; if (ft->active) r = ft->lastcfg; @@ -2542,7 +2543,7 @@ ftreq_hwinfo(ftu_t ftu, QIC_HWInfo *hwp) static int ftreq_hdr(ftu_t ftu, int cmd, QIC_Segment *sp) { - ft_p ft = &ft_data[ftu]; + ft_p ft = ft_data[ftu]; QIC_Header *h = (QIC_Header *)ft->hdr->buff; if (sp == NULL || sp->sg_data == NULL) return(EINVAL); diff --git a/sys/pc98/pc98/if_ed.c b/sys/pc98/pc98/if_ed.c index 9e1d45b..1ea310e 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.10 1996/10/29 08:36:20 asami Exp $ + * $Id: if_ed.c,v 1.11 1996/10/30 22:39:52 asami Exp $ */ /* @@ -3097,7 +3097,6 @@ edintr_sc(sc) * TSR_ABT is set. */ collisions = 16; - sc->mibdata.dot3StatsMultipleCollisionFrames++; sc->mibdata.dot3StatsExcessiveCollisions++; sc->mibdata.dot3StatsCollFrequencies[15]++; } @@ -3145,12 +3144,10 @@ edintr_sc(sc) break; case 1: sc->mibdata.dot3StatsSingleCollisionFrames++; - sc->mibdata.dot3StatsDeferredTransmissions++; sc->mibdata.dot3StatsCollFrequencies[0]++; break; default: sc->mibdata.dot3StatsMultipleCollisionFrames++; - sc->mibdata.dot3StatsDeferredTransmissions++; sc->mibdata. dot3StatsCollFrequencies[collisions-1] ++; diff --git a/sys/pc98/pc98/if_fe.c b/sys/pc98/pc98/if_fe.c index 7248ac3..849081e 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.10 1996/10/30 22:39:56 asami Exp $ + * $Id: if_fe.c,v 1.11 1996/11/14 08:46:14 asami Exp $ * * Device driver for Fujitsu MB86960A/MB86965A based Ethernet cards. * To be used with FreeBSD 2.x @@ -75,7 +75,9 @@ * o To test IPX codes. */ +#include "isa.h" #include "fe.h" +#include "crd.h" #include "bpfilter.h" #include <sys/param.h> @@ -126,11 +128,11 @@ #include <machine/clock.h> +#include <i386/isa/isa.h> #include <i386/isa/isa_device.h> #include <i386/isa/icu.h> /* PCCARD suport */ -#include "crd.h" #if NCRD > 0 #include <sys/select.h> #include <pccard/card.h> @@ -184,7 +186,7 @@ #define FE_FLAGS_OVERRIDE_DLCR6 0x0080 /* Shouldn't these be defined somewhere else such as isa_device.h? */ -#define NO_IOADDR 0xFFFFFFFF +#define NO_IOADDR (-1) #define NO_IRQ 0 /* @@ -231,6 +233,9 @@ static struct fe_softc { u_char txb_count; /* number of packets in TX buffer */ u_char txb_sched; /* number of scheduled packets */ + /* Excessive collision counter (see fe_tint() for details. */ + u_char tx_excolls; /* # of excessive collisions. */ + /* Multicast address filter management. */ u_char filter_change; /* MARs must be changed ASAP. */ struct fe_filter filter;/* new filter value. */ @@ -257,14 +262,20 @@ static int fe_probe_re1000p( DEVICE *, struct fe_softc * ); #else static int fe_probe_fmv ( DEVICE *, struct fe_softc * ); static int fe_probe_ati ( DEVICE *, struct fe_softc * ); +static void fe_init_ati ( struct fe_softc * ); +static int fe_probe_gwy ( DEVICE *, struct fe_softc * ); +#if NCRD > 0 static int fe_probe_mbh ( DEVICE *, struct fe_softc * ); static void fe_init_mbh ( struct fe_softc * ); +static int fe_probe_tdk ( DEVICE *, struct fe_softc * ); +#endif #endif static int fe_get_packet ( struct fe_softc *, u_short ); static void fe_stop ( int ); static void fe_tint ( struct fe_softc *, u_char ); static void fe_rint ( struct fe_softc *, u_char ); static void fe_xmit ( struct fe_softc * ); +static void fe_emptybuffer ( struct fe_softc * ); static void fe_write_mbufs ( struct fe_softc *, struct mbuf * ); static struct fe_filter fe_mcaf ( struct fe_softc * ); @@ -368,6 +379,7 @@ static int feinit(struct pccard_dev *dp, int first) { /* validate unit number. */ + struct fe_softc *sc; if (first) { if (dp->isahd.id_unit >= NFE) return (ENODEV); @@ -378,6 +390,8 @@ feinit(struct pccard_dev *dp, int first) #if FE_DEBUG >= 2 printf("Start Probe\n"); #endif + sc = &fe_softc[dp->isahd.id_unit]; + memcpy( sc->sc_enaddr, dp->misc, ETHER_ADDR_LEN ); if (fe_probe(&dp->isahd) == 0) return (ENXIO); #if FE_DEBUG >= 2 @@ -408,6 +422,7 @@ feinit(struct pccard_dev *dp, int first) static void feunload(struct pccard_dev *dp) { + struct fe_softc *sc = &fe_softc[dp->isahd.id_unit]; printf("fe%d: unload\n", dp->isahd.id_unit); fe_stop(dp->isahd.id_unit); } @@ -458,7 +473,10 @@ static struct fe_probe_list const fe_probe_list [] = #else { fe_probe_fmv, fe_fmv_addr }, { fe_probe_ati, fe_ati_addr }, +#if NCRD > 0 { fe_probe_mbh, NULL }, /* PCMCIAs cannot be auto-detected. */ + { fe_probe_tdk, NULL }, +#endif #endif { NULL, NULL } }; @@ -998,7 +1016,15 @@ fe_probe_fmv ( DEVICE * dev, struct fe_softc * sc ) /* Check if our I/O address matches config info. on EEPROM. */ n = ( inb( sc->ioaddr[ FE_FMV2 ] ) & FE_FMV2_IOS ) >> FE_FMV2_IOS_SHIFT; - if ( baseaddr[ n ] != sc->iobase ) return 0; + if ( baseaddr[ n ] != sc->iobase ) { +#if 0 + /* May not work on some revisions of the cards... FIXME. */ + return 0; +#else + /* Just log the fact and see what happens... FIXME. */ + log( LOG_WARNING, "fe%d: strange I/O config?n", sc->sc_unit ); +#endif + } /* Find the "hardware revision." */ revision = inb( sc->ioaddr[ FE_FMV1 ] ) & FE_FMV1_REV; @@ -1014,6 +1040,9 @@ fe_probe_fmv ( DEVICE * dev, struct fe_softc * sc ) case 8: sc->typestr = "FMV-183"; break; + case 12: + sc->typestr = "FMV-183 (on-board)"; + break; } break; case FE_FMV0_MEDIUM_T | FE_FMV0_MEDIUM_5: @@ -1333,6 +1362,9 @@ fe_probe_ati ( DEVICE * dev, struct fe_softc * sc ) fe_dump( LOG_INFO, sc, "ATI found" ); #endif + /* Setup hooks. This may solves a nasty bug. FIXME. */ + sc->init = fe_init_ati; + /* Initialize 86965. */ DELAY( 200 ); outb( sc->ioaddr[ FE_DLCR6 ], sc->proto_dlcr6 | FE_D6_DLC_DISABLE ); @@ -1365,36 +1397,132 @@ fe_probe_ati ( DEVICE * dev, struct fe_softc * sc ) return ( 0 ); } +/* ATI specific initialization routine. */ +static void +fe_init_ati ( struct fe_softc * sc ) +{ /* - * Probe and initialization for Fujitsu MBH10302 PCMCIA Ethernet interface. + * I've told that the following operation "Resets" the chip. + * Hope this solve a bug which hangs up the driver under + * heavy load... FIXME. + */ + + /* Minimal initialization of 86965. */ + DELAY( 200 ); + outb( sc->ioaddr[ FE_DLCR6 ], sc->proto_dlcr6 | FE_D6_DLC_DISABLE ); + DELAY( 200 ); + + /* "Reset" by wrting into an undocument register location. */ + outb( sc->ioaddr[ 0x1F ], 0 ); + + /* How long do we have to wait after the reset? FIXME. */ + DELAY( 300 ); +} + +/* + * Probe and initialization for Gateway Communications' old cards. */ static int -fe_probe_mbh ( DEVICE * dev, struct fe_softc * sc ) +fe_probe_gwy ( DEVICE * dev, struct fe_softc * sc ) { - int i; + int i,type; static struct fe_simple_probe_struct probe_table [] = { { FE_DLCR2, 0x70, 0x00 }, { FE_DLCR4, 0x08, 0x00 }, - /* { FE_DLCR5, 0x80, 0x00 }, Does not work well. */ -#if 0 + { FE_DLCR7, 0xC0, 0x00 }, /* - * Test *vendor* part of the address for Fujitsu. - * The test will gain reliability of probe process, but - * it rejects clones by other vendors, or OEM product - * supplied by retailer other than Fujitsu. + * Test *vendor* part of the address for Gateway. + * This test is essential to identify Gateway's cards. + * We shuld define some symbolic names for the + * following offsets. FIXME. + */ + { 0x18, 0xFF, 0x00 }, + { 0x19, 0xFF, 0x00 }, + { 0x1A, 0xFF, 0x61 }, + { 0 } + }; + + /* + * We need explicit IRQ and supported address. + * I'm not sure which address and IRQ is possible for Gateway + * Ethernet family. The following accepts everything. FIXME. */ - { FE_MBH10, 0xFF, 0x00 }, - { FE_MBH11, 0xFF, 0x00 }, - { FE_MBH12, 0xFF, 0x0E }, -#else + if ( dev->id_irq == NO_IRQ || ( sc->iobase & ~0x3E0 ) != 0 ) { + return ( 0 ); + } + +#if FE_DEBUG >= 3 + fe_dump( LOG_INFO, sc, "top of probe" ); +#endif + + /* Setup an I/O address mapping table. */ + for ( i = 0; i < MAXREGISTERS; i++ ) { + sc->ioaddr[ i ] = sc->iobase + i; + } + + /* See if the card is on its address. */ + if ( !fe_simple_probe( sc, probe_table ) ) { + return 0; + } + + /* Determine the card type. */ + sc->typestr = "Gateway Ethernet w/ Fujitsu chipset"; + + /* Get our station address from EEPROM. */ + inblk( sc, 0x18, sc->sc_enaddr, ETHER_ADDR_LEN ); + /* + * Program the 86960 as follows: + * SRAM: 16KB, 100ns, byte-wide access. + * Transmission buffer: 2KB x 2. + * System bus interface: 16 bits. + * Make sure to clear out ID bits in DLCR7 + * (They actually are Encoder/Decoder control in NICE.) + */ + sc->proto_dlcr4 = FE_D4_LBC_DISABLE | FE_D4_CNTRL; + sc->proto_dlcr5 = 0; + sc->proto_dlcr6 = FE_D6_BUFSIZ_16KB | FE_D6_TXBSIZ_2x2KB + | FE_D6_BBW_BYTE | FE_D6_SBW_WORD | FE_D6_SRAM_100ns; + sc->proto_dlcr7 = FE_D7_BYTSWP_LH; + sc->proto_bmpr13 = 0; + + /* Minimal initialization of 86960. */ + DELAY( 200 ); + outb( sc->ioaddr[ FE_DLCR6 ], sc->proto_dlcr6 | FE_D6_DLC_DISABLE ); + DELAY( 200 ); + + /* Disable all interrupts. */ + outb( sc->ioaddr[ FE_DLCR2 ], 0 ); + outb( sc->ioaddr[ FE_DLCR3 ], 0 ); + + /* That's all. The card occupies 32 I/O addresses, as always. */ + return 32; +} + +#if NCRD > 0 + /* + * Probe and initialization for Fujitsu MBH10302 PCMCIA Ethernet interface. + * Note that this is for 10302 only; MBH10304 is handled by fe_probe_tdk(). + */ +static int +fe_probe_mbh ( DEVICE * dev, struct fe_softc * sc ) +{ + int i,type; + + static struct fe_simple_probe_struct probe_table [] = { + { FE_DLCR0, 0x09, 0x00 }, + { FE_DLCR2, 0x79, 0x00 }, + { FE_DLCR4, 0x08, 0x00 }, + { FE_DLCR6, 0xFF, 0xB6 }, + /* + * The following location has the first byte of the card's + * Ethernet (MAC) address. * We can always verify the *first* 2 bits (in Ethernet - * bit order) are "global" and "unicast" even for - * unknown vendors. + * bit order) are "global" and "unicast" for any vendors'. */ { FE_MBH10, 0x03, 0x00 }, -#endif + /* Just a gap? Seems reliable, anyway. */ { 0x12, 0xFF, 0x00 }, { 0x13, 0xFF, 0x00 }, @@ -1405,7 +1533,7 @@ fe_probe_mbh ( DEVICE * dev, struct fe_softc * sc ) #if 0 { 0x18, 0xFF, 0xFF }, { 0x19, 0xFF, 0xFF }, -#endif /* 0 */ +#endif { 0 } }; @@ -1443,10 +1571,9 @@ fe_probe_mbh ( DEVICE * dev, struct fe_softc * sc ) inblk( sc, FE_MBH10, sc->sc_enaddr, ETHER_ADDR_LEN ); /* Make sure we got a valid station address. */ - if ( ( sc->sc_enaddr[ 0 ] & 0x03 ) != 0x00 - || ( sc->sc_enaddr[ 0 ] == 0x00 + if ( sc->sc_enaddr[ 0 ] == 0x00 && sc->sc_enaddr[ 1 ] == 0x00 - && sc->sc_enaddr[ 2 ] == 0x00 ) ) return 0; + && sc->sc_enaddr[ 2 ] == 0x00 ) return 0; /* * Program the 86960 as follows: @@ -1506,6 +1633,92 @@ fe_init_mbh ( struct fe_softc * sc ) } #endif /* PC98 */ +#endif /* NCRD > 0 */ + +#if NCRD > 0 +/* + * Probe and initialization for TDK/CONTEC PCMCIA Ethernet interface. + * by MASUI Kenji <masui@cs.titech.ac.jp> + * + * (Contec uses TDK Ethenet chip -- hosokawa) + * + * This version of fe_probe_tdk has been rewrote to handle + * *generic* PC card implementation of Fujitsu MB8696x family. The + * name _tdk is just for a historical reason. :-) + */ +static int +fe_probe_tdk ( DEVICE * dev, struct fe_softc * sc ) +{ + int i; + + static struct fe_simple_probe_struct probe_table [] = { + { FE_DLCR2, 0x70, 0x00 }, + { FE_DLCR4, 0x08, 0x00 }, + /* { FE_DLCR5, 0x80, 0x00 }, Does not work well. */ + { 0 } + }; + + if ( dev->id_irq == NO_IRQ ) { + return ( 0 ); + } + + /* Setup an I/O address mapping table. */ + for ( i = 0; i < MAXREGISTERS; i++ ) { + sc->ioaddr[ i ] = sc->iobase + i; + } + + /* + * See if C-NET(PC)C is on its address. + */ + + if ( !fe_simple_probe( sc, probe_table ) ) return 0; + + /* Determine the card type. */ + sc->typestr = "Generic MB8696x Ethernet (PCMCIA)"; + + /* + * Initialize constants in the per-line structure. + */ + + /* The station address *must*be* already in sc_enaddr; + Make sure we got a valid station address. */ + if ( ( sc->sc_enaddr[ 0 ] & 0x03 ) != 0x00 + || ( sc->sc_enaddr[ 0 ] == 0x00 + && sc->sc_enaddr[ 1 ] == 0x00 + && sc->sc_enaddr[ 2 ] == 0x00 ) ) return 0; + + /* + * Program the 86965 as follows: + * SRAM: 32KB, 100ns, byte-wide access. + * Transmission buffer: 4KB x 2. + * System bus interface: 16 bits. + * XXX: Should we remove IDENT_NICE from DLCR7? Or, + * even add IDENT_EC instead? FIXME. + */ + sc->proto_dlcr4 = FE_D4_LBC_DISABLE | FE_D4_CNTRL; + sc->proto_dlcr5 = 0; + sc->proto_dlcr6 = FE_D6_BUFSIZ_32KB | FE_D6_TXBSIZ_2x4KB + | FE_D6_BBW_BYTE | FE_D6_SBW_WORD | FE_D6_SRAM_100ns; + sc->proto_dlcr7 = FE_D7_BYTSWP_LH | FE_D7_IDENT_NICE; + sc->proto_bmpr13 = FE_B13_TPTYPE_UTP | FE_B13_PORT_AUTO; + + /* Minimul initialization of 86960. */ + DELAY( 200 ); + outb( sc->ioaddr[ FE_DLCR6 ], sc->proto_dlcr6 | FE_D6_DLC_DISABLE ); + DELAY( 200 ); + + /* Disable all interrupts. */ + outb( sc->ioaddr[ FE_DLCR2 ], 0 ); + outb( sc->ioaddr[ FE_DLCR3 ], 0 ); + + /* + * That's all. C-NET(PC)C occupies 16 I/O addresses. + * XXX: Are there any card with 32 I/O addresses? FIXME. + */ + return 16; +} +#endif + /* * Install interface into kernel networking data structures */ @@ -1719,13 +1932,11 @@ fe_watchdog ( struct ifnet *ifp ) log( LOG_ERR, "fe%d: transmission timeout (%d+%d)%s\n", ifp->if_unit, sc->txb_sched, sc->txb_count, ( ifp->if_flags & IFF_UP ) ? "" : " when down" ); -#endif - - /* Suggest users a possible cause. */ - if ( ifp->if_oerrors > 0 ) { - log( LOG_WARNING, "fe%d: wrong IRQ setting in config?", + if ( sc->sc_if.if_opackets == 0 && sc->sc_if.if_ipackets == 0 ) { + log( LOG_WARNING, "fe%d: wrong IRQ setting in config?\n", ifp->if_unit ); } +#endif #if FE_DEBUG >= 3 fe_dump( LOG_INFO, sc, NULL ); @@ -1847,11 +2058,12 @@ fe_init ( int unit ) #if FE_DEBUG >= 3 fe_dump( LOG_INFO, sc, "just after enabling DLC" ); #endif + /* * Make sure to empty the receive buffer. * * This may be redundant, but *if* the receive buffer were full - * at this point, the driver would hang. I have experienced + * at this point, then the driver would hang. I have experienced * some strange hang-up just after UP. I hope the following * code solve the problem. * @@ -1859,29 +2071,24 @@ fe_init ( int unit ) * I think the receive buffer cannot have any packets at this * point in this version. The following code *must* be * redundant now. FIXME. + * + * I've heard a rumore that on some PC card implementation of + * 8696x, the receive buffer can have some data at this point. + * The following message helps discovering the fact. FIXME. */ - for ( i = 0; i < FE_MAX_RECV_COUNT; i++ ) { - if ( inb( sc->ioaddr[ FE_DLCR5 ] ) & FE_D5_BUFEMP ) break; - outb( sc->ioaddr[ FE_BMPR14 ], FE_B14_SKIP ); - } -#if FE_DEBUG >= 1 - if ( i >= FE_MAX_RECV_COUNT ) { - log( LOG_ERR, "fe%d: cannot empty receive buffer\n", + if ( !( inb( sc->ioaddr[ FE_DLCR5 ] ) & FE_D5_BUFEMP ) ) { + log( LOG_WARNING, + "fe%d: receive buffer has some data after reset\n", sc->sc_unit ); + + fe_emptybuffer( sc ); } -#endif -#if FE_DEBUG >= 3 - if ( i < FE_MAX_RECV_COUNT ) { - log( LOG_INFO, "fe%d: receive buffer emptied (%d)\n", - sc->sc_unit, i ); - } -#endif #if FE_DEBUG >= 3 fe_dump( LOG_INFO, sc, "after ERB loop" ); #endif - /* Do we need this here? FIXME. */ + /* Do we need this here? Actually, no. I must be paranoia. */ outb( sc->ioaddr[ FE_DLCR0 ], 0xFF ); /* Clear all bits. */ outb( sc->ioaddr[ FE_DLCR1 ], 0xFF ); /* ditto. */ @@ -1931,6 +2138,7 @@ fe_xmit ( struct fe_softc * sc ) sc->txb_sched = sc->txb_count; sc->txb_count = 0; sc->txb_free = sc->txb_size; + sc->tx_excolls = 0; /* Start transmitter, passing packets in TX buffer. */ outb( sc->ioaddr[ FE_BMPR10 ], sc->txb_sched | FE_B10_START ); @@ -2028,7 +2236,8 @@ fe_start ( struct ifnet *ifp ) * (i.e., minimum packet sized) packets rapidly. An 8KB * buffer can hold 130 blocks of 62 bytes long... */ - if ( sc->txb_free < ETHER_MAX_LEN - ETHER_CRC_LEN + FE_DATA_LEN_LEN ) { + if ( sc->txb_free + < ETHER_MAX_LEN - ETHER_CRC_LEN + FE_DATA_LEN_LEN ) { /* No room. */ goto indicate_active; } @@ -2056,7 +2265,9 @@ fe_start ( struct ifnet *ifp ) fe_write_mbufs( sc, m ); /* Start transmitter if it's idle. */ - if ( sc->txb_sched == 0 ) fe_xmit( sc ); + if ( ( sc->txb_count > 0 ) && ( sc->txb_sched == 0 ) ) { + fe_xmit( sc ); + } /* * Tap off here if there is a bpf listener, @@ -2101,9 +2312,69 @@ fe_start ( struct ifnet *ifp ) * Drop (skip) a packet from receive buffer in 86960 memory. */ static void -fe_droppacket ( struct fe_softc * sc ) +fe_droppacket ( struct fe_softc * sc, int len ) { + int i; + + /* + * 86960 manual says that we have to read 8 bytes from the buffer + * before skip the packets and that there must be more than 8 bytes + * remaining in the buffer when issue a skip command. + * Remember, we have already read 4 bytes before come here. + */ + if ( len > 12 ) { + /* Read 4 more bytes, and skip the rest of the packet. */ + ( void )inw( sc->ioaddr[ FE_BMPR8 ] ); + ( void )inw( sc->ioaddr[ FE_BMPR8 ] ); outb( sc->ioaddr[ FE_BMPR14 ], FE_B14_SKIP ); + } else { + /* We should not come here unless receiving RUNTs. */ + for ( i = 0; i < len; i += 2 ) { + ( void )inw( sc->ioaddr[ FE_BMPR8 ] ); + } + } +} + +/* + * Empty receiving buffer. + */ +static void +fe_emptybuffer ( struct fe_softc * sc ) +{ + int i; + u_char saved_dlcr5; + +#if FE_DEBUG >= 1 + log( LOG_WARNING, "fe%d: emptying receive buffer", sc->sc_unit ); +#endif + /* + * Stop receiving packets, temporarily. + */ + saved_dlcr5 = inb( sc->ioaddr[ FE_DLCR5 ] ); + outb( sc->ioaddr[ FE_DLCR5 ], sc->proto_dlcr5 ); + + /* + * When we come here, the receive buffer management should + * have been broken. So, we cannot use skip operation. + */ + for ( i = 0; i < sc->txb_size; i += 2 ) { + if ( inb( sc->ioaddr[ FE_DLCR5 ] ) & FE_D5_BUFEMP ) break; + ( void )inw( sc->ioaddr[ FE_BMPR8 ] ); + } + + /* + * Double check. + */ + if ( inb( sc->ioaddr[ FE_DLCR5 ] ) & FE_D5_BUFEMP ) { + log( LOG_ERR, "fe%d: could not empty receive buffer\n", + sc->sc_unit ); + /* Hmm. What should I do if this happens? FIXME. */ + } + + /* + * Restart receiving packets. + */ + outb( sc->ioaddr[ FE_DLCR5 ], saved_dlcr5 ); } /* @@ -2136,15 +2407,8 @@ fe_tint ( struct fe_softc * sc, u_char tstat ) #endif /* - * Update statistics. - */ - sc->sc_if.if_collisions += 16; - sc->sc_if.if_oerrors++; - sc->sc_if.if_opackets += sc->txb_sched - left; - - /* - * Collision statistics has been updated. - * Clear the collision flag on 86960 now to avoid confusion. + * Clear the collision flag (in 86960) here + * to avoid confusing statistics. */ outb( sc->ioaddr[ FE_DLCR0 ], FE_D0_COLLID ); @@ -2163,7 +2427,9 @@ fe_tint ( struct fe_softc * sc, u_char tstat ) */ outb( sc->ioaddr[ FE_BMPR11 ], FE_B11_CTRL_SKIP | FE_B11_MODE1 ); - sc->txb_sched = left - 1; + + /* Update statistics. */ + sc->tx_excolls++; } /* @@ -2219,10 +2485,12 @@ fe_tint ( struct fe_softc * sc, u_char tstat ) } /* - * Update total number of successfully - * transmitted packets. + * Update transmission statistics. + * Be sure to reflect number of excessive collisions. */ - sc->sc_if.if_opackets += sc->txb_sched; + sc->sc_if.if_opackets += sc->txb_sched - sc->tx_excolls; + sc->sc_if.if_oerrors += sc->tx_excolls; + sc->sc_if.if_collisions += sc->tx_excolls * 16; sc->txb_sched = 0; /* @@ -2298,6 +2566,13 @@ fe_rint ( struct fe_softc * sc, u_char rstat ) #endif /* + * Extract the packet length. + * It is a sum of a header (14 bytes) and a payload. + * CRC has been stripped off by the 86960. + */ + len = inw( sc->ioaddr[ FE_BMPR8 ] ); + + /* * If there was an error, update statistics and drop * the packet, unless the interface is in promiscuous * mode. @@ -2305,56 +2580,38 @@ fe_rint ( struct fe_softc * sc, u_char rstat ) if ( ( status & 0xF0 ) != 0x20 ) { if ( !( sc->sc_if.if_flags & IFF_PROMISC ) ) { sc->sc_if.if_ierrors++; - fe_droppacket(sc); + fe_droppacket( sc, len ); continue; } } /* - * Extract the packet length. - * It is a sum of a header (14 bytes) and a payload. - * CRC has been stripped off by the 86960. - */ - len = inw( sc->ioaddr[ FE_BMPR8 ] ); - - /* - * MB86965 checks the packet length and drop big packet + * MB86960 checks the packet length and drop big packet * before passing it to us. There are no chance we can * get big packets through it, even if they are actually * sent over a line. Hence, if the length exceeds * the specified limit, it means some serious failure, * such as out-of-sync on receive buffer management. * - * Is this statement true? FIXME. + * Same for short packets, since we have programmed + * 86960 to drop short packets. */ - if ( len > ETHER_MAX_LEN - ETHER_CRC_LEN || len < ETHER_MIN_LEN- ETHER_CRC_LEN ) { -#if FE_DEBUG >= 2 + if ( len > ETHER_MAX_LEN - ETHER_CRC_LEN + || len < ETHER_MIN_LEN - ETHER_CRC_LEN ) { +#if FE_DEBUG >= 1 log( LOG_WARNING, "fe%d: received a %s packet? (%u bytes)\n", sc->sc_unit, - len < ETHER_MIN_SIZE- ETHER_CRC_SIZE ? "partial" : "big", + len < ETHER_MIN_LEN - ETHER_CRC_LEN + ? "partial" : "big", len ); #endif sc->sc_if.if_ierrors++; - fe_droppacket( sc ); + fe_emptybuffer( sc ); continue; } /* - * Check for a short (RUNT) packet. We *do* check - * but do nothing other than print a message. - * Short packets are illegal, but does nothing bad - * if it carries data for upper layer. - */ -#if FE_DEBUG >= 2 - if ( len < ETHER_MIN_LEN - ETHER_CRC_LEN) { - log( LOG_WARNING, - "fe%d: received a short packet? (%u bytes)\n", - sc->sc_unit, len ); - } -#endif - - /* * Go get a packet. */ if ( fe_get_packet( sc, len ) < 0 ) { @@ -2365,7 +2622,7 @@ fe_rint ( struct fe_softc * sc, u_char rstat ) sc->sc_unit, len ); #endif sc->sc_if.if_ierrors++; - fe_droppacket( sc ); + fe_droppacket( sc, len ); /* * We stop receiving packets, even if there are @@ -2854,7 +3111,8 @@ 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 ( length < ETHER_HDR_LEN + || length > ETHER_MAX_LEN - ETHER_CRC_LEN ) { log( LOG_ERR, "fe%d: got an out-of-spec packet (%u bytes) to send\n", sc->sc_unit, length ); diff --git a/sys/pc98/pc98/kbd.h b/sys/pc98/pc98/kbd.h deleted file mode 100644 index a4fcc74..0000000 --- a/sys/pc98/pc98/kbd.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Keyboard definitions - * from: unknown origin, 386BSD 0.1 - * $Id: kbd.h,v 1.4 1995/05/30 08:02:38 rgrimes Exp $ - */ - -#ifndef _I386_ISA_KBD_H_ -#define _I386_ISA_KBD_H_ 1 - -/* Reference: IBM AT Technical Reference Manual, - * pp. 1-38 to 1-43, 4-3 to 4-22 - */ - -/* commands and responses */ -#define KBC_RESET 0xFF /* Reset the keyboard */ -#define KBC_STSIND 0xED /* set keyboard status indicators */ -#define KBR_OVERRUN 0xFE /* Keyboard flooded */ -#define KBR_RESEND 0xFE /* Keyboard needs resend of command */ -#define KBR_ACK 0xFA /* Keyboard did receive command */ -#define KBR_RSTDONE 0xAA /* Keyboard reset complete */ -#endif /* _I386_ISA_KBD_H_ */ diff --git a/sys/pc98/pc98/lpt.c b/sys/pc98/pc98/lpt.c index 84235d6..eed039f 100644 --- a/sys/pc98/pc98/lpt.c +++ b/sys/pc98/pc98/lpt.c @@ -46,7 +46,7 @@ * SUCH DAMAGE. * * from: unknown origin, 386BSD 0.1 - * $Id: lpt.c,v 1.5 1996/09/10 09:38:13 asami Exp $ + * $Id: lpt.c,v 1.6 1996/11/02 10:39:30 asami Exp $ */ /* @@ -207,7 +207,7 @@ static int volatile lptflag = 1; #define LPTFLAGS(s) ((s)&0xfc) static struct lpt_softc { - short sc_port; + int sc_port; short sc_state; /* default case: negative prime, negative ack, handshake strobe, prime once */ @@ -320,7 +320,7 @@ static struct cdevsw lpt_cdevsw = * Internal routine to lptprobe to do port tests of one byte value */ static int -lpt_port_test (short port, u_char data, u_char mask) +lpt_port_test (int port, u_char data, u_char mask) { int temp, timeout; @@ -388,7 +388,7 @@ lptprobe(struct isa_device *dvp) #ifdef PC98 return 8; #else - short port; + int port; static short next_bios_lpt = 0; int status; u_char data; diff --git a/sys/pc98/pc98/machdep.c b/sys/pc98/pc98/machdep.c index 90f493f..78bcb06 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.13 1996/11/13 02:00:17 asami Exp $ + * $Id: machdep.c,v 1.14 1996/12/01 16:34:25 bde Exp $ */ #include "npx.h" @@ -1201,6 +1201,10 @@ init386(first) Maxmem = MAXMEM/4; #endif + idp = find_isadev(isa_devtab_null, &npxdriver, 0); + if (idp != NULL && idp->id_msize != 0) + Maxmem = idp->id_msize / 4; + /* call pmap initialization to make new kernel address space */ pmap_bootstrap (first, 0); diff --git a/sys/pc98/pc98/npx.c b/sys/pc98/pc98/npx.c index 186510a..34a5ba3 100644 --- a/sys/pc98/pc98/npx.c +++ b/sys/pc98/pc98/npx.c @@ -32,12 +32,13 @@ * SUCH DAMAGE. * * from: @(#)npx.c 7.2 (Berkeley) 5/12/91 - * $Id: npx.c,v 1.7 1996/10/09 21:46:29 asami Exp $ + * $Id: npx.c,v 1.8 1996/10/29 08:36:22 asami Exp $ */ #include "npx.h" #if NNPX > 0 +#include "opt_cpu.h" #include "opt_math_emulate.h" #include <sys/param.h> @@ -71,6 +72,22 @@ * 387 and 287 Numeric Coprocessor Extension (NPX) Driver. */ +/* Configuration flags. */ +#define NPX_DISABLE_I586_OPTIMIZED_BCOPY (1 << 0) +#define NPX_DISABLE_I586_OPTIMIZED_BZERO (1 << 1) +#define NPX_DISABLE_I586_OPTIMIZED_COPYIO (1 << 2) + +/* XXX - should be in header file. */ +extern void (*bcopy_vector) __P((const void *from, void *to, size_t len)); +extern void (*ovbcopy_vector) __P((const void *from, void *to, size_t len)); +extern int (*copyin_vector) __P((const void *udaddr, void *kaddr, size_t len)); +extern int (*copyout_vector) __P((const void *kaddr, void *udaddr, size_t len)); + +void i586_bcopy __P((const void *from, void *to, size_t len)); +void i586_bzero __P((void *buf, size_t len)); +int i586_copyin __P((const void *udaddr, void *kaddr, size_t len)); +int i586_copyout __P((const void *kaddr, void *udaddr, size_t len)); + #ifdef __GNUC__ #define fldcw(addr) __asm("fldcw %0" : : "m" (*(addr))) @@ -366,22 +383,39 @@ int npxattach(dvp) struct isa_device *dvp; { - if (npx_ex16) - printf("npx%d: INT 16 interface\n", dvp->id_unit); - else if (npx_irq13) - ; /* higher level has printed "irq 13" */ + /* The caller has printed "irq 13" for the npx_irq13 case. */ + if (!npx_irq13) { + printf("npx%d: ", dvp->id_unit); + if (npx_ex16) + printf("INT 16 interface\n"); #if defined(MATH_EMULATE) || defined(GPL_MATH_EMULATE) - else if (npx_exists) { - printf("npx%d: error reporting broken; using 387 emulator\n", - dvp->id_unit); - npx_exists = 0; - } else - printf("npx%d: 387 emulator\n",dvp->id_unit); + else if (npx_exists) { + printf("error reporting broken; using 387 emulator\n"); + hw_float = npx_exists = 0; + } else + printf("387 emulator\n"); #else - else - printf("npx%d: no 387 emulator in kernel!\n", dvp->id_unit); + else + printf("no 387 emulator in kernel!\n"); #endif + } npxinit(__INITIAL_NPXCW__); + +#ifdef I586_CPU + if (cpu_class == CPUCLASS_586 && npx_ex16) { + if (!(dvp->id_flags & NPX_DISABLE_I586_OPTIMIZED_BCOPY)) { + bcopy_vector = i586_bcopy; + ovbcopy_vector = i586_bcopy; + } + if (!(dvp->id_flags & NPX_DISABLE_I586_OPTIMIZED_BZERO)) + bzero = i586_bzero; + if (!(dvp->id_flags & NPX_DISABLE_I586_OPTIMIZED_COPYIO)) { + copyin_vector = i586_copyin; + copyout_vector = i586_copyout; + } + } +#endif + return (1); /* XXX unused */ } diff --git a/sys/pc98/pc98/sio.c b/sys/pc98/pc98/sio.c index c72f7b8..e84a4cd 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.8 1996/10/09 21:46:46 asami Exp $ + * $Id: sio.c,v 1.9 1996/11/02 10:39:44 asami Exp $ */ #include "opt_comconsole.h" @@ -2120,6 +2120,10 @@ sioioctl(dev, cmd, data, flag, p) case TIOCCDTR: (void)commctl(com, TIOCM_DTR, DMBIC); break; + /* + * XXX should disallow changing MCR_RTS if CS_RTS_IFLOW is set. The + * changes get undone on the next call to comparam(). + */ case TIOCMSET: (void)commctl(com, *(int *)data, DMSET); break; @@ -2278,13 +2282,6 @@ repeat: * of input, so enable RTS if it is now disabled and * there is room in the high-level buffer. */ - /* - * XXX this used not to look at CS_RTS_IFLOW. The - * change is to allow full control of MCR_RTS via - * ioctls after turning CS_RTS_IFLOW off. Check - * for races. We shouldn't allow the ioctls while - * CS_RTS_IFLOW is on. - */ #ifdef PC98 if(IS_8251(com->pc98_if_type)) tmp = com_tiocm_get(com) & TIOCM_RTS; @@ -2586,10 +2583,22 @@ retry: #endif if (!(tp->t_state & TS_TTSTOP)) com->state |= CS_TTGO; - if (cflag & CRTS_IFLOW) - com->state |= CS_RTS_IFLOW; /* XXX - secondary changes? */ - else + if (cflag & CRTS_IFLOW) { + com->state |= CS_RTS_IFLOW; + /* + * If CS_RTS_IFLOW just changed from off to on, the change + * needs to be propagated to MCR_RTS. This isn't urgent, + * so do it later by calling comstart() instead of repeating + * a lot of code from comstart() here. + */ + } else if (com->state & CS_RTS_IFLOW) { com->state &= ~CS_RTS_IFLOW; + /* + * CS_RTS_IFLOW just changed from on to off. Force MCR_RTS + * on here, since comstart() won't do it later. + */ + outb(com->modem_ctl_port, com->mcr_image |= MCR_RTS); + } /* * Set up state to handle output flow control. @@ -2624,6 +2633,7 @@ retry: enable_intr(); splx(s); + comstart(tp); return (0); } @@ -2663,19 +2673,16 @@ comstart(tp) #endif outb(com->modem_ctl_port, com->mcr_image &= ~MCR_RTS); } else { - /* - * XXX don't raise MCR_RTS if CTS_RTS_IFLOW is off. Set it - * appropriately in comparam() if RTS-flow is being changed. - * Check for races. - */ #ifdef PC98 if(IS_8251(com->pc98_if_type)) tmp = com_tiocm_get(com) & TIOCM_RTS; else tmp = com->mcr_image & MCR_RTS; - if (!(tmp) && com->iptr < com->ihighwater) + if (!(tmp) && com->iptr < com->ihighwater + && com->state & CS_RTS_IFLOW) #else - if (!(com->mcr_image & MCR_RTS) && com->iptr < com->ihighwater) + if (!(com->mcr_image & MCR_RTS) && com->iptr < com->ihighwater + && com->state & CS_RTS_IFLOW) #endif #ifdef PC98 if(IS_8251(com->pc98_if_type)) diff --git a/sys/pc98/pc98/syscons.c b/sys/pc98/pc98/syscons.c index ee5c0db..5448033 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.13 1996/10/30 22:40:15 asami Exp $ + * $Id: syscons.c,v 1.14 1996/11/09 00:39:59 asami Exp $ */ #include "sc.h" @@ -71,12 +71,14 @@ #include <i386/isa/isa_device.h> #include <i386/isa/timerreg.h> #include <i386/isa/kbdtables.h> +#include <i386/isa/kbdio.h> #include <pc98/pc98/syscons.h> #else #include <i386/isa/isa.h> #include <i386/isa/isa_device.h> #include <i386/isa/timerreg.h> #include <i386/isa/kbdtables.h> +#include <i386/isa/kbdio.h> #include <i386/isa/syscons.h> #endif @@ -121,6 +123,7 @@ static scr_stat *new_scp, *old_scp; static term_stat kernel_console; static default_attr *current_default; static int flags = 0; +static int sc_port = IO_KBD; static char init_done = COLD; static u_short sc_buffer[ROW*COL]; static char switch_in_progress = FALSE; @@ -229,8 +232,6 @@ 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); @@ -391,67 +392,110 @@ static int scprobe(struct isa_device *dev) { #ifdef PC98 + sc_port = dev->id_iobase; return(16); #else - int i, j, retries = 5; - u_char val; + int c; - /* Enable interrupts and keyboard controller */ - kbd_wait(); - outb(KB_STAT, KB_WRITE); - kbd_wait(); - outb(KB_DATA, KB_MODE); + sc_port = dev->id_iobase; - /* flush any noise in the buffer */ - while (inb(KB_STAT) & KB_BUF_FULL) { - DELAY(100); - (void) inb(KB_DATA); - } + /* discard anything left after UserConfig */ + empty_both_buffers(sc_port, 10); - /* Reset keyboard hardware */ - while (retries--) { - kbd_wait(); - outb(KB_DATA, KB_RESET); - for (i=0; i<10000; i++) { - DELAY(100); - val = inb(KB_DATA); - if (val == KB_ACK || val == KB_ECHO) - goto gotres; - if (val == KB_RESEND) - break; - } + /* save the current keyboard controller command byte */ + c = -1; + if (!write_controller_command(sc_port, KBDC_GET_COMMAND_BYTE)) { + /* CONTROLLER ERROR */ + printf("sc%d: unable to get the current command byte value.\n", + dev->id_unit); + goto fail; } -gotres: - if (retries < 0) { - printf("scprobe: keyboard won't accept RESET command\n"); + c = read_controller_data(sc_port); + if (c == -1) { + /* CONTROLLER ERROR */ + printf("sc%d: unable to get the current command byte value.\n", + dev->id_unit); goto fail; - } else { - i = 10; /* At most 10 retries. */ -gotack: - DELAY(100); - j = 1000; /* Wait at most 1 s. */ - while ((inb(KB_STAT) & KB_BUF_FULL) == 0 && --j > 0) DELAY(1000); - DELAY(1000); - val = inb(KB_DATA); - if (val == KB_ACK && --i > 0) - goto gotack; - if (val != KB_RESET_DONE) { - printf("scprobe: keyboard RESET failed (result = 0x%02x)\n", val); + } +#if 0 + /* override the keyboard lock switch */ + c |= KBD_OVERRIDE_KBD_LOCK; +#endif + + /* + * enable the keyboard port, but disable the keyboard intr. + * the aux port (mouse port) is disabled too. + */ + if (!set_controller_command_byte(sc_port, + c & ~(KBD_KBD_CONTROL_BITS | KBD_AUX_CONTROL_BITS), + KBD_ENABLE_KBD_PORT | KBD_DISABLE_KBD_INT + | KBD_DISABLE_AUX_PORT | KBD_DISABLE_AUX_INT)) { + /* CONTROLLER ERROR + * there is very little we can do... + */ + printf("sc%d: unable to set the command byte.\n", dev->id_unit); + goto fail; + } + + /* reset keyboard hardware */ + if (!reset_kbd(sc_port)) { + /* KEYBOARD ERROR + * Keyboard reset may fail either because the keyboard doen't exist, + * or because the keyboard doesn't pass the self-test, or the keyboard + * controller on the motherboard and the keyboard somehow fail to + * shake hands. It is just possible, particularly in the last case, + * that the keyoard controller may be left in a hung state. + * test_controller() and test_kbd_port() appear to bring the keyboard + * controller back (I don't know why and how, though.) + */ + empty_both_buffers(sc_port, 10); + test_controller(sc_port); + test_kbd_port(sc_port); + /* We could disable the keyboard port and interrupt... but, + * the keyboard may still exist (see above). + */ + if (bootverbose) + printf("sc%d: failed to reset the keyboard.\n", dev->id_unit); + goto fail; + } + + /* + * Allow us to set the XT_KEYBD flag in UserConfig so that keyboards + * such as those on the IBM ThinkPad laptop computers can be used + * with the standard console driver. + */ + if (dev->id_flags & XT_KEYBD) { + if (send_kbd_command_and_data( + sc_port, KBDC_SET_SCAN_CODESET, 1) == KBD_ACK) { + /* XT kbd doesn't need scan code translation */ + c &= ~KBD_TRANSLATION; + } else { + /* KEYBOARD ERROR + * The XT kbd isn't usable unless the proper scan code set + * is selected. + */ + printf("sc%d: unable to set the XT keyboard mode.\n", dev->id_unit); goto fail; } } -#ifdef XT_KEYBOARD - kbd_wait(); - outb(KB_DATA, 0xF0); - kbd_wait(); - outb(KB_DATA, 1); - kbd_wait(); -#endif /* XT_KEYBOARD */ - - succeed: + /* enable the keyboard port and intr. */ + if (!set_controller_command_byte(sc_port, c & ~KBD_KBD_CONTROL_BITS, + KBD_ENABLE_KBD_PORT | KBD_ENABLE_KBD_INT)) { + /* CONTROLLER ERROR + * This is serious; we are left with the disabled keyboard intr. + */ + printf("sc%d: unable to enable the keyboard port and intr.\n", + dev->id_unit); + goto fail; + } + +succeed: return (IO_KBDSIZE); - fail: +fail: + if (c != -1) + /* try to restore the command byte as before, if possible */ + set_controller_command_byte(sc_port, c, 0); return ((dev->id_flags & DETECT_KBD) ? 0 : IO_KBDSIZE); #endif } @@ -660,8 +704,10 @@ scclose(dev_t dev, int flag, int mode, struct proc *p) scp->smode.mode = VT_AUTO; #endif } + spltty(); (*linesw[tp->t_line].l_close)(tp, flag); ttyclose(tp); + spl0(); return(0); } @@ -709,7 +755,7 @@ scintr(int unit) cur_tty = VIRTUAL_TTY(get_scr_num()); if (!(cur_tty->t_state & TS_ISOPEN)) if (!((cur_tty = CONSOLE_TTY)->t_state & TS_ISOPEN)) - return; + continue; switch (c & 0xff00) { case 0x0000: /* normal key */ @@ -720,7 +766,7 @@ scintr(int unit) while (len-- > 0) (*linesw[cur_tty->t_line].l_rint)(*cp++ & 0xFF, cur_tty); } - break; + break; case MKEY: /* meta is active, prepend ESC */ (*linesw[cur_tty->t_line].l_rint)(0x1b, cur_tty); (*linesw[cur_tty->t_line].l_rint)(c & 0xFF, cur_tty); @@ -1236,6 +1282,8 @@ scioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p) error = suser(p->p_ucred, &p->p_acflag); if (error != 0) return error; + if (securelevel > 0) + return EPERM; fp = (struct trapframe *)p->p_md.md_regs; fp->tf_eflags |= PSL_IOPL; return 0; @@ -1317,8 +1365,7 @@ scioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p) if (*data & 0x80) return EINVAL; i = spltty(); - kbd_cmd(KB_SETRAD); - kbd_cmd(*data); + send_kbd_command_and_data(sc_port, KBDC_SET_TYPEMATIC, *data); splx(i); #endif return 0; @@ -1609,7 +1656,7 @@ sccnputc(dev_t dev, int c) scp->term = kernel_console; current_default = &kernel_default; - if (!(scp->status & UNKNOWN_MODE)) + if (scp == cur_console && !(scp->status & UNKNOWN_MODE)) remove_cursor_image(scp); buf[0] = c; ansi_put(scp, buf, 1); @@ -1684,12 +1731,12 @@ scrn_timer() /* * With release 2.1 of the Xaccel server, the keyboard is left - * hanging pretty often. Apparently the interrupt from the + * hanging pretty often. Apparently an interrupt from the * keyboard is lost, and I don't know why (yet). - * This Ugly hack calls scintr if input is ready and - * conveniently hides the problem. XXX + * This ugly hack calls scintr if input is ready for the keyboard + * and conveniently hides the problem. XXX */ - if (inb(KB_STAT) & KB_BUF_FULL) + if ((inb(sc_port+KBD_STATUS_PORT)&KBDS_BUFFER_FULL) == KBDS_KBD_BUFFER_FULL) scintr(0); /* should we just return ? */ @@ -3063,6 +3110,13 @@ scinit(void) outb(crtc_addr, 15); hw_cursor |= inb(crtc_addr + 1); + /* + * Validate cursor location. It may be off the screen. Then we must + * not use it for the initial buffer offset. + */ + if (hw_cursor >= ROW * COL) + hw_cursor = (ROW - 1) * COL; + /* move hardware cursor out of the way */ outb(crtc_addr, 14); outb(crtc_addr + 1, 0xff); @@ -3292,22 +3346,25 @@ history_down_line(scr_stat *scp) static u_int scgetc(u_int flags) { + struct key_t *key; u_char scancode, keycode; u_int state, action; - struct key_t *key; + int c; static u_char esc_flag = 0, compose = 0; static u_int chr = 0; next_code: - /* check if there is anything in the keyboard buffer */ - if (inb(KB_STAT) & KB_BUF_FULL) { - DELAY(25); - scancode = inb(KB_DATA); + /* first see if there is something in the keyboard port */ + if (flags & SCGETC_NONBLOCK) { + c = read_kbd_data_no_wait(sc_port); + if (c == -1) + return(NOKEY); + } else { + do { + c = read_kbd_data(sc_port); + } while(c == -1); } - else if (flags & SCGETC_NONBLOCK) - return(NOKEY); - else - goto next_code; + scancode = (u_char)c; /* do the /dev/random device a favour */ if (!(flags & SCGETC_CN)) @@ -3867,46 +3924,6 @@ mask2attr(struct term_stat *term) } static void -kbd_wait(void) -{ -#ifdef PC98 - DELAY(30); -#else - int i = 500; - - while (i--) { - if ((inb(KB_STAT) & KB_READY) == 0) - break; - DELAY (25); - } -#endif -} - -#ifndef PC98 -static void -kbd_cmd(u_char command) -{ - int i, retry = 5; - do { - kbd_wait(); - outb(KB_DATA, command); - i = 50000; - while (i--) { - if (inb(KB_STAT) & KB_BUF_FULL) { - int val; - DELAY(25); - val = inb(KB_DATA); - if (val == KB_ACK) - return; - if (val == KB_RESEND) - break; - } - } - } while (retry--); -} -#endif - -static void update_leds(int which) { #ifndef PC98 @@ -3920,9 +3937,10 @@ update_leds(int which) else which &= ~CLKED; } + s = spltty(); - kbd_cmd(KB_SETLEDS); - kbd_cmd(xlate_leds[which & LED_MASK]); + send_kbd_command_and_data(sc_port, KBDC_SET_LEDS, + xlate_leds[which & LED_MASK]); splx(s); #endif } diff --git a/sys/pc98/pc98/syscons.h b/sys/pc98/pc98/syscons.h index bb20855..702cc1e 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.6 1996/10/29 08:36:28 asami Exp $ + * $Id: syscons.h,v 1.7 1996/10/30 22:40:17 asami Exp $ */ #ifndef _PC98_PC98_SYSCONS_H_ @@ -70,6 +70,7 @@ #define BLINK_CURSOR 0x00002 #define CHAR_CURSOR 0x00004 #define DETECT_KBD 0x00008 +#define XT_KEYBD 0x00010 /* attribute flags */ #define NORMAL_ATTR 0x00 diff --git a/sys/pc98/pc98/wd.c b/sys/pc98/pc98/wd.c index 2f6da0e..d5acdbb 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.10 1996/11/02 10:40:07 asami Exp $ + * $Id: wd.c,v 1.11 1996/12/01 16:34:30 bde Exp $ */ /* TODO: @@ -173,7 +173,7 @@ struct disk { u_char dk_status; /* copy of status reg. */ u_char dk_error; /* copy of error reg. */ u_char dk_timeout; /* countdown to next timeout */ - short dk_port; /* i/o port base */ + int dk_port; /* i/o port base */ #ifdef DEVFS void *dk_bdev; /* devfs token for whole disk */ void *dk_cdev; /* devfs token for raw whole disk */ diff --git a/sys/sys/diskslice.h b/sys/sys/diskslice.h index 8786f5a..532fa8c 100644 --- a/sys/sys/diskslice.h +++ b/sys/sys/diskslice.h @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: diskslice.h,v 1.15 1996/09/20 17:39:34 bde Exp $ + * $Id: diskslice.h,v 1.16 1996/09/21 14:59:28 bde Exp $ */ #ifndef _SYS_DISKSLICE_H_ @@ -47,10 +47,6 @@ struct diskslice { u_long ds_offset; /* starting sector */ u_long ds_size; /* number of sectors */ int ds_type; /* (foreign) slice type */ -#ifdef PC98 - int ds_subtype; /* sub slice type */ - u_char ds_name[16]; /* slice name */ -#endif struct dkbad_intern *ds_bad; /* bad sector table, if any */ struct disklabel *ds_label; /* BSD label, if any */ void *ds_bdev; /* devfs token for whole slice */ @@ -88,10 +84,6 @@ struct diskslice { u_long ds_offset; /* starting sector */ u_long ds_size; /* number of sectors */ int ds_type; /* (foreign) slice type */ -#ifdef PC98 - int ds_subtype; /* sub slice type */ - u_char ds_name[16]; /* slice name */ -#endif struct dkbad_intern *ds_bad; /* bad sector table, if any */ void *ds_date; /* Slice type specific data */ struct slice_switch *switch; /* switch table for type handler */ |