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