ispreg.h revision 1.9 1 1.8 mjacob /* $NetBSD: ispreg.h,v 1.9 1998/12/05 19:48:23 mjacob Exp $ */
2 1.9 mjacob /* ispreg.h 1.7 */
3 1.1 cgd /*
4 1.1 cgd * Machine Independent (well, as best as possible) register
5 1.1 cgd * definitions for Qlogic ISP SCSI adapters.
6 1.1 cgd *
7 1.5 mjacob *---------------------------------------
8 1.2 cgd * Copyright (c) 1997 by Matthew Jacob
9 1.2 cgd * NASA/Ames Research Center
10 1.1 cgd * All rights reserved.
11 1.5 mjacob *---------------------------------------
12 1.1 cgd * Redistribution and use in source and binary forms, with or without
13 1.1 cgd * modification, are permitted provided that the following conditions
14 1.1 cgd * are met:
15 1.1 cgd * 1. Redistributions of source code must retain the above copyright
16 1.1 cgd * notice immediately at the beginning of the file, without modification,
17 1.1 cgd * this list of conditions, and the following disclaimer.
18 1.1 cgd * 2. Redistributions in binary form must reproduce the above copyright
19 1.1 cgd * notice, this list of conditions and the following disclaimer in the
20 1.1 cgd * documentation and/or other materials provided with the distribution.
21 1.1 cgd * 3. The name of the author may not be used to endorse or promote products
22 1.1 cgd * derived from this software without specific prior written permission.
23 1.1 cgd *
24 1.1 cgd * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
25 1.1 cgd * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 1.1 cgd * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 1.1 cgd * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
28 1.1 cgd * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 1.1 cgd * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 1.1 cgd * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 1.1 cgd * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 1.1 cgd * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 1.1 cgd * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 1.1 cgd * SUCH DAMAGE.
35 1.1 cgd */
36 1.1 cgd #ifndef _ISPREG_H
37 1.1 cgd #define _ISPREG_H
38 1.1 cgd
39 1.1 cgd /*
40 1.1 cgd * Hardware definitions for the Qlogic ISP registers.
41 1.1 cgd */
42 1.1 cgd
43 1.1 cgd /*
44 1.1 cgd * This defines types of access to various registers.
45 1.1 cgd *
46 1.1 cgd * R: Read Only
47 1.1 cgd * W: Write Only
48 1.1 cgd * RW: Read/Write
49 1.1 cgd *
50 1.1 cgd * R*, W*, RW*: Read Only, Write Only, Read/Write, but only
51 1.1 cgd * if RISC processor in ISP is paused.
52 1.1 cgd */
53 1.1 cgd
54 1.1 cgd /*
55 1.1 cgd * Offsets for various register blocks.
56 1.1 cgd *
57 1.1 cgd * Sad but true, different architectures have different offsets.
58 1.1 cgd */
59 1.1 cgd
60 1.1 cgd #define BIU_REGS_OFF 0x00
61 1.1 cgd
62 1.1 cgd #define PCI_MBOX_REGS_OFF 0x70
63 1.3 mjacob #define PCI_MBOX_REGS2100_OFF 0x10
64 1.1 cgd #define SBUS_MBOX_REGS_OFF 0x80
65 1.1 cgd
66 1.1 cgd #define PCI_SXP_REGS_OFF 0x80
67 1.1 cgd #define SBUS_SXP_REGS_OFF 0x200
68 1.1 cgd
69 1.1 cgd #define PCI_RISC_REGS_OFF 0x80
70 1.1 cgd #define SBUS_RISC_REGS_OFF 0x400
71 1.1 cgd
72 1.1 cgd /*
73 1.1 cgd * NB: The *_BLOCK definitions have no specific hardware meaning.
74 1.1 cgd * They serve simply to note to the MD layer which block of
75 1.1 cgd * registers offsets are being accessed.
76 1.1 cgd */
77 1.1 cgd
78 1.1 cgd /*
79 1.1 cgd * Bus Interface Block Register Offsets
80 1.1 cgd */
81 1.1 cgd #define BIU_BLOCK 0x0100
82 1.1 cgd #define BIU_ID_LO BIU_BLOCK+0x0 /* R : Bus ID, Low */
83 1.3 mjacob #define BIU2100_FLASH_ADDR BIU_BLOCK+0x0
84 1.1 cgd #define BIU_ID_HI BIU_BLOCK+0x2 /* R : Bus ID, High */
85 1.3 mjacob #define BIU2100_FLASH_DATA BIU_BLOCK+0x2
86 1.1 cgd #define BIU_CONF0 BIU_BLOCK+0x4 /* R : Bus Configuration #0 */
87 1.1 cgd #define BIU_CONF1 BIU_BLOCK+0x6 /* R : Bus Configuration #1 */
88 1.3 mjacob #define BIU2100_CSR BIU_BLOCK+0x6
89 1.1 cgd #define BIU_ICR BIU_BLOCK+0x8 /* RW : Bus Interface Ctrl */
90 1.1 cgd #define BIU_ISR BIU_BLOCK+0xA /* R : Bus Interface Status */
91 1.1 cgd #define BIU_SEMA BIU_BLOCK+0xC /* RW : Bus Semaphore */
92 1.1 cgd #define BIU_NVRAM BIU_BLOCK+0xE /* RW : Bus NVRAM */
93 1.1 cgd #define CDMA_CONF BIU_BLOCK+0x20 /* RW*: DMA Configuration */
94 1.3 mjacob #define CDMA2100_CONTROL CDMA_CONF
95 1.1 cgd #define CDMA_CONTROL BIU_BLOCK+0x22 /* RW*: DMA Control */
96 1.1 cgd #define CDMA_STATUS BIU_BLOCK+0x24 /* R : DMA Status */
97 1.1 cgd #define CDMA_FIFO_STS BIU_BLOCK+0x26 /* R : DMA FIFO Status */
98 1.1 cgd #define CDMA_COUNT BIU_BLOCK+0x28 /* RW*: DMA Transfer Count */
99 1.1 cgd #define CDMA_ADDR0 BIU_BLOCK+0x2C /* RW*: DMA Address, Word 0 */
100 1.1 cgd #define CDMA_ADDR1 BIU_BLOCK+0x2E /* RW*: DMA Address, Word 1 */
101 1.1 cgd /* these are for the 1040A cards */
102 1.1 cgd #define CDMA_ADDR2 BIU_BLOCK+0x30 /* RW*: DMA Address, Word 2 */
103 1.1 cgd #define CDMA_ADDR3 BIU_BLOCK+0x32 /* RW*: DMA Address, Word 3 */
104 1.1 cgd
105 1.1 cgd #define DDMA_CONF BIU_BLOCK+0x40 /* RW*: DMA Configuration */
106 1.3 mjacob #define TDMA2100_CONTROL DDMA_CONF
107 1.1 cgd #define DDMA_CONTROL BIU_BLOCK+0x42 /* RW*: DMA Control */
108 1.1 cgd #define DDMA_STATUS BIU_BLOCK+0x44 /* R : DMA Status */
109 1.1 cgd #define DDMA_FIFO_STS BIU_BLOCK+0x46 /* R : DMA FIFO Status */
110 1.1 cgd #define DDMA_COUNT_LO BIU_BLOCK+0x48 /* RW*: DMA Xfer Count, Low */
111 1.1 cgd #define DDMA_COUNT_HI BIU_BLOCK+0x4A /* RW*: DMA Xfer Count, High */
112 1.1 cgd #define DDMA_ADDR0 BIU_BLOCK+0x4C /* RW*: DMA Address, Word 0 */
113 1.1 cgd #define DDMA_ADDR1 BIU_BLOCK+0x4E /* RW*: DMA Address, Word 1 */
114 1.1 cgd /* these are for the 1040A cards */
115 1.1 cgd #define DDMA_ADDR2 BIU_BLOCK+0x50 /* RW*: DMA Address, Word 2 */
116 1.1 cgd #define DDMA_ADDR3 BIU_BLOCK+0x52 /* RW*: DMA Address, Word 3 */
117 1.1 cgd
118 1.1 cgd #define DFIFO_COMMAND BIU_BLOCK+0x60 /* RW : Command FIFO Port */
119 1.3 mjacob #define RDMA2100_CONTROL DFIFO_COMMAND
120 1.1 cgd #define DFIFO_DATA BIU_BLOCK+0x62 /* RW : Data FIFO Port */
121 1.1 cgd
122 1.1 cgd /*
123 1.1 cgd * Bus Interface Block Register Definitions
124 1.1 cgd */
125 1.1 cgd /* BUS CONFIGURATION REGISTER #0 */
126 1.1 cgd #define BIU_CONF0_HW_MASK 0x000F /* Hardware revision mask */
127 1.1 cgd /* BUS CONFIGURATION REGISTER #1 */
128 1.1 cgd
129 1.1 cgd #define BIU_SBUS_CONF1_PARITY 0x0100 /* Enable parity checking */
130 1.1 cgd #define BIU_SBUS_CONF1_FCODE_MASK 0x00F0 /* Fcode cycle mask */
131 1.1 cgd
132 1.1 cgd #define BIU_PCI_CONF1_FIFO_128 0x0040 /* 128 bytes FIFO threshold */
133 1.1 cgd #define BIU_PCI_CONF1_FIFO_64 0x0030 /* 64 bytes FIFO threshold */
134 1.1 cgd #define BIU_PCI_CONF1_FIFO_32 0x0020 /* 32 bytes FIFO threshold */
135 1.1 cgd #define BIU_PCI_CONF1_FIFO_16 0x0010 /* 16 bytes FIFO threshold */
136 1.1 cgd #define BIU_BURST_ENABLE 0x0004 /* Global enable Bus bursts */
137 1.1 cgd #define BIU_SBUS_CONF1_FIFO_64 0x0003 /* 64 bytes FIFO threshold */
138 1.1 cgd #define BIU_SBUS_CONF1_FIFO_32 0x0002 /* 32 bytes FIFO threshold */
139 1.1 cgd #define BIU_SBUS_CONF1_FIFO_16 0x0001 /* 16 bytes FIFO threshold */
140 1.1 cgd #define BIU_SBUS_CONF1_FIFO_8 0x0000 /* 8 bytes FIFO threshold */
141 1.1 cgd #define BIU_SBUS_CONF1_BURST8 0x0008 /* Enable 8-byte bursts */
142 1.1 cgd #define BIU_PCI_CONF1_SXP 0x0008 /* SXP register select */
143 1.1 cgd
144 1.3 mjacob /* ISP2100 Bus Control/Status Register */
145 1.3 mjacob
146 1.3 mjacob #define BIU2100_ICSR_REGBSEL 0x30 /* RW: register bank select */
147 1.3 mjacob #define BIU2100_RISC_REGS (0 << 4) /* RISC Regs */
148 1.3 mjacob #define BIU2100_FB_REGS (1 << 4) /* FrameBuffer Regs */
149 1.3 mjacob #define BIU2100_FPM0_REGS (2 << 4) /* FPM 0 Regs */
150 1.3 mjacob #define BIU2100_FPM1_REGS (3 << 4) /* FPM 1 Regs */
151 1.3 mjacob #define BIU2100_PCI64 0x04 /* R: 64 Bit PCI slot */
152 1.3 mjacob #define BIU2100_FLASH_ENABLE 0x02 /* RW: Enable Flash RAM */
153 1.3 mjacob #define BIU2100_SOFT_RESET 0x01
154 1.3 mjacob /* SOFT RESET FOR ISP2100 is same bit, but in this register, not ICR */
155 1.3 mjacob
156 1.3 mjacob
157 1.1 cgd /* BUS CONTROL REGISTER */
158 1.1 cgd #define BIU_ICR_ENABLE_DMA_INT 0x0020 /* Enable DMA interrupts */
159 1.1 cgd #define BIU_ICR_ENABLE_CDMA_INT 0x0010 /* Enable CDMA interrupts */
160 1.1 cgd #define BIU_ICR_ENABLE_SXP_INT 0x0008 /* Enable SXP interrupts */
161 1.1 cgd #define BIU_ICR_ENABLE_RISC_INT 0x0004 /* Enable Risc interrupts */
162 1.1 cgd #define BIU_ICR_ENABLE_ALL_INTS 0x0002 /* Global enable all inter */
163 1.1 cgd #define BIU_ICR_SOFT_RESET 0x0001 /* Soft Reset of ISP */
164 1.1 cgd
165 1.3 mjacob #define BIU2100_ICR_ENABLE_ALL_INTS 0x8000
166 1.3 mjacob #define BIU2100_ICR_ENA_FPM_INT 0x0020
167 1.3 mjacob #define BIU2100_ICR_ENA_FB_INT 0x0010
168 1.3 mjacob #define BIU2100_ICR_ENA_RISC_INT 0x0008
169 1.3 mjacob #define BIU2100_ICR_ENA_CDMA_INT 0x0004
170 1.3 mjacob #define BIU2100_ICR_ENABLE_RXDMA_INT 0x0002
171 1.3 mjacob #define BIU2100_ICR_ENABLE_TXDMA_INT 0x0001
172 1.3 mjacob #define BIU2100_ICR_DISABLE_ALL_INTS 0x0000
173 1.3 mjacob
174 1.3 mjacob #define ENABLE_INTS(isp) (isp->isp_type & ISP_HA_SCSI)? \
175 1.3 mjacob ISP_WRITE(isp, BIU_ICR, BIU_ICR_ENABLE_RISC_INT | BIU_ICR_ENABLE_ALL_INTS) : \
176 1.3 mjacob ISP_WRITE(isp, BIU_ICR, BIU2100_ICR_ENA_RISC_INT | BIU2100_ICR_ENABLE_ALL_INTS)
177 1.3 mjacob
178 1.3 mjacob #define DISABLE_INTS(isp) ISP_WRITE(isp, BIU_ICR, 0)
179 1.1 cgd
180 1.1 cgd /* BUS STATUS REGISTER */
181 1.1 cgd #define BIU_ISR_DMA_INT 0x0020 /* DMA interrupt pending */
182 1.1 cgd #define BIU_ISR_CDMA_INT 0x0010 /* CDMA interrupt pending */
183 1.1 cgd #define BIU_ISR_SXP_INT 0x0008 /* SXP interrupt pending */
184 1.1 cgd #define BIU_ISR_RISC_INT 0x0004 /* Risc interrupt pending */
185 1.1 cgd #define BIU_ISR_IPEND 0x0002 /* Global interrupt pending */
186 1.1 cgd
187 1.3 mjacob #define BIU2100_ISR_INT_PENDING 0x8000 /* Global interrupt pending */
188 1.3 mjacob #define BIU2100_ISR_FPM_INT 0x0020 /* FPM interrupt pending */
189 1.3 mjacob #define BIU2100_ISR_FB_INT 0x0010 /* FB interrupt pending */
190 1.3 mjacob #define BIU2100_ISR_RISC_INT 0x0008 /* Risc interrupt pending */
191 1.3 mjacob #define BIU2100_ISR_CDMA_INT 0x0004 /* CDMA interrupt pending */
192 1.3 mjacob #define BIU2100_ISR_RXDMA_INT_PENDING 0x0002 /* Global interrupt pending */
193 1.3 mjacob #define BIU2100_ISR_TXDMA_INT_PENDING 0x0001 /* Global interrupt pending */
194 1.3 mjacob
195 1.1 cgd
196 1.1 cgd /* BUS SEMAPHORE REGISTER */
197 1.1 cgd #define BIU_SEMA_STATUS 0x0002 /* Semaphore Status Bit */
198 1.1 cgd #define BIU_SEMA_LOCK 0x0001 /* Semaphore Lock Bit */
199 1.1 cgd
200 1.7 mjacob /* NVRAM SEMAPHORE REGISTER */
201 1.7 mjacob #define BIU_NVRAM_CLOCK 0x0001
202 1.7 mjacob #define BIU_NVRAM_SELECT 0x0002
203 1.7 mjacob #define BIU_NVRAM_DATAOUT 0x0004
204 1.7 mjacob #define BIU_NVRAM_DATAIN 0x0008
205 1.7 mjacob #define ISP_NVRAM_READ 6
206 1.1 cgd
207 1.1 cgd /* COMNMAND && DATA DMA CONFIGURATION REGISTER */
208 1.1 cgd #define DMA_ENABLE_SXP_DMA 0x0008 /* Enable SXP to DMA Data */
209 1.1 cgd #define DMA_ENABLE_INTS 0x0004 /* Enable interrupts to RISC */
210 1.1 cgd #define DMA_ENABLE_BURST 0x0002 /* Enable Bus burst trans */
211 1.1 cgd #define DMA_DMA_DIRECTION 0x0001 /*
212 1.1 cgd * Set DMA direction:
213 1.1 cgd * 0 - DMA FIFO to host
214 1.1 cgd * 1 - Host to DMA FIFO
215 1.1 cgd */
216 1.1 cgd
217 1.1 cgd /* COMMAND && DATA DMA CONTROL REGISTER */
218 1.1 cgd #define DMA_CNTRL_SUSPEND_CHAN 0x0010 /* Suspend DMA transfer */
219 1.1 cgd #define DMA_CNTRL_CLEAR_CHAN 0x0008 /*
220 1.1 cgd * Clear FIFO and DMA Channel,
221 1.1 cgd * reset DMA registers
222 1.1 cgd */
223 1.1 cgd #define DMA_CNTRL_CLEAR_FIFO 0x0004 /* Clear DMA FIFO */
224 1.1 cgd #define DMA_CNTRL_RESET_INT 0x0002 /* Clear DMA interrupt */
225 1.1 cgd #define DMA_CNTRL_STROBE 0x0001 /* Start DMA transfer */
226 1.1 cgd
227 1.3 mjacob /*
228 1.3 mjacob * Variants of same for 2100
229 1.3 mjacob */
230 1.3 mjacob #define DMA_CNTRL2100_CLEAR_CHAN 0x0004
231 1.3 mjacob #define DMA_CNTRL2100_RESET_INT 0x0002
232 1.3 mjacob
233 1.3 mjacob
234 1.1 cgd
235 1.1 cgd /* DMA STATUS REGISTER */
236 1.1 cgd #define DMA_SBUS_STATUS_PIPE_MASK 0x00C0 /* DMA Pipeline status mask */
237 1.1 cgd #define DMA_SBUS_STATUS_CHAN_MASK 0x0030 /* Channel status mask */
238 1.1 cgd #define DMA_SBUS_STATUS_BUS_PARITY 0x0008 /* Parity Error on bus */
239 1.1 cgd #define DMA_SBUS_STATUS_BUS_ERR 0x0004 /* Error Detected on bus */
240 1.1 cgd #define DMA_SBUS_STATUS_TERM_COUNT 0x0002 /* DMA Transfer Completed */
241 1.1 cgd #define DMA_SBUS_STATUS_INTERRUPT 0x0001 /* Enable DMA channel inter */
242 1.1 cgd
243 1.1 cgd #define DMA_PCI_STATUS_INTERRUPT 0x8000 /* Enable DMA channel inter */
244 1.1 cgd #define DMA_PCI_STATUS_RETRY_STAT 0x4000 /* Retry status */
245 1.1 cgd #define DMA_PCI_STATUS_CHAN_MASK 0x3000 /* Channel status mask */
246 1.1 cgd #define DMA_PCI_STATUS_FIFO_OVR 0x0100 /* DMA FIFO overrun cond */
247 1.1 cgd #define DMA_PCI_STATUS_FIFO_UDR 0x0080 /* DMA FIFO underrun cond */
248 1.1 cgd #define DMA_PCI_STATUS_BUS_ERR 0x0040 /* Error Detected on bus */
249 1.1 cgd #define DMA_PCI_STATUS_BUS_PARITY 0x0020 /* Parity Error on bus */
250 1.1 cgd #define DMA_PCI_STATUS_CLR_PEND 0x0010 /* DMA clear pending */
251 1.1 cgd #define DMA_PCI_STATUS_TERM_COUNT 0x0008 /* DMA Transfer Completed */
252 1.1 cgd #define DMA_PCI_STATUS_DMA_SUSP 0x0004 /* DMA suspended */
253 1.1 cgd #define DMA_PCI_STATUS_PIPE_MASK 0x0003 /* DMA Pipeline status mask */
254 1.1 cgd
255 1.1 cgd /* DMA Status Register, pipeline status bits */
256 1.1 cgd #define DMA_SBUS_PIPE_FULL 0x00C0 /* Both pipeline stages full */
257 1.1 cgd #define DMA_SBUS_PIPE_OVERRUN 0x0080 /* Pipeline overrun */
258 1.1 cgd #define DMA_SBUS_PIPE_STAGE1 0x0040 /*
259 1.1 cgd * Pipeline stage 1 Loaded,
260 1.1 cgd * stage 2 empty
261 1.1 cgd */
262 1.1 cgd #define DMA_PCI_PIPE_FULL 0x0003 /* Both pipeline stages full */
263 1.1 cgd #define DMA_PCI_PIPE_OVERRUN 0x0002 /* Pipeline overrun */
264 1.1 cgd #define DMA_PCI_PIPE_STAGE1 0x0001 /*
265 1.1 cgd * Pipeline stage 1 Loaded,
266 1.1 cgd * stage 2 empty
267 1.1 cgd */
268 1.1 cgd #define DMA_PIPE_EMPTY 0x0000 /* All pipeline stages empty */
269 1.1 cgd
270 1.1 cgd /* DMA Status Register, channel status bits */
271 1.1 cgd #define DMA_SBUS_CHAN_SUSPEND 0x0030 /* Channel error or suspended */
272 1.1 cgd #define DMA_SBUS_CHAN_TRANSFER 0x0020 /* Chan transfer in progress */
273 1.1 cgd #define DMA_SBUS_CHAN_ACTIVE 0x0010 /* Chan trans to host active */
274 1.1 cgd #define DMA_PCI_CHAN_TRANSFER 0x3000 /* Chan transfer in progress */
275 1.1 cgd #define DMA_PCI_CHAN_SUSPEND 0x2000 /* Channel error or suspended */
276 1.1 cgd #define DMA_PCI_CHAN_ACTIVE 0x1000 /* Chan trans to host active */
277 1.1 cgd #define ISP_DMA_CHAN_IDLE 0x0000 /* Chan idle (normal comp) */
278 1.1 cgd
279 1.1 cgd
280 1.1 cgd /* DMA FIFO STATUS REGISTER */
281 1.1 cgd #define DMA_FIFO_STATUS_OVERRUN 0x0200 /* FIFO Overrun Condition */
282 1.1 cgd #define DMA_FIFO_STATUS_UNDERRUN 0x0100 /* FIFO Underrun Condition */
283 1.1 cgd #define DMA_FIFO_SBUS_COUNT_MASK 0x007F /* FIFO Byte count mask */
284 1.1 cgd #define DMA_FIFO_PCI_COUNT_MASK 0x00FF /* FIFO Byte count mask */
285 1.1 cgd
286 1.1 cgd /*
287 1.1 cgd * Mailbox Block Register Offsets
288 1.1 cgd */
289 1.1 cgd
290 1.1 cgd #define MBOX_BLOCK 0x0200
291 1.1 cgd #define INMAILBOX0 MBOX_BLOCK+0x0
292 1.1 cgd #define INMAILBOX1 MBOX_BLOCK+0x2
293 1.1 cgd #define INMAILBOX2 MBOX_BLOCK+0x4
294 1.1 cgd #define INMAILBOX3 MBOX_BLOCK+0x6
295 1.1 cgd #define INMAILBOX4 MBOX_BLOCK+0x8
296 1.1 cgd #define INMAILBOX5 MBOX_BLOCK+0xA
297 1.3 mjacob #define INMAILBOX6 MBOX_BLOCK+0xC
298 1.3 mjacob #define INMAILBOX7 MBOX_BLOCK+0xE
299 1.1 cgd
300 1.1 cgd #define OUTMAILBOX0 MBOX_BLOCK+0x0
301 1.1 cgd #define OUTMAILBOX1 MBOX_BLOCK+0x2
302 1.1 cgd #define OUTMAILBOX2 MBOX_BLOCK+0x4
303 1.1 cgd #define OUTMAILBOX3 MBOX_BLOCK+0x6
304 1.1 cgd #define OUTMAILBOX4 MBOX_BLOCK+0x8
305 1.1 cgd #define OUTMAILBOX5 MBOX_BLOCK+0xA
306 1.3 mjacob #define OUTMAILBOX6 MBOX_BLOCK+0xC
307 1.3 mjacob #define OUTMAILBOX7 MBOX_BLOCK+0xE
308 1.1 cgd
309 1.3 mjacob #define OMBOX_OFFN(n) (MBOX_BLOCK + (n * 2))
310 1.3 mjacob #define NMBOX(isp) \
311 1.3 mjacob (((((isp)->isp_type & ISP_HA_SCSI) >= ISP_HA_SCSI_1040A) || \
312 1.3 mjacob ((isp)->isp_type & ISP_HA_FC))? 8 : 6)
313 1.3 mjacob
314 1.1 cgd /*
315 1.1 cgd * SXP Block Register Offsets
316 1.1 cgd */
317 1.1 cgd #define SXP_BLOCK 0x0400
318 1.1 cgd #define SXP_PART_ID SXP_BLOCK+0x0 /* R : Part ID Code */
319 1.1 cgd #define SXP_CONFIG1 SXP_BLOCK+0x2 /* RW*: Configuration Reg #1 */
320 1.1 cgd #define SXP_CONFIG2 SXP_BLOCK+0x4 /* RW*: Configuration Reg #2 */
321 1.1 cgd #define SXP_CONFIG3 SXP_BLOCK+0x6 /* RW*: Configuration Reg #2 */
322 1.1 cgd #define SXP_INSTRUCTION SXP_BLOCK+0xC /* RW*: Instruction Pointer */
323 1.1 cgd #define SXP_RETURN_ADDR SXP_BLOCK+0x10 /* RW*: Return Address */
324 1.1 cgd #define SXP_COMMAND SXP_BLOCK+0x14 /* RW*: Command */
325 1.1 cgd #define SXP_INTERRUPT SXP_BLOCK+0x18 /* R : Interrupt */
326 1.1 cgd #define SXP_SEQUENCE SXP_BLOCK+0x1C /* RW*: Sequence */
327 1.1 cgd #define SXP_GROSS_ERR SXP_BLOCK+0x1E /* R : Gross Error */
328 1.1 cgd #define SXP_EXCEPTION SXP_BLOCK+0x20 /* RW*: Exception Enable */
329 1.1 cgd #define SXP_OVERRIDE SXP_BLOCK+0x24 /* RW*: Override */
330 1.1 cgd #define SXP_LITERAL_BASE SXP_BLOCK+0x28 /* RW*: Literal Base */
331 1.1 cgd #define SXP_USER_FLAGS SXP_BLOCK+0x2C /* RW*: User Flags */
332 1.1 cgd #define SXP_USER_EXCEPT SXP_BLOCK+0x30 /* RW*: User Exception */
333 1.1 cgd #define SXP_BREAKPOINT SXP_BLOCK+0x34 /* RW*: Breakpoint */
334 1.1 cgd #define SXP_SCSI_ID SXP_BLOCK+0x40 /* RW*: SCSI ID */
335 1.1 cgd #define SXP_DEV_CONFIG1 SXP_BLOCK+0x42 /* RW*: Device Config Reg #1 */
336 1.1 cgd #define SXP_DEV_CONFIG2 SXP_BLOCK+0x44 /* RW*: Device Config Reg #2 */
337 1.1 cgd #define SXP_PHASE_POINTER SXP_BLOCK+0x48 /* RW*: SCSI Phase Pointer */
338 1.1 cgd #define SXP_BUF_POINTER SXP_BLOCK+0x4C /* RW*: SCSI Buffer Pointer */
339 1.1 cgd #define SXP_BUF_COUNTER SXP_BLOCK+0x50 /* RW*: SCSI Buffer Counter */
340 1.1 cgd #define SXP_BUFFER SXP_BLOCK+0x52 /* RW*: SCSI Buffer */
341 1.1 cgd #define SXP_BUF_BYTE SXP_BLOCK+0x54 /* RW*: SCSI Buffer Byte */
342 1.1 cgd #define SXP_BUF_WORD SXP_BLOCK+0x56 /* RW*: SCSI Buffer Word */
343 1.1 cgd #define SXP_BUF_WORD_TRAN SXP_BLOCK+0x58 /* RW*: SCSI Buffer Wd xlate */
344 1.1 cgd #define SXP_FIFO SXP_BLOCK+0x5A /* RW*: SCSI FIFO */
345 1.1 cgd #define SXP_FIFO_STATUS SXP_BLOCK+0x5C /* RW*: SCSI FIFO Status */
346 1.1 cgd #define SXP_FIFO_TOP SXP_BLOCK+0x5E /* RW*: SCSI FIFO Top Resid */
347 1.1 cgd #define SXP_FIFO_BOTTOM SXP_BLOCK+0x60 /* RW*: SCSI FIFO Bot Resid */
348 1.1 cgd #define SXP_TRAN_REG SXP_BLOCK+0x64 /* RW*: SCSI Transferr Reg */
349 1.1 cgd #define SXP_TRAN_COUNT_LO SXP_BLOCK+0x68 /* RW*: SCSI Trans Count */
350 1.1 cgd #define SXP_TRAN_COUNT_HI SXP_BLOCK+0x6A /* RW*: SCSI Trans Count */
351 1.1 cgd #define SXP_TRAN_COUNTER_LO SXP_BLOCK+0x6C /* RW*: SCSI Trans Counter */
352 1.1 cgd #define SXP_TRAN_COUNTER_HI SXP_BLOCK+0x6E /* RW*: SCSI Trans Counter */
353 1.1 cgd #define SXP_ARB_DATA SXP_BLOCK+0x70 /* R : SCSI Arb Data */
354 1.1 cgd #define SXP_PINS_CONTROL SXP_BLOCK+0x72 /* RW*: SCSI Control Pins */
355 1.1 cgd #define SXP_PINS_DATA SXP_BLOCK+0x74 /* RW*: SCSI Data Pins */
356 1.1 cgd #define SXP_PINS_DIFF SXP_BLOCK+0x76 /* RW*: SCSI Diff Pins */
357 1.1 cgd
358 1.1 cgd
359 1.1 cgd /* SXP CONF1 REGISTER */
360 1.1 cgd #define SXP_CONF1_ASYNCH_SETUP 0xF000 /* Asynchronous setup time */
361 1.1 cgd #define SXP_CONF1_SELECTION_UNIT 0x0000 /* Selection time unit */
362 1.1 cgd #define SXP_CONF1_SELECTION_TIMEOUT 0x0600 /* Selection timeout */
363 1.1 cgd #define SXP_CONF1_CLOCK_FACTOR 0x00E0 /* Clock factor */
364 1.1 cgd #define SXP_CONF1_SCSI_ID 0x000F /* SCSI id */
365 1.1 cgd
366 1.1 cgd /* SXP CONF2 REGISTER */
367 1.1 cgd #define SXP_CONF2_DISABLE_FILTER 0x0040 /* Disable SCSI rec filters */
368 1.1 cgd #define SXP_CONF2_REQ_ACK_PULLUPS 0x0020 /* Enable req/ack pullups */
369 1.1 cgd #define SXP_CONF2_DATA_PULLUPS 0x0010 /* Enable data pullups */
370 1.1 cgd #define SXP_CONF2_CONFIG_AUTOLOAD 0x0008 /* Enable dev conf auto-load */
371 1.1 cgd #define SXP_CONF2_RESELECT 0x0002 /* Enable reselection */
372 1.1 cgd #define SXP_CONF2_SELECT 0x0001 /* Enable selection */
373 1.1 cgd
374 1.1 cgd /* SXP INTERRUPT REGISTER */
375 1.1 cgd #define SXP_INT_PARITY_ERR 0x8000 /* Parity error detected */
376 1.1 cgd #define SXP_INT_GROSS_ERR 0x4000 /* Gross error detected */
377 1.1 cgd #define SXP_INT_FUNCTION_ABORT 0x2000 /* Last cmd aborted */
378 1.1 cgd #define SXP_INT_CONDITION_FAILED 0x1000 /* Last cond failed test */
379 1.1 cgd #define SXP_INT_FIFO_EMPTY 0x0800 /* SCSI FIFO is empty */
380 1.1 cgd #define SXP_INT_BUF_COUNTER_ZERO 0x0400 /* SCSI buf count == zero */
381 1.1 cgd #define SXP_INT_XFER_ZERO 0x0200 /* SCSI trans count == zero */
382 1.1 cgd #define SXP_INT_INT_PENDING 0x0080 /* SXP interrupt pending */
383 1.1 cgd #define SXP_INT_CMD_RUNNING 0x0040 /* SXP is running a command */
384 1.1 cgd #define SXP_INT_INT_RETURN_CODE 0x000F /* Interrupt return code */
385 1.1 cgd
386 1.1 cgd
387 1.1 cgd /* SXP GROSS ERROR REGISTER */
388 1.1 cgd #define SXP_GROSS_OFFSET_RESID 0x0040 /* Req/Ack offset not zero */
389 1.1 cgd #define SXP_GROSS_OFFSET_UNDERFLOW 0x0020 /* Req/Ack offset underflow */
390 1.1 cgd #define SXP_GROSS_OFFSET_OVERFLOW 0x0010 /* Req/Ack offset overflow */
391 1.1 cgd #define SXP_GROSS_FIFO_UNDERFLOW 0x0008 /* SCSI FIFO underflow */
392 1.1 cgd #define SXP_GROSS_FIFO_OVERFLOW 0x0004 /* SCSI FIFO overflow */
393 1.1 cgd #define SXP_GROSS_WRITE_ERR 0x0002 /* SXP and RISC wrote to reg */
394 1.1 cgd #define SXP_GROSS_ILLEGAL_INST 0x0001 /* Bad inst loaded into SXP */
395 1.1 cgd
396 1.1 cgd /* SXP EXCEPTION REGISTER */
397 1.1 cgd #define SXP_EXCEPT_USER_0 0x8000 /* Enable user exception #0 */
398 1.1 cgd #define SXP_EXCEPT_USER_1 0x4000 /* Enable user exception #1 */
399 1.1 cgd #define PCI_SXP_EXCEPT_SCAM 0x0400 /* SCAM Selection enable */
400 1.1 cgd #define SXP_EXCEPT_BUS_FREE 0x0200 /* Enable Bus Free det */
401 1.1 cgd #define SXP_EXCEPT_TARGET_ATN 0x0100 /* Enable TGT mode atten det */
402 1.1 cgd #define SXP_EXCEPT_RESELECTED 0x0080 /* Enable ReSEL exc handling */
403 1.1 cgd #define SXP_EXCEPT_SELECTED 0x0040 /* Enable SEL exc handling */
404 1.1 cgd #define SXP_EXCEPT_ARBITRATION 0x0020 /* Enable ARB exc handling */
405 1.1 cgd #define SXP_EXCEPT_GROSS_ERR 0x0010 /* Enable gross error except */
406 1.1 cgd #define SXP_EXCEPT_BUS_RESET 0x0008 /* Enable Bus Reset except */
407 1.1 cgd
408 1.1 cgd /* SXP OVERRIDE REGISTER */
409 1.1 cgd #define SXP_ORIDE_EXT_TRIGGER 0x8000 /* Enable external trigger */
410 1.1 cgd #define SXP_ORIDE_STEP 0x4000 /* Enable single step mode */
411 1.1 cgd #define SXP_ORIDE_BREAKPOINT 0x2000 /* Enable breakpoint reg */
412 1.1 cgd #define SXP_ORIDE_PIN_WRITE 0x1000 /* Enable write to SCSI pins */
413 1.1 cgd #define SXP_ORIDE_FORCE_OUTPUTS 0x0800 /* Force SCSI outputs on */
414 1.1 cgd #define SXP_ORIDE_LOOPBACK 0x0400 /* Enable SCSI loopback mode */
415 1.1 cgd #define SXP_ORIDE_PARITY_TEST 0x0200 /* Enable parity test mode */
416 1.1 cgd #define SXP_ORIDE_TRISTATE_ENA_PINS 0x0100 /* Tristate SCSI enable pins */
417 1.1 cgd #define SXP_ORIDE_TRISTATE_PINS 0x0080 /* Tristate SCSI pins */
418 1.1 cgd #define SXP_ORIDE_FIFO_RESET 0x0008 /* Reset SCSI FIFO */
419 1.1 cgd #define SXP_ORIDE_CMD_TERMINATE 0x0004 /* Terminate cur SXP com */
420 1.1 cgd #define SXP_ORIDE_RESET_REG 0x0002 /* Reset SXP registers */
421 1.1 cgd #define SXP_ORIDE_RESET_MODULE 0x0001 /* Reset SXP module */
422 1.1 cgd
423 1.1 cgd /* SXP COMMANDS */
424 1.1 cgd #define SXP_RESET_BUS_CMD 0x300b
425 1.1 cgd
426 1.1 cgd /* SXP SCSI ID REGISTER */
427 1.1 cgd #define SXP_SELECTING_ID 0x0F00 /* (Re)Selecting id */
428 1.1 cgd #define SXP_SELECT_ID 0x000F /* Select id */
429 1.1 cgd
430 1.1 cgd /* SXP DEV CONFIG1 REGISTER */
431 1.1 cgd #define SXP_DCONF1_SYNC_HOLD 0x7000 /* Synchronous data hold */
432 1.1 cgd #define SXP_DCONF1_SYNC_SETUP 0x0F00 /* Synchronous data setup */
433 1.1 cgd #define SXP_DCONF1_SYNC_OFFSET 0x000F /* Synchronous data offset */
434 1.1 cgd
435 1.1 cgd
436 1.1 cgd /* SXP DEV CONFIG2 REGISTER */
437 1.1 cgd #define SXP_DCONF2_FLAGS_MASK 0xF000 /* Device flags */
438 1.1 cgd #define SXP_DCONF2_WIDE 0x0400 /* Enable wide SCSI */
439 1.1 cgd #define SXP_DCONF2_PARITY 0x0200 /* Enable parity checking */
440 1.1 cgd #define SXP_DCONF2_BLOCK_MODE 0x0100 /* Enable blk mode xfr count */
441 1.1 cgd #define SXP_DCONF2_ASSERTION_MASK 0x0007 /* Assersion period mask */
442 1.1 cgd
443 1.1 cgd
444 1.1 cgd /* SXP PHASE POINTER REGISTER */
445 1.1 cgd #define SXP_PHASE_STATUS_PTR 0x1000 /* Status buffer offset */
446 1.1 cgd #define SXP_PHASE_MSG_IN_PTR 0x0700 /* Msg in buffer offset */
447 1.1 cgd #define SXP_PHASE_COM_PTR 0x00F0 /* Command buffer offset */
448 1.1 cgd #define SXP_PHASE_MSG_OUT_PTR 0x0007 /* Msg out buffer offset */
449 1.1 cgd
450 1.1 cgd
451 1.1 cgd /* SXP FIFO STATUS REGISTER */
452 1.1 cgd #define SXP_FIFO_TOP_RESID 0x8000 /* Top residue reg full */
453 1.1 cgd #define SXP_FIFO_ACK_RESID 0x4000 /* Wide transfers odd resid */
454 1.1 cgd #define SXP_FIFO_COUNT_MASK 0x001C /* Words in SXP FIFO */
455 1.1 cgd #define SXP_FIFO_BOTTOM_RESID 0x0001 /* Bottom residue reg full */
456 1.1 cgd
457 1.1 cgd
458 1.1 cgd /* SXP CONTROL PINS REGISTER */
459 1.1 cgd #define SXP_PINS_CON_PHASE 0x8000 /* Scsi phase valid */
460 1.1 cgd #define SXP_PINS_CON_PARITY_HI 0x0400 /* Parity pin */
461 1.1 cgd #define SXP_PINS_CON_PARITY_LO 0x0200 /* Parity pin */
462 1.1 cgd #define SXP_PINS_CON_REQ 0x0100 /* SCSI bus REQUEST */
463 1.1 cgd #define SXP_PINS_CON_ACK 0x0080 /* SCSI bus ACKNOWLEDGE */
464 1.1 cgd #define SXP_PINS_CON_RST 0x0040 /* SCSI bus RESET */
465 1.1 cgd #define SXP_PINS_CON_BSY 0x0020 /* SCSI bus BUSY */
466 1.1 cgd #define SXP_PINS_CON_SEL 0x0010 /* SCSI bus SELECT */
467 1.1 cgd #define SXP_PINS_CON_ATN 0x0008 /* SCSI bus ATTENTION */
468 1.1 cgd #define SXP_PINS_CON_MSG 0x0004 /* SCSI bus MESSAGE */
469 1.1 cgd #define SXP_PINS_CON_CD 0x0002 /* SCSI bus COMMAND */
470 1.1 cgd #define SXP_PINS_CON_IO 0x0001 /* SCSI bus INPUT */
471 1.1 cgd
472 1.1 cgd /*
473 1.1 cgd * Set the hold time for the SCSI Bus Reset to be 250 ms
474 1.1 cgd */
475 1.1 cgd #define SXP_SCSI_BUS_RESET_HOLD_TIME 250
476 1.1 cgd
477 1.1 cgd /* SXP DIFF PINS REGISTER */
478 1.1 cgd #define SXP_PINS_DIFF_SENSE 0x0200 /* DIFFSENS sig on SCSI bus */
479 1.1 cgd #define SXP_PINS_DIFF_MODE 0x0100 /* DIFFM signal */
480 1.1 cgd #define SXP_PINS_DIFF_ENABLE_OUTPUT 0x0080 /* Enable SXP SCSI data drv */
481 1.1 cgd #define SXP_PINS_DIFF_PINS_MASK 0x007C /* Differential control pins */
482 1.1 cgd #define SXP_PINS_DIFF_TARGET 0x0002 /* Enable SXP target mode */
483 1.1 cgd #define SXP_PINS_DIFF_INITIATOR 0x0001 /* Enable SXP initiator mode */
484 1.1 cgd
485 1.1 cgd /*
486 1.1 cgd * RISC and Host Command and Control Block Register Offsets
487 1.1 cgd */
488 1.1 cgd #define RISC_BLOCK 0x0800
489 1.1 cgd
490 1.1 cgd #define RISC_ACC RISC_BLOCK+0x0 /* RW*: Accumulator */
491 1.1 cgd #define RISC_R1 RISC_BLOCK+0x2 /* RW*: GP Reg R1 */
492 1.1 cgd #define RISC_R2 RISC_BLOCK+0x4 /* RW*: GP Reg R2 */
493 1.1 cgd #define RISC_R3 RISC_BLOCK+0x6 /* RW*: GP Reg R3 */
494 1.1 cgd #define RISC_R4 RISC_BLOCK+0x8 /* RW*: GP Reg R4 */
495 1.1 cgd #define RISC_R5 RISC_BLOCK+0xA /* RW*: GP Reg R5 */
496 1.1 cgd #define RISC_R6 RISC_BLOCK+0xC /* RW*: GP Reg R6 */
497 1.1 cgd #define RISC_R7 RISC_BLOCK+0xE /* RW*: GP Reg R7 */
498 1.1 cgd #define RISC_R8 RISC_BLOCK+0x10 /* RW*: GP Reg R8 */
499 1.1 cgd #define RISC_R9 RISC_BLOCK+0x12 /* RW*: GP Reg R9 */
500 1.1 cgd #define RISC_R10 RISC_BLOCK+0x14 /* RW*: GP Reg R10 */
501 1.1 cgd #define RISC_R11 RISC_BLOCK+0x16 /* RW*: GP Reg R11 */
502 1.1 cgd #define RISC_R12 RISC_BLOCK+0x18 /* RW*: GP Reg R12 */
503 1.1 cgd #define RISC_R13 RISC_BLOCK+0x1a /* RW*: GP Reg R13 */
504 1.1 cgd #define RISC_R14 RISC_BLOCK+0x1c /* RW*: GP Reg R14 */
505 1.1 cgd #define RISC_R15 RISC_BLOCK+0x1e /* RW*: GP Reg R15 */
506 1.1 cgd #define RISC_PSR RISC_BLOCK+0x20 /* RW*: Processor Status */
507 1.1 cgd #define RISC_IVR RISC_BLOCK+0x22 /* RW*: Interrupt Vector */
508 1.1 cgd #define RISC_PCR RISC_BLOCK+0x24 /* RW*: Processor Ctrl */
509 1.1 cgd #define RISC_RAR0 RISC_BLOCK+0x26 /* RW*: Ram Address #0 */
510 1.1 cgd #define RISC_RAR1 RISC_BLOCK+0x28 /* RW*: Ram Address #1 */
511 1.1 cgd #define RISC_LCR RISC_BLOCK+0x2a /* RW*: Loop Counter */
512 1.1 cgd #define RISC_PC RISC_BLOCK+0x2c /* R : Program Counter */
513 1.1 cgd #define RISC_MTR RISC_BLOCK+0x2e /* RW*: Memory Timing */
514 1.3 mjacob #define RISC_MTR2100 RISC_BLOCK+0x30
515 1.3 mjacob
516 1.1 cgd #define RISC_EMB RISC_BLOCK+0x30 /* RW*: Ext Mem Boundary */
517 1.1 cgd #define RISC_SP RISC_BLOCK+0x32 /* RW*: Stack Pointer */
518 1.1 cgd #define RISC_HRL RISC_BLOCK+0x3e /* R *: Hardware Rev Level */
519 1.1 cgd #define HCCR RISC_BLOCK+0x40 /* RW : Host Command & Ctrl */
520 1.1 cgd #define BP0 RISC_BLOCK+0x42 /* RW : Processor Brkpt #0 */
521 1.1 cgd #define BP1 RISC_BLOCK+0x44 /* RW : Processor Brkpt #1 */
522 1.1 cgd #define TCR RISC_BLOCK+0x46 /* W : Test Control */
523 1.1 cgd #define TMR RISC_BLOCK+0x48 /* W : Test Mode */
524 1.1 cgd
525 1.1 cgd
526 1.1 cgd /* PROCESSOR STATUS REGISTER */
527 1.1 cgd #define RISC_PSR_FORCE_TRUE 0x8000
528 1.1 cgd #define RISC_PSR_LOOP_COUNT_DONE 0x4000
529 1.1 cgd #define RISC_PSR_RISC_INT 0x2000
530 1.1 cgd #define RISC_PSR_TIMER_ROLLOVER 0x1000
531 1.1 cgd #define RISC_PSR_ALU_OVERFLOW 0x0800
532 1.1 cgd #define RISC_PSR_ALU_MSB 0x0400
533 1.1 cgd #define RISC_PSR_ALU_CARRY 0x0200
534 1.1 cgd #define RISC_PSR_ALU_ZERO 0x0100
535 1.7 mjacob
536 1.7 mjacob #define RISC_PSR_PCI_ULTRA 0x0080
537 1.7 mjacob #define RISC_PSR_SBUS_ULTRA 0x0020
538 1.7 mjacob
539 1.1 cgd #define RISC_PSR_DMA_INT 0x0010
540 1.1 cgd #define RISC_PSR_SXP_INT 0x0008
541 1.1 cgd #define RISC_PSR_HOST_INT 0x0004
542 1.1 cgd #define RISC_PSR_INT_PENDING 0x0002
543 1.1 cgd #define RISC_PSR_FORCE_FALSE 0x0001
544 1.1 cgd
545 1.1 cgd
546 1.1 cgd /* Host Command and Control */
547 1.1 cgd #define HCCR_CMD_NOP 0x0000 /* NOP */
548 1.1 cgd #define HCCR_CMD_RESET 0x1000 /* Reset RISC */
549 1.1 cgd #define HCCR_CMD_PAUSE 0x2000 /* Pause RISC */
550 1.1 cgd #define HCCR_CMD_RELEASE 0x3000 /* Release Paused RISC */
551 1.1 cgd #define HCCR_CMD_STEP 0x4000 /* Single Step RISC */
552 1.1 cgd #define HCCR_CMD_SET_HOST_INT 0x5000 /* Set Host Interrupt */
553 1.1 cgd #define HCCR_CMD_CLEAR_HOST_INT 0x6000 /* Clear Host Interrupt */
554 1.1 cgd #define HCCR_CMD_CLEAR_RISC_INT 0x7000 /* Clear RISC interrupt */
555 1.1 cgd #define HCCR_CMD_BREAKPOINT 0x8000 /* Change breakpoint enables */
556 1.1 cgd #define PCI_HCCR_CMD_BIOS 0x9000 /* Write BIOS (disable) */
557 1.1 cgd #define PCI_HCCR_CMD_PARITY 0xA000 /* Write parity enable */
558 1.1 cgd #define PCI_HCCR_CMD_PARITY_ERR 0xE000 /* Generate parity error */
559 1.1 cgd #define HCCR_CMD_TEST_MODE 0xF000 /* Set Test Mode */
560 1.3 mjacob
561 1.3 mjacob #define ISP2100_HCCR_PARITY_ENABLE_2 0x0400
562 1.3 mjacob #define ISP2100_HCCR_PARITY_ENABLE_1 0x0200
563 1.3 mjacob #define ISP2100_HCCR_PARITY_ENABLE_0 0x0100
564 1.3 mjacob #define ISP2100_HCCR_PARITY 0x0001
565 1.1 cgd
566 1.1 cgd #define PCI_HCCR_PARITY 0x0400 /* Parity error flag */
567 1.1 cgd #define PCI_HCCR_PARITY_ENABLE_1 0x0200 /* Parity enable bank 1 */
568 1.1 cgd #define PCI_HCCR_PARITY_ENABLE_0 0x0100 /* Parity enable bank 0 */
569 1.1 cgd
570 1.1 cgd #define HCCR_HOST_INT 0x0080 /* R : Host interrupt set */
571 1.1 cgd #define HCCR_RESET 0x0040 /* R : reset in progress */
572 1.1 cgd #define HCCR_PAUSE 0x0020 /* R : RISC paused */
573 1.1 cgd
574 1.1 cgd #define PCI_HCCR_BIOS 0x0001 /* W : BIOS enable */
575 1.7 mjacob
576 1.7 mjacob /*
577 1.7 mjacob * Qlogic 1XXX NVRAM is an array of 128 bytes.
578 1.7 mjacob *
579 1.7 mjacob * Some portion of the front of this is for general host adapter properties
580 1.7 mjacob * This is followed by an array of per-target parameters, and is tailed off
581 1.7 mjacob * with a checksum xor byte at offset 127. For non-byte entities data is
582 1.7 mjacob * stored in Little Endian order.
583 1.7 mjacob */
584 1.7 mjacob
585 1.7 mjacob #define ISP_NVRAM_SIZE 128
586 1.7 mjacob
587 1.7 mjacob #define ISPBSMX(c, byte, shift, mask) \
588 1.7 mjacob (((c)[(byte)] >> (shift)) & (mask))
589 1.7 mjacob
590 1.7 mjacob #define ISP_NVRAM_VERSION(c) (c)[4]
591 1.7 mjacob #define ISP_NVRAM_FIFO_THRESHOLD(c) ISPBSMX(c, 5, 0, 0x03)
592 1.7 mjacob #define ISP_NVRAM_BIOS_DISABLE(c) ISPBSMX(c, 5, 2, 0x01)
593 1.7 mjacob #define ISP_NVRAM_HBA_ENABLE(c) ISPBSMX(c, 5, 3, 0x01)
594 1.7 mjacob #define ISP_NVRAM_INITIATOR_ID(c) ISPBSMX(c, 5, 4, 0x0f)
595 1.7 mjacob #define ISP_NVRAM_BUS_RESET_DELAY(c) (c)[6]
596 1.7 mjacob #define ISP_NVRAM_BUS_RETRY_COUNT(c) (c)[7]
597 1.7 mjacob #define ISP_NVRAM_BUS_RETRY_DELAY(c) (c)[8]
598 1.7 mjacob #define ISP_NVRAM_ASYNC_DATA_SETUP_TIME(c) ISPBSMX(c, 9, 0, 0x0f)
599 1.7 mjacob #define ISP_NVRAM_REQ_ACK_ACTIVE_NEGATION(c) ISPBSMX(c, 9, 4, 0x01)
600 1.7 mjacob #define ISP_NVRAM_DATA_LINE_ACTIVE_NEGATION(c) ISPBSMX(c, 9, 5, 0x01)
601 1.7 mjacob #define ISP_NVRAM_DATA_DMA_BURST_ENABLE(c) ISPBSMX(c, 9, 6, 0x01)
602 1.7 mjacob #define ISP_NVRAM_CMD_DMA_BURST_ENABLE(c) ISPBSMX(c, 9, 7, 0x01)
603 1.7 mjacob #define ISP_NVRAM_TAG_AGE_LIMIT(c) (c)[10]
604 1.7 mjacob #define ISP_NVRAM_LOWTRM_ENABLE(c) ISPBSMX(c, 11, 0, 0x01)
605 1.7 mjacob #define ISP_NVRAM_HITRM_ENABLE(c) ISPBSMX(c, 11, 1, 0x01)
606 1.7 mjacob #define ISP_NVRAM_PCMC_BURST_ENABLE(c) ISPBSMX(c, 11, 2, 0x01)
607 1.7 mjacob #define ISP_NVRAM_ENABLE_60_MHZ(c) ISPBSMX(c, 11, 3, 0x01)
608 1.7 mjacob #define ISP_NVRAM_SCSI_RESET_DISABLE(c) ISPBSMX(c, 11, 4, 0x01)
609 1.7 mjacob #define ISP_NVRAM_ENABLE_AUTO_TERM(c) ISPBSMX(c, 11, 5, 0x01)
610 1.7 mjacob #define ISP_NVRAM_FIFO_THRESHOLD_128(c) ISPBSMX(c, 11, 6, 0x01)
611 1.7 mjacob #define ISP_NVRAM_AUTO_TERM_SUPPORT(c) ISPBSMX(c, 11, 7, 0x01)
612 1.7 mjacob #define ISP_NVRAM_SELECTION_TIMEOUT(c) (((c)[12]) | ((c)[13] << 8))
613 1.7 mjacob #define ISP_NVRAM_MAX_QUEUE_DEPTH(c) (((c)[14]) | ((c)[15] << 8))
614 1.7 mjacob #define ISP_NVRAM_SCSI_BUS_SIZE(c) ISPBSMX(c, 16, 0, 0x01)
615 1.7 mjacob #define ISP_NVRAM_SCSI_BUS_TYPE(c) ISPBSMX(c, 16, 1, 0x01)
616 1.7 mjacob #define ISP_NVRAM_ADAPTER_CLK_SPEED(c) ISPBSMX(c, 16, 2, 0x01)
617 1.7 mjacob #define ISP_NVRAM_SOFT_TERM_SUPPORT(c) ISPBSMX(c, 16, 3, 0x01)
618 1.7 mjacob #define ISP_NVRAM_FLASH_ONBOARD(c) ISPBSMX(c, 16, 4, 0x01)
619 1.7 mjacob #define ISP_NVRAM_FAST_MTTR_ENABLE(c) ISPBSMX(c, 22, 0, 0x01)
620 1.7 mjacob
621 1.7 mjacob #define ISP_NVRAM_TARGOFF 28
622 1.7 mjacob #define ISP_NVARM_TARGSIZE 6
623 1.7 mjacob #define _IxT(tgt, tidx) \
624 1.7 mjacob (ISP_NVRAM_TARGOFF + (ISP_NVARM_TARGSIZE * (tgt)) + (tidx))
625 1.7 mjacob #define ISP_NVRAM_TGT_RENEG(c, t) ISPBSMX(c, _IxT(t, 0), 0, 0x01)
626 1.7 mjacob #define ISP_NVRAM_TGT_QFRZ(c, t) ISPBSMX(c, _IxT(t, 0), 1, 0x01)
627 1.7 mjacob #define ISP_NVRAM_TGT_ARQ(c, t) ISPBSMX(c, _IxT(t, 0), 2, 0x01)
628 1.7 mjacob #define ISP_NVRAM_TGT_TQING(c, t) ISPBSMX(c, _IxT(t, 0), 3, 0x01)
629 1.7 mjacob #define ISP_NVRAM_TGT_SYNC(c, t) ISPBSMX(c, _IxT(t, 0), 4, 0x01)
630 1.7 mjacob #define ISP_NVRAM_TGT_WIDE(c, t) ISPBSMX(c, _IxT(t, 0), 5, 0x01)
631 1.7 mjacob #define ISP_NVRAM_TGT_PARITY(c, t) ISPBSMX(c, _IxT(t, 0), 6, 0x01)
632 1.7 mjacob #define ISP_NVRAM_TGT_DISC(c, t) ISPBSMX(c, _IxT(t, 0), 7, 0x01)
633 1.7 mjacob #define ISP_NVRAM_TGT_EXEC_THROTTLE(c, t) ISPBSMX(c, _IxT(t, 1), 0, 0xff)
634 1.7 mjacob #define ISP_NVRAM_TGT_SYNC_PERIOD(c, t) ISPBSMX(c, _IxT(t, 2), 0, 0xff)
635 1.7 mjacob #define ISP_NVRAM_TGT_SYNC_OFFSET(c, t) ISPBSMX(c, _IxT(t, 3), 0, 0x0f)
636 1.7 mjacob #define ISP_NVRAM_TGT_DEVICE_ENABLE(c, t) ISPBSMX(c, _IxT(t, 3), 4, 0x01)
637 1.7 mjacob #define ISP_NVRAM_TGT_LUN_DISABLE(c, t) ISPBSMX(c, _IxT(t, 3), 5, 0x01)
638 1.7 mjacob
639 1.7 mjacob /*
640 1.7 mjacob * Qlogic 2XXX NVRAM is an array of 256 bytes.
641 1.7 mjacob *
642 1.7 mjacob * Some portion of the front of this is for general RISC engine parameters,
643 1.7 mjacob * mostly reflecting the state of the last INITIALIZE FIRMWARE mailbox command.
644 1.7 mjacob *
645 1.7 mjacob * This is followed by some general host adapter parameters, and ends with
646 1.7 mjacob * a checksum xor byte at offset 255. For non-byte entities data is stored
647 1.7 mjacob * in Little Endian order.
648 1.7 mjacob */
649 1.7 mjacob #define ISP2100_NVRAM_SIZE 256
650 1.7 mjacob /* ISP_NVRAM_VERSION is in same overall place */
651 1.7 mjacob #define ISP2100_NVRAM_RISCVER(c) (c)[6]
652 1.7 mjacob #define ISP2100_NVRAM_ENABLE_HARDLOOPID(c) ISPBSMX(c, 8, 0, 0x01)
653 1.7 mjacob #define ISP2100_NVRAM_ENABLE_FAIRNESS(c) ISPBSMX(c, 8, 1, 0x01)
654 1.7 mjacob #define ISP2100_NVRAM_ENABLE_FULLDUPLEX(c) ISPBSMX(c, 8, 2, 0x01)
655 1.7 mjacob #define ISP2100_NVRAM_ENABLE_FAST_POSTING(c) ISPBSMX(c, 8, 3, 0x01)
656 1.7 mjacob #define ISP2100_NVRAM_ENABLE_TARGET_MODE(c) ISPBSMX(c, 8, 4, 0x01)
657 1.7 mjacob #define ISP2100_NVRAM_ENABLE_INITIATOR_MODE(c) ISPBSMX(c, 8, 5, 0x01)
658 1.7 mjacob #define ISP2100_NVRAM_QFRZ(c) ISPBSMX(c, 8, 6, 0x01)
659 1.7 mjacob #define ISP2100_NVRAM_MAXFRAMELENGTH(c) (((c)[10]) | ((c)[11] << 8))
660 1.7 mjacob #define ISP2100_NVRAM_MAXIOCBALLOCATION(c) (((c)[12]) | ((c)[13] << 8))
661 1.7 mjacob #define ISP2100_NVRAM_EXECUTION_THROTTLE(c) (((c)[14]) | ((c)[15] << 8))
662 1.7 mjacob #define ISP2100_NVRAM_RETRY_COUNT(c) (c)[16]
663 1.7 mjacob #define ISP2100_NVRAM_RETRY_DELAY(c) (c)[17]
664 1.7 mjacob
665 1.7 mjacob #define ISP2100_NVRAM_NODE_NAME(c) ( \
666 1.7 mjacob (((u_int64_t)(c)[18]) << 56) | \
667 1.7 mjacob (((u_int64_t)(c)[19]) << 48) | \
668 1.7 mjacob (((u_int64_t)(c)[20]) << 40) | \
669 1.7 mjacob (((u_int64_t)(c)[21]) << 32) | \
670 1.7 mjacob (((u_int64_t)(c)[22]) << 24) | \
671 1.7 mjacob (((u_int64_t)(c)[23]) << 16) | \
672 1.7 mjacob (((u_int64_t)(c)[24]) << 8) | \
673 1.7 mjacob (((u_int64_t)(c)[25]) << 0))
674 1.9 mjacob #define ISP2100_NVRAM_HARDLOOPID(c) (c)[26]
675 1.7 mjacob
676 1.7 mjacob #define ISP2100_NVRAM_HBA_DISABLE(c) ISPBSMX(c, 70, 0, 0x01)
677 1.7 mjacob #define ISP2100_NVRAM_BIOS_DISABLE(c) ISPBSMX(c, 70, 1, 0x01)
678 1.7 mjacob #define ISP2100_NVRAM_LUN_DISABLE(c) ISPBSMX(c, 70, 2, 0x01)
679 1.7 mjacob #define ISP2100_NVRAM_ENABLE_SELECT_BOOT(c) ISPBSMX(c, 70, 3, 0x01)
680 1.7 mjacob #define ISP2100_NVRAM_DISABLE_CODELOAD(c) ISPBSMX(c, 70, 4, 0x01)
681 1.7 mjacob #define ISP2100_NVRAM_SET_CACHELINESZ(c) ISPBSMX(c, 70, 5, 0x01)
682 1.7 mjacob
683 1.7 mjacob #define ISP2100_NVRAM_BOOT_NODE_NAME(c) ( \
684 1.7 mjacob (((u_int64_t)(c)[72]) << 56) | \
685 1.7 mjacob (((u_int64_t)(c)[73]) << 48) | \
686 1.7 mjacob (((u_int64_t)(c)[74]) << 40) | \
687 1.7 mjacob (((u_int64_t)(c)[75]) << 32) | \
688 1.7 mjacob (((u_int64_t)(c)[76]) << 24) | \
689 1.7 mjacob (((u_int64_t)(c)[77]) << 16) | \
690 1.7 mjacob (((u_int64_t)(c)[78]) << 8) | \
691 1.7 mjacob (((u_int64_t)(c)[79]) << 0))
692 1.7 mjacob #define ISP2100_NVRAM_BOOT_LUN(c) (c)[80]
693 1.7 mjacob
694 1.1 cgd #endif /* _ISPREG_H */
695