1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 #define SILI_PCI_BAR_GLOBAL 0x10
21 #define SILI_PCI_BAR_PORT 0x18
22 #define SILI_PCI_BAR_INDIRECT 0x20
23
24
25 #define SILI_REG_PORT0_STATUS 0x00
26 #define SILI_REG_PORT1_STATUS 0x04
27 #define SILI_REG_PORT2_STATUS 0x08
28 #define SILI_REG_PORT3_STATUS 0x0c
29 #define SILI_REG_GC 0x40
30 #define SILI_REG_GC_GR (1<<31)
31 #define SILI_REG_GC_MSIACK (1<<30)
32 #define SILI_REG_GC_I2CINT (1<<29)
33 #define SILI_REG_GC_PERRDIS (1<<28)
34 #define SILI_REG_GC_REQ64 (1<<20)
35 #define SILI_REG_GC_DEVSEL (1<<19)
36 #define SILI_REG_GC_STOP (1<<18)
37 #define SILI_REG_GC_TRDY (1<<17)
38 #define SILI_REG_GC_M66EN (1<<16)
39 #define SILI_REG_GC_PIE_MASK 0x0f
40 #define SILI_FMT_GC "\020" "\040GR" "\037MSIACK" "\036I2CINT" \
41 "\035PERRDIS" "\025REQ64" "\024DEVSEL" \
42 "\023STOP" "\022TRDY" "\021M66EN" \
43 "\004P3IE" "\003P2IE" "\002P1IE" "\001P0IE"
44 #define SILI_REG_GIS 0x44
45 #define SILI_REG_GIS_I2C (1 << 29)
46 #define SILI_REG_GIS_PIS_MASK 0x0f
47 #define SILI_REG_PHYCONF 0x48
48 #define SILI_REG_BISTCTL 0x50
49 #define SILI_REG_BISTPATTERN 0x54
50 #define SILI_REG_BISTSTAT 0x58
51 #define SILI_REG_FLASHADDR 0x70
52 #define SILI_REG_FLASHDATA 0x74
53 #define SILI_REG_GPIOCTL SILI_REG_FLASHDATA
54 #define SILI_REG_IICADDR 0x78
55 #define SILI_REG_IIC 0x7c
56
57 #define SILI_PORT_SIZE 0x2000
58 #define SILI_PORT_OFFSET(_p) ((_p) * SILI_PORT_SIZE)
59
60
61 #define SILI_PREG_LRAM 0x0000
62 #define SILI_PREG_SLOT_WIDTH 0x80
63 #define SILI_PREG_SLOT(_s) (SILI_PREG_LRAM + (_s) * SILI_PREG_SLOT_WIDTH)
64 #define SILI_PREG_RX_COUNT(_s) (SILI_PREG_SLOT(_s) + 0x04)
65 #define SILI_PREG_SIG_HI(_s) (SILI_PREG_SLOT(_s) + 0x0c)
66 #define SILI_PREG_SIG_HI_SHIFT 8
67 #define SILI_PREG_SIG_LO(_s) (SILI_PREG_SLOT(_s) + 0x14)
68 #define SILI_PREG_SIG_LO_MASK 0xff
69
70 #define SILI_PREG_PCS 0x1000
71 #define SILI_PREG_PCS_PORTRDY (1<<31)
72 #define SILI_PREG_PCS_OOBB (1<<25)
73 #define SILI_PREG_PCS_ACTIVE(_x) (((_x)>>16) & 0x1f)
74 #define SILI_PREG_PCS_LED_ON (1<<15)
75 #define SILI_PREG_PCS_AIA (1<<14)
76 #define SILI_PREG_PCS_PMEN (1<<13)
77 #define SILI_PREG_PCS_IA (1<<12)
78 #define SILI_PREG_PCS_IR (1<<11)
79 #define SILI_PREG_PCS_A32B (1<<10)
80 #define SILI_PREG_PCS_SD (1<<9)
81 #define SILI_PREG_PCS_CD (1<<8)
82 #define SILI_PREG_PCS_TB (1<<7)
83 #define SILI_PREG_PCS_RESUME (1<<6)
84 #define SILI_PREG_PCS_PLEN (1<<5)
85 #define SILI_PREG_PCS_LEDDISABLE (1<<4)
86 #define SILI_PREG_PCS_NOINTCLR (1<<3)
87 #define SILI_PREG_PCS_PORTINIT (1<<2)
88 #define SILI_PREG_PCS_DEVRESET (1<<1)
89 #define SILI_PREG_PCS_PORTRESET (1<<0)
90 #define SILI_PFMT_PCS "\020" "\032OOBB" "\020LED_ON" "\017AIA" \
91 "\016PMEN" "\015IA" "\014IR" "\013A32B" \
92 "\012SD" "\011CD" "\010TB" "\007RESUME" \
93 "\006PLEN" "\005LEDDISABLE" \
94 "\004NOINTCLR" "\003PORTINIT" \
95 "\002PORTINIT" "\001PORTRESET"
96 #define SILI_PREG_PCC 0x1004
97 #define SILI_PREG_PCC_OOBB (1<<25)
98 #define SILI_PREG_PCC_LED_ON (1<<15)
99 #define SILI_PREG_PCC_AIA (1<<14)
100 #define SILI_PREG_PCC_PMEN (1<<13)
101 #define SILI_PREG_PCC_IA (1<<12)
102 #define SILI_PREG_PCC_IR (1<<11)
103 #define SILI_PREG_PCC_A32B (1<<10)
104 #define SILI_PREG_PCC_SD (1<<9)
105 #define SILI_PREG_PCC_CD (1<<8)
106 #define SILI_PREG_PCC_TB (1<<7)
107 #define SILI_PREG_PCC_RESUME (1<<6)
108 #define SILI_PREG_PCC_PLEN (1<<5)
109 #define SILI_PREG_PCC_LEDDISABLE (1<<4)
110 #define SILI_PREG_PCC_NOINTCLR (1<<3)
111 #define SILI_PREG_PCC_PORTINIT (1<<2)
112 #define SILI_PREG_PCC_DEVRESET (1<<1)
113 #define SILI_PREG_PCC_PORTRESET (1<<0)
114 #define SILI_PREG_IS 0x1008
115 #define SILI_PREG_IS_SDB (1<<11)
116 #define SILI_PREG_IS_HANDSHAKE (1<<10)
117 #define SILI_PREG_IS_CRC (1<<9)
118 #define SILI_PREG_IS_DEC (1<<8)
119 #define SILI_PREG_IS_DEVXCHG (1<<7)
120 #define SILI_PREG_IS_UNRECFIS (1<<6)
121 #define SILI_PREG_IS_COMWAKE (1<<5)
122 #define SILI_PREG_IS_PHYRDYCHG (1<<4)
123 #define SILI_PREG_IS_PMCHG (1<<3)
124 #define SILI_PREG_IS_PORTRDY (1<<2)
125 #define SILI_PREG_IS_CMDERR (1<<1)
126 #define SILI_PREG_IS_CMDCOMP (1<<0)
127 #define SILI_PFMT_IS "\020" "\014SDB" "\013HANDSHAKE" \
128 "\012CRC" "\011DECODE" \
129 "\010DEVXCHG" "\007UNRECFIS" \
130 "\006COMWAKE" "\005PHYRDYCHG" \
131 "\004PMCHG" "\003PORTRDY" \
132 "\002CMDERR" "\001CMDCOMP"
133 #define SILI_PREG_IES 0x1010
134 #define SILI_PREG_IEC 0x1014
135 #define SILI_PREG_IE_SDB (1<<11)
136 #define SILI_PREG_IE_DEVXCHG (1<<7)
137 #define SILI_PREG_IE_UNRECFIS (1<<6)
138 #define SILI_PREG_IE_COMWAKE (1<<5)
139 #define SILI_PREG_IE_PHYRDYCHG (1<<4)
140 #define SILI_PREG_IE_PMCHG (1<<3)
141 #define SILI_PREG_IE_PORTRDY (1<<2)
142 #define SILI_PREG_IE_CMDERR (1<<1)
143 #define SILI_PREG_IE_CMDCOMP (1<<0)
144 #define SILI_PREG_IE_ALL 0x08ff
145 #define SILI_PREG_AUA 0x101c
146 #define SILI_PREG_FIFO 0x1020
147 #define SILI_PREG_CE 0x1024
148 #define SILI_PREG_CE_DEVICEERROR 1
149 #define SILI_PREG_CE_SDBERROR 2
150 #define SILI_PREG_CE_DATAFISERROR 3
151 #define SILI_PREG_FC 0x1028
152 #define SILI_PREG_RFT 0x102c
153 #define SILI_PREG_DEC 0x1040
154 #define SILI_PREG_CEC 0x1044
155 #define SILI_PREG_HEC 0x1048
156 #define SILI_PREG_PHYCONF 0x1050
157 #define SILI_PREG_PSS 0x1800
158 #define SILI_PREG_PSS_ATTENTION (1 << 31)
159 #define SILI_PREG_PSS_ALL_SLOTS 0x7fffffff
160 #define SILI_PREG_CAR_LO(_s) (0x1c00 + ((_s) * 0x8))
161 #define SILI_PREG_CAR_HI(_s) (0x1c00 + ((_s) * 0x8) + 0x4)
162 #define SILI_PREG_CONTEXT 0x1e0f
163 #define SILI_PREG_SCTL 0x1f00
164 #define SILI_PREG_SSTS 0x1f04
165 #define SILI_PREG_SERR 0x1f08
166 #define SILI_PREG_SACT 0x1f0c
167
168
169 struct sili_sge {
170 u_int32_t addr_lo;
171 u_int32_t addr_hi;
172 u_int32_t data_count;
173 u_int32_t flags;
174 #define SILI_SGE_TRM (1<<31)
175 #define SILI_SGE_LNK (1<<30)
176 #define SILI_SGE_DRD (1<<29)
177 #define SILI_SGE_XCF (1<<28)
178 } __packed;
179
180 #define SILI_SGT_SGLLEN 4
181
182 struct sili_sgt {
183 struct sili_sge sgl[SILI_SGT_SGLLEN];
184 } __packed;
185
186 #define SILI_PRB_PROTOCOL_OVERRIDE (1<<0)
187 #define SILI_PRB_RETRANSMIT (1<<1)
188 #define SILI_PRB_EXTERNAL_COMMAND (1<<2)
189 #define SILI_PRB_RECEIVE (1<<3)
190 #define SILI_PRB_PACKET_READ (1<<4)
191 #define SILI_PRB_PACKET_WRITE (1<<5)
192 #define SILI_PRB_INTERRUPT_MASK (1<<6)
193 #define SILI_PRB_SOFT_RESET (1<<7)
194
195 struct sili_prb {
196 u_int16_t control;
197 u_int16_t reserved1;
198 u_int32_t reserved2;
199
200 u_int8_t fis[ATA_FIS_LENGTH];
201
202 u_int32_t reserved3[9];
203 } __packed;
204
205 struct sili_prb_ata {
206 u_int16_t control;
207 u_int16_t protocol_override;
208 u_int32_t rx_count;
209
210 u_int8_t fis[ATA_FIS_LENGTH];
211
212 u_int32_t reserved;
213
214 struct sili_sge sgl[2];
215 } __packed;
216
217 struct sili_prb_packet {
218 u_int16_t control;
219 u_int16_t protocol_override;
220 u_int32_t rx_count;
221
222 u_int8_t fis[ATA_FIS_LENGTH];
223
224 u_int32_t reserved;
225
226 u_int8_t cdb[16];
227
228 struct sili_sge sgl[1];
229 } __packed;
230
231 struct sili_prb_softreset {
232 u_int16_t control;
233 u_int16_t reserved1;
234 u_int32_t reserved2;
235
236 u_int8_t fis[ATA_FIS_LENGTH];
237
238 u_int32_t reserved3[9];
239 } __packed;
240
241 #define SILI_MAX_CMDS 31
242 #define SILI_PRB_LENGTH 64
243 #define SILI_PRB_ALIGN 8
244 #define SILI_SGT_LENGTH 64