1 /* socal.h: Definitions for Sparc SUNW,socal (SOC+) Fibre Channel Sbus driver.
3 * Copyright (C) 1998,1999 Jakub Jelinek (jj@ultra.linux.cz)
13 /* Hardware register offsets and constants first {{{ */
22 #define SOCAL_CFG_EXT_RAM_BANK_MASK 0x07000000
23 #define SOCAL_CFG_EEPROM_BANK_MASK 0x00030000
24 #define SOCAL_CFG_BURST64_MASK 0x00000700
25 #define SOCAL_CFG_SBUS_PARITY_TEST 0x00000020
26 #define SOCAL_CFG_SBUS_PARITY_CHECK 0x00000010
27 #define SOCAL_CFG_SBUS_ENHANCED 0x00000008
28 #define SOCAL_CFG_BURST_MASK 0x00000007
30 #define SOCAL_CFG_BURST_4 0x00000000
31 #define SOCAL_CFG_BURST_8 0x00000003
32 #define SOCAL_CFG_BURST_16 0x00000004
33 #define SOCAL_CFG_BURST_32 0x00000005
34 #define SOCAL_CFG_BURST_64 0x00000006
35 #define SOCAL_CFG_BURST_128 0x00000007
37 /* Slave Access Error Register */
38 #define SOCAL_SAE_ALIGNMENT 0x00000004
39 #define SOCAL_SAE_UNSUPPORTED 0x00000002
40 #define SOCAL_SAE_PARITY 0x00000001
42 /* Command & Status Register */
43 #define SOCAL_CMD_RSP_QALL 0x000f0000
44 #define SOCAL_CMD_RSP_Q0 0x00010000
45 #define SOCAL_CMD_RSP_Q1 0x00020000
46 #define SOCAL_CMD_RSP_Q2 0x00040000
47 #define SOCAL_CMD_RSP_Q3 0x00080000
48 #define SOCAL_CMD_REQ_QALL 0x00000f00
49 #define SOCAL_CMD_REQ_Q0 0x00000100
50 #define SOCAL_CMD_REQ_Q1 0x00000200
51 #define SOCAL_CMD_REQ_Q2 0x00000400
52 #define SOCAL_CMD_REQ_Q3 0x00000800
53 #define SOCAL_CMD_SAE 0x00000080
54 #define SOCAL_CMD_INTR_PENDING 0x00000008
55 #define SOCAL_CMD_NON_QUEUED 0x00000004
56 #define SOCAL_CMD_IDLE 0x00000002
57 #define SOCAL_CMD_SOFT_RESET 0x00000001
59 /* Interrupt Mask Register */
60 #define SOCAL_IMASK_RSP_QALL 0x000f0000
61 #define SOCAL_IMASK_RSP_Q0 0x00010000
62 #define SOCAL_IMASK_RSP_Q1 0x00020000
63 #define SOCAL_IMASK_RSP_Q2 0x00040000
64 #define SOCAL_IMASK_RSP_Q3 0x00080000
65 #define SOCAL_IMASK_REQ_QALL 0x00000f00
66 #define SOCAL_IMASK_REQ_Q0 0x00000100
67 #define SOCAL_IMASK_REQ_Q1 0x00000200
68 #define SOCAL_IMASK_REQ_Q2 0x00000400
69 #define SOCAL_IMASK_REQ_Q3 0x00000800
70 #define SOCAL_IMASK_SAE 0x00000080
71 #define SOCAL_IMASK_NON_QUEUED 0x00000004
73 #define SOCAL_INTR(s, cmd) \
74 (((cmd & SOCAL_CMD_RSP_QALL) | ((~cmd) & SOCAL_CMD_REQ_QALL)) \
77 #define SOCAL_SETIMASK(s, i) \
78 do { (s)->imask = (i); \
79 sbus_writel((i), (s)->regs + IMASK); \
82 #define SOCAL_MAX_EXCHANGES 1024
86 * This is a 64KB register area.
87 * From the documentation, it seems like it is finally able to cope
88 * at least with 1,2,4 byte accesses for read and 2,4 byte accesses for write.
93 #define SOCAL_CQ_REQ_OFFSET 0x200
94 #define SOCAL_CQ_RSP_OFFSET 0x220
104 #define SOCAL_PORT_A 0x0000 /* From/To Port A */
105 #define SOCAL_PORT_B 0x0001 /* From/To Port A */
106 #define SOCAL_FC_HDR 0x0002 /* Contains FC Header */
107 #define SOCAL_NORSP 0x0004 /* Don't generate response nor interrupt */
108 #define SOCAL_NOINT 0x0008 /* Generate response but not interrupt */
109 #define SOCAL_XFERRDY 0x0010 /* Generate XFERRDY */
110 #define SOCAL_IGNOREPARAM 0x0020 /* Ignore PARAM field in the FC header */
111 #define SOCAL_COMPLETE 0x0040 /* Command completed */
112 #define SOCAL_UNSOLICITED 0x0080 /* For request this is the packet to establish unsolicited pools, */
113 /* for rsp this is unsolicited packet */
114 #define SOCAL_STATUS 0x0100 /* State change (on/off line) */
115 #define SOCAL_RSP_HDR 0x0200 /* Return frame header in any case */
130 #define SOCAL_CQTYPE_NOP 0x00
131 #define SOCAL_CQTYPE_OUTBOUND 0x01
132 #define SOCAL_CQTYPE_INBOUND 0x02
133 #define SOCAL_CQTYPE_SIMPLE 0x03
134 #define SOCAL_CQTYPE_IO_WRITE 0x04
135 #define SOCAL_CQTYPE_IO_READ 0x05
136 #define SOCAL_CQTYPE_UNSOLICITED 0x06
137 #define SOCAL_CQTYPE_BYPASS_DEV 0x06
138 #define SOCAL_CQTYPE_DIAG 0x07
139 #define SOCAL_CQTYPE_OFFLINE 0x08
140 #define SOCAL_CQTYPE_ADD_POOL 0x09
141 #define SOCAL_CQTYPE_DELETE_POOL 0x0a
142 #define SOCAL_CQTYPE_ADD_BUFFER 0x0b
143 #define SOCAL_CQTYPE_ADD_POOL_BUFFER 0x0c
144 #define SOCAL_CQTYPE_REQUEST_ABORT 0x0d
145 #define SOCAL_CQTYPE_REQUEST_LIP 0x0e
146 #define SOCAL_CQTYPE_REPORT_MAP 0x0f
147 #define SOCAL_CQTYPE_RESPONSE 0x10
148 #define SOCAL_CQTYPE_INLINE 0x20
150 #define SOCAL_CQFLAGS_CONT 0x01
151 #define SOCAL_CQFLAGS_FULL 0x02
152 #define SOCAL_CQFLAGS_BADHDR 0x04
153 #define SOCAL_CQFLAGS_BADPKT 0x08
166 #define SOCAL_P_RJT 2
167 #define SOCAL_F_RJT 3
168 #define SOCAL_P_BSY 4
169 #define SOCAL_F_BSY 5
170 #define SOCAL_ONLINE 0x10
171 #define SOCAL_OFFLINE 0x11
172 #define SOCAL_TIMEOUT 0x12
173 #define SOCAL_OVERRUN 0x13
174 #define SOCAL_ONLINE_LOOP 0x14
175 #define SOCAL_OLD_PORT 0x15
176 #define SOCAL_AL_PORT 0x16
177 #define SOCAL_UNKOWN_CQ_TYPE 0x20
178 #define SOCAL_BAD_SEG_CNT 0x21
179 #define SOCAL_MAX_XCHG_EXCEEDED 0x22
180 #define SOCAL_BAD_XID 0x23
181 #define SOCAL_XCHG_BUSY 0x24
182 #define SOCAL_BAD_POOL_ID 0x25
183 #define SOCAL_INSUFFICIENT_CQES 0x26
184 #define SOCAL_ALLOC_FAIL 0x27
185 #define SOCAL_BAD_SID 0x28
186 #define SOCAL_NO_SEG_INIT 0x29
187 #define SOCAL_BAD_DID 0x2a
188 #define SOCAL_ABORTED 0x30
189 #define SOCAL_ABORT_FAILED 0x31
213 #define SOCAL_DIAG_NOP 0x00
214 #define SOCAL_DIAG_INT_LOOP 0x01
215 #define SOCAL_DIAG_EXT_LOOP 0x02
216 #define SOCAL_DIAG_REM_LOOP 0x03
217 #define SOCAL_DIAG_XRAM_TEST 0x04
218 #define SOCAL_DIAG_SOC_TEST 0x05
219 #define SOCAL_DIAG_HCB_TEST 0x06
220 #define SOCAL_DIAG_SOCLB_TEST 0x07
221 #define SOCAL_DIAG_SRDSLB_TEST 0x08
222 #define SOCAL_DIAG_EXTOE_TEST 0x09
234 #define SOCAL_POOL_MASK_RCTL 0x800000
235 #define SOCAL_POOL_MASK_DID 0x700000
236 #define SOCAL_POOL_MASK_SID 0x070000
237 #define SOCAL_POOL_MASK_TYPE 0x008000
238 #define SOCAL_POOL_MASK_F_CTL 0x007000
239 #define SOCAL_POOL_MASK_SEQ_ID 0x000800
240 #define SOCAL_POOL_MASK_D_CTL 0x000400
241 #define SOCAL_POOL_MASK_SEQ_CNT 0x000300
242 #define SOCAL_POOL_MASK_OX_ID 0x0000f0
243 #define SOCAL_POOL_MASK_PARAM 0x00000f
261 /* Now our software structures and constants we use to drive the beast {{{ */
263 #define SOCAL_CQ_REQ0_SIZE 4
264 #define SOCAL_CQ_REQ1_SIZE 256
265 #define SOCAL_CQ_RSP0_SIZE 8
266 #define SOCAL_CQ_RSP1_SIZE 4
267 #define SOCAL_CQ_RSP2_SIZE 4
269 #define SOCAL_SOLICITED_RSP_Q 0
270 #define SOCAL_SOLICITED_BAD_RSP_Q 1
271 #define SOCAL_UNSOLICITED_RSP_Q 2
276 /* This must come first */
284 socal_hw_cq __iomem *hw_cq; /* Related XRAM cq */
294 socal_port port[2]; /* Every SOCAL has one or two FC ports */
295 socal_cq req[4]; /* Request CQs */
296 socal_cq rsp[4]; /* Response CQs */
300 void __iomem *eeprom;
302 u32 imask; /* Our copy of regs->imask */
303 u32 cfg; /* Our copy of regs->cfg */
304 char serv_params[80];
306 int curr_port; /* Which port will have priority to fcp_queue_empty */
314 #endif /* !(__SOCAL_H) */