Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/x68k Finally switch PSX16550 fast serial board driv...



details:   https://anonhg.NetBSD.org/src/rev/b32f5d373e93
branches:  trunk
changeset: 779052:b32f5d373e93
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Sun Apr 29 07:17:11 2012 +0000

description:
Finally switch PSX16550 fast serial board driver to using MI com(4) driver.
Based on isaki@'s patch and debugged by both isaki@ and tsutsui@.

PSX16550 specific hardware infomation is taken from Human68k's PSXIO driver:
http://retropc.net/x68000/software/hardware/psx16550/

XXX1: TL16C550C seems to have some timing critical issue around THRE interrupt
XXX2: auto hardware flow control of TL16C550 is not implemented in MI com(4)

diffstat:

 sys/arch/x68k/conf/GENERIC     |     8 +-
 sys/arch/x68k/conf/INSTALL     |     8 +-
 sys/arch/x68k/conf/files.x68k  |     9 +-
 sys/arch/x68k/conf/majors.x68k |     4 +-
 sys/arch/x68k/dev/com.c        |  1188 ----------------------------------------
 sys/arch/x68k/dev/com_intio.c  |   130 ++++
 sys/arch/x68k/dev/comreg.h     |    44 -
 sys/arch/x68k/x68k/locore.s    |    31 +-
 sys/arch/x68k/x68k/vectors.s   |     6 +-
 9 files changed, 148 insertions(+), 1280 deletions(-)

diffs (truncated from 1545 to 300 lines):

diff -r 611f3e8e3623 -r b32f5d373e93 sys/arch/x68k/conf/GENERIC
--- a/sys/arch/x68k/conf/GENERIC        Sun Apr 29 03:46:43 2012 +0000
+++ b/sys/arch/x68k/conf/GENERIC        Sun Apr 29 07:17:11 2012 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.160 2012/03/10 21:51:57 joerg Exp $
+# $NetBSD: GENERIC,v 1.161 2012/04/29 07:17:11 tsutsui Exp $
 #
 # GENERIC machine description file
 # 
@@ -22,7 +22,7 @@
 
 options        INCLUDE_CONFIG_FILE     # embed config file in kernel binary
 
-#ident                 "GENERIC-$Revision: 1.160 $"
+#ident                 "GENERIC-$Revision: 1.161 $"
 
 maxusers       8
 
@@ -290,8 +290,8 @@
 powsw0 at mfp0                         # Front switch
 #powsw1        at mfp0                         # External power switch
 
-xcom0  at mainbus0                     # NS16550 fast serial
-xcom1  at mainbus0
+com0   at intio0 addr 0xefff00 intr 240        # PSX16550, port1
+com1   at intio0 addr 0xefff10 intr 241        # PSX16550, port2
 
 ## Audio device
 vs0 at intio0 addr 0xe92000 dma 3 dmaintr 106
diff -r 611f3e8e3623 -r b32f5d373e93 sys/arch/x68k/conf/INSTALL
--- a/sys/arch/x68k/conf/INSTALL        Sun Apr 29 03:46:43 2012 +0000
+++ b/sys/arch/x68k/conf/INSTALL        Sun Apr 29 07:17:11 2012 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: INSTALL,v 1.94 2011/12/18 05:49:33 dholland Exp $
+#      $NetBSD: INSTALL,v 1.95 2012/04/29 07:17:11 tsutsui Exp $
 
 #
 #      INSTALL -- installation kernel.
@@ -8,7 +8,7 @@
 
 #options       INCLUDE_CONFIG_FILE     # embed config file in kernel binary
 
-#ident                 "INSTALL-$Revision: 1.94 $"
+#ident                 "INSTALL-$Revision: 1.95 $"
 
 makeoptions    COPTS="-Os"             # Optimise for space. Implies -O2
 
@@ -258,8 +258,8 @@
 sram0  at intio0 addr 0xed0000         # battery-backuped static RAM
 #pseudo-device bell                    # OPM bell
 
-#xcom0 at mainbus0                     # NS16550 fast serial
-#xcom1 at mainbus0
+#com0  at intio0 addr 0xefff00 intr 240        # PSX16550, port1
+#com1  at intio0 addr 0xefff10 intr 241        # PSX16550, port2
 
 ## Audio device
 #vs0 at intio0 addr 0xe92000 dma 3 dmaintr 106
diff -r 611f3e8e3623 -r b32f5d373e93 sys/arch/x68k/conf/files.x68k
--- a/sys/arch/x68k/conf/files.x68k     Sun Apr 29 03:46:43 2012 +0000
+++ b/sys/arch/x68k/conf/files.x68k     Sun Apr 29 07:17:11 2012 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.x68k,v 1.77 2011/11/27 09:00:32 isaki Exp $
+#      $NetBSD: files.x68k,v 1.78 2012/04/29 07:17:11 tsutsui Exp $
 #
 # new style config file for x68k architecture
 #
@@ -51,10 +51,6 @@
 # 68060 software support package
 include "arch/m68k/060sp/files.060sp"
 
-device xcom: tty
-attach xcom at mainbus
-file   arch/x68k/dev/com.c             xcom needs-count
-
 # graphic devices
 define grfb { addr = -1 }
 
@@ -149,6 +145,9 @@
 attach par at intio
 file   arch/x68k/dev/par.c             par needs-flag
 
+attach com at intio with com_intio
+file   arch/x68k/dev/com_intio.c       com_intio
+
 #
 # SCSI drivers
 #
diff -r 611f3e8e3623 -r b32f5d373e93 sys/arch/x68k/conf/majors.x68k
--- a/sys/arch/x68k/conf/majors.x68k    Sun Apr 29 03:46:43 2012 +0000
+++ b/sys/arch/x68k/conf/majors.x68k    Sun Apr 29 07:17:11 2012 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: majors.x68k,v 1.25 2011/11/19 12:27:43 isaki Exp $
+#      $NetBSD: majors.x68k,v 1.26 2012/04/29 07:17:11 tsutsui Exp $
 #
 # Device majors for x68k
 #
@@ -19,7 +19,7 @@
 device-major   ite             char 13                 ite
 device-major   kbd             char 14                 kbd
 device-major   ms              char 15                 ms
-device-major   xcom            char 16                 xcom
+device-major   com             char 16                 com
 device-major   audio           char 17                 audio
 device-major   fd              char 18  block 2        fd
 device-major   vnd             char 19  block 6        vnd
diff -r 611f3e8e3623 -r b32f5d373e93 sys/arch/x68k/dev/com.c
--- a/sys/arch/x68k/dev/com.c   Sun Apr 29 03:46:43 2012 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,1188 +0,0 @@
-/*     $NetBSD: com.c,v 1.57 2011/04/24 16:26:58 rmind Exp $   */
-
-/*-
- * Copyright (c) 1998 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Charles M. Hannum.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*-
- * Copyright (c) 1991 The Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- *     @(#)com.c       7.5 (Berkeley) 5/16/91
- */
-
-/*
- * COM driver, based on HP dca driver
- * uses National Semiconductor NS16450/NS16550AF UART
- */
-
-#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: com.c,v 1.57 2011/04/24 16:26:58 rmind Exp $");
-
-#include "opt_ddb.h"
-#include "opt_kgdb.h"
-#include "opt_com.h"
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/ioctl.h>
-#include <sys/select.h>
-#include <sys/tty.h>
-#include <sys/proc.h>
-#include <sys/conf.h>
-#include <sys/file.h>
-#include <sys/uio.h>
-#include <sys/kernel.h>
-#include <sys/syslog.h>
-#include <sys/types.h>
-#include <sys/device.h>
-#include <sys/kauth.h>
-
-#ifdef KGDB
-#include <machine/remote-sl.h>
-#include <sys/kgdb.h>
-#endif
-
-#include <machine/cpu.h>
-#if 0
-#include <machine/pio.h>
-#endif
-
-#include <x68k/x68k/iodevice.h>
-#if 0
-#include <dev/isa/isavar.h>
-#endif
-#include <x68k/dev/comreg.h>
-#include <dev/ic/ns16550reg.h>
-#ifdef COM_HAYESP
-#include <dev/ic/hayespreg.h>
-#endif
-#define        com_lcr com_cfcr
-
-#define        COM_IBUFSIZE    (2 * 512)
-#define        COM_IHIGHWATER  ((3 * COM_IBUFSIZE) / 4)
-
-struct com_softc {
-       device_t sc_dev;
-       void *sc_ih;
-       struct tty *sc_tty;
-
-       struct callout sc_diag_ch;
-
-       int sc_overflows;
-       int sc_floods;
-       int sc_errors;
-
-       int sc_halt;
-
-       int sc_iobase;
-#ifdef COM_HAYESP
-       int sc_hayespbase;
-#endif
-       u_char sc_hwflags;
-#define        COM_HW_NOIEN    0x01
-#define        COM_HW_FIFO     0x02
-#define        COM_HW_HAYESP   0x04
-#define        COM_HW_CONSOLE  0x40
-       u_char sc_swflags;
-#define        COM_SW_SOFTCAR  0x01
-#define        COM_SW_CLOCAL   0x02
-#define        COM_SW_CRTSCTS  0x04
-#define        COM_SW_MDMBUF   0x08
-       u_char sc_msr, sc_mcr, sc_lcr, sc_ier;
-       u_char sc_dtr;
-
-       u_char *sc_ibuf, *sc_ibufp, *sc_ibufhigh, *sc_ibufend;
-       u_char sc_ibufs[2][COM_IBUFSIZE];
-};
-
-struct callout com_poll_ch;
-
-int comprobe(device_t, cfdata_t, void *);
-void comattach(device_t, device_t, void *);
-
-static int comprobe1(int);
-static void comdiag(void *);
-int comintr(void *);
-static void compollin(void *);
-static int comparam(struct tty *, struct termios *);
-static void comstart(struct tty *);
-static void cominit(int);
-static int comspeed(long);
-
-static u_char tiocm_xxx2mcr(int);
-
-CFATTACH_DECL_NEW(xcom, sizeof(struct com_softc),
-    comprobe, comattach, NULL, NULL);
-
-extern struct cfdriver xcom_cd;
-
-int com_attached;
-
-dev_type_open(comopen);
-dev_type_close(comclose);
-dev_type_read(comread);
-dev_type_write(comwrite);
-dev_type_ioctl(comioctl);
-dev_type_stop(comstop);
-dev_type_tty(comtty);
-dev_type_poll(compoll);
-
-const struct cdevsw xcom_cdevsw = {
-       comopen, comclose, comread, comwrite, comioctl,
-       comstop, comtty, compoll, nommap, ttykqfilter, D_TTY
-};
-
-#define        outb(addr, val)         *(u_char *)(addr) = (val)
-#define        inb(addr)               *(u_char *)(addr)
-#define pio(addr,regno)        ((addr)+1+(regno)*2)
-
-#ifdef COMCONSOLE
-int    comdefaultrate = CONSPEED;



Home | Main Index | Thread Index | Old Index