ispreg.h revision 1.2
1/*	$NetBSD: ispreg.h,v 1.2 1997/03/12 21:07:03 cgd Exp $	*/
2
3/*
4 * Machine Independent (well, as best as possible) register
5 * definitions for Qlogic ISP SCSI adapters.
6 *
7 * Copyright (c) 1997 by Matthew Jacob
8 * NASA/Ames Research Center
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 *    notice immediately at the beginning of the file, without modification,
16 *    this list of conditions, and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 *    notice, this list of conditions and the following disclaimer in the
19 *    documentation and/or other materials provided with the distribution.
20 * 3. The name of the author may not be used to endorse or promote products
21 *    derived from this software without specific prior written permission.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
27 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * SUCH DAMAGE.
34 */
35
36#ifndef	_ISPREG_H
37#define	_ISPREG_H
38
39/*
40 * Hardware definitions for the Qlogic ISP  registers.
41 */
42
43/*
44 * This defines types of access to various registers.
45 *
46 *  	R:		Read Only
47 *	W:		Write Only
48 *	RW:		Read/Write
49 *
50 *	R*, W*, RW*:	Read Only, Write Only, Read/Write, but only
51 *			if RISC processor in ISP is paused.
52 */
53
54/*
55 * Offsets for various register blocks.
56 *
57 * Sad but true, different architectures have different offsets.
58 */
59
60#define	BIU_REGS_OFF		0x00
61
62#define	 PCI_MBOX_REGS_OFF		0x70
63#define	SBUS_MBOX_REGS_OFF		0x80
64
65#define	 PCI_SXP_REGS_OFF		0x80
66#define	SBUS_SXP_REGS_OFF		0x200
67
68#define	 PCI_RISC_REGS_OFF		0x80
69#define	SBUS_RISC_REGS_OFF		0x400
70
71/*
72 * NB:	The *_BLOCK definitions have no specific hardware meaning.
73 *	They serve simply to note to the MD layer which block of
74 *	registers offsets are being accessed.
75 */
76
77/*
78 * Bus Interface Block Register Offsets
79 */
80#define	BIU_BLOCK	0x0100
81#define	BIU_ID_LO	BIU_BLOCK+0x0	/* R  : Bus ID, Low */
82#define	BIU_ID_HI	BIU_BLOCK+0x2	/* R  : Bus ID, High */
83#define	BIU_CONF0	BIU_BLOCK+0x4	/* R  : Bus Configuration #0 */
84#define	BIU_CONF1	BIU_BLOCK+0x6	/* R  : Bus Configuration #1 */
85#define	BIU_ICR		BIU_BLOCK+0x8	/* RW : Bus Interface Ctrl */
86#define	BIU_ISR		BIU_BLOCK+0xA	/* R  : Bus Interface Status */
87#define	BIU_SEMA	BIU_BLOCK+0xC	/* RW : Bus Semaphore */
88#define	BIU_NVRAM	BIU_BLOCK+0xE	/* RW : Bus NVRAM */
89#define	CDMA_CONF	BIU_BLOCK+0x20	/* RW*: DMA Configuration */
90#define	CDMA_CONTROL	BIU_BLOCK+0x22	/* RW*: DMA Control */
91#define	CDMA_STATUS 	BIU_BLOCK+0x24	/* R  : DMA Status */
92#define	CDMA_FIFO_STS	BIU_BLOCK+0x26	/* R  : DMA FIFO Status */
93#define	CDMA_COUNT	BIU_BLOCK+0x28	/* RW*: DMA Transfer Count */
94#define	CDMA_ADDR0	BIU_BLOCK+0x2C	/* RW*: DMA Address, Word 0 */
95#define	CDMA_ADDR1	BIU_BLOCK+0x2E	/* RW*: DMA Address, Word 1 */
96/* these are for the 1040A cards */
97#define	CDMA_ADDR2	BIU_BLOCK+0x30	/* RW*: DMA Address, Word 2 */
98#define	CDMA_ADDR3	BIU_BLOCK+0x32	/* RW*: DMA Address, Word 3 */
99
100#define	DDMA_CONF	BIU_BLOCK+0x40	/* RW*: DMA Configuration */
101#define	DDMA_CONTROL	BIU_BLOCK+0x42	/* RW*: DMA Control */
102#define	DDMA_STATUS	BIU_BLOCK+0x44	/* R  : DMA Status */
103#define	DDMA_FIFO_STS	BIU_BLOCK+0x46	/* R  : DMA FIFO Status */
104#define	DDMA_COUNT_LO	BIU_BLOCK+0x48	/* RW*: DMA Xfer Count, Low */
105#define	DDMA_COUNT_HI	BIU_BLOCK+0x4A	/* RW*: DMA Xfer Count, High */
106#define	DDMA_ADDR0	BIU_BLOCK+0x4C	/* RW*: DMA Address, Word 0 */
107#define	DDMA_ADDR1	BIU_BLOCK+0x4E	/* RW*: DMA Address, Word 1 */
108/* these are for the 1040A cards */
109#define	DDMA_ADDR2	BIU_BLOCK+0x50	/* RW*: DMA Address, Word 2 */
110#define	DDMA_ADDR3	BIU_BLOCK+0x52	/* RW*: DMA Address, Word 3 */
111
112#define	DFIFO_COMMAND	BIU_BLOCK+0x60	/* RW : Command FIFO Port */
113#define	DFIFO_DATA	BIU_BLOCK+0x62	/* RW : Data FIFO Port */
114
115/*
116 * Bus Interface Block Register Definitions
117 */
118/* BUS CONFIGURATION REGISTER #0 */
119#define	BIU_CONF0_HW_MASK		0x000F	/* Hardware revision mask */
120/* BUS CONFIGURATION REGISTER #1 */
121
122#define	BIU_SBUS_CONF1_PARITY		0x0100 	/* Enable parity checking */
123#define	BIU_SBUS_CONF1_FCODE_MASK	0x00F0	/* Fcode cycle mask */
124
125#define	BIU_PCI_CONF1_FIFO_128		0x0040	/* 128 bytes FIFO threshold */
126#define	BIU_PCI_CONF1_FIFO_64		0x0030	/* 64 bytes FIFO threshold */
127#define	BIU_PCI_CONF1_FIFO_32		0x0020	/* 32 bytes FIFO threshold */
128#define	BIU_PCI_CONF1_FIFO_16		0x0010	/* 16 bytes FIFO threshold */
129#define	BIU_BURST_ENABLE		0x0004	/* Global enable Bus bursts */
130#define	BIU_SBUS_CONF1_FIFO_64		0x0003	/* 64 bytes FIFO threshold */
131#define	BIU_SBUS_CONF1_FIFO_32		0x0002	/* 32 bytes FIFO threshold */
132#define	BIU_SBUS_CONF1_FIFO_16		0x0001	/* 16 bytes FIFO threshold */
133#define	BIU_SBUS_CONF1_FIFO_8		0x0000	/* 8 bytes FIFO threshold */
134#define	BIU_SBUS_CONF1_BURST8		0x0008 	/* Enable 8-byte  bursts */
135#define	BIU_PCI_CONF1_SXP		0x0008	/* SXP register select */
136
137/* BUS CONTROL REGISTER */
138#define	BIU_ICR_ENABLE_DMA_INT		0x0020	/* Enable DMA interrupts */
139#define	BIU_ICR_ENABLE_CDMA_INT		0x0010	/* Enable CDMA interrupts */
140#define	BIU_ICR_ENABLE_SXP_INT		0x0008	/* Enable SXP interrupts */
141#define	BIU_ICR_ENABLE_RISC_INT		0x0004	/* Enable Risc interrupts */
142#define	BIU_ICR_ENABLE_ALL_INTS		0x0002	/* Global enable all inter */
143#define	BIU_ICR_SOFT_RESET		0x0001	/* Soft Reset of ISP */
144
145
146/* BUS STATUS REGISTER */
147#define	BIU_ISR_DMA_INT			0x0020	/* DMA interrupt pending */
148#define	BIU_ISR_CDMA_INT		0x0010	/* CDMA interrupt pending */
149#define	BIU_ISR_SXP_INT			0x0008	/* SXP interrupt pending */
150#define	BIU_ISR_RISC_INT		0x0004	/* Risc interrupt pending */
151#define	BIU_ISR_IPEND			0x0002	/* Global interrupt pending */
152
153
154/* BUS SEMAPHORE REGISTER */
155#define	BIU_SEMA_STATUS		0x0002	/* Semaphore Status Bit */
156#define	BIU_SEMA_LOCK  		0x0001	/* Semaphore Lock Bit */
157
158
159/* COMNMAND && DATA DMA CONFIGURATION REGISTER */
160#define	DMA_ENABLE_SXP_DMA		0x0008	/* Enable SXP to DMA Data */
161#define	DMA_ENABLE_INTS			0x0004	/* Enable interrupts to RISC */
162#define	DMA_ENABLE_BURST		0x0002	/* Enable Bus burst trans */
163#define	DMA_DMA_DIRECTION		0x0001	/*
164						 * Set DMA direction:
165						 *	0 - DMA FIFO to host
166						 *	1 - Host to DMA FIFO
167						 */
168
169/* COMMAND && DATA DMA CONTROL REGISTER */
170#define	DMA_CNTRL_SUSPEND_CHAN		0x0010	/* Suspend DMA transfer */
171#define	DMA_CNTRL_CLEAR_CHAN		0x0008	/*
172						 * Clear FIFO and DMA Channel,
173						 * reset DMA registers
174						 */
175#define	DMA_CNTRL_CLEAR_FIFO		0x0004	/* Clear DMA FIFO */
176#define	DMA_CNTRL_RESET_INT		0x0002	/* Clear DMA interrupt */
177#define	DMA_CNTRL_STROBE		0x0001	/* Start DMA transfer */
178
179
180/* DMA STATUS REGISTER */
181#define	DMA_SBUS_STATUS_PIPE_MASK	0x00C0	/* DMA Pipeline status mask */
182#define	DMA_SBUS_STATUS_CHAN_MASK	0x0030	/* Channel status mask */
183#define	DMA_SBUS_STATUS_BUS_PARITY	0x0008	/* Parity Error on bus */
184#define	DMA_SBUS_STATUS_BUS_ERR		0x0004	/* Error Detected on bus */
185#define	DMA_SBUS_STATUS_TERM_COUNT	0x0002	/* DMA Transfer Completed */
186#define	DMA_SBUS_STATUS_INTERRUPT	0x0001	/* Enable DMA channel inter */
187
188#define	DMA_PCI_STATUS_INTERRUPT	0x8000	/* Enable DMA channel inter */
189#define	DMA_PCI_STATUS_RETRY_STAT	0x4000	/* Retry status */
190#define	DMA_PCI_STATUS_CHAN_MASK	0x3000	/* Channel status mask */
191#define	DMA_PCI_STATUS_FIFO_OVR		0x0100	/* DMA FIFO overrun cond */
192#define	DMA_PCI_STATUS_FIFO_UDR		0x0080	/* DMA FIFO underrun cond */
193#define	DMA_PCI_STATUS_BUS_ERR		0x0040	/* Error Detected on bus */
194#define	DMA_PCI_STATUS_BUS_PARITY	0x0020	/* Parity Error on bus */
195#define	DMA_PCI_STATUS_CLR_PEND		0x0010	/* DMA clear pending */
196#define	DMA_PCI_STATUS_TERM_COUNT	0x0008	/* DMA Transfer Completed */
197#define	DMA_PCI_STATUS_DMA_SUSP		0x0004	/* DMA suspended */
198#define	DMA_PCI_STATUS_PIPE_MASK	0x0003	/* DMA Pipeline status mask */
199
200/* DMA Status Register, pipeline status bits */
201#define	DMA_SBUS_PIPE_FULL		0x00C0	/* Both pipeline stages full */
202#define	DMA_SBUS_PIPE_OVERRUN		0x0080	/* Pipeline overrun */
203#define	DMA_SBUS_PIPE_STAGE1		0x0040	/*
204						 * Pipeline stage 1 Loaded,
205						 * stage 2 empty
206						 */
207#define	DMA_PCI_PIPE_FULL		0x0003	/* Both pipeline stages full */
208#define	DMA_PCI_PIPE_OVERRUN		0x0002	/* Pipeline overrun */
209#define	DMA_PCI_PIPE_STAGE1		0x0001	/*
210						 * Pipeline stage 1 Loaded,
211						 * stage 2 empty
212						 */
213#define	DMA_PIPE_EMPTY			0x0000	/* All pipeline stages empty */
214
215/* DMA Status Register, channel status bits */
216#define	DMA_SBUS_CHAN_SUSPEND	0x0030	/* Channel error or suspended */
217#define	DMA_SBUS_CHAN_TRANSFER	0x0020	/* Chan transfer in progress */
218#define	DMA_SBUS_CHAN_ACTIVE	0x0010	/* Chan trans to host active */
219#define	DMA_PCI_CHAN_TRANSFER	0x3000	/* Chan transfer in progress */
220#define	DMA_PCI_CHAN_SUSPEND	0x2000	/* Channel error or suspended */
221#define	DMA_PCI_CHAN_ACTIVE	0x1000	/* Chan trans to host active */
222#define	ISP_DMA_CHAN_IDLE	0x0000	/* Chan idle (normal comp) */
223
224
225/* DMA FIFO STATUS REGISTER */
226#define	DMA_FIFO_STATUS_OVERRUN		0x0200	/* FIFO Overrun Condition */
227#define	DMA_FIFO_STATUS_UNDERRUN	0x0100	/* FIFO Underrun Condition */
228#define	DMA_FIFO_SBUS_COUNT_MASK	0x007F	/* FIFO Byte count mask */
229#define	DMA_FIFO_PCI_COUNT_MASK		0x00FF	/* FIFO Byte count mask */
230
231/*
232 * Mailbox Block Register Offsets
233 */
234
235#define	MBOX_BLOCK	0x0200
236#define	INMAILBOX0	MBOX_BLOCK+0x0
237#define	INMAILBOX1	MBOX_BLOCK+0x2
238#define	INMAILBOX2	MBOX_BLOCK+0x4
239#define	INMAILBOX3	MBOX_BLOCK+0x6
240#define	INMAILBOX4	MBOX_BLOCK+0x8
241#define	INMAILBOX5	MBOX_BLOCK+0xA
242
243#define	OUTMAILBOX0	MBOX_BLOCK+0x0
244#define	OUTMAILBOX1	MBOX_BLOCK+0x2
245#define	OUTMAILBOX2	MBOX_BLOCK+0x4
246#define	OUTMAILBOX3	MBOX_BLOCK+0x6
247#define	OUTMAILBOX4	MBOX_BLOCK+0x8
248#define	OUTMAILBOX5	MBOX_BLOCK+0xA
249
250/*
251 * Mailbox Command Complete Status Codes
252 */
253#define	MBOX_COMMAND_COMPLETE		0x4000
254#define	MBOX_INVALID_COMMAND		0x4001
255#define	MBOX_HOST_INTERFACE_ERROR	0x4002
256#define	MBOX_TEST_FAILED		0x4003
257#define	MBOX_COMMAND_ERROR		0x4005
258#define	MBOX_COMMAND_PARAM_ERROR	0x4006
259
260/*
261 * Asynchronous event status codes
262 */
263#define	ASYNC_BUS_RESET			0x8001
264#define	ASYNC_SYSTEM_ERROR		0x8002
265#define	ASYNC_RQS_XFER_ERR		0x8003
266#define	ASYNC_RSP_XFER_ERR		0x8004
267#define	ASYNC_QWAKEUP			0x8005
268#define	ASYNC_TIMEOUT_RESET		0x8006
269
270/*
271 * SXP Block Register Offsets
272 */
273#define	SXP_BLOCK	0x0400
274#define	SXP_PART_ID		SXP_BLOCK+0x0	/* R  : Part ID Code */
275#define	SXP_CONFIG1		SXP_BLOCK+0x2	/* RW*: Configuration Reg #1 */
276#define	SXP_CONFIG2		SXP_BLOCK+0x4	/* RW*: Configuration Reg #2 */
277#define	SXP_CONFIG3		SXP_BLOCK+0x6	/* RW*: Configuration Reg #2 */
278#define	SXP_INSTRUCTION		SXP_BLOCK+0xC	/* RW*: Instruction Pointer */
279#define	SXP_RETURN_ADDR		SXP_BLOCK+0x10	/* RW*: Return Address */
280#define	SXP_COMMAND		SXP_BLOCK+0x14	/* RW*: Command */
281#define	SXP_INTERRUPT		SXP_BLOCK+0x18	/* R  : Interrupt */
282#define	SXP_SEQUENCE		SXP_BLOCK+0x1C	/* RW*: Sequence */
283#define	SXP_GROSS_ERR		SXP_BLOCK+0x1E	/* R  : Gross Error */
284#define	SXP_EXCEPTION		SXP_BLOCK+0x20	/* RW*: Exception Enable */
285#define	SXP_OVERRIDE		SXP_BLOCK+0x24	/* RW*: Override */
286#define	SXP_LITERAL_BASE	SXP_BLOCK+0x28	/* RW*: Literal Base */
287#define	SXP_USER_FLAGS		SXP_BLOCK+0x2C	/* RW*: User Flags */
288#define	SXP_USER_EXCEPT		SXP_BLOCK+0x30	/* RW*: User Exception */
289#define	SXP_BREAKPOINT		SXP_BLOCK+0x34	/* RW*: Breakpoint */
290#define	SXP_SCSI_ID		SXP_BLOCK+0x40	/* RW*: SCSI ID */
291#define	SXP_DEV_CONFIG1		SXP_BLOCK+0x42	/* RW*: Device Config Reg #1 */
292#define	SXP_DEV_CONFIG2		SXP_BLOCK+0x44	/* RW*: Device Config Reg #2 */
293#define	SXP_PHASE_POINTER	SXP_BLOCK+0x48	/* RW*: SCSI Phase Pointer */
294#define	SXP_BUF_POINTER		SXP_BLOCK+0x4C	/* RW*: SCSI Buffer Pointer */
295#define	SXP_BUF_COUNTER		SXP_BLOCK+0x50	/* RW*: SCSI Buffer Counter */
296#define	SXP_BUFFER		SXP_BLOCK+0x52	/* RW*: SCSI Buffer */
297#define	SXP_BUF_BYTE		SXP_BLOCK+0x54	/* RW*: SCSI Buffer Byte */
298#define	SXP_BUF_WORD		SXP_BLOCK+0x56	/* RW*: SCSI Buffer Word */
299#define	SXP_BUF_WORD_TRAN	SXP_BLOCK+0x58	/* RW*: SCSI Buffer Wd xlate */
300#define	SXP_FIFO		SXP_BLOCK+0x5A	/* RW*: SCSI FIFO */
301#define	SXP_FIFO_STATUS		SXP_BLOCK+0x5C	/* RW*: SCSI FIFO Status */
302#define	SXP_FIFO_TOP		SXP_BLOCK+0x5E	/* RW*: SCSI FIFO Top Resid */
303#define	SXP_FIFO_BOTTOM		SXP_BLOCK+0x60	/* RW*: SCSI FIFO Bot Resid */
304#define	SXP_TRAN_REG		SXP_BLOCK+0x64	/* RW*: SCSI Transferr Reg */
305#define	SXP_TRAN_COUNT_LO	SXP_BLOCK+0x68	/* RW*: SCSI Trans Count */
306#define	SXP_TRAN_COUNT_HI	SXP_BLOCK+0x6A	/* RW*: SCSI Trans Count */
307#define	SXP_TRAN_COUNTER_LO	SXP_BLOCK+0x6C	/* RW*: SCSI Trans Counter */
308#define	SXP_TRAN_COUNTER_HI	SXP_BLOCK+0x6E	/* RW*: SCSI Trans Counter */
309#define	SXP_ARB_DATA		SXP_BLOCK+0x70	/* R  : SCSI Arb Data */
310#define	SXP_PINS_CONTROL	SXP_BLOCK+0x72	/* RW*: SCSI Control Pins */
311#define	SXP_PINS_DATA		SXP_BLOCK+0x74	/* RW*: SCSI Data Pins */
312#define	SXP_PINS_DIFF		SXP_BLOCK+0x76	/* RW*: SCSI Diff Pins */
313
314
315/* SXP CONF1 REGISTER */
316#define	SXP_CONF1_ASYNCH_SETUP		0xF000	/* Asynchronous setup time */
317#define	SXP_CONF1_SELECTION_UNIT	0x0000	/* Selection time unit */
318#define	SXP_CONF1_SELECTION_TIMEOUT	0x0600	/* Selection timeout */
319#define	SXP_CONF1_CLOCK_FACTOR		0x00E0	/* Clock factor */
320#define	SXP_CONF1_SCSI_ID		0x000F	/* SCSI id */
321
322/* SXP CONF2 REGISTER */
323#define	SXP_CONF2_DISABLE_FILTER	0x0040	/* Disable SCSI rec filters */
324#define	SXP_CONF2_REQ_ACK_PULLUPS	0x0020	/* Enable req/ack pullups */
325#define	SXP_CONF2_DATA_PULLUPS		0x0010	/* Enable data pullups */
326#define	SXP_CONF2_CONFIG_AUTOLOAD	0x0008	/* Enable dev conf auto-load */
327#define	SXP_CONF2_RESELECT		0x0002	/* Enable reselection */
328#define	SXP_CONF2_SELECT		0x0001	/* Enable selection */
329
330/* SXP INTERRUPT REGISTER */
331#define	SXP_INT_PARITY_ERR		0x8000	/* Parity error detected */
332#define	SXP_INT_GROSS_ERR		0x4000	/* Gross error detected */
333#define	SXP_INT_FUNCTION_ABORT		0x2000	/* Last cmd aborted */
334#define	SXP_INT_CONDITION_FAILED	0x1000	/* Last cond failed test */
335#define	SXP_INT_FIFO_EMPTY		0x0800	/* SCSI FIFO is empty */
336#define	SXP_INT_BUF_COUNTER_ZERO	0x0400	/* SCSI buf count == zero */
337#define	SXP_INT_XFER_ZERO		0x0200	/* SCSI trans count == zero */
338#define	SXP_INT_INT_PENDING		0x0080	/* SXP interrupt pending */
339#define	SXP_INT_CMD_RUNNING		0x0040	/* SXP is running a command */
340#define	SXP_INT_INT_RETURN_CODE		0x000F	/* Interrupt return code */
341
342
343/* SXP GROSS ERROR REGISTER */
344#define	SXP_GROSS_OFFSET_RESID		0x0040	/* Req/Ack offset not zero */
345#define	SXP_GROSS_OFFSET_UNDERFLOW	0x0020	/* Req/Ack offset underflow */
346#define	SXP_GROSS_OFFSET_OVERFLOW	0x0010	/* Req/Ack offset overflow */
347#define	SXP_GROSS_FIFO_UNDERFLOW	0x0008	/* SCSI FIFO underflow */
348#define	SXP_GROSS_FIFO_OVERFLOW		0x0004	/* SCSI FIFO overflow */
349#define	SXP_GROSS_WRITE_ERR		0x0002	/* SXP and RISC wrote to reg */
350#define	SXP_GROSS_ILLEGAL_INST		0x0001	/* Bad inst loaded into SXP */
351
352/* SXP EXCEPTION REGISTER */
353#define	SXP_EXCEPT_USER_0		0x8000	/* Enable user exception #0 */
354#define	SXP_EXCEPT_USER_1		0x4000	/* Enable user exception #1 */
355#define	PCI_SXP_EXCEPT_SCAM		0x0400	/* SCAM Selection enable */
356#define	SXP_EXCEPT_BUS_FREE		0x0200	/* Enable Bus Free det */
357#define	SXP_EXCEPT_TARGET_ATN		0x0100	/* Enable TGT mode atten det */
358#define	SXP_EXCEPT_RESELECTED		0x0080	/* Enable ReSEL exc handling */
359#define	SXP_EXCEPT_SELECTED		0x0040	/* Enable SEL exc handling */
360#define	SXP_EXCEPT_ARBITRATION		0x0020	/* Enable ARB exc handling */
361#define	SXP_EXCEPT_GROSS_ERR		0x0010	/* Enable gross error except */
362#define	SXP_EXCEPT_BUS_RESET		0x0008	/* Enable Bus Reset except */
363
364	/* SXP OVERRIDE REGISTER */
365#define	SXP_ORIDE_EXT_TRIGGER		0x8000	/* Enable external trigger */
366#define	SXP_ORIDE_STEP			0x4000	/* Enable single step mode */
367#define	SXP_ORIDE_BREAKPOINT		0x2000	/* Enable breakpoint reg */
368#define	SXP_ORIDE_PIN_WRITE		0x1000	/* Enable write to SCSI pins */
369#define	SXP_ORIDE_FORCE_OUTPUTS		0x0800	/* Force SCSI outputs on */
370#define	SXP_ORIDE_LOOPBACK		0x0400	/* Enable SCSI loopback mode */
371#define	SXP_ORIDE_PARITY_TEST		0x0200	/* Enable parity test mode */
372#define	SXP_ORIDE_TRISTATE_ENA_PINS	0x0100	/* Tristate SCSI enable pins */
373#define	SXP_ORIDE_TRISTATE_PINS		0x0080	/* Tristate SCSI pins */
374#define	SXP_ORIDE_FIFO_RESET		0x0008	/* Reset SCSI FIFO */
375#define	SXP_ORIDE_CMD_TERMINATE		0x0004	/* Terminate cur SXP com */
376#define	SXP_ORIDE_RESET_REG		0x0002	/* Reset SXP registers */
377#define	SXP_ORIDE_RESET_MODULE		0x0001	/* Reset SXP module */
378
379/* SXP COMMANDS */
380#define	SXP_RESET_BUS_CMD		0x300b
381
382/* SXP SCSI ID REGISTER */
383#define	SXP_SELECTING_ID		0x0F00	/* (Re)Selecting id */
384#define	SXP_SELECT_ID			0x000F	/* Select id */
385
386/* SXP DEV CONFIG1 REGISTER */
387#define	SXP_DCONF1_SYNC_HOLD		0x7000	/* Synchronous data hold */
388#define	SXP_DCONF1_SYNC_SETUP		0x0F00	/* Synchronous data setup */
389#define	SXP_DCONF1_SYNC_OFFSET		0x000F	/* Synchronous data offset */
390
391
392/* SXP DEV CONFIG2 REGISTER */
393#define	SXP_DCONF2_FLAGS_MASK		0xF000	/* Device flags */
394#define	SXP_DCONF2_WIDE			0x0400	/* Enable wide SCSI */
395#define	SXP_DCONF2_PARITY		0x0200	/* Enable parity checking */
396#define	SXP_DCONF2_BLOCK_MODE		0x0100	/* Enable blk mode xfr count */
397#define	SXP_DCONF2_ASSERTION_MASK	0x0007	/* Assersion period mask */
398
399
400/* SXP PHASE POINTER REGISTER */
401#define	SXP_PHASE_STATUS_PTR		0x1000	/* Status buffer offset */
402#define	SXP_PHASE_MSG_IN_PTR		0x0700	/* Msg in buffer offset */
403#define	SXP_PHASE_COM_PTR		0x00F0	/* Command buffer offset */
404#define	SXP_PHASE_MSG_OUT_PTR		0x0007	/* Msg out buffer offset */
405
406
407/* SXP FIFO STATUS REGISTER */
408#define	SXP_FIFO_TOP_RESID		0x8000	/* Top residue reg full */
409#define	SXP_FIFO_ACK_RESID		0x4000	/* Wide transfers odd resid */
410#define	SXP_FIFO_COUNT_MASK		0x001C	/* Words in SXP FIFO */
411#define	SXP_FIFO_BOTTOM_RESID		0x0001	/* Bottom residue reg full */
412
413
414/* SXP CONTROL PINS REGISTER */
415#define	SXP_PINS_CON_PHASE		0x8000	/* Scsi phase valid */
416#define	SXP_PINS_CON_PARITY_HI		0x0400	/* Parity pin */
417#define	SXP_PINS_CON_PARITY_LO		0x0200	/* Parity pin */
418#define	SXP_PINS_CON_REQ		0x0100	/* SCSI bus REQUEST */
419#define	SXP_PINS_CON_ACK		0x0080	/* SCSI bus ACKNOWLEDGE */
420#define	SXP_PINS_CON_RST		0x0040	/* SCSI bus RESET */
421#define	SXP_PINS_CON_BSY		0x0020	/* SCSI bus BUSY */
422#define	SXP_PINS_CON_SEL		0x0010	/* SCSI bus SELECT */
423#define	SXP_PINS_CON_ATN		0x0008	/* SCSI bus ATTENTION */
424#define	SXP_PINS_CON_MSG		0x0004	/* SCSI bus MESSAGE */
425#define	SXP_PINS_CON_CD 		0x0002	/* SCSI bus COMMAND */
426#define	SXP_PINS_CON_IO 		0x0001	/* SCSI bus INPUT */
427
428/*
429 * Set the hold time for the SCSI Bus Reset to be 250 ms
430 */
431#define	SXP_SCSI_BUS_RESET_HOLD_TIME	250
432
433/* SXP DIFF PINS REGISTER */
434#define	SXP_PINS_DIFF_SENSE		0x0200	/* DIFFSENS sig on SCSI bus */
435#define	SXP_PINS_DIFF_MODE		0x0100	/* DIFFM signal */
436#define	SXP_PINS_DIFF_ENABLE_OUTPUT	0x0080	/* Enable SXP SCSI data drv */
437#define	SXP_PINS_DIFF_PINS_MASK		0x007C	/* Differential control pins */
438#define	SXP_PINS_DIFF_TARGET		0x0002	/* Enable SXP target mode */
439#define	SXP_PINS_DIFF_INITIATOR		0x0001	/* Enable SXP initiator mode */
440
441/*
442 * RISC and Host Command and Control Block Register Offsets
443 */
444#define	RISC_BLOCK	0x0800
445
446#define	RISC_ACC	RISC_BLOCK+0x0	/* RW*: Accumulator */
447#define	RISC_R1		RISC_BLOCK+0x2	/* RW*: GP Reg R1  */
448#define	RISC_R2		RISC_BLOCK+0x4	/* RW*: GP Reg R2  */
449#define	RISC_R3		RISC_BLOCK+0x6	/* RW*: GP Reg R3  */
450#define	RISC_R4		RISC_BLOCK+0x8	/* RW*: GP Reg R4  */
451#define	RISC_R5		RISC_BLOCK+0xA	/* RW*: GP Reg R5  */
452#define	RISC_R6		RISC_BLOCK+0xC	/* RW*: GP Reg R6  */
453#define	RISC_R7		RISC_BLOCK+0xE	/* RW*: GP Reg R7  */
454#define	RISC_R8		RISC_BLOCK+0x10	/* RW*: GP Reg R8  */
455#define	RISC_R9		RISC_BLOCK+0x12	/* RW*: GP Reg R9  */
456#define	RISC_R10	RISC_BLOCK+0x14	/* RW*: GP Reg R10 */
457#define	RISC_R11	RISC_BLOCK+0x16	/* RW*: GP Reg R11 */
458#define	RISC_R12	RISC_BLOCK+0x18	/* RW*: GP Reg R12 */
459#define	RISC_R13	RISC_BLOCK+0x1a	/* RW*: GP Reg R13 */
460#define	RISC_R14	RISC_BLOCK+0x1c	/* RW*: GP Reg R14 */
461#define	RISC_R15	RISC_BLOCK+0x1e	/* RW*: GP Reg R15 */
462#define	RISC_PSR	RISC_BLOCK+0x20	/* RW*: Processor Status */
463#define	RISC_IVR	RISC_BLOCK+0x22	/* RW*: Interrupt Vector */
464#define	RISC_PCR	RISC_BLOCK+0x24	/* RW*: Processor Ctrl */
465#define	RISC_RAR0	RISC_BLOCK+0x26	/* RW*: Ram Address #0 */
466#define	RISC_RAR1	RISC_BLOCK+0x28	/* RW*: Ram Address #1 */
467#define	RISC_LCR	RISC_BLOCK+0x2a	/* RW*: Loop Counter */
468#define	RISC_PC		RISC_BLOCK+0x2c	/* R  : Program Counter */
469#define	RISC_MTR	RISC_BLOCK+0x2e	/* RW*: Memory Timing */
470#define	RISC_EMB	RISC_BLOCK+0x30	/* RW*: Ext Mem Boundary */
471#define	RISC_SP		RISC_BLOCK+0x32	/* RW*: Stack Pointer */
472#define	RISC_HRL	RISC_BLOCK+0x3e	/* R *: Hardware Rev Level */
473#define	HCCR		RISC_BLOCK+0x40	/* RW : Host Command & Ctrl */
474#define	BP0		RISC_BLOCK+0x42	/* RW : Processor Brkpt #0 */
475#define	BP1		RISC_BLOCK+0x44	/* RW : Processor Brkpt #1 */
476#define	TCR		RISC_BLOCK+0x46	/*  W : Test Control */
477#define	TMR		RISC_BLOCK+0x48	/*  W : Test Mode */
478
479
480/* PROCESSOR STATUS REGISTER */
481#define	RISC_PSR_FORCE_TRUE		0x8000
482#define	RISC_PSR_LOOP_COUNT_DONE	0x4000
483#define	RISC_PSR_RISC_INT		0x2000
484#define	RISC_PSR_TIMER_ROLLOVER		0x1000
485#define	RISC_PSR_ALU_OVERFLOW		0x0800
486#define	RISC_PSR_ALU_MSB		0x0400
487#define	RISC_PSR_ALU_CARRY		0x0200
488#define	RISC_PSR_ALU_ZERO		0x0100
489#define	RISC_PSR_DMA_INT		0x0010
490#define	RISC_PSR_SXP_INT		0x0008
491#define	RISC_PSR_HOST_INT		0x0004
492#define	RISC_PSR_INT_PENDING		0x0002
493#define	RISC_PSR_FORCE_FALSE  		0x0001
494
495
496/* Host Command and Control */
497#define	HCCR_CMD_NOP			0x0000	/* NOP */
498#define	HCCR_CMD_RESET			0x1000	/* Reset RISC */
499#define	HCCR_CMD_PAUSE			0x2000	/* Pause RISC */
500#define	HCCR_CMD_RELEASE		0x3000	/* Release Paused RISC */
501#define	HCCR_CMD_STEP			0x4000	/* Single Step RISC */
502#define	HCCR_CMD_SET_HOST_INT		0x5000	/* Set Host Interrupt */
503#define	HCCR_CMD_CLEAR_HOST_INT		0x6000	/* Clear Host Interrupt */
504#define	HCCR_CMD_CLEAR_RISC_INT		0x7000	/* Clear RISC interrupt */
505#define	HCCR_CMD_BREAKPOINT		0x8000	/* Change breakpoint enables */
506#define	PCI_HCCR_CMD_BIOS		0x9000	/* Write BIOS (disable) */
507#define	PCI_HCCR_CMD_PARITY		0xA000	/* Write parity enable */
508#define	PCI_HCCR_CMD_PARITY_ERR		0xE000	/* Generate parity error */
509#define	HCCR_CMD_TEST_MODE		0xF000	/* Set Test Mode */
510
511#define	PCI_HCCR_PARITY			0x0400	/* Parity error flag */
512#define	PCI_HCCR_PARITY_ENABLE_1	0x0200	/* Parity enable bank 1 */
513#define	PCI_HCCR_PARITY_ENABLE_0	0x0100	/* Parity enable bank 0 */
514
515#define	HCCR_HOST_INT			0x0080	/* R  : Host interrupt set */
516#define	HCCR_RESET			0x0040	/* R  : reset in progress */
517#define	HCCR_PAUSE			0x0020	/* R  : RISC paused */
518
519#define	PCI_HCCR_BIOS			0x0001	/*  W : BIOS enable */
520#endif	/* _ISPREG_H */
521