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