1 /*        $NetBSD: qvavar.h,v 1.2 2019/12/27 06:52:43 msaitoh Exp $   */
2 
3 /*-
4  * Copyright (c) 2015 The NetBSD Foundation, Inc.
5  * All rights reserved.
6  *
7  * This code is derived from software contributed to The NetBSD Foundation
8  * by Charles H. Dickman
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  * 1. Redistributions of source code must retain the above copyright
14  *    notice, this list of conditions and the following disclaimer.
15  * 2. Redistributions in binary form must reproduce the above copyright
16  *    notice, this list of conditions and the following disclaimer in the
17  *    documentation and/or other materials provided with the distribution.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29  * POSSIBILITY OF SUCH DAMAGE.
30  */
31 
32 /*
33  * Copyright (c) 1996, 1997 Philip L. Budne.
34  * Copyright (c) 1993 Philip A. Nelson.
35  * All rights reserved.
36  *
37  * Redistribution and use in source and binary forms, with or without
38  * modification, are permitted provided that the following conditions
39  * are met:
40  * 1. Redistributions of source code must retain the above copyright
41  *    notice, this list of conditions and the following disclaimer.
42  * 2. Redistributions in binary form must reproduce the above copyright
43  *    notice, this list of conditions and the following disclaimer in the
44  *    documentation and/or other materials provided with the distribution.
45  * 3. All advertising materials mentioning features or use of this software
46  *    must display the following acknowledgement:
47  *        This product includes software developed by Philip A. Nelson.
48  * 4. The name of Philip A. Nelson may not be used to endorse or promote
49  *    products derived from this software without specific prior written
50  *    permission.
51  *
52  * THIS SOFTWARE IS PROVIDED BY PHILIP NELSON ``AS IS'' AND ANY EXPRESS OR
53  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
54  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
55  * IN NO EVENT SHALL PHILIP NELSON BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
56  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
57  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
58  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
59  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
60  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
61  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
62  *
63  *        qvavar.h: definitions for qvss scn2681 DUART
64  */
65 
66 #ifndef _VAX_UBA_QVVAR_H_
67 #define _VAX_UBA_QVVAR_H_
68 
69 /* Constants. */
70 #ifdef COMDEF_SPEED
71 #undef  TTYDEF_SPEED
72 #define TTYDEF_SPEED    COMDEF_SPEED    /* default baud rate */
73 #endif
74 
75 #define SCN_SIZE             0x10       /* address space for port */
76 #define SCN_CONSOLE              0      /* minor number of console */
77 #define SCN_CONSDUART                      0
78 #define SCN_CONSCHAN                       0
79 
80 #define CH_SZ                 16
81 #define DUART_SZ    32
82 #define SCN_REG(n)  ((n) << 1)          /* DUART bytes are word aligned */
83 #define QVA_FIRSTREG    SCN_REG(0)
84 #define QVA_WINSIZE     (SCN_REG(16) - SCN_REG(0))
85 
86 /* A QVAUX is SCN2681 DUART */
87 
88 #define   NQVAUXLINE          2
89 
90 #define QVA_C2I(c)  (0)                 /* convert controller # to index */
91 #define QVA_I2C(c)  (0)                 /* convert minor to controller # */
92 #define QVA_PORT(u) ((u)&01)    /* extract the port # */
93 #define QVA_QVCSR       (-32)             /* offset to VCB01 CSR */
94 #define QVA_QVIC        (QVA_QVCSR + 12)  /* offset to VCB01 IC */
95 
96 struct    qvaux_softc {
97           device_t      sc_dev;           /* Autoconf blaha */
98           struct    evcnt         sc_rintrcnt;  /* receive interrupt counts */
99           struct    evcnt         sc_tintrcnt;  /* transmit interrupt counts */
100           struct    qvaux_regs  sc_qr;    /* reg pointers */
101           bus_space_tag_t         sc_iot;
102           bus_space_handle_t  sc_ioh;
103           int                     sc_consline;  /* console line, or -1 XXX */
104           int                     sc_rxint;     /* Receive interrupt count XXX */
105           u_char                  sc_brk;              /* Break asserted on some lines */
106           u_char                  sc_dsr;              /* DSR set bits if no mdm ctrl */
107           int                 sc_imr;      /* interrupts that are enabled */
108           struct qvaux_linestate {
109                     struct qvaux_softc *qvaux_sc; /* backpointer to softc */
110                     int           qvaux_line;               /* channel number */
111                     void          *qvaux_private; /* sub-driver data pointer */
112                     int           (*qvaux_catch)(void *, int); /* Fast catch recv */
113                     struct tty  *qvaux_tty;                 /* what we work on */
114 #ifdef notyet
115                     void *        qvaux_mem;                /* pointers to clist output */
116                     void *        qvaux_end;                /*   allowing pdma action */
117 #endif
118           } sc_qvaux[NQVAUXLINE];
119 };
120 
121 void      qvauxattach(struct qvaux_softc *, struct evcnt *, int);
122 void    qvauxint(void *);
123 void      qvauxrint(void *);
124 void      qvauxxint(void *);
125 void      qvauxreset(device_t);
126 
127 #endif /* _VAX_UBA_QVVAR_H_ */
128 
129