sireg.h revision 1.1 1 1.1 thorpej /* $NetBSD: sireg.h,v 1.1 2024/02/13 05:35:13 thorpej Exp $ */
2 1.1 thorpej
3 1.1 thorpej /*-
4 1.1 thorpej * Copyright (c) 2000 The NetBSD Foundation, Inc.
5 1.1 thorpej * All rights reserved.
6 1.1 thorpej *
7 1.1 thorpej * This code is derived from software contributed to The NetBSD Foundation
8 1.1 thorpej * by Paul Kranenburg.
9 1.1 thorpej *
10 1.1 thorpej * Redistribution and use in source and binary forms, with or without
11 1.1 thorpej * modification, are permitted provided that the following conditions
12 1.1 thorpej * are met:
13 1.1 thorpej * 1. Redistributions of source code must retain the above copyright
14 1.1 thorpej * notice, this list of conditions and the following disclaimer.
15 1.1 thorpej * 2. Redistributions in binary form must reproduce the above copyright
16 1.1 thorpej * notice, this list of conditions and the following disclaimer in the
17 1.1 thorpej * documentation and/or other materials provided with the distribution.
18 1.1 thorpej *
19 1.1 thorpej * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 1.1 thorpej * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 1.1 thorpej * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 1.1 thorpej * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 1.1 thorpej * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 1.1 thorpej * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 1.1 thorpej * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 1.1 thorpej * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 1.1 thorpej * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 1.1 thorpej * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 1.1 thorpej * POSSIBILITY OF SUCH DAMAGE.
30 1.1 thorpej */
31 1.1 thorpej
32 1.1 thorpej /*
33 1.1 thorpej * Register map for the VME SCSI-3 adapter (si)
34 1.1 thorpej * The first part of this register map is an NCR5380
35 1.1 thorpej * SCSI Bus Interface Controller (SBIC). The rest is a
36 1.1 thorpej * DMA controller and custom logic.
37 1.1 thorpej */
38 1.1 thorpej
39 1.1 thorpej
40 1.1 thorpej #if __for_reference_only__
41 1.1 thorpej /*
42 1.1 thorpej * Am5380 Register map (no padding). See dev/ic/ncr5380reg.h
43 1.1 thorpej */
44 1.1 thorpej struct ncr5380regs {
45 1.1 thorpej u_char r[8];
46 1.1 thorpej };
47 1.1 thorpej
48 1.1 thorpej struct si_regs {
49 1.1 thorpej struct ncr5380regs sci;
50 1.1 thorpej
51 1.1 thorpej /* DMA controller registers */
52 1.1 thorpej u_short dma_addrh; /* DMA address (VME only) */
53 1.1 thorpej u_short dma_addrl; /* (high word, low word) */
54 1.1 thorpej u_short dma_counth; /* DMA count (VME only) */
55 1.1 thorpej u_short dma_countl; /* (high word, low word) */
56 1.1 thorpej
57 1.1 thorpej u_int pad0; /* no-existent register */
58 1.1 thorpej
59 1.1 thorpej u_short fifo_data; /* fifo data register */
60 1.1 thorpej u_short fifo_count; /* fifo count register */
61 1.1 thorpej u_short si_csr; /* si control/status */
62 1.1 thorpej u_short bprh; /* VME byte pack high */
63 1.1 thorpej u_short bprl; /* VME byte pack low */
64 1.1 thorpej u_short iv_am; /* bits 0-7: intr vector */
65 1.1 thorpej /* bits 8-13: addr modifier (VME only) */
66 1.1 thorpej /* bits 14-15: unused */
67 1.1 thorpej u_short fifo_cnt_hi; /* high part of fifo_count (VME only) */
68 1.1 thorpej
69 1.1 thorpej /* Whole thing repeats after 32 bytes. */
70 1.1 thorpej u_short _space[3];
71 1.1 thorpej };
72 1.1 thorpej #endif
73 1.1 thorpej
74 1.1 thorpej /*
75 1.1 thorpej * Size of NCR5380 registers located at the bottom of the register bank
76 1.1 thorpej */
77 1.1 thorpej #define NCR5380REGS_SZ 8
78 1.1 thorpej
79 1.1 thorpej /*
80 1.1 thorpej * Register definition for the `si' VME controller
81 1.1 thorpej */
82 1.1 thorpej #define SIREG_DMA_ADDRH (NCR5380REGS_SZ + 0) /* DMA address, high word */
83 1.1 thorpej #define SIREG_DMA_ADDRL (NCR5380REGS_SZ + 2) /* DMA address, low word */
84 1.1 thorpej #define SIREG_DMA_CNTH (NCR5380REGS_SZ + 4) /* DMA count, high word */
85 1.1 thorpej #define SIREG_DMA_CNTL (NCR5380REGS_SZ + 6) /* DMA count, low word */
86 1.1 thorpej #define SIREG_FIFO_DATA (NCR5380REGS_SZ + 12) /* FIFO data */
87 1.1 thorpej #define SIREG_FIFO_CNT (NCR5380REGS_SZ + 14) /* FIFO count, low word */
88 1.1 thorpej #define SIREG_CSR (NCR5380REGS_SZ + 16) /* Control/status register */
89 1.1 thorpej #define SIREG_BPRH (NCR5380REGS_SZ + 18) /* VME byte pack, high word */
90 1.1 thorpej #define SIREG_BPRL (NCR5380REGS_SZ + 20) /* VME byte pack, low word */
91 1.1 thorpej #define SIREG_IV_AM (NCR5380REGS_SZ + 22) /* bits 0-7: intr vector;
92 1.1 thorpej bits 8-13: addr modifier */
93 1.1 thorpej #define SIREG_FIFO_CNTH (NCR5380REGS_SZ + 24) /* FIFO count, high word */
94 1.1 thorpej #define SIREG_BANK_SZ (NCR5380REGS_SZ + 26)
95 1.1 thorpej
96 1.1 thorpej /*
97 1.1 thorpej * Status Register.
98 1.1 thorpej * Note:
99 1.1 thorpej * (r) indicates bit is read only.
100 1.1 thorpej * (rw) indicates bit is read or write.
101 1.1 thorpej * (v) vme host adaptor interface only.
102 1.1 thorpej * (o) sun3/50 onboard host adaptor interface only.
103 1.1 thorpej * (b) both vme and sun3/50 host adaptor interfaces.
104 1.1 thorpej *
105 1.1 thorpej * Note 2: because of the historical connections of this VME driver
106 1.1 thorpej * with the on-board SCSI interfaces found in sun3/50, sun3/60 and sun4/100
107 1.1 thorpej * systems, the (v), (o) and (b) qualifications are left in for
108 1.1 thorpej * cross-reference.
109 1.1 thorpej */
110 1.1 thorpej #define SI_CSR_DMA_ACTIVE 0x8000 /* (r,o) DMA transfer active */
111 1.1 thorpej #define SI_CSR_DMA_CONFLICT 0x4000 /* (r,b) reg accessed while DMA'ing */
112 1.1 thorpej #define SI_CSR_DMA_BUS_ERR 0x2000 /* (r,b) bus error during DMA */
113 1.1 thorpej #define SI_CSR_ID 0x1000 /* (r,b) 0 for 3/50, 1 for SCSI-3, */
114 1.1 thorpej /* 0 if SCSI-3 unmodified */
115 1.1 thorpej #define SI_CSR_FIFO_FULL 0x0800 /* (r,b) fifo full */
116 1.1 thorpej #define SI_CSR_FIFO_EMPTY 0x0400 /* (r,b) fifo empty */
117 1.1 thorpej #define SI_CSR_SBC_IP 0x0200 /* (r,b) sbc interrupt pending */
118 1.1 thorpej #define SI_CSR_DMA_IP 0x0100 /* (r,b) DMA interrupt pending */
119 1.1 thorpej #define SI_CSR_LOB 0x00c0 /* (r,v) number of leftover bytes */
120 1.1 thorpej #define SI_CSR_LOB_THREE 0x00c0 /* (r,v) three leftover bytes */
121 1.1 thorpej #define SI_CSR_LOB_TWO 0x0080 /* (r,v) two leftover bytes */
122 1.1 thorpej #define SI_CSR_LOB_ONE 0x0040 /* (r,v) one leftover byte */
123 1.1 thorpej #define SI_CSR_BPCON 0x0020 /* (rw,v) byte packing control */
124 1.1 thorpej /* DMA is in 0=longwords, 1=words */
125 1.1 thorpej #define SI_CSR_DMA_EN 0x0010 /* (rw,v) DMA/interrupt enable */
126 1.1 thorpej #define SI_CSR_SEND 0x0008 /* (rw,b) DMA dir, 1=to device */
127 1.1 thorpej #define SI_CSR_INTR_EN 0x0004 /* (rw,b) interrupts enable */
128 1.1 thorpej #define SI_CSR_FIFO_RES 0x0002 /* (rw,b) inits fifo, 0=reset */
129 1.1 thorpej #define SI_CSR_SCSI_RES 0x0001 /* (rw,b) reset sbc and udc, 0=reset */
130