diff options
author | Arvind Bhushan <arvindb@chelsio.com> | 2013-03-14 01:09:08 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-03-14 11:36:00 -0400 |
commit | 7cc163806b0dc31ea2067d48a2732b452a709f48 (patch) | |
tree | 8211ed0286b901937b89fc01b0c3284d36659d93 /drivers/scsi/csiostor/csio_hw.c | |
parent | d69630e8a42220b04318995d8ed0637ea79a717e (diff) |
csiostor: Cleanup chip specific operations.
This patch removes chip specific operations from the common hardware
paths, as well as the Makefile change to accomodate the new files.
Signed-off-by: Arvind Bhushan <arvindb@chelsio.com>
Signed-off-by: Naresh Kumar Inna <naresh@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/scsi/csiostor/csio_hw.c')
-rw-r--r-- | drivers/scsi/csiostor/csio_hw.c | 559 |
1 files changed, 119 insertions, 440 deletions
diff --git a/drivers/scsi/csiostor/csio_hw.c b/drivers/scsi/csiostor/csio_hw.c index bdd78fb4fc70..a0b4c8991deb 100644 --- a/drivers/scsi/csiostor/csio_hw.c +++ b/drivers/scsi/csiostor/csio_hw.c | |||
@@ -61,7 +61,7 @@ int csio_msi = 2; | |||
61 | static int dev_num; | 61 | static int dev_num; |
62 | 62 | ||
63 | /* FCoE Adapter types & its description */ | 63 | /* FCoE Adapter types & its description */ |
64 | static const struct csio_adap_desc csio_fcoe_adapters[] = { | 64 | static const struct csio_adap_desc csio_t4_fcoe_adapters[] = { |
65 | {"T440-Dbg 10G", "Chelsio T440-Dbg 10G [FCoE]"}, | 65 | {"T440-Dbg 10G", "Chelsio T440-Dbg 10G [FCoE]"}, |
66 | {"T420-CR 10G", "Chelsio T420-CR 10G [FCoE]"}, | 66 | {"T420-CR 10G", "Chelsio T420-CR 10G [FCoE]"}, |
67 | {"T422-CR 10G/1G", "Chelsio T422-CR 10G/1G [FCoE]"}, | 67 | {"T422-CR 10G/1G", "Chelsio T422-CR 10G/1G [FCoE]"}, |
@@ -77,7 +77,38 @@ static const struct csio_adap_desc csio_fcoe_adapters[] = { | |||
77 | {"B404-BT 1G", "Chelsio B404-BT 1G [FCoE]"}, | 77 | {"B404-BT 1G", "Chelsio B404-BT 1G [FCoE]"}, |
78 | {"T480-CR 10G", "Chelsio T480-CR 10G [FCoE]"}, | 78 | {"T480-CR 10G", "Chelsio T480-CR 10G [FCoE]"}, |
79 | {"T440-LP-CR 10G", "Chelsio T440-LP-CR 10G [FCoE]"}, | 79 | {"T440-LP-CR 10G", "Chelsio T440-LP-CR 10G [FCoE]"}, |
80 | {"T4 FPGA", "Chelsio T4 FPGA [FCoE]"} | 80 | {"AMSTERDAM 10G", "Chelsio AMSTERDAM 10G [FCoE]"}, |
81 | {"HUAWEI T480 10G", "Chelsio HUAWEI T480 10G [FCoE]"}, | ||
82 | {"HUAWEI T440 10G", "Chelsio HUAWEI T440 10G [FCoE]"}, | ||
83 | {"HUAWEI STG 10G", "Chelsio HUAWEI STG 10G [FCoE]"}, | ||
84 | {"ACROMAG XAUI 10G", "Chelsio ACROMAG XAUI 10G [FCoE]"}, | ||
85 | {"ACROMAG SFP+ 10G", "Chelsio ACROMAG SFP+ 10G [FCoE]"}, | ||
86 | {"QUANTA SFP+ 10G", "Chelsio QUANTA SFP+ 10G [FCoE]"}, | ||
87 | {"HUAWEI 10Gbase-T", "Chelsio HUAWEI 10Gbase-T [FCoE]"}, | ||
88 | {"HUAWEI T4TOE 10G", "Chelsio HUAWEI T4TOE 10G [FCoE]"} | ||
89 | }; | ||
90 | |||
91 | static const struct csio_adap_desc csio_t5_fcoe_adapters[] = { | ||
92 | {"T580-Dbg 10G", "Chelsio T580-Dbg 10G [FCoE]"}, | ||
93 | {"T520-CR 10G", "Chelsio T520-CR 10G [FCoE]"}, | ||
94 | {"T522-CR 10G/1G", "Chelsio T452-CR 10G/1G [FCoE]"}, | ||
95 | {"T540-CR 10G", "Chelsio T540-CR 10G [FCoE]"}, | ||
96 | {"T520-BCH 10G", "Chelsio T520-BCH 10G [FCoE]"}, | ||
97 | {"T540-BCH 10G", "Chelsio T540-BCH 10G [FCoE]"}, | ||
98 | {"T540-CH 10G", "Chelsio T540-CH 10G [FCoE]"}, | ||
99 | {"T520-SO 10G", "Chelsio T520-SO 10G [FCoE]"}, | ||
100 | {"T520-CX4 10G", "Chelsio T520-CX4 10G [FCoE]"}, | ||
101 | {"T520-BT 10G", "Chelsio T520-BT 10G [FCoE]"}, | ||
102 | {"T504-BT 1G", "Chelsio T504-BT 1G [FCoE]"}, | ||
103 | {"B520-SR 10G", "Chelsio B520-SR 10G [FCoE]"}, | ||
104 | {"B504-BT 1G", "Chelsio B504-BT 1G [FCoE]"}, | ||
105 | {"T580-CR 10G", "Chelsio T580-CR 10G [FCoE]"}, | ||
106 | {"T540-LP-CR 10G", "Chelsio T540-LP-CR 10G [FCoE]"}, | ||
107 | {"AMSTERDAM 10G", "Chelsio AMSTERDAM 10G [FCoE]"}, | ||
108 | {"T580-LP-CR 40G", "Chelsio T580-LP-CR 40G [FCoE]"}, | ||
109 | {"T520-LL-CR 10G", "Chelsio T520-LL-CR 10G [FCoE]"}, | ||
110 | {"T560-CR 40G", "Chelsio T560-CR 40G [FCoE]"}, | ||
111 | {"T580-CR 40G", "Chelsio T580-CR 40G [FCoE]"} | ||
81 | }; | 112 | }; |
82 | 113 | ||
83 | static void csio_mgmtm_cleanup(struct csio_mgmtm *); | 114 | static void csio_mgmtm_cleanup(struct csio_mgmtm *); |
@@ -124,7 +155,7 @@ int csio_is_hw_removing(struct csio_hw *hw) | |||
124 | * at the time it indicated completion is stored there. Returns 0 if the | 155 | * at the time it indicated completion is stored there. Returns 0 if the |
125 | * operation completes and -EAGAIN otherwise. | 156 | * operation completes and -EAGAIN otherwise. |
126 | */ | 157 | */ |
127 | static int | 158 | int |
128 | csio_hw_wait_op_done_val(struct csio_hw *hw, int reg, uint32_t mask, | 159 | csio_hw_wait_op_done_val(struct csio_hw *hw, int reg, uint32_t mask, |
129 | int polarity, int attempts, int delay, uint32_t *valp) | 160 | int polarity, int attempts, int delay, uint32_t *valp) |
130 | { | 161 | { |
@@ -145,6 +176,24 @@ csio_hw_wait_op_done_val(struct csio_hw *hw, int reg, uint32_t mask, | |||
145 | } | 176 | } |
146 | } | 177 | } |
147 | 178 | ||
179 | /* | ||
180 | * csio_hw_tp_wr_bits_indirect - set/clear bits in an indirect TP register | ||
181 | * @hw: the adapter | ||
182 | * @addr: the indirect TP register address | ||
183 | * @mask: specifies the field within the register to modify | ||
184 | * @val: new value for the field | ||
185 | * | ||
186 | * Sets a field of an indirect TP register to the given value. | ||
187 | */ | ||
188 | void | ||
189 | csio_hw_tp_wr_bits_indirect(struct csio_hw *hw, unsigned int addr, | ||
190 | unsigned int mask, unsigned int val) | ||
191 | { | ||
192 | csio_wr_reg32(hw, addr, TP_PIO_ADDR); | ||
193 | val |= csio_rd_reg32(hw, TP_PIO_DATA) & ~mask; | ||
194 | csio_wr_reg32(hw, val, TP_PIO_DATA); | ||
195 | } | ||
196 | |||
148 | void | 197 | void |
149 | csio_set_reg_field(struct csio_hw *hw, uint32_t reg, uint32_t mask, | 198 | csio_set_reg_field(struct csio_hw *hw, uint32_t reg, uint32_t mask, |
150 | uint32_t value) | 199 | uint32_t value) |
@@ -157,242 +206,22 @@ csio_set_reg_field(struct csio_hw *hw, uint32_t reg, uint32_t mask, | |||
157 | 206 | ||
158 | } | 207 | } |
159 | 208 | ||
160 | /* | ||
161 | * csio_hw_mc_read - read from MC through backdoor accesses | ||
162 | * @hw: the hw module | ||
163 | * @addr: address of first byte requested | ||
164 | * @data: 64 bytes of data containing the requested address | ||
165 | * @ecc: where to store the corresponding 64-bit ECC word | ||
166 | * | ||
167 | * Read 64 bytes of data from MC starting at a 64-byte-aligned address | ||
168 | * that covers the requested address @addr. If @parity is not %NULL it | ||
169 | * is assigned the 64-bit ECC word for the read data. | ||
170 | */ | ||
171 | int | ||
172 | csio_hw_mc_read(struct csio_hw *hw, uint32_t addr, __be32 *data, | ||
173 | uint64_t *ecc) | ||
174 | { | ||
175 | int i; | ||
176 | |||
177 | if (csio_rd_reg32(hw, MC_BIST_CMD) & START_BIST) | ||
178 | return -EBUSY; | ||
179 | csio_wr_reg32(hw, addr & ~0x3fU, MC_BIST_CMD_ADDR); | ||
180 | csio_wr_reg32(hw, 64, MC_BIST_CMD_LEN); | ||
181 | csio_wr_reg32(hw, 0xc, MC_BIST_DATA_PATTERN); | ||
182 | csio_wr_reg32(hw, BIST_OPCODE(1) | START_BIST | BIST_CMD_GAP(1), | ||
183 | MC_BIST_CMD); | ||
184 | i = csio_hw_wait_op_done_val(hw, MC_BIST_CMD, START_BIST, | ||
185 | 0, 10, 1, NULL); | ||
186 | if (i) | ||
187 | return i; | ||
188 | |||
189 | #define MC_DATA(i) MC_BIST_STATUS_REG(MC_BIST_STATUS_RDATA, i) | ||
190 | |||
191 | for (i = 15; i >= 0; i--) | ||
192 | *data++ = htonl(csio_rd_reg32(hw, MC_DATA(i))); | ||
193 | if (ecc) | ||
194 | *ecc = csio_rd_reg64(hw, MC_DATA(16)); | ||
195 | #undef MC_DATA | ||
196 | return 0; | ||
197 | } | ||
198 | |||
199 | /* | ||
200 | * csio_hw_edc_read - read from EDC through backdoor accesses | ||
201 | * @hw: the hw module | ||
202 | * @idx: which EDC to access | ||
203 | * @addr: address of first byte requested | ||
204 | * @data: 64 bytes of data containing the requested address | ||
205 | * @ecc: where to store the corresponding 64-bit ECC word | ||
206 | * | ||
207 | * Read 64 bytes of data from EDC starting at a 64-byte-aligned address | ||
208 | * that covers the requested address @addr. If @parity is not %NULL it | ||
209 | * is assigned the 64-bit ECC word for the read data. | ||
210 | */ | ||
211 | int | ||
212 | csio_hw_edc_read(struct csio_hw *hw, int idx, uint32_t addr, __be32 *data, | ||
213 | uint64_t *ecc) | ||
214 | { | ||
215 | int i; | ||
216 | |||
217 | idx *= EDC_STRIDE; | ||
218 | if (csio_rd_reg32(hw, EDC_BIST_CMD + idx) & START_BIST) | ||
219 | return -EBUSY; | ||
220 | csio_wr_reg32(hw, addr & ~0x3fU, EDC_BIST_CMD_ADDR + idx); | ||
221 | csio_wr_reg32(hw, 64, EDC_BIST_CMD_LEN + idx); | ||
222 | csio_wr_reg32(hw, 0xc, EDC_BIST_DATA_PATTERN + idx); | ||
223 | csio_wr_reg32(hw, BIST_OPCODE(1) | BIST_CMD_GAP(1) | START_BIST, | ||
224 | EDC_BIST_CMD + idx); | ||
225 | i = csio_hw_wait_op_done_val(hw, EDC_BIST_CMD + idx, START_BIST, | ||
226 | 0, 10, 1, NULL); | ||
227 | if (i) | ||
228 | return i; | ||
229 | |||
230 | #define EDC_DATA(i) (EDC_BIST_STATUS_REG(EDC_BIST_STATUS_RDATA, i) + idx) | ||
231 | |||
232 | for (i = 15; i >= 0; i--) | ||
233 | *data++ = htonl(csio_rd_reg32(hw, EDC_DATA(i))); | ||
234 | if (ecc) | ||
235 | *ecc = csio_rd_reg64(hw, EDC_DATA(16)); | ||
236 | #undef EDC_DATA | ||
237 | return 0; | ||
238 | } | ||
239 | |||
240 | /* | ||
241 | * csio_mem_win_rw - read/write memory through PCIE memory window | ||
242 | * @hw: the adapter | ||
243 | * @addr: address of first byte requested | ||
244 | * @data: MEMWIN0_APERTURE bytes of data containing the requested address | ||
245 | * @dir: direction of transfer 1 => read, 0 => write | ||
246 | * | ||
247 | * Read/write MEMWIN0_APERTURE bytes of data from MC starting at a | ||
248 | * MEMWIN0_APERTURE-byte-aligned address that covers the requested | ||
249 | * address @addr. | ||
250 | */ | ||
251 | static int | ||
252 | csio_mem_win_rw(struct csio_hw *hw, u32 addr, u32 *data, int dir) | ||
253 | { | ||
254 | int i; | ||
255 | |||
256 | /* | ||
257 | * Setup offset into PCIE memory window. Address must be a | ||
258 | * MEMWIN0_APERTURE-byte-aligned address. (Read back MA register to | ||
259 | * ensure that changes propagate before we attempt to use the new | ||
260 | * values.) | ||
261 | */ | ||
262 | csio_wr_reg32(hw, addr & ~(MEMWIN0_APERTURE - 1), | ||
263 | PCIE_MEM_ACCESS_OFFSET); | ||
264 | csio_rd_reg32(hw, PCIE_MEM_ACCESS_OFFSET); | ||
265 | |||
266 | /* Collecting data 4 bytes at a time upto MEMWIN0_APERTURE */ | ||
267 | for (i = 0; i < MEMWIN0_APERTURE; i = i + sizeof(__be32)) { | ||
268 | if (dir) | ||
269 | *data++ = csio_rd_reg32(hw, (MEMWIN0_BASE + i)); | ||
270 | else | ||
271 | csio_wr_reg32(hw, *data++, (MEMWIN0_BASE + i)); | ||
272 | } | ||
273 | |||
274 | return 0; | ||
275 | } | ||
276 | |||
277 | /* | ||
278 | * csio_memory_rw - read/write EDC 0, EDC 1 or MC via PCIE memory window | ||
279 | * @hw: the csio_hw | ||
280 | * @mtype: memory type: MEM_EDC0, MEM_EDC1 or MEM_MC | ||
281 | * @addr: address within indicated memory type | ||
282 | * @len: amount of memory to transfer | ||
283 | * @buf: host memory buffer | ||
284 | * @dir: direction of transfer 1 => read, 0 => write | ||
285 | * | ||
286 | * Reads/writes an [almost] arbitrary memory region in the firmware: the | ||
287 | * firmware memory address, length and host buffer must be aligned on | ||
288 | * 32-bit boudaries. The memory is transferred as a raw byte sequence | ||
289 | * from/to the firmware's memory. If this memory contains data | ||
290 | * structures which contain multi-byte integers, it's the callers | ||
291 | * responsibility to perform appropriate byte order conversions. | ||
292 | */ | ||
293 | static int | ||
294 | csio_memory_rw(struct csio_hw *hw, int mtype, u32 addr, u32 len, | ||
295 | uint32_t *buf, int dir) | ||
296 | { | ||
297 | uint32_t pos, start, end, offset, memoffset; | ||
298 | int ret; | ||
299 | uint32_t *data; | ||
300 | |||
301 | /* | ||
302 | * Argument sanity checks ... | ||
303 | */ | ||
304 | if ((addr & 0x3) || (len & 0x3)) | ||
305 | return -EINVAL; | ||
306 | |||
307 | data = kzalloc(MEMWIN0_APERTURE, GFP_KERNEL); | ||
308 | if (!data) | ||
309 | return -ENOMEM; | ||
310 | |||
311 | /* Offset into the region of memory which is being accessed | ||
312 | * MEM_EDC0 = 0 | ||
313 | * MEM_EDC1 = 1 | ||
314 | * MEM_MC = 2 | ||
315 | */ | ||
316 | memoffset = (mtype * (5 * 1024 * 1024)); | ||
317 | |||
318 | /* Determine the PCIE_MEM_ACCESS_OFFSET */ | ||
319 | addr = addr + memoffset; | ||
320 | |||
321 | /* | ||
322 | * The underlaying EDC/MC read routines read MEMWIN0_APERTURE bytes | ||
323 | * at a time so we need to round down the start and round up the end. | ||
324 | * We'll start copying out of the first line at (addr - start) a word | ||
325 | * at a time. | ||
326 | */ | ||
327 | start = addr & ~(MEMWIN0_APERTURE-1); | ||
328 | end = (addr + len + MEMWIN0_APERTURE-1) & ~(MEMWIN0_APERTURE-1); | ||
329 | offset = (addr - start)/sizeof(__be32); | ||
330 | |||
331 | for (pos = start; pos < end; pos += MEMWIN0_APERTURE, offset = 0) { | ||
332 | /* | ||
333 | * If we're writing, copy the data from the caller's memory | ||
334 | * buffer | ||
335 | */ | ||
336 | if (!dir) { | ||
337 | /* | ||
338 | * If we're doing a partial write, then we need to do | ||
339 | * a read-modify-write ... | ||
340 | */ | ||
341 | if (offset || len < MEMWIN0_APERTURE) { | ||
342 | ret = csio_mem_win_rw(hw, pos, data, 1); | ||
343 | if (ret) { | ||
344 | kfree(data); | ||
345 | return ret; | ||
346 | } | ||
347 | } | ||
348 | while (offset < (MEMWIN0_APERTURE/sizeof(__be32)) && | ||
349 | len > 0) { | ||
350 | data[offset++] = *buf++; | ||
351 | len -= sizeof(__be32); | ||
352 | } | ||
353 | } | ||
354 | |||
355 | /* | ||
356 | * Transfer a block of memory and bail if there's an error. | ||
357 | */ | ||
358 | ret = csio_mem_win_rw(hw, pos, data, dir); | ||
359 | if (ret) { | ||
360 | kfree(data); | ||
361 | return ret; | ||
362 | } | ||
363 | |||
364 | /* | ||
365 | * If we're reading, copy the data into the caller's memory | ||
366 | * buffer. | ||
367 | */ | ||
368 | if (dir) | ||
369 | while (offset < (MEMWIN0_APERTURE/sizeof(__be32)) && | ||
370 | len > 0) { | ||
371 | *buf++ = data[offset++]; | ||
372 | len -= sizeof(__be32); | ||
373 | } | ||
374 | } | ||
375 | |||
376 | kfree(data); | ||
377 | |||
378 | return 0; | ||
379 | } | ||
380 | |||
381 | static int | 209 | static int |
382 | csio_memory_write(struct csio_hw *hw, int mtype, u32 addr, u32 len, u32 *buf) | 210 | csio_memory_write(struct csio_hw *hw, int mtype, u32 addr, u32 len, u32 *buf) |
383 | { | 211 | { |
384 | return csio_memory_rw(hw, mtype, addr, len, buf, 0); | 212 | return hw->chip_ops->chip_memory_rw(hw, MEMWIN_CSIOSTOR, mtype, |
213 | addr, len, buf, 0); | ||
385 | } | 214 | } |
386 | 215 | ||
387 | /* | 216 | /* |
388 | * EEPROM reads take a few tens of us while writes can take a bit over 5 ms. | 217 | * EEPROM reads take a few tens of us while writes can take a bit over 5 ms. |
389 | */ | 218 | */ |
390 | #define EEPROM_MAX_RD_POLL 40 | 219 | #define EEPROM_MAX_RD_POLL 40 |
391 | #define EEPROM_MAX_WR_POLL 6 | 220 | #define EEPROM_MAX_WR_POLL 6 |
392 | #define EEPROM_STAT_ADDR 0x7bfc | 221 | #define EEPROM_STAT_ADDR 0x7bfc |
393 | #define VPD_BASE 0x400 | 222 | #define VPD_BASE 0x400 |
394 | #define VPD_BASE_OLD 0 | 223 | #define VPD_BASE_OLD 0 |
395 | #define VPD_LEN 512 | 224 | #define VPD_LEN 1024 |
396 | #define VPD_INFO_FLD_HDR_SIZE 3 | 225 | #define VPD_INFO_FLD_HDR_SIZE 3 |
397 | 226 | ||
398 | /* | 227 | /* |
@@ -817,23 +646,6 @@ out: | |||
817 | return 0; | 646 | return 0; |
818 | } | 647 | } |
819 | 648 | ||
820 | /* | ||
821 | * csio_hw_flash_cfg_addr - return the address of the flash | ||
822 | * configuration file | ||
823 | * @hw: the HW module | ||
824 | * | ||
825 | * Return the address within the flash where the Firmware Configuration | ||
826 | * File is stored. | ||
827 | */ | ||
828 | static unsigned int | ||
829 | csio_hw_flash_cfg_addr(struct csio_hw *hw) | ||
830 | { | ||
831 | if (hw->params.sf_size == 0x100000) | ||
832 | return FPGA_FLASH_CFG_OFFSET; | ||
833 | else | ||
834 | return FLASH_CFG_OFFSET; | ||
835 | } | ||
836 | |||
837 | static void | 649 | static void |
838 | csio_hw_print_fw_version(struct csio_hw *hw, char *str) | 650 | csio_hw_print_fw_version(struct csio_hw *hw, char *str) |
839 | { | 651 | { |
@@ -898,13 +710,13 @@ csio_hw_check_fw_version(struct csio_hw *hw) | |||
898 | minor = FW_HDR_FW_VER_MINOR_GET(hw->fwrev); | 710 | minor = FW_HDR_FW_VER_MINOR_GET(hw->fwrev); |
899 | micro = FW_HDR_FW_VER_MICRO_GET(hw->fwrev); | 711 | micro = FW_HDR_FW_VER_MICRO_GET(hw->fwrev); |
900 | 712 | ||
901 | if (major != FW_VERSION_MAJOR) { /* major mismatch - fail */ | 713 | if (major != FW_VERSION_MAJOR(hw)) { /* major mismatch - fail */ |
902 | csio_err(hw, "card FW has major version %u, driver wants %u\n", | 714 | csio_err(hw, "card FW has major version %u, driver wants %u\n", |
903 | major, FW_VERSION_MAJOR); | 715 | major, FW_VERSION_MAJOR(hw)); |
904 | return -EINVAL; | 716 | return -EINVAL; |
905 | } | 717 | } |
906 | 718 | ||
907 | if (minor == FW_VERSION_MINOR && micro == FW_VERSION_MICRO) | 719 | if (minor == FW_VERSION_MINOR(hw) && micro == FW_VERSION_MICRO(hw)) |
908 | return 0; /* perfect match */ | 720 | return 0; /* perfect match */ |
909 | 721 | ||
910 | /* Minor/micro version mismatch */ | 722 | /* Minor/micro version mismatch */ |
@@ -1044,7 +856,7 @@ static void | |||
1044 | csio_set_pcie_completion_timeout(struct csio_hw *hw, u8 range) | 856 | csio_set_pcie_completion_timeout(struct csio_hw *hw, u8 range) |
1045 | { | 857 | { |
1046 | uint16_t val; | 858 | uint16_t val; |
1047 | uint32_t pcie_cap; | 859 | int pcie_cap; |
1048 | 860 | ||
1049 | if (!csio_pci_capability(hw->pdev, PCI_CAP_ID_EXP, &pcie_cap)) { | 861 | if (!csio_pci_capability(hw->pdev, PCI_CAP_ID_EXP, &pcie_cap)) { |
1050 | pci_read_config_word(hw->pdev, | 862 | pci_read_config_word(hw->pdev, |
@@ -1056,84 +868,6 @@ csio_set_pcie_completion_timeout(struct csio_hw *hw, u8 range) | |||
1056 | } | 868 | } |
1057 | } | 869 | } |
1058 | 870 | ||
1059 | |||
1060 | /* | ||
1061 | * Return the specified PCI-E Configuration Space register from our Physical | ||
1062 | * Function. We try first via a Firmware LDST Command since we prefer to let | ||
1063 | * the firmware own all of these registers, but if that fails we go for it | ||
1064 | * directly ourselves. | ||
1065 | */ | ||
1066 | static uint32_t | ||
1067 | csio_read_pcie_cfg4(struct csio_hw *hw, int reg) | ||
1068 | { | ||
1069 | u32 val = 0; | ||
1070 | struct csio_mb *mbp; | ||
1071 | int rv; | ||
1072 | struct fw_ldst_cmd *ldst_cmd; | ||
1073 | |||
1074 | mbp = mempool_alloc(hw->mb_mempool, GFP_ATOMIC); | ||
1075 | if (!mbp) { | ||
1076 | CSIO_INC_STATS(hw, n_err_nomem); | ||
1077 | pci_read_config_dword(hw->pdev, reg, &val); | ||
1078 | return val; | ||
1079 | } | ||
1080 | |||
1081 | csio_mb_ldst(hw, mbp, CSIO_MB_DEFAULT_TMO, reg); | ||
1082 | |||
1083 | rv = csio_mb_issue(hw, mbp); | ||
1084 | |||
1085 | /* | ||
1086 | * If the LDST Command suucceeded, exctract the returned register | ||
1087 | * value. Otherwise read it directly ourself. | ||
1088 | */ | ||
1089 | if (rv == 0) { | ||
1090 | ldst_cmd = (struct fw_ldst_cmd *)(mbp->mb); | ||
1091 | val = ntohl(ldst_cmd->u.pcie.data[0]); | ||
1092 | } else | ||
1093 | pci_read_config_dword(hw->pdev, reg, &val); | ||
1094 | |||
1095 | mempool_free(mbp, hw->mb_mempool); | ||
1096 | |||
1097 | return val; | ||
1098 | } /* csio_read_pcie_cfg4 */ | ||
1099 | |||
1100 | static int | ||
1101 | csio_hw_set_mem_win(struct csio_hw *hw) | ||
1102 | { | ||
1103 | u32 bar0; | ||
1104 | |||
1105 | /* | ||
1106 | * Truncation intentional: we only read the bottom 32-bits of the | ||
1107 | * 64-bit BAR0/BAR1 ... We use the hardware backdoor mechanism to | ||
1108 | * read BAR0 instead of using pci_resource_start() because we could be | ||
1109 | * operating from within a Virtual Machine which is trapping our | ||
1110 | * accesses to our Configuration Space and we need to set up the PCI-E | ||
1111 | * Memory Window decoders with the actual addresses which will be | ||
1112 | * coming across the PCI-E link. | ||
1113 | */ | ||
1114 | bar0 = csio_read_pcie_cfg4(hw, PCI_BASE_ADDRESS_0); | ||
1115 | bar0 &= PCI_BASE_ADDRESS_MEM_MASK; | ||
1116 | |||
1117 | /* | ||
1118 | * Set up memory window for accessing adapter memory ranges. (Read | ||
1119 | * back MA register to ensure that changes propagate before we attempt | ||
1120 | * to use the new values.) | ||
1121 | */ | ||
1122 | csio_wr_reg32(hw, (bar0 + MEMWIN0_BASE) | BIR(0) | | ||
1123 | WINDOW(ilog2(MEMWIN0_APERTURE) - 10), | ||
1124 | PCIE_MEM_ACCESS_REG(PCIE_MEM_ACCESS_BASE_WIN, 0)); | ||
1125 | csio_wr_reg32(hw, (bar0 + MEMWIN1_BASE) | BIR(0) | | ||
1126 | WINDOW(ilog2(MEMWIN1_APERTURE) - 10), | ||
1127 | PCIE_MEM_ACCESS_REG(PCIE_MEM_ACCESS_BASE_WIN, 1)); | ||
1128 | csio_wr_reg32(hw, (bar0 + MEMWIN2_BASE) | BIR(0) | | ||
1129 | WINDOW(ilog2(MEMWIN2_APERTURE) - 10), | ||
1130 | PCIE_MEM_ACCESS_REG(PCIE_MEM_ACCESS_BASE_WIN, 2)); | ||
1131 | csio_rd_reg32(hw, PCIE_MEM_ACCESS_REG(PCIE_MEM_ACCESS_BASE_WIN, 2)); | ||
1132 | return 0; | ||
1133 | } /* csio_hw_set_mem_win */ | ||
1134 | |||
1135 | |||
1136 | |||
1137 | /*****************************************************************************/ | 871 | /*****************************************************************************/ |
1138 | /* HW State machine assists */ | 872 | /* HW State machine assists */ |
1139 | /*****************************************************************************/ | 873 | /*****************************************************************************/ |
@@ -1234,7 +968,9 @@ retry: | |||
1234 | for (;;) { | 968 | for (;;) { |
1235 | uint32_t pcie_fw; | 969 | uint32_t pcie_fw; |
1236 | 970 | ||
971 | spin_unlock_irq(&hw->lock); | ||
1237 | msleep(50); | 972 | msleep(50); |
973 | spin_lock_irq(&hw->lock); | ||
1238 | waiting -= 50; | 974 | waiting -= 50; |
1239 | 975 | ||
1240 | /* | 976 | /* |
@@ -2121,9 +1857,9 @@ csio_hw_flash_config(struct csio_hw *hw, u32 *fw_cfg_param, char *path) | |||
2121 | uint32_t *cfg_data; | 1857 | uint32_t *cfg_data; |
2122 | int value_to_add = 0; | 1858 | int value_to_add = 0; |
2123 | 1859 | ||
2124 | if (request_firmware(&cf, CSIO_CF_FNAME, dev) < 0) { | 1860 | if (request_firmware(&cf, CSIO_CF_FNAME(hw), dev) < 0) { |
2125 | csio_err(hw, "could not find config file " CSIO_CF_FNAME | 1861 | csio_err(hw, "could not find config file %s, err: %d\n", |
2126 | ",err: %d\n", ret); | 1862 | CSIO_CF_FNAME(hw), ret); |
2127 | return -ENOENT; | 1863 | return -ENOENT; |
2128 | } | 1864 | } |
2129 | 1865 | ||
@@ -2147,9 +1883,24 @@ csio_hw_flash_config(struct csio_hw *hw, u32 *fw_cfg_param, char *path) | |||
2147 | 1883 | ||
2148 | ret = csio_memory_write(hw, mtype, maddr, | 1884 | ret = csio_memory_write(hw, mtype, maddr, |
2149 | cf->size + value_to_add, cfg_data); | 1885 | cf->size + value_to_add, cfg_data); |
1886 | |||
1887 | if ((ret == 0) && (value_to_add != 0)) { | ||
1888 | union { | ||
1889 | u32 word; | ||
1890 | char buf[4]; | ||
1891 | } last; | ||
1892 | size_t size = cf->size & ~0x3; | ||
1893 | int i; | ||
1894 | |||
1895 | last.word = cfg_data[size >> 2]; | ||
1896 | for (i = value_to_add; i < 4; i++) | ||
1897 | last.buf[i] = 0; | ||
1898 | ret = csio_memory_write(hw, mtype, maddr + size, 4, &last.word); | ||
1899 | } | ||
2150 | if (ret == 0) { | 1900 | if (ret == 0) { |
2151 | csio_info(hw, "config file upgraded to " CSIO_CF_FNAME "\n"); | 1901 | csio_info(hw, "config file upgraded to %s\n", |
2152 | strncpy(path, "/lib/firmware/" CSIO_CF_FNAME, 64); | 1902 | CSIO_CF_FNAME(hw)); |
1903 | snprintf(path, 64, "%s%s", "/lib/firmware/", CSIO_CF_FNAME(hw)); | ||
2153 | } | 1904 | } |
2154 | 1905 | ||
2155 | leave: | 1906 | leave: |
@@ -2179,7 +1930,7 @@ csio_hw_use_fwconfig(struct csio_hw *hw, int reset, u32 *fw_cfg_param) | |||
2179 | { | 1930 | { |
2180 | unsigned int mtype, maddr; | 1931 | unsigned int mtype, maddr; |
2181 | int rv; | 1932 | int rv; |
2182 | uint32_t finiver, finicsum, cfcsum; | 1933 | uint32_t finiver = 0, finicsum = 0, cfcsum = 0; |
2183 | int using_flash; | 1934 | int using_flash; |
2184 | char path[64]; | 1935 | char path[64]; |
2185 | 1936 | ||
@@ -2207,7 +1958,7 @@ csio_hw_use_fwconfig(struct csio_hw *hw, int reset, u32 *fw_cfg_param) | |||
2207 | * config file from flash. | 1958 | * config file from flash. |
2208 | */ | 1959 | */ |
2209 | mtype = FW_MEMTYPE_CF_FLASH; | 1960 | mtype = FW_MEMTYPE_CF_FLASH; |
2210 | maddr = csio_hw_flash_cfg_addr(hw); | 1961 | maddr = hw->chip_ops->chip_flash_cfg_addr(hw); |
2211 | using_flash = 1; | 1962 | using_flash = 1; |
2212 | } else { | 1963 | } else { |
2213 | /* | 1964 | /* |
@@ -2346,30 +2097,32 @@ csio_hw_flash_fw(struct csio_hw *hw) | |||
2346 | struct pci_dev *pci_dev = hw->pdev; | 2097 | struct pci_dev *pci_dev = hw->pdev; |
2347 | struct device *dev = &pci_dev->dev ; | 2098 | struct device *dev = &pci_dev->dev ; |
2348 | 2099 | ||
2349 | if (request_firmware(&fw, CSIO_FW_FNAME, dev) < 0) { | 2100 | if (request_firmware(&fw, CSIO_FW_FNAME(hw), dev) < 0) { |
2350 | csio_err(hw, "could not find firmware image " CSIO_FW_FNAME | 2101 | csio_err(hw, "could not find firmware image %s, err: %d\n", |
2351 | ",err: %d\n", ret); | 2102 | CSIO_FW_FNAME(hw), ret); |
2352 | return -EINVAL; | 2103 | return -EINVAL; |
2353 | } | 2104 | } |
2354 | 2105 | ||
2355 | hdr = (const struct fw_hdr *)fw->data; | 2106 | hdr = (const struct fw_hdr *)fw->data; |
2356 | fw_ver = ntohl(hdr->fw_ver); | 2107 | fw_ver = ntohl(hdr->fw_ver); |
2357 | if (FW_HDR_FW_VER_MAJOR_GET(fw_ver) != FW_VERSION_MAJOR) | 2108 | if (FW_HDR_FW_VER_MAJOR_GET(fw_ver) != FW_VERSION_MAJOR(hw)) |
2358 | return -EINVAL; /* wrong major version, won't do */ | 2109 | return -EINVAL; /* wrong major version, won't do */ |
2359 | 2110 | ||
2360 | /* | 2111 | /* |
2361 | * If the flash FW is unusable or we found something newer, load it. | 2112 | * If the flash FW is unusable or we found something newer, load it. |
2362 | */ | 2113 | */ |
2363 | if (FW_HDR_FW_VER_MAJOR_GET(hw->fwrev) != FW_VERSION_MAJOR || | 2114 | if (FW_HDR_FW_VER_MAJOR_GET(hw->fwrev) != FW_VERSION_MAJOR(hw) || |
2364 | fw_ver > hw->fwrev) { | 2115 | fw_ver > hw->fwrev) { |
2365 | ret = csio_hw_fw_upgrade(hw, hw->pfn, fw->data, fw->size, | 2116 | ret = csio_hw_fw_upgrade(hw, hw->pfn, fw->data, fw->size, |
2366 | /*force=*/false); | 2117 | /*force=*/false); |
2367 | if (!ret) | 2118 | if (!ret) |
2368 | csio_info(hw, "firmware upgraded to version %pI4 from " | 2119 | csio_info(hw, |
2369 | CSIO_FW_FNAME "\n", &hdr->fw_ver); | 2120 | "firmware upgraded to version %pI4 from %s\n", |
2121 | &hdr->fw_ver, CSIO_FW_FNAME(hw)); | ||
2370 | else | 2122 | else |
2371 | csio_err(hw, "firmware upgrade failed! err=%d\n", ret); | 2123 | csio_err(hw, "firmware upgrade failed! err=%d\n", ret); |
2372 | } | 2124 | } else |
2125 | ret = -EINVAL; | ||
2373 | 2126 | ||
2374 | release_firmware(fw); | 2127 | release_firmware(fw); |
2375 | 2128 | ||
@@ -2410,7 +2163,7 @@ csio_hw_configure(struct csio_hw *hw) | |||
2410 | /* Set pci completion timeout value to 4 seconds. */ | 2163 | /* Set pci completion timeout value to 4 seconds. */ |
2411 | csio_set_pcie_completion_timeout(hw, 0xd); | 2164 | csio_set_pcie_completion_timeout(hw, 0xd); |
2412 | 2165 | ||
2413 | csio_hw_set_mem_win(hw); | 2166 | hw->chip_ops->chip_set_mem_win(hw, MEMWIN_CSIOSTOR); |
2414 | 2167 | ||
2415 | rv = csio_hw_get_fw_version(hw, &hw->fwrev); | 2168 | rv = csio_hw_get_fw_version(hw, &hw->fwrev); |
2416 | if (rv != 0) | 2169 | if (rv != 0) |
@@ -2478,6 +2231,8 @@ csio_hw_configure(struct csio_hw *hw) | |||
2478 | } else { | 2231 | } else { |
2479 | if (hw->fw_state == CSIO_DEV_STATE_INIT) { | 2232 | if (hw->fw_state == CSIO_DEV_STATE_INIT) { |
2480 | 2233 | ||
2234 | hw->flags |= CSIO_HWF_USING_SOFT_PARAMS; | ||
2235 | |||
2481 | /* device parameters */ | 2236 | /* device parameters */ |
2482 | rv = csio_get_device_params(hw); | 2237 | rv = csio_get_device_params(hw); |
2483 | if (rv != 0) | 2238 | if (rv != 0) |
@@ -2651,7 +2406,7 @@ csio_hw_intr_disable(struct csio_hw *hw) | |||
2651 | 2406 | ||
2652 | } | 2407 | } |
2653 | 2408 | ||
2654 | static void | 2409 | void |
2655 | csio_hw_fatal_err(struct csio_hw *hw) | 2410 | csio_hw_fatal_err(struct csio_hw *hw) |
2656 | { | 2411 | { |
2657 | csio_set_reg_field(hw, SGE_CONTROL, GLOBALENABLE, 0); | 2412 | csio_set_reg_field(hw, SGE_CONTROL, GLOBALENABLE, 0); |
@@ -2990,14 +2745,6 @@ csio_hws_pcierr(struct csio_hw *hw, enum csio_hw_ev evt) | |||
2990 | /* END: HW SM */ | 2745 | /* END: HW SM */ |
2991 | /*****************************************************************************/ | 2746 | /*****************************************************************************/ |
2992 | 2747 | ||
2993 | /* Slow path handlers */ | ||
2994 | struct intr_info { | ||
2995 | unsigned int mask; /* bits to check in interrupt status */ | ||
2996 | const char *msg; /* message to print or NULL */ | ||
2997 | short stat_idx; /* stat counter to increment or -1 */ | ||
2998 | unsigned short fatal; /* whether the condition reported is fatal */ | ||
2999 | }; | ||
3000 | |||
3001 | /* | 2748 | /* |
3002 | * csio_handle_intr_status - table driven interrupt handler | 2749 | * csio_handle_intr_status - table driven interrupt handler |
3003 | * @hw: HW instance | 2750 | * @hw: HW instance |
@@ -3011,7 +2758,7 @@ struct intr_info { | |||
3011 | * by an entry specifying mask 0. Returns the number of fatal interrupt | 2758 | * by an entry specifying mask 0. Returns the number of fatal interrupt |
3012 | * conditions. | 2759 | * conditions. |
3013 | */ | 2760 | */ |
3014 | static int | 2761 | int |
3015 | csio_handle_intr_status(struct csio_hw *hw, unsigned int reg, | 2762 | csio_handle_intr_status(struct csio_hw *hw, unsigned int reg, |
3016 | const struct intr_info *acts) | 2763 | const struct intr_info *acts) |
3017 | { | 2764 | { |
@@ -3038,80 +2785,6 @@ csio_handle_intr_status(struct csio_hw *hw, unsigned int reg, | |||
3038 | } | 2785 | } |
3039 | 2786 | ||
3040 | /* | 2787 | /* |
3041 | * Interrupt handler for the PCIE module. | ||
3042 | */ | ||
3043 | static void | ||
3044 | csio_pcie_intr_handler(struct csio_hw *hw) | ||
3045 | { | ||
3046 | static struct intr_info sysbus_intr_info[] = { | ||
3047 | { RNPP, "RXNP array parity error", -1, 1 }, | ||
3048 | { RPCP, "RXPC array parity error", -1, 1 }, | ||
3049 | { RCIP, "RXCIF array parity error", -1, 1 }, | ||
3050 | { RCCP, "Rx completions control array parity error", -1, 1 }, | ||
3051 | { RFTP, "RXFT array parity error", -1, 1 }, | ||
3052 | { 0, NULL, 0, 0 } | ||
3053 | }; | ||
3054 | static struct intr_info pcie_port_intr_info[] = { | ||
3055 | { TPCP, "TXPC array parity error", -1, 1 }, | ||
3056 | { TNPP, "TXNP array parity error", -1, 1 }, | ||
3057 | { TFTP, "TXFT array parity error", -1, 1 }, | ||
3058 | { TCAP, "TXCA array parity error", -1, 1 }, | ||
3059 | { TCIP, "TXCIF array parity error", -1, 1 }, | ||
3060 | { RCAP, "RXCA array parity error", -1, 1 }, | ||
3061 | { OTDD, "outbound request TLP discarded", -1, 1 }, | ||
3062 | { RDPE, "Rx data parity error", -1, 1 }, | ||
3063 | { TDUE, "Tx uncorrectable data error", -1, 1 }, | ||
3064 | { 0, NULL, 0, 0 } | ||
3065 | }; | ||
3066 | static struct intr_info pcie_intr_info[] = { | ||
3067 | { MSIADDRLPERR, "MSI AddrL parity error", -1, 1 }, | ||
3068 | { MSIADDRHPERR, "MSI AddrH parity error", -1, 1 }, | ||
3069 | { MSIDATAPERR, "MSI data parity error", -1, 1 }, | ||
3070 | { MSIXADDRLPERR, "MSI-X AddrL parity error", -1, 1 }, | ||
3071 | { MSIXADDRHPERR, "MSI-X AddrH parity error", -1, 1 }, | ||
3072 | { MSIXDATAPERR, "MSI-X data parity error", -1, 1 }, | ||
3073 | { MSIXDIPERR, "MSI-X DI parity error", -1, 1 }, | ||
3074 | { PIOCPLPERR, "PCI PIO completion FIFO parity error", -1, 1 }, | ||
3075 | { PIOREQPERR, "PCI PIO request FIFO parity error", -1, 1 }, | ||
3076 | { TARTAGPERR, "PCI PCI target tag FIFO parity error", -1, 1 }, | ||
3077 | { CCNTPERR, "PCI CMD channel count parity error", -1, 1 }, | ||
3078 | { CREQPERR, "PCI CMD channel request parity error", -1, 1 }, | ||
3079 | { CRSPPERR, "PCI CMD channel response parity error", -1, 1 }, | ||
3080 | { DCNTPERR, "PCI DMA channel count parity error", -1, 1 }, | ||
3081 | { DREQPERR, "PCI DMA channel request parity error", -1, 1 }, | ||
3082 | { DRSPPERR, "PCI DMA channel response parity error", -1, 1 }, | ||
3083 | { HCNTPERR, "PCI HMA channel count parity error", -1, 1 }, | ||
3084 | { HREQPERR, "PCI HMA channel request parity error", -1, 1 }, | ||
3085 | { HRSPPERR, "PCI HMA channel response parity error", -1, 1 }, | ||
3086 | { CFGSNPPERR, "PCI config snoop FIFO parity error", -1, 1 }, | ||
3087 | { FIDPERR, "PCI FID parity error", -1, 1 }, | ||
3088 | { INTXCLRPERR, "PCI INTx clear parity error", -1, 1 }, | ||
3089 | { MATAGPERR, "PCI MA tag parity error", -1, 1 }, | ||
3090 | { PIOTAGPERR, "PCI PIO tag parity error", -1, 1 }, | ||
3091 | { RXCPLPERR, "PCI Rx completion parity error", -1, 1 }, | ||
3092 | { RXWRPERR, "PCI Rx write parity error", -1, 1 }, | ||
3093 | { RPLPERR, "PCI replay buffer parity error", -1, 1 }, | ||
3094 | { PCIESINT, "PCI core secondary fault", -1, 1 }, | ||
3095 | { PCIEPINT, "PCI core primary fault", -1, 1 }, | ||
3096 | { UNXSPLCPLERR, "PCI unexpected split completion error", -1, | ||
3097 | 0 }, | ||
3098 | { 0, NULL, 0, 0 } | ||
3099 | }; | ||
3100 | |||
3101 | int fat; | ||
3102 | |||
3103 | fat = csio_handle_intr_status(hw, | ||
3104 | PCIE_CORE_UTL_SYSTEM_BUS_AGENT_STATUS, | ||
3105 | sysbus_intr_info) + | ||
3106 | csio_handle_intr_status(hw, | ||
3107 | PCIE_CORE_UTL_PCI_EXPRESS_PORT_STATUS, | ||
3108 | pcie_port_intr_info) + | ||
3109 | csio_handle_intr_status(hw, PCIE_INT_CAUSE, pcie_intr_info); | ||
3110 | if (fat) | ||
3111 | csio_hw_fatal_err(hw); | ||
3112 | } | ||
3113 | |||
3114 | /* | ||
3115 | * TP interrupt handler. | 2788 | * TP interrupt handler. |
3116 | */ | 2789 | */ |
3117 | static void csio_tp_intr_handler(struct csio_hw *hw) | 2790 | static void csio_tp_intr_handler(struct csio_hw *hw) |
@@ -3517,7 +3190,7 @@ static void csio_ncsi_intr_handler(struct csio_hw *hw) | |||
3517 | */ | 3190 | */ |
3518 | static void csio_xgmac_intr_handler(struct csio_hw *hw, int port) | 3191 | static void csio_xgmac_intr_handler(struct csio_hw *hw, int port) |
3519 | { | 3192 | { |
3520 | uint32_t v = csio_rd_reg32(hw, PORT_REG(port, XGMAC_PORT_INT_CAUSE)); | 3193 | uint32_t v = csio_rd_reg32(hw, CSIO_MAC_INT_CAUSE_REG(hw, port)); |
3521 | 3194 | ||
3522 | v &= TXFIFO_PRTY_ERR | RXFIFO_PRTY_ERR; | 3195 | v &= TXFIFO_PRTY_ERR | RXFIFO_PRTY_ERR; |
3523 | if (!v) | 3196 | if (!v) |
@@ -3527,7 +3200,7 @@ static void csio_xgmac_intr_handler(struct csio_hw *hw, int port) | |||
3527 | csio_fatal(hw, "XGMAC %d Tx FIFO parity error\n", port); | 3200 | csio_fatal(hw, "XGMAC %d Tx FIFO parity error\n", port); |
3528 | if (v & RXFIFO_PRTY_ERR) | 3201 | if (v & RXFIFO_PRTY_ERR) |
3529 | csio_fatal(hw, "XGMAC %d Rx FIFO parity error\n", port); | 3202 | csio_fatal(hw, "XGMAC %d Rx FIFO parity error\n", port); |
3530 | csio_wr_reg32(hw, v, PORT_REG(port, XGMAC_PORT_INT_CAUSE)); | 3203 | csio_wr_reg32(hw, v, CSIO_MAC_INT_CAUSE_REG(hw, port)); |
3531 | csio_hw_fatal_err(hw); | 3204 | csio_hw_fatal_err(hw); |
3532 | } | 3205 | } |
3533 | 3206 | ||
@@ -3596,7 +3269,7 @@ csio_hw_slow_intr_handler(struct csio_hw *hw) | |||
3596 | csio_xgmac_intr_handler(hw, 3); | 3269 | csio_xgmac_intr_handler(hw, 3); |
3597 | 3270 | ||
3598 | if (cause & PCIE) | 3271 | if (cause & PCIE) |
3599 | csio_pcie_intr_handler(hw); | 3272 | hw->chip_ops->chip_pcie_intr_handler(hw); |
3600 | 3273 | ||
3601 | if (cause & MC) | 3274 | if (cause & MC) |
3602 | csio_mem_intr_handler(hw, MEM_MC); | 3275 | csio_mem_intr_handler(hw, MEM_MC); |
@@ -4262,6 +3935,7 @@ csio_hw_get_device_id(struct csio_hw *hw) | |||
4262 | &hw->params.pci.device_id); | 3935 | &hw->params.pci.device_id); |
4263 | 3936 | ||
4264 | csio_dev_id_cached(hw); | 3937 | csio_dev_id_cached(hw); |
3938 | hw->chip_id = (hw->params.pci.device_id & CSIO_HW_CHIP_MASK); | ||
4265 | 3939 | ||
4266 | } /* csio_hw_get_device_id */ | 3940 | } /* csio_hw_get_device_id */ |
4267 | 3941 | ||
@@ -4280,19 +3954,21 @@ csio_hw_set_description(struct csio_hw *hw, uint16_t ven_id, uint16_t dev_id) | |||
4280 | prot_type = (dev_id & CSIO_ASIC_DEVID_PROTO_MASK); | 3954 | prot_type = (dev_id & CSIO_ASIC_DEVID_PROTO_MASK); |
4281 | adap_type = (dev_id & CSIO_ASIC_DEVID_TYPE_MASK); | 3955 | adap_type = (dev_id & CSIO_ASIC_DEVID_TYPE_MASK); |
4282 | 3956 | ||
4283 | if (prot_type == CSIO_FPGA) { | 3957 | if (prot_type == CSIO_T4_FCOE_ASIC) { |
3958 | memcpy(hw->hw_ver, | ||
3959 | csio_t4_fcoe_adapters[adap_type].model_no, 16); | ||
4284 | memcpy(hw->model_desc, | 3960 | memcpy(hw->model_desc, |
4285 | csio_fcoe_adapters[13].description, 32); | 3961 | csio_t4_fcoe_adapters[adap_type].description, |
4286 | } else if (prot_type == CSIO_T4_FCOE_ASIC) { | 3962 | 32); |
3963 | } else if (prot_type == CSIO_T5_FCOE_ASIC) { | ||
4287 | memcpy(hw->hw_ver, | 3964 | memcpy(hw->hw_ver, |
4288 | csio_fcoe_adapters[adap_type].model_no, 16); | 3965 | csio_t5_fcoe_adapters[adap_type].model_no, 16); |
4289 | memcpy(hw->model_desc, | 3966 | memcpy(hw->model_desc, |
4290 | csio_fcoe_adapters[adap_type].description, 32); | 3967 | csio_t5_fcoe_adapters[adap_type].description, |
3968 | 32); | ||
4291 | } else { | 3969 | } else { |
4292 | char tempName[32] = "Chelsio FCoE Controller"; | 3970 | char tempName[32] = "Chelsio FCoE Controller"; |
4293 | memcpy(hw->model_desc, tempName, 32); | 3971 | memcpy(hw->model_desc, tempName, 32); |
4294 | |||
4295 | CSIO_DB_ASSERT(0); | ||
4296 | } | 3972 | } |
4297 | } | 3973 | } |
4298 | } /* csio_hw_set_description */ | 3974 | } /* csio_hw_set_description */ |
@@ -4321,6 +3997,9 @@ csio_hw_init(struct csio_hw *hw) | |||
4321 | 3997 | ||
4322 | strcpy(hw->name, CSIO_HW_NAME); | 3998 | strcpy(hw->name, CSIO_HW_NAME); |
4323 | 3999 | ||
4000 | /* Initialize the HW chip ops with T4/T5 specific ops */ | ||
4001 | hw->chip_ops = csio_is_t4(hw->chip_id) ? &t4_ops : &t5_ops; | ||
4002 | |||
4324 | /* Set the model & its description */ | 4003 | /* Set the model & its description */ |
4325 | 4004 | ||
4326 | ven_id = hw->params.pci.vendor_id; | 4005 | ven_id = hw->params.pci.vendor_id; |