Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/hp300 Switch DCA and APCI serial devices to use MI ...



details:   https://anonhg.NetBSD.org/src/rev/254ccae68b42
branches:  trunk
changeset: 555084:254ccae68b42
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Sat Nov 08 11:18:33 2003 +0000

description:
Switch DCA and APCI serial devices to use MI com(4) driver.

DCA is tested on HP362 and HP382 with serial console,
but APCI on HP4xx is not tested yet.

diffstat:

 sys/arch/hp300/conf/GENERIC       |    9 +-
 sys/arch/hp300/conf/INSTALL       |    7 +-
 sys/arch/hp300/conf/files.hp300   |   12 +-
 sys/arch/hp300/conf/majors.hp300  |    6 +-
 sys/arch/hp300/dev/com_dio.c      |  207 ++++++++++++++++++++++++++++++++++
 sys/arch/hp300/dev/com_dioreg.h   |   58 +++++++++
 sys/arch/hp300/dev/com_diovar.h   |   29 ++++
 sys/arch/hp300/dev/com_frodo.c    |  181 ++++++++++++++++++++++++++++++
 sys/arch/hp300/dev/com_frodovar.h |   29 ++++
 sys/arch/hp300/dev/frodo.c        |  225 ++++++++++++++++++++++++++++++++++++-
 sys/arch/hp300/dev/frodovar.h     |   14 ++-
 sys/arch/hp300/hp300/autoconf.c   |   24 ++-
 sys/arch/hp300/include/intr.h     |    3 +-
 13 files changed, 765 insertions(+), 39 deletions(-)

diffs (truncated from 1059 to 300 lines):

diff -r 585cd6d260dc -r 254ccae68b42 sys/arch/hp300/conf/GENERIC
--- a/sys/arch/hp300/conf/GENERIC       Sat Nov 08 09:25:01 2003 +0000
+++ b/sys/arch/hp300/conf/GENERIC       Sat Nov 08 11:18:33 2003 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.95 2003/09/22 14:11:17 cl Exp $
+# $NetBSD: GENERIC,v 1.96 2003/11/08 11:18:33 tsutsui Exp $
 #
 # GENERIC machine description file
 # 
@@ -22,7 +22,7 @@
 
 options        INCLUDE_CONFIG_FILE     # embed config file in kernel binary
 
-#ident                 "GENERIC-$Revision: 1.95 $"
+#ident                 "GENERIC-$Revision: 1.96 $"
 
 maxusers       32              # estimated number of users
 
@@ -174,7 +174,7 @@
 
 # 8250-like serial ports found on Frodo ASIC
 #dnkbd0                at frodo? offset 0x0    # Domain keyboard flavor
-apci*          at frodo? offset ?      # tty flavor
+com*           at frodo? offset ?      # tty flavor
 
 dvbox*         at intio?               # Davinci framebuffer
 dvbox*         at dio? scode ?
@@ -199,8 +199,7 @@
 
 ite*           at grf?                 # Internal Terminal Emulator
 
-dca0           at dio? scode 9 flags 1 # DCA serial interfaces
-dca*           at dio? scode ?
+com*           at dio? scode ?         # DCA serial interfaces
 
 dcm*           at dio? scode ? flags 0xe # DCM 4- or 8-port serial interfaces
 
diff -r 585cd6d260dc -r 254ccae68b42 sys/arch/hp300/conf/INSTALL
--- a/sys/arch/hp300/conf/INSTALL       Sat Nov 08 09:25:01 2003 +0000
+++ b/sys/arch/hp300/conf/INSTALL       Sat Nov 08 11:18:33 2003 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: INSTALL,v 1.12 2003/09/22 14:11:18 cl Exp $
+# $NetBSD: INSTALL,v 1.13 2003/11/08 11:18:33 tsutsui Exp $
 #
 # INSTALL machine description file
 #
@@ -136,7 +136,7 @@
 
 # 8250-like serial ports found on Frodo ASIC
 #dnkbd0                at frodo? offset 0x0    # Domain keyboard flavor
-apci*          at frodo? offset ?      # tty flavor
+com*           at frodo? offset ?      # tty flavor
 
 # Davinci framebuffer
 dvbox*         at intio?
@@ -167,8 +167,7 @@
 # Internal Terminal Emulator
 ite*           at grf?
 
-dca0           at dio? scode 9 flags 1 # DCA serial interfaces
-dca*           at dio? scode ?
+com*           at dio? scode ?         # DCA serial interfaces
 
 dcm*           at dio? scode ? flags 0xe # DCM 4- or 8-port serial interfaces
 
diff -r 585cd6d260dc -r 254ccae68b42 sys/arch/hp300/conf/files.hp300
--- a/sys/arch/hp300/conf/files.hp300   Sat Nov 08 09:25:01 2003 +0000
+++ b/sys/arch/hp300/conf/files.hp300   Sat Nov 08 11:18:33 2003 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.hp300,v 1.68 2003/08/01 01:18:47 tsutsui Exp $
+#      $NetBSD: files.hp300,v 1.69 2003/11/08 11:18:33 tsutsui Exp $
 #
 # hp300-specific configuration info
 
@@ -68,9 +68,8 @@
 file   arch/hp300/dev/frodo.c          frodo
 
 # Apollo APCI 8250-like UARTs
-device apci: tty
-attach apci at frodo
-file   arch/hp300/dev/apci.c           apci needs-flag
+attach com at frodo with com_frodo
+file   arch/hp300/dev/com_frodo.c      com_frodo needs-flag
 
 # Frame buffer attribute
 define grfdev { }
@@ -121,9 +120,8 @@
 attach topcat at dio with topcat_dio
 
 # DCA serial interface
-device dca: tty
-attach dca at dio
-file   arch/hp300/dev/dca.c            dca needs-flag
+attach com at dio with com_dio
+file   arch/hp300/dev/com_dio.c        com_dio needs-flag
 
 # DCM serial interface
 device dcm: tty
diff -r 585cd6d260dc -r 254ccae68b42 sys/arch/hp300/conf/majors.hp300
--- a/sys/arch/hp300/conf/majors.hp300  Sat Nov 08 09:25:01 2003 +0000
+++ b/sys/arch/hp300/conf/majors.hp300  Sat Nov 08 11:18:33 2003 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: majors.hp300,v 1.12 2003/10/24 08:09:53 jdolecek Exp $
+#      $NetBSD: majors.hp300,v 1.13 2003/11/08 11:18:33 tsutsui Exp $
 #
 # Device majors for hp300
 #
@@ -15,7 +15,7 @@
 device-major   rd              char 9   block 2        rd
 device-major   grf             char 10                 grf
 device-major   ppi             char 11                 ppi
-device-major   dca             char 12                 dca
+device-major   com             char 12                 com
 device-major   ite             char 13                 ite
 device-major   hil             char 14
 device-major   dcm             char 15                 dcm
@@ -29,7 +29,7 @@
 device-major   tun             char 23                 tun
 device-major   lkm             char 24                 lkm
 
-device-major   apci            char 31                 apci
+# device major 31 was apci (superseded by MI com)
 device-major   md              char 32  block 14       md
 device-major   rnd             char 33                 rnd
 device-major   scsibus         char 34                 scsibus
diff -r 585cd6d260dc -r 254ccae68b42 sys/arch/hp300/dev/com_dio.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/hp300/dev/com_dio.c      Sat Nov 08 11:18:33 2003 +0000
@@ -0,0 +1,207 @@
+/*     $NetBSD: com_dio.c,v 1.1 2003/11/08 11:18:33 tsutsui 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.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *        This product includes software developed by the NetBSD
+ *        Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation 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 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
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: com_dio.c,v 1.1 2003/11/08 11:18:33 tsutsui Exp $");
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/device.h>
+#include <sys/termios.h>
+#include <sys/ttydefaults.h>
+
+#include <machine/bus.h>
+
+#include <dev/ic/comreg.h>
+#include <dev/ic/comvar.h>
+
+#include <hp300/dev/diovar.h>
+#include <hp300/dev/diodevs.h>
+#include <hp300/dev/com_dioreg.h>
+#include <hp300/dev/com_diovar.h>
+
+struct com_dio_softc {
+       struct  com_softc sc_com;       /* real "com" softc */
+
+       /* DIO-specific goo. */
+       struct  bus_space_tag sc_tag;   /* device specific bus space tag */
+       void    *sc_ih;                 /* interrupt handler */
+};
+
+int com_dio_match(struct device *, struct cfdata *, void *);
+void com_dio_attach(struct device *, struct device *, void *);
+
+CFATTACH_DECL(com_dio, sizeof(struct com_dio_softc),
+    com_dio_match, com_dio_attach, NULL, NULL);
+
+static int com_dio_speed = TTYDEF_SPEED;
+static struct bus_space_tag comcntag;
+
+#define CONMODE        ((TTYDEF_CFLAG & ~(CSIZE | CSTOPB | PARENB)) | CS8) /* 8N1 */
+
+int
+com_dio_match(struct device *parent, struct cfdata *match, void *aux)
+{
+       struct dio_attach_args *da = aux;
+
+       switch (da->da_id) {
+       case DIO_DEVICE_ID_DCA0:
+       case DIO_DEVICE_ID_DCA0REM:
+       case DIO_DEVICE_ID_DCA1:
+       case DIO_DEVICE_ID_DCA1REM:
+               return 1;
+       }
+
+       return 0;
+}
+
+void
+com_dio_attach(struct device *parent, struct device *self, void *aux)
+{
+       struct com_dio_softc *dsc = (void *)self;
+       struct com_softc *sc = &dsc->sc_com;
+       bus_space_tag_t iot;
+       bus_space_handle_t iohdca, iohcom;
+       struct dio_attach_args *da = aux;
+       int isconsole;
+
+       isconsole = com_is_console(&comcntag, da->da_addr + DCA_COM_OFFSET,
+           &iohcom);
+
+       if (isconsole) {
+               iot = &comcntag;
+               bus_space_unmap(iot, iohcom, COM_NPORTS);
+       } else {
+               iot = &dsc->sc_tag;
+               memcpy(iot, da->da_bst, sizeof(struct bus_space_tag));
+               dio_set_bus_space_oddbyte(iot);
+       }
+
+       if (bus_space_map(iot, da->da_addr, DCA_SIZE, 0, &iohdca) ||
+           bus_space_subregion(iot, iohdca, DCA_COM_OFFSET,
+           COM_NPORTS << 1, &iohcom)) {
+               printf(": can't map i/o space\n");
+               return;
+       }
+
+       if (!isconsole) {
+               bus_space_write_1(iot, iohdca, DCA_RESET, 0xff);
+               DELAY(1000);
+       }
+
+       sc->sc_iot = iot;
+       sc->sc_ioh = iohcom;
+       sc->sc_iobase = da->da_addr + DCA_COM_OFFSET;
+       sc->sc_frequency = COM_DIO_FREQ;
+
+       com_attach_subr(sc);
+
+       dsc->sc_ih = dio_intr_establish(comintr, sc, da->da_ipl,
+           ((sc->sc_hwflags & COM_HW_FIFO) != 0) ? IPL_TTY : IPL_TTYNOBUF);
+
+       /* Enable interrupts. */
+       bus_space_write_1(iot, iohdca, DCA_IC, IC_IE);
+}
+



Home | Main Index | Thread Index | Old Index