mscpreg.h revision 1.6 1 1.6 perry /* $NetBSD: mscpreg.h,v 1.6 2005/02/27 00:27:32 perry Exp $ */
2 1.1 ragge /*
3 1.1 ragge * Copyright (c) 1988 Regents of the University of California.
4 1.1 ragge * All rights reserved.
5 1.5 agc *
6 1.5 agc * This code is derived from software contributed to Berkeley by
7 1.5 agc * Chris Torek.
8 1.5 agc *
9 1.5 agc * Redistribution and use in source and binary forms, with or without
10 1.5 agc * modification, are permitted provided that the following conditions
11 1.5 agc * are met:
12 1.5 agc * 1. Redistributions of source code must retain the above copyright
13 1.5 agc * notice, this list of conditions and the following disclaimer.
14 1.5 agc * 2. Redistributions in binary form must reproduce the above copyright
15 1.5 agc * notice, this list of conditions and the following disclaimer in the
16 1.5 agc * documentation and/or other materials provided with the distribution.
17 1.5 agc * 3. Neither the name of the University nor the names of its contributors
18 1.5 agc * may be used to endorse or promote products derived from this software
19 1.5 agc * without specific prior written permission.
20 1.5 agc *
21 1.5 agc * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 1.5 agc * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 1.5 agc * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 1.5 agc * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 1.5 agc * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 1.5 agc * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 1.5 agc * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 1.5 agc * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 1.5 agc * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 1.5 agc * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 1.5 agc * SUCH DAMAGE.
32 1.5 agc *
33 1.5 agc * @(#)udareg.h 7.3 (Berkeley) 5/8/91
34 1.5 agc */
35 1.5 agc
36 1.5 agc /*
37 1.5 agc * Copyright (c) 1996 Ludd, University of Lule}, Sweden.
38 1.1 ragge *
39 1.1 ragge * This code is derived from software contributed to Berkeley by
40 1.1 ragge * Chris Torek.
41 1.1 ragge *
42 1.1 ragge * Redistribution and use in source and binary forms, with or without
43 1.1 ragge * modification, are permitted provided that the following conditions
44 1.1 ragge * are met:
45 1.1 ragge * 1. Redistributions of source code must retain the above copyright
46 1.1 ragge * notice, this list of conditions and the following disclaimer.
47 1.1 ragge * 2. Redistributions in binary form must reproduce the above copyright
48 1.1 ragge * notice, this list of conditions and the following disclaimer in the
49 1.1 ragge * documentation and/or other materials provided with the distribution.
50 1.1 ragge * 3. All advertising materials mentioning features or use of this software
51 1.1 ragge * must display the following acknowledgement:
52 1.1 ragge * This product includes software developed by the University of
53 1.1 ragge * California, Berkeley and its contributors.
54 1.1 ragge * 4. Neither the name of the University nor the names of its contributors
55 1.1 ragge * may be used to endorse or promote products derived from this software
56 1.1 ragge * without specific prior written permission.
57 1.1 ragge *
58 1.1 ragge * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
59 1.1 ragge * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
60 1.1 ragge * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
61 1.1 ragge * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
62 1.1 ragge * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
63 1.1 ragge * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
64 1.1 ragge * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
65 1.1 ragge * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
66 1.1 ragge * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
67 1.1 ragge * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
68 1.1 ragge * SUCH DAMAGE.
69 1.1 ragge *
70 1.1 ragge * @(#)udareg.h 7.3 (Berkeley) 5/8/91
71 1.1 ragge */
72 1.1 ragge
73 1.1 ragge /*
74 1.1 ragge * NRSPL2 and NCMDL2 control the number of response and command
75 1.1 ragge * packets respectively. They may be any value from 0 to 7, though
76 1.1 ragge * setting them higher than 5 is unlikely to be of any value.
77 1.1 ragge * If you get warnings about your command ring being too small,
78 1.1 ragge * try increasing the values by one.
79 1.1 ragge */
80 1.3 ragge #ifndef NRSP
81 1.3 ragge #define NRSPL2 5
82 1.3 ragge #define NCMDL2 5
83 1.3 ragge #define NRSP (1 << NRSPL2)
84 1.3 ragge #define NCMD (1 << NCMDL2)
85 1.2 ragge #endif
86 1.1 ragge
87 1.1 ragge /*
88 1.1 ragge * Communication area definition. This seems to be the same for
89 1.1 ragge * all types of MSCP controllers.
90 1.1 ragge */
91 1.1 ragge
92 1.1 ragge struct mscp_ca {
93 1.1 ragge short ca_xxx1; /* unused */
94 1.1 ragge char ca_xxx2; /* unused */
95 1.1 ragge char ca_bdp; /* BDP to purge */
96 1.1 ragge short ca_cmdint; /* command ring transition flag */
97 1.1 ragge short ca_rspint; /* response ring transition flag */
98 1.1 ragge long ca_rspdsc[NRSP];/* response descriptors */
99 1.1 ragge long ca_cmddsc[NCMD];/* command descriptors */
100 1.1 ragge };
101 1.1 ragge
102 1.1 ragge /*
103 1.1 ragge * Simplified routines (e.g., uddump) reprogram the UDA50 for one command
104 1.1 ragge * and one response at a time; uda1ca is like udaca except that it provides
105 1.1 ragge * exactly one command and response descriptor.
106 1.1 ragge */
107 1.1 ragge struct mscp_1ca {
108 1.1 ragge short ca_xxx1;
109 1.1 ragge char ca_xxx2;
110 1.1 ragge char ca_bdp;
111 1.1 ragge short ca_cmdint;
112 1.1 ragge short ca_rspint;
113 1.1 ragge long ca_rspdsc;
114 1.1 ragge long ca_cmddsc;
115 1.1 ragge };
116 1.1 ragge
117 1.1 ragge /*
118 1.1 ragge * Combined communications area and MSCP packet pools, per controller.
119 1.1 ragge * NRSP and NCMD must be defined before this struct is used.
120 1.1 ragge */
121 1.1 ragge
122 1.1 ragge struct mscp_pack {
123 1.1 ragge struct mscp_ca mp_ca; /* communications area */
124 1.1 ragge struct mscp mp_rsp[NRSP]; /* response packets */
125 1.1 ragge struct mscp mp_cmd[NCMD]; /* command packets */
126 1.1 ragge };
127 1.1 ragge
128 1.1 ragge /*
129 1.1 ragge * Bits in UDA status register during initialisation
130 1.1 ragge */
131 1.3 ragge #define MP_ERR 0x8000 /* error */
132 1.3 ragge #define MP_STEP4 0x4000 /* step 4 has started */
133 1.3 ragge #define MP_STEP3 0x2000 /* step 3 has started */
134 1.3 ragge #define MP_STEP2 0x1000 /* step 2 has started */
135 1.3 ragge #define MP_STEP1 0x0800 /* step 1 has started */
136 1.3 ragge #define MP_NV 0x0400 /* no host settable interrupt vector */
137 1.3 ragge #define MP_QB 0x0200 /* controller supports Q22 bus */
138 1.3 ragge #define MP_DI 0x0100 /* controller implements diagnostics */
139 1.3 ragge #define MP_IE 0x0080 /* interrupt enable */
140 1.3 ragge #define MP_NCNRMASK 0x003f /* in STEP1, bits 0-2=NCMDL2, 3-5=NRSPL2 */
141 1.3 ragge #define MP_IVECMASK 0x007f /* in STEP2, bits 0-6 are interruptvec / 4 */
142 1.3 ragge #define MP_PI 0x0001 /* host requests adapter purge interrupts */
143 1.3 ragge #define MP_GO 0x0001 /* Go command to ctlr */
144 1.1 ragge
145 1.1 ragge #define ALLSTEPS (MP_ERR | MP_STEP4 | MP_STEP3 | MP_STEP2 | MP_STEP1)
146 1.1 ragge
147 1.1 ragge #define STEP0MASK (ALLSTEPS | MP_NV)
148 1.1 ragge
149 1.6 perry #define STEP1MASK (ALLSTEPS | MP_IE | MP_NCNRMASK)
150 1.3 ragge #define STEP1GOOD (MP_STEP2 | MP_IE | (NCMDL2 << 3) | NRSPL2)
151 1.6 perry
152 1.3 ragge #define STEP2MASK (ALLSTEPS | MP_IE | MP_IVECMASK)
153 1.3 ragge #define STEP2GOOD(iv) (MP_STEP3 | MP_IE | (iv))
154 1.6 perry
155 1.3 ragge #define STEP3MASK ALLSTEPS
156 1.3 ragge #define STEP3GOOD MP_STEP4
157 1.1 ragge
158