diff options
Diffstat (limited to 'drivers/scsi/qla2xxx/qla_mbx.c')
-rw-r--r-- | drivers/scsi/qla2xxx/qla_mbx.c | 759 |
1 files changed, 392 insertions, 367 deletions
diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c index 3402746ec128..bc52aa01a49e 100644 --- a/drivers/scsi/qla2xxx/qla_mbx.c +++ b/drivers/scsi/qla2xxx/qla_mbx.c | |||
@@ -29,7 +29,7 @@ | |||
29 | * Kernel context. | 29 | * Kernel context. |
30 | */ | 30 | */ |
31 | static int | 31 | static int |
32 | qla2x00_mailbox_command(scsi_qla_host_t *pvha, mbx_cmd_t *mcp) | 32 | qla2x00_mailbox_command(scsi_qla_host_t *vha, mbx_cmd_t *mcp) |
33 | { | 33 | { |
34 | int rval; | 34 | int rval; |
35 | unsigned long flags = 0; | 35 | unsigned long flags = 0; |
@@ -42,15 +42,16 @@ qla2x00_mailbox_command(scsi_qla_host_t *pvha, mbx_cmd_t *mcp) | |||
42 | uint32_t cnt; | 42 | uint32_t cnt; |
43 | uint32_t mboxes; | 43 | uint32_t mboxes; |
44 | unsigned long wait_time; | 44 | unsigned long wait_time; |
45 | scsi_qla_host_t *ha = to_qla_parent(pvha); | 45 | struct qla_hw_data *ha = vha->hw; |
46 | scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); | ||
46 | 47 | ||
47 | reg = ha->iobase; | 48 | reg = ha->iobase; |
48 | io_lock_on = ha->flags.init_done; | 49 | io_lock_on = base_vha->flags.init_done; |
49 | 50 | ||
50 | rval = QLA_SUCCESS; | 51 | rval = QLA_SUCCESS; |
51 | abort_active = test_bit(ABORT_ISP_ACTIVE, &ha->dpc_flags); | 52 | abort_active = test_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags); |
52 | 53 | ||
53 | DEBUG11(printk("%s(%ld): entered.\n", __func__, pvha->host_no)); | 54 | DEBUG11(printk("%s(%ld): entered.\n", __func__, base_vha->host_no)); |
54 | 55 | ||
55 | /* | 56 | /* |
56 | * Wait for active mailbox commands to finish by waiting at most tov | 57 | * Wait for active mailbox commands to finish by waiting at most tov |
@@ -62,7 +63,7 @@ qla2x00_mailbox_command(scsi_qla_host_t *pvha, mbx_cmd_t *mcp) | |||
62 | mcp->tov * HZ)) { | 63 | mcp->tov * HZ)) { |
63 | /* Timeout occurred. Return error. */ | 64 | /* Timeout occurred. Return error. */ |
64 | DEBUG2_3_11(printk("%s(%ld): cmd access timeout. " | 65 | DEBUG2_3_11(printk("%s(%ld): cmd access timeout. " |
65 | "Exiting.\n", __func__, ha->host_no)); | 66 | "Exiting.\n", __func__, base_vha->host_no)); |
66 | return QLA_FUNCTION_TIMEOUT; | 67 | return QLA_FUNCTION_TIMEOUT; |
67 | } | 68 | } |
68 | } | 69 | } |
@@ -72,7 +73,7 @@ qla2x00_mailbox_command(scsi_qla_host_t *pvha, mbx_cmd_t *mcp) | |||
72 | ha->mcp = mcp; | 73 | ha->mcp = mcp; |
73 | 74 | ||
74 | DEBUG11(printk("scsi(%ld): prepare to issue mbox cmd=0x%x.\n", | 75 | DEBUG11(printk("scsi(%ld): prepare to issue mbox cmd=0x%x.\n", |
75 | ha->host_no, mcp->mb[0])); | 76 | base_vha->host_no, mcp->mb[0])); |
76 | 77 | ||
77 | spin_lock_irqsave(&ha->hardware_lock, flags); | 78 | spin_lock_irqsave(&ha->hardware_lock, flags); |
78 | 79 | ||
@@ -100,15 +101,16 @@ qla2x00_mailbox_command(scsi_qla_host_t *pvha, mbx_cmd_t *mcp) | |||
100 | 101 | ||
101 | #if defined(QL_DEBUG_LEVEL_1) | 102 | #if defined(QL_DEBUG_LEVEL_1) |
102 | printk("%s(%ld): Loaded MBX registers (displayed in bytes) = \n", | 103 | printk("%s(%ld): Loaded MBX registers (displayed in bytes) = \n", |
103 | __func__, ha->host_no); | 104 | __func__, base_vha->host_no); |
104 | qla2x00_dump_buffer((uint8_t *)mcp->mb, 16); | 105 | qla2x00_dump_buffer((uint8_t *)mcp->mb, 16); |
105 | printk("\n"); | 106 | printk("\n"); |
106 | qla2x00_dump_buffer(((uint8_t *)mcp->mb + 0x10), 16); | 107 | qla2x00_dump_buffer(((uint8_t *)mcp->mb + 0x10), 16); |
107 | printk("\n"); | 108 | printk("\n"); |
108 | qla2x00_dump_buffer(((uint8_t *)mcp->mb + 0x20), 8); | 109 | qla2x00_dump_buffer(((uint8_t *)mcp->mb + 0x20), 8); |
109 | printk("\n"); | 110 | printk("\n"); |
110 | printk("%s(%ld): I/O address = %p.\n", __func__, ha->host_no, optr); | 111 | printk("%s(%ld): I/O address = %p.\n", __func__, base_vha->host_no, |
111 | qla2x00_dump_regs(ha); | 112 | optr); |
113 | qla2x00_dump_regs(base_vha); | ||
112 | #endif | 114 | #endif |
113 | 115 | ||
114 | /* Issue set host interrupt command to send cmd out. */ | 116 | /* Issue set host interrupt command to send cmd out. */ |
@@ -117,7 +119,7 @@ qla2x00_mailbox_command(scsi_qla_host_t *pvha, mbx_cmd_t *mcp) | |||
117 | 119 | ||
118 | /* Unlock mbx registers and wait for interrupt */ | 120 | /* Unlock mbx registers and wait for interrupt */ |
119 | DEBUG11(printk("%s(%ld): going to unlock irq & waiting for interrupt. " | 121 | DEBUG11(printk("%s(%ld): going to unlock irq & waiting for interrupt. " |
120 | "jiffies=%lx.\n", __func__, ha->host_no, jiffies)); | 122 | "jiffies=%lx.\n", __func__, base_vha->host_no, jiffies)); |
121 | 123 | ||
122 | /* Wait for mbx cmd completion until timeout */ | 124 | /* Wait for mbx cmd completion until timeout */ |
123 | 125 | ||
@@ -137,7 +139,7 @@ qla2x00_mailbox_command(scsi_qla_host_t *pvha, mbx_cmd_t *mcp) | |||
137 | 139 | ||
138 | } else { | 140 | } else { |
139 | DEBUG3_11(printk("%s(%ld): cmd=%x POLLING MODE.\n", __func__, | 141 | DEBUG3_11(printk("%s(%ld): cmd=%x POLLING MODE.\n", __func__, |
140 | ha->host_no, command)); | 142 | base_vha->host_no, command)); |
141 | 143 | ||
142 | if (IS_FWI2_CAPABLE(ha)) | 144 | if (IS_FWI2_CAPABLE(ha)) |
143 | WRT_REG_DWORD(®->isp24.hccr, HCCRX_SET_HOST_INT); | 145 | WRT_REG_DWORD(®->isp24.hccr, HCCRX_SET_HOST_INT); |
@@ -151,7 +153,7 @@ qla2x00_mailbox_command(scsi_qla_host_t *pvha, mbx_cmd_t *mcp) | |||
151 | break; | 153 | break; |
152 | 154 | ||
153 | /* Check for pending interrupts. */ | 155 | /* Check for pending interrupts. */ |
154 | qla2x00_poll(ha); | 156 | qla2x00_poll(ha->rsp); |
155 | 157 | ||
156 | if (command != MBC_LOAD_RISC_RAM_EXTENDED && | 158 | if (command != MBC_LOAD_RISC_RAM_EXTENDED && |
157 | !ha->flags.mbox_int) | 159 | !ha->flags.mbox_int) |
@@ -164,7 +166,7 @@ qla2x00_mailbox_command(scsi_qla_host_t *pvha, mbx_cmd_t *mcp) | |||
164 | uint16_t *iptr2; | 166 | uint16_t *iptr2; |
165 | 167 | ||
166 | DEBUG3_11(printk("%s(%ld): cmd %x completed.\n", __func__, | 168 | DEBUG3_11(printk("%s(%ld): cmd %x completed.\n", __func__, |
167 | ha->host_no, command)); | 169 | base_vha->host_no, command)); |
168 | 170 | ||
169 | /* Got interrupt. Clear the flag. */ | 171 | /* Got interrupt. Clear the flag. */ |
170 | ha->flags.mbox_int = 0; | 172 | ha->flags.mbox_int = 0; |
@@ -200,12 +202,12 @@ qla2x00_mailbox_command(scsi_qla_host_t *pvha, mbx_cmd_t *mcp) | |||
200 | ictrl = RD_REG_WORD(®->isp.ictrl); | 202 | ictrl = RD_REG_WORD(®->isp.ictrl); |
201 | } | 203 | } |
202 | printk("%s(%ld): **** MB Command Timeout for cmd %x ****\n", | 204 | printk("%s(%ld): **** MB Command Timeout for cmd %x ****\n", |
203 | __func__, ha->host_no, command); | 205 | __func__, base_vha->host_no, command); |
204 | printk("%s(%ld): icontrol=%x jiffies=%lx\n", __func__, | 206 | printk("%s(%ld): icontrol=%x jiffies=%lx\n", __func__, |
205 | ha->host_no, ictrl, jiffies); | 207 | base_vha->host_no, ictrl, jiffies); |
206 | printk("%s(%ld): *** mailbox[0] = 0x%x ***\n", __func__, | 208 | printk("%s(%ld): *** mailbox[0] = 0x%x ***\n", __func__, |
207 | ha->host_no, mb0); | 209 | base_vha->host_no, mb0); |
208 | qla2x00_dump_regs(ha); | 210 | qla2x00_dump_regs(base_vha); |
209 | #endif | 211 | #endif |
210 | 212 | ||
211 | rval = QLA_FUNCTION_TIMEOUT; | 213 | rval = QLA_FUNCTION_TIMEOUT; |
@@ -218,10 +220,10 @@ qla2x00_mailbox_command(scsi_qla_host_t *pvha, mbx_cmd_t *mcp) | |||
218 | 220 | ||
219 | if (abort_active || !io_lock_on) { | 221 | if (abort_active || !io_lock_on) { |
220 | DEBUG11(printk("%s(%ld): checking for additional resp " | 222 | DEBUG11(printk("%s(%ld): checking for additional resp " |
221 | "interrupt.\n", __func__, ha->host_no)); | 223 | "interrupt.\n", __func__, base_vha->host_no)); |
222 | 224 | ||
223 | /* polling mode for non isp_abort commands. */ | 225 | /* polling mode for non isp_abort commands. */ |
224 | qla2x00_poll(ha); | 226 | qla2x00_poll(ha->rsp); |
225 | } | 227 | } |
226 | 228 | ||
227 | if (rval == QLA_FUNCTION_TIMEOUT && | 229 | if (rval == QLA_FUNCTION_TIMEOUT && |
@@ -229,35 +231,37 @@ qla2x00_mailbox_command(scsi_qla_host_t *pvha, mbx_cmd_t *mcp) | |||
229 | if (!io_lock_on || (mcp->flags & IOCTL_CMD)) { | 231 | if (!io_lock_on || (mcp->flags & IOCTL_CMD)) { |
230 | /* not in dpc. schedule it for dpc to take over. */ | 232 | /* not in dpc. schedule it for dpc to take over. */ |
231 | DEBUG(printk("%s(%ld): timeout schedule " | 233 | DEBUG(printk("%s(%ld): timeout schedule " |
232 | "isp_abort_needed.\n", __func__, ha->host_no)); | 234 | "isp_abort_needed.\n", __func__, |
235 | base_vha->host_no)); | ||
233 | DEBUG2_3_11(printk("%s(%ld): timeout schedule " | 236 | DEBUG2_3_11(printk("%s(%ld): timeout schedule " |
234 | "isp_abort_needed.\n", __func__, ha->host_no)); | 237 | "isp_abort_needed.\n", __func__, |
238 | base_vha->host_no)); | ||
235 | qla_printk(KERN_WARNING, ha, | 239 | qla_printk(KERN_WARNING, ha, |
236 | "Mailbox command timeout occurred. Scheduling ISP " | 240 | "Mailbox command timeout occurred. Scheduling ISP " |
237 | "abort.\n"); | 241 | "abort.\n"); |
238 | set_bit(ISP_ABORT_NEEDED, &ha->dpc_flags); | 242 | set_bit(ISP_ABORT_NEEDED, &base_vha->dpc_flags); |
239 | qla2xxx_wake_dpc(ha); | 243 | qla2xxx_wake_dpc(vha); |
240 | } else if (!abort_active) { | 244 | } else if (!abort_active) { |
241 | /* call abort directly since we are in the DPC thread */ | 245 | /* call abort directly since we are in the DPC thread */ |
242 | DEBUG(printk("%s(%ld): timeout calling abort_isp\n", | 246 | DEBUG(printk("%s(%ld): timeout calling abort_isp\n", |
243 | __func__, ha->host_no)); | 247 | __func__, base_vha->host_no)); |
244 | DEBUG2_3_11(printk("%s(%ld): timeout calling " | 248 | DEBUG2_3_11(printk("%s(%ld): timeout calling " |
245 | "abort_isp\n", __func__, ha->host_no)); | 249 | "abort_isp\n", __func__, base_vha->host_no)); |
246 | qla_printk(KERN_WARNING, ha, | 250 | qla_printk(KERN_WARNING, ha, |
247 | "Mailbox command timeout occurred. Issuing ISP " | 251 | "Mailbox command timeout occurred. Issuing ISP " |
248 | "abort.\n"); | 252 | "abort.\n"); |
249 | 253 | ||
250 | set_bit(ABORT_ISP_ACTIVE, &ha->dpc_flags); | 254 | set_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags); |
251 | clear_bit(ISP_ABORT_NEEDED, &ha->dpc_flags); | 255 | clear_bit(ISP_ABORT_NEEDED, &base_vha->dpc_flags); |
252 | if (qla2x00_abort_isp(ha)) { | 256 | if (qla2x00_abort_isp(base_vha)) { |
253 | /* Failed. retry later. */ | 257 | /* Failed. retry later. */ |
254 | set_bit(ISP_ABORT_NEEDED, &ha->dpc_flags); | 258 | set_bit(ISP_ABORT_NEEDED, &base_vha->dpc_flags); |
255 | } | 259 | } |
256 | clear_bit(ABORT_ISP_ACTIVE, &ha->dpc_flags); | 260 | clear_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags); |
257 | DEBUG(printk("%s(%ld): finished abort_isp\n", __func__, | 261 | DEBUG(printk("%s(%ld): finished abort_isp\n", __func__, |
258 | ha->host_no)); | 262 | base_vha->host_no)); |
259 | DEBUG2_3_11(printk("%s(%ld): finished abort_isp\n", | 263 | DEBUG2_3_11(printk("%s(%ld): finished abort_isp\n", |
260 | __func__, ha->host_no)); | 264 | __func__, base_vha->host_no)); |
261 | } | 265 | } |
262 | } | 266 | } |
263 | 267 | ||
@@ -267,24 +271,26 @@ qla2x00_mailbox_command(scsi_qla_host_t *pvha, mbx_cmd_t *mcp) | |||
267 | 271 | ||
268 | if (rval) { | 272 | if (rval) { |
269 | DEBUG2_3_11(printk("%s(%ld): **** FAILED. mbx0=%x, mbx1=%x, " | 273 | DEBUG2_3_11(printk("%s(%ld): **** FAILED. mbx0=%x, mbx1=%x, " |
270 | "mbx2=%x, cmd=%x ****\n", __func__, ha->host_no, | 274 | "mbx2=%x, cmd=%x ****\n", __func__, base_vha->host_no, |
271 | mcp->mb[0], mcp->mb[1], mcp->mb[2], command)); | 275 | mcp->mb[0], mcp->mb[1], mcp->mb[2], command)); |
272 | } else { | 276 | } else { |
273 | DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no)); | 277 | DEBUG11(printk("%s(%ld): done.\n", __func__, |
278 | base_vha->host_no)); | ||
274 | } | 279 | } |
275 | 280 | ||
276 | return rval; | 281 | return rval; |
277 | } | 282 | } |
278 | 283 | ||
279 | int | 284 | int |
280 | qla2x00_load_ram(scsi_qla_host_t *ha, dma_addr_t req_dma, uint32_t risc_addr, | 285 | qla2x00_load_ram(scsi_qla_host_t *vha, dma_addr_t req_dma, uint32_t risc_addr, |
281 | uint32_t risc_code_size) | 286 | uint32_t risc_code_size) |
282 | { | 287 | { |
283 | int rval; | 288 | int rval; |
289 | struct qla_hw_data *ha = vha->hw; | ||
284 | mbx_cmd_t mc; | 290 | mbx_cmd_t mc; |
285 | mbx_cmd_t *mcp = &mc; | 291 | mbx_cmd_t *mcp = &mc; |
286 | 292 | ||
287 | DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no)); | 293 | DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no)); |
288 | 294 | ||
289 | if (MSW(risc_addr) || IS_FWI2_CAPABLE(ha)) { | 295 | if (MSW(risc_addr) || IS_FWI2_CAPABLE(ha)) { |
290 | mcp->mb[0] = MBC_LOAD_RISC_RAM_EXTENDED; | 296 | mcp->mb[0] = MBC_LOAD_RISC_RAM_EXTENDED; |
@@ -312,13 +318,13 @@ qla2x00_load_ram(scsi_qla_host_t *ha, dma_addr_t req_dma, uint32_t risc_addr, | |||
312 | mcp->in_mb = MBX_0; | 318 | mcp->in_mb = MBX_0; |
313 | mcp->tov = MBX_TOV_SECONDS; | 319 | mcp->tov = MBX_TOV_SECONDS; |
314 | mcp->flags = 0; | 320 | mcp->flags = 0; |
315 | rval = qla2x00_mailbox_command(ha, mcp); | 321 | rval = qla2x00_mailbox_command(vha, mcp); |
316 | 322 | ||
317 | if (rval != QLA_SUCCESS) { | 323 | if (rval != QLA_SUCCESS) { |
318 | DEBUG2_3_11(printk("%s(%ld): failed=%x mb[0]=%x.\n", __func__, | 324 | DEBUG2_3_11(printk("%s(%ld): failed=%x mb[0]=%x.\n", __func__, |
319 | ha->host_no, rval, mcp->mb[0])); | 325 | vha->host_no, rval, mcp->mb[0])); |
320 | } else { | 326 | } else { |
321 | DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no)); | 327 | DEBUG11(printk("%s(%ld): done.\n", __func__, vha->host_no)); |
322 | } | 328 | } |
323 | 329 | ||
324 | return rval; | 330 | return rval; |
@@ -340,13 +346,14 @@ qla2x00_load_ram(scsi_qla_host_t *ha, dma_addr_t req_dma, uint32_t risc_addr, | |||
340 | * Kernel context. | 346 | * Kernel context. |
341 | */ | 347 | */ |
342 | int | 348 | int |
343 | qla2x00_execute_fw(scsi_qla_host_t *ha, uint32_t risc_addr) | 349 | qla2x00_execute_fw(scsi_qla_host_t *vha, uint32_t risc_addr) |
344 | { | 350 | { |
345 | int rval; | 351 | int rval; |
352 | struct qla_hw_data *ha = vha->hw; | ||
346 | mbx_cmd_t mc; | 353 | mbx_cmd_t mc; |
347 | mbx_cmd_t *mcp = &mc; | 354 | mbx_cmd_t *mcp = &mc; |
348 | 355 | ||
349 | DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no)); | 356 | DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no)); |
350 | 357 | ||
351 | mcp->mb[0] = MBC_EXECUTE_FIRMWARE; | 358 | mcp->mb[0] = MBC_EXECUTE_FIRMWARE; |
352 | mcp->out_mb = MBX_0; | 359 | mcp->out_mb = MBX_0; |
@@ -369,18 +376,18 @@ qla2x00_execute_fw(scsi_qla_host_t *ha, uint32_t risc_addr) | |||
369 | 376 | ||
370 | mcp->tov = MBX_TOV_SECONDS; | 377 | mcp->tov = MBX_TOV_SECONDS; |
371 | mcp->flags = 0; | 378 | mcp->flags = 0; |
372 | rval = qla2x00_mailbox_command(ha, mcp); | 379 | rval = qla2x00_mailbox_command(vha, mcp); |
373 | 380 | ||
374 | if (rval != QLA_SUCCESS) { | 381 | if (rval != QLA_SUCCESS) { |
375 | DEBUG2_3_11(printk("%s(%ld): failed=%x mb[0]=%x.\n", __func__, | 382 | DEBUG2_3_11(printk("%s(%ld): failed=%x mb[0]=%x.\n", __func__, |
376 | ha->host_no, rval, mcp->mb[0])); | 383 | vha->host_no, rval, mcp->mb[0])); |
377 | } else { | 384 | } else { |
378 | if (IS_FWI2_CAPABLE(ha)) { | 385 | if (IS_FWI2_CAPABLE(ha)) { |
379 | DEBUG11(printk("%s(%ld): done exchanges=%x.\n", | 386 | DEBUG11(printk("%s(%ld): done exchanges=%x.\n", |
380 | __func__, ha->host_no, mcp->mb[1])); | 387 | __func__, vha->host_no, mcp->mb[1])); |
381 | } else { | 388 | } else { |
382 | DEBUG11(printk("%s(%ld): done.\n", __func__, | 389 | DEBUG11(printk("%s(%ld): done.\n", __func__, |
383 | ha->host_no)); | 390 | vha->host_no)); |
384 | } | 391 | } |
385 | } | 392 | } |
386 | 393 | ||
@@ -404,28 +411,28 @@ qla2x00_execute_fw(scsi_qla_host_t *ha, uint32_t risc_addr) | |||
404 | * Kernel context. | 411 | * Kernel context. |
405 | */ | 412 | */ |
406 | void | 413 | void |
407 | qla2x00_get_fw_version(scsi_qla_host_t *ha, uint16_t *major, uint16_t *minor, | 414 | qla2x00_get_fw_version(scsi_qla_host_t *vha, uint16_t *major, uint16_t *minor, |
408 | uint16_t *subminor, uint16_t *attributes, uint32_t *memory) | 415 | uint16_t *subminor, uint16_t *attributes, uint32_t *memory) |
409 | { | 416 | { |
410 | int rval; | 417 | int rval; |
411 | mbx_cmd_t mc; | 418 | mbx_cmd_t mc; |
412 | mbx_cmd_t *mcp = &mc; | 419 | mbx_cmd_t *mcp = &mc; |
413 | 420 | ||
414 | DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no)); | 421 | DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no)); |
415 | 422 | ||
416 | mcp->mb[0] = MBC_GET_FIRMWARE_VERSION; | 423 | mcp->mb[0] = MBC_GET_FIRMWARE_VERSION; |
417 | mcp->out_mb = MBX_0; | 424 | mcp->out_mb = MBX_0; |
418 | mcp->in_mb = MBX_6|MBX_5|MBX_4|MBX_3|MBX_2|MBX_1|MBX_0; | 425 | mcp->in_mb = MBX_6|MBX_5|MBX_4|MBX_3|MBX_2|MBX_1|MBX_0; |
419 | mcp->flags = 0; | 426 | mcp->flags = 0; |
420 | mcp->tov = MBX_TOV_SECONDS; | 427 | mcp->tov = MBX_TOV_SECONDS; |
421 | rval = qla2x00_mailbox_command(ha, mcp); | 428 | rval = qla2x00_mailbox_command(vha, mcp); |
422 | 429 | ||
423 | /* Return mailbox data. */ | 430 | /* Return mailbox data. */ |
424 | *major = mcp->mb[1]; | 431 | *major = mcp->mb[1]; |
425 | *minor = mcp->mb[2]; | 432 | *minor = mcp->mb[2]; |
426 | *subminor = mcp->mb[3]; | 433 | *subminor = mcp->mb[3]; |
427 | *attributes = mcp->mb[6]; | 434 | *attributes = mcp->mb[6]; |
428 | if (IS_QLA2100(ha) || IS_QLA2200(ha)) | 435 | if (IS_QLA2100(vha->hw) || IS_QLA2200(vha->hw)) |
429 | *memory = 0x1FFFF; /* Defaults to 128KB. */ | 436 | *memory = 0x1FFFF; /* Defaults to 128KB. */ |
430 | else | 437 | else |
431 | *memory = (mcp->mb[5] << 16) | mcp->mb[4]; | 438 | *memory = (mcp->mb[5] << 16) | mcp->mb[4]; |
@@ -433,10 +440,10 @@ qla2x00_get_fw_version(scsi_qla_host_t *ha, uint16_t *major, uint16_t *minor, | |||
433 | if (rval != QLA_SUCCESS) { | 440 | if (rval != QLA_SUCCESS) { |
434 | /*EMPTY*/ | 441 | /*EMPTY*/ |
435 | DEBUG2_3_11(printk("%s(%ld): failed=%x.\n", __func__, | 442 | DEBUG2_3_11(printk("%s(%ld): failed=%x.\n", __func__, |
436 | ha->host_no, rval)); | 443 | vha->host_no, rval)); |
437 | } else { | 444 | } else { |
438 | /*EMPTY*/ | 445 | /*EMPTY*/ |
439 | DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no)); | 446 | DEBUG11(printk("%s(%ld): done.\n", __func__, vha->host_no)); |
440 | } | 447 | } |
441 | } | 448 | } |
442 | 449 | ||
@@ -455,32 +462,32 @@ qla2x00_get_fw_version(scsi_qla_host_t *ha, uint16_t *major, uint16_t *minor, | |||
455 | * Kernel context. | 462 | * Kernel context. |
456 | */ | 463 | */ |
457 | int | 464 | int |
458 | qla2x00_get_fw_options(scsi_qla_host_t *ha, uint16_t *fwopts) | 465 | qla2x00_get_fw_options(scsi_qla_host_t *vha, uint16_t *fwopts) |
459 | { | 466 | { |
460 | int rval; | 467 | int rval; |
461 | mbx_cmd_t mc; | 468 | mbx_cmd_t mc; |
462 | mbx_cmd_t *mcp = &mc; | 469 | mbx_cmd_t *mcp = &mc; |
463 | 470 | ||
464 | DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no)); | 471 | DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no)); |
465 | 472 | ||
466 | mcp->mb[0] = MBC_GET_FIRMWARE_OPTION; | 473 | mcp->mb[0] = MBC_GET_FIRMWARE_OPTION; |
467 | mcp->out_mb = MBX_0; | 474 | mcp->out_mb = MBX_0; |
468 | mcp->in_mb = MBX_3|MBX_2|MBX_1|MBX_0; | 475 | mcp->in_mb = MBX_3|MBX_2|MBX_1|MBX_0; |
469 | mcp->tov = MBX_TOV_SECONDS; | 476 | mcp->tov = MBX_TOV_SECONDS; |
470 | mcp->flags = 0; | 477 | mcp->flags = 0; |
471 | rval = qla2x00_mailbox_command(ha, mcp); | 478 | rval = qla2x00_mailbox_command(vha, mcp); |
472 | 479 | ||
473 | if (rval != QLA_SUCCESS) { | 480 | if (rval != QLA_SUCCESS) { |
474 | /*EMPTY*/ | 481 | /*EMPTY*/ |
475 | DEBUG2_3_11(printk("%s(%ld): failed=%x.\n", __func__, | 482 | DEBUG2_3_11(printk("%s(%ld): failed=%x.\n", __func__, |
476 | ha->host_no, rval)); | 483 | vha->host_no, rval)); |
477 | } else { | 484 | } else { |
478 | fwopts[0] = mcp->mb[0]; | 485 | fwopts[0] = mcp->mb[0]; |
479 | fwopts[1] = mcp->mb[1]; | 486 | fwopts[1] = mcp->mb[1]; |
480 | fwopts[2] = mcp->mb[2]; | 487 | fwopts[2] = mcp->mb[2]; |
481 | fwopts[3] = mcp->mb[3]; | 488 | fwopts[3] = mcp->mb[3]; |
482 | 489 | ||
483 | DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no)); | 490 | DEBUG11(printk("%s(%ld): done.\n", __func__, vha->host_no)); |
484 | } | 491 | } |
485 | 492 | ||
486 | return rval; | 493 | return rval; |
@@ -502,13 +509,13 @@ qla2x00_get_fw_options(scsi_qla_host_t *ha, uint16_t *fwopts) | |||
502 | * Kernel context. | 509 | * Kernel context. |
503 | */ | 510 | */ |
504 | int | 511 | int |
505 | qla2x00_set_fw_options(scsi_qla_host_t *ha, uint16_t *fwopts) | 512 | qla2x00_set_fw_options(scsi_qla_host_t *vha, uint16_t *fwopts) |
506 | { | 513 | { |
507 | int rval; | 514 | int rval; |
508 | mbx_cmd_t mc; | 515 | mbx_cmd_t mc; |
509 | mbx_cmd_t *mcp = &mc; | 516 | mbx_cmd_t *mcp = &mc; |
510 | 517 | ||
511 | DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no)); | 518 | DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no)); |
512 | 519 | ||
513 | mcp->mb[0] = MBC_SET_FIRMWARE_OPTION; | 520 | mcp->mb[0] = MBC_SET_FIRMWARE_OPTION; |
514 | mcp->mb[1] = fwopts[1]; | 521 | mcp->mb[1] = fwopts[1]; |
@@ -516,7 +523,7 @@ qla2x00_set_fw_options(scsi_qla_host_t *ha, uint16_t *fwopts) | |||
516 | mcp->mb[3] = fwopts[3]; | 523 | mcp->mb[3] = fwopts[3]; |
517 | mcp->out_mb = MBX_3|MBX_2|MBX_1|MBX_0; | 524 | mcp->out_mb = MBX_3|MBX_2|MBX_1|MBX_0; |
518 | mcp->in_mb = MBX_0; | 525 | mcp->in_mb = MBX_0; |
519 | if (IS_FWI2_CAPABLE(ha)) { | 526 | if (IS_FWI2_CAPABLE(vha->hw)) { |
520 | mcp->in_mb |= MBX_1; | 527 | mcp->in_mb |= MBX_1; |
521 | } else { | 528 | } else { |
522 | mcp->mb[10] = fwopts[10]; | 529 | mcp->mb[10] = fwopts[10]; |
@@ -526,17 +533,17 @@ qla2x00_set_fw_options(scsi_qla_host_t *ha, uint16_t *fwopts) | |||
526 | } | 533 | } |
527 | mcp->tov = MBX_TOV_SECONDS; | 534 | mcp->tov = MBX_TOV_SECONDS; |
528 | mcp->flags = 0; | 535 | mcp->flags = 0; |
529 | rval = qla2x00_mailbox_command(ha, mcp); | 536 | rval = qla2x00_mailbox_command(vha, mcp); |
530 | 537 | ||
531 | fwopts[0] = mcp->mb[0]; | 538 | fwopts[0] = mcp->mb[0]; |
532 | 539 | ||
533 | if (rval != QLA_SUCCESS) { | 540 | if (rval != QLA_SUCCESS) { |
534 | /*EMPTY*/ | 541 | /*EMPTY*/ |
535 | DEBUG2_3_11(printk("%s(%ld): failed=%x (%x/%x).\n", __func__, | 542 | DEBUG2_3_11(printk("%s(%ld): failed=%x (%x/%x).\n", __func__, |
536 | ha->host_no, rval, mcp->mb[0], mcp->mb[1])); | 543 | vha->host_no, rval, mcp->mb[0], mcp->mb[1])); |
537 | } else { | 544 | } else { |
538 | /*EMPTY*/ | 545 | /*EMPTY*/ |
539 | DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no)); | 546 | DEBUG11(printk("%s(%ld): done.\n", __func__, vha->host_no)); |
540 | } | 547 | } |
541 | 548 | ||
542 | return rval; | 549 | return rval; |
@@ -558,13 +565,14 @@ qla2x00_set_fw_options(scsi_qla_host_t *ha, uint16_t *fwopts) | |||
558 | * Kernel context. | 565 | * Kernel context. |
559 | */ | 566 | */ |
560 | int | 567 | int |
561 | qla2x00_mbx_reg_test(scsi_qla_host_t *ha) | 568 | qla2x00_mbx_reg_test(scsi_qla_host_t *vha) |
562 | { | 569 | { |
563 | int rval; | 570 | int rval; |
571 | struct qla_hw_data *ha = vha->hw; | ||
564 | mbx_cmd_t mc; | 572 | mbx_cmd_t mc; |
565 | mbx_cmd_t *mcp = &mc; | 573 | mbx_cmd_t *mcp = &mc; |
566 | 574 | ||
567 | DEBUG11(printk("qla2x00_mbx_reg_test(%ld): entered.\n", ha->host_no)); | 575 | DEBUG11(printk("qla2x00_mbx_reg_test(%ld): entered.\n", vha->host_no)); |
568 | 576 | ||
569 | mcp->mb[0] = MBC_MAILBOX_REGISTER_TEST; | 577 | mcp->mb[0] = MBC_MAILBOX_REGISTER_TEST; |
570 | mcp->mb[1] = 0xAAAA; | 578 | mcp->mb[1] = 0xAAAA; |
@@ -578,7 +586,7 @@ qla2x00_mbx_reg_test(scsi_qla_host_t *ha) | |||
578 | mcp->in_mb = MBX_7|MBX_6|MBX_5|MBX_4|MBX_3|MBX_2|MBX_1|MBX_0; | 586 | mcp->in_mb = MBX_7|MBX_6|MBX_5|MBX_4|MBX_3|MBX_2|MBX_1|MBX_0; |
579 | mcp->tov = MBX_TOV_SECONDS; | 587 | mcp->tov = MBX_TOV_SECONDS; |
580 | mcp->flags = 0; | 588 | mcp->flags = 0; |
581 | rval = qla2x00_mailbox_command(ha, mcp); | 589 | rval = qla2x00_mailbox_command(vha, mcp); |
582 | 590 | ||
583 | if (rval == QLA_SUCCESS) { | 591 | if (rval == QLA_SUCCESS) { |
584 | if (mcp->mb[1] != 0xAAAA || mcp->mb[2] != 0x5555 || | 592 | if (mcp->mb[1] != 0xAAAA || mcp->mb[2] != 0x5555 || |
@@ -591,7 +599,7 @@ qla2x00_mbx_reg_test(scsi_qla_host_t *ha) | |||
591 | struct device_reg_24xx __iomem *reg = | 599 | struct device_reg_24xx __iomem *reg = |
592 | &ha->iobase->isp24; | 600 | &ha->iobase->isp24; |
593 | 601 | ||
594 | qla2xxx_hw_event_log(ha, HW_EVENT_ISP_ERR, 0, | 602 | qla2xxx_hw_event_log(vha, HW_EVENT_ISP_ERR, 0, |
595 | LSW(RD_REG_DWORD(®->hccr)), | 603 | LSW(RD_REG_DWORD(®->hccr)), |
596 | LSW(RD_REG_DWORD(®->istatus))); | 604 | LSW(RD_REG_DWORD(®->istatus))); |
597 | } | 605 | } |
@@ -600,11 +608,11 @@ qla2x00_mbx_reg_test(scsi_qla_host_t *ha) | |||
600 | if (rval != QLA_SUCCESS) { | 608 | if (rval != QLA_SUCCESS) { |
601 | /*EMPTY*/ | 609 | /*EMPTY*/ |
602 | DEBUG2_3_11(printk("qla2x00_mbx_reg_test(%ld): failed=%x.\n", | 610 | DEBUG2_3_11(printk("qla2x00_mbx_reg_test(%ld): failed=%x.\n", |
603 | ha->host_no, rval)); | 611 | vha->host_no, rval)); |
604 | } else { | 612 | } else { |
605 | /*EMPTY*/ | 613 | /*EMPTY*/ |
606 | DEBUG11(printk("qla2x00_mbx_reg_test(%ld): done.\n", | 614 | DEBUG11(printk("qla2x00_mbx_reg_test(%ld): done.\n", |
607 | ha->host_no)); | 615 | vha->host_no)); |
608 | } | 616 | } |
609 | 617 | ||
610 | return rval; | 618 | return rval; |
@@ -626,18 +634,18 @@ qla2x00_mbx_reg_test(scsi_qla_host_t *ha) | |||
626 | * Kernel context. | 634 | * Kernel context. |
627 | */ | 635 | */ |
628 | int | 636 | int |
629 | qla2x00_verify_checksum(scsi_qla_host_t *ha, uint32_t risc_addr) | 637 | qla2x00_verify_checksum(scsi_qla_host_t *vha, uint32_t risc_addr) |
630 | { | 638 | { |
631 | int rval; | 639 | int rval; |
632 | mbx_cmd_t mc; | 640 | mbx_cmd_t mc; |
633 | mbx_cmd_t *mcp = &mc; | 641 | mbx_cmd_t *mcp = &mc; |
634 | 642 | ||
635 | DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no)); | 643 | DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no)); |
636 | 644 | ||
637 | mcp->mb[0] = MBC_VERIFY_CHECKSUM; | 645 | mcp->mb[0] = MBC_VERIFY_CHECKSUM; |
638 | mcp->out_mb = MBX_0; | 646 | mcp->out_mb = MBX_0; |
639 | mcp->in_mb = MBX_0; | 647 | mcp->in_mb = MBX_0; |
640 | if (IS_FWI2_CAPABLE(ha)) { | 648 | if (IS_FWI2_CAPABLE(vha->hw)) { |
641 | mcp->mb[1] = MSW(risc_addr); | 649 | mcp->mb[1] = MSW(risc_addr); |
642 | mcp->mb[2] = LSW(risc_addr); | 650 | mcp->mb[2] = LSW(risc_addr); |
643 | mcp->out_mb |= MBX_2|MBX_1; | 651 | mcp->out_mb |= MBX_2|MBX_1; |
@@ -650,14 +658,14 @@ qla2x00_verify_checksum(scsi_qla_host_t *ha, uint32_t risc_addr) | |||
650 | 658 | ||
651 | mcp->tov = MBX_TOV_SECONDS; | 659 | mcp->tov = MBX_TOV_SECONDS; |
652 | mcp->flags = 0; | 660 | mcp->flags = 0; |
653 | rval = qla2x00_mailbox_command(ha, mcp); | 661 | rval = qla2x00_mailbox_command(vha, mcp); |
654 | 662 | ||
655 | if (rval != QLA_SUCCESS) { | 663 | if (rval != QLA_SUCCESS) { |
656 | DEBUG2_3_11(printk("%s(%ld): failed=%x chk sum=%x.\n", __func__, | 664 | DEBUG2_3_11(printk("%s(%ld): failed=%x chk sum=%x.\n", __func__, |
657 | ha->host_no, rval, IS_FWI2_CAPABLE(ha) ? | 665 | vha->host_no, rval, IS_FWI2_CAPABLE(vha->hw) ? |
658 | (mcp->mb[2] << 16) | mcp->mb[1]: mcp->mb[1])); | 666 | (mcp->mb[2] << 16) | mcp->mb[1]: mcp->mb[1])); |
659 | } else { | 667 | } else { |
660 | DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no)); | 668 | DEBUG11(printk("%s(%ld): done.\n", __func__, vha->host_no)); |
661 | } | 669 | } |
662 | 670 | ||
663 | return rval; | 671 | return rval; |
@@ -682,7 +690,7 @@ qla2x00_verify_checksum(scsi_qla_host_t *ha, uint32_t risc_addr) | |||
682 | * Kernel context. | 690 | * Kernel context. |
683 | */ | 691 | */ |
684 | static int | 692 | static int |
685 | qla2x00_issue_iocb_timeout(scsi_qla_host_t *ha, void *buffer, | 693 | qla2x00_issue_iocb_timeout(scsi_qla_host_t *vha, void *buffer, |
686 | dma_addr_t phys_addr, size_t size, uint32_t tov) | 694 | dma_addr_t phys_addr, size_t size, uint32_t tov) |
687 | { | 695 | { |
688 | int rval; | 696 | int rval; |
@@ -699,30 +707,30 @@ qla2x00_issue_iocb_timeout(scsi_qla_host_t *ha, void *buffer, | |||
699 | mcp->in_mb = MBX_2|MBX_0; | 707 | mcp->in_mb = MBX_2|MBX_0; |
700 | mcp->tov = tov; | 708 | mcp->tov = tov; |
701 | mcp->flags = 0; | 709 | mcp->flags = 0; |
702 | rval = qla2x00_mailbox_command(ha, mcp); | 710 | rval = qla2x00_mailbox_command(vha, mcp); |
703 | 711 | ||
704 | if (rval != QLA_SUCCESS) { | 712 | if (rval != QLA_SUCCESS) { |
705 | /*EMPTY*/ | 713 | /*EMPTY*/ |
706 | DEBUG(printk("qla2x00_issue_iocb(%ld): failed rval 0x%x\n", | 714 | DEBUG(printk("qla2x00_issue_iocb(%ld): failed rval 0x%x\n", |
707 | ha->host_no, rval)); | 715 | vha->host_no, rval)); |
708 | DEBUG2(printk("qla2x00_issue_iocb(%ld): failed rval 0x%x\n", | 716 | DEBUG2(printk("qla2x00_issue_iocb(%ld): failed rval 0x%x\n", |
709 | ha->host_no, rval)); | 717 | vha->host_no, rval)); |
710 | } else { | 718 | } else { |
711 | sts_entry_t *sts_entry = (sts_entry_t *) buffer; | 719 | sts_entry_t *sts_entry = (sts_entry_t *) buffer; |
712 | 720 | ||
713 | /* Mask reserved bits. */ | 721 | /* Mask reserved bits. */ |
714 | sts_entry->entry_status &= | 722 | sts_entry->entry_status &= |
715 | IS_FWI2_CAPABLE(ha) ? RF_MASK_24XX :RF_MASK; | 723 | IS_FWI2_CAPABLE(vha->hw) ? RF_MASK_24XX : RF_MASK; |
716 | } | 724 | } |
717 | 725 | ||
718 | return rval; | 726 | return rval; |
719 | } | 727 | } |
720 | 728 | ||
721 | int | 729 | int |
722 | qla2x00_issue_iocb(scsi_qla_host_t *ha, void *buffer, dma_addr_t phys_addr, | 730 | qla2x00_issue_iocb(scsi_qla_host_t *vha, void *buffer, dma_addr_t phys_addr, |
723 | size_t size) | 731 | size_t size) |
724 | { | 732 | { |
725 | return qla2x00_issue_iocb_timeout(ha, buffer, phys_addr, size, | 733 | return qla2x00_issue_iocb_timeout(vha, buffer, phys_addr, size, |
726 | MBX_TOV_SECONDS); | 734 | MBX_TOV_SECONDS); |
727 | } | 735 | } |
728 | 736 | ||
@@ -741,7 +749,7 @@ qla2x00_issue_iocb(scsi_qla_host_t *ha, void *buffer, dma_addr_t phys_addr, | |||
741 | * Kernel context. | 749 | * Kernel context. |
742 | */ | 750 | */ |
743 | int | 751 | int |
744 | qla2x00_abort_command(scsi_qla_host_t *ha, srb_t *sp) | 752 | qla2x00_abort_command(scsi_qla_host_t *vha, srb_t *sp) |
745 | { | 753 | { |
746 | unsigned long flags = 0; | 754 | unsigned long flags = 0; |
747 | fc_port_t *fcport; | 755 | fc_port_t *fcport; |
@@ -749,14 +757,16 @@ qla2x00_abort_command(scsi_qla_host_t *ha, srb_t *sp) | |||
749 | uint32_t handle; | 757 | uint32_t handle; |
750 | mbx_cmd_t mc; | 758 | mbx_cmd_t mc; |
751 | mbx_cmd_t *mcp = &mc; | 759 | mbx_cmd_t *mcp = &mc; |
760 | struct qla_hw_data *ha = vha->hw; | ||
761 | struct req_que *req = ha->req; | ||
752 | 762 | ||
753 | DEBUG11(printk("qla2x00_abort_command(%ld): entered.\n", ha->host_no)); | 763 | DEBUG11(printk("qla2x00_abort_command(%ld): entered.\n", vha->host_no)); |
754 | 764 | ||
755 | fcport = sp->fcport; | 765 | fcport = sp->fcport; |
756 | 766 | ||
757 | spin_lock_irqsave(&ha->hardware_lock, flags); | 767 | spin_lock_irqsave(&ha->hardware_lock, flags); |
758 | for (handle = 1; handle < MAX_OUTSTANDING_COMMANDS; handle++) { | 768 | for (handle = 1; handle < MAX_OUTSTANDING_COMMANDS; handle++) { |
759 | if (ha->outstanding_cmds[handle] == sp) | 769 | if (req->outstanding_cmds[handle] == sp) |
760 | break; | 770 | break; |
761 | } | 771 | } |
762 | spin_unlock_irqrestore(&ha->hardware_lock, flags); | 772 | spin_unlock_irqrestore(&ha->hardware_lock, flags); |
@@ -778,14 +788,14 @@ qla2x00_abort_command(scsi_qla_host_t *ha, srb_t *sp) | |||
778 | mcp->in_mb = MBX_0; | 788 | mcp->in_mb = MBX_0; |
779 | mcp->tov = MBX_TOV_SECONDS; | 789 | mcp->tov = MBX_TOV_SECONDS; |
780 | mcp->flags = 0; | 790 | mcp->flags = 0; |
781 | rval = qla2x00_mailbox_command(ha, mcp); | 791 | rval = qla2x00_mailbox_command(vha, mcp); |
782 | 792 | ||
783 | if (rval != QLA_SUCCESS) { | 793 | if (rval != QLA_SUCCESS) { |
784 | DEBUG2_3_11(printk("qla2x00_abort_command(%ld): failed=%x.\n", | 794 | DEBUG2_3_11(printk("qla2x00_abort_command(%ld): failed=%x.\n", |
785 | ha->host_no, rval)); | 795 | vha->host_no, rval)); |
786 | } else { | 796 | } else { |
787 | DEBUG11(printk("qla2x00_abort_command(%ld): done.\n", | 797 | DEBUG11(printk("qla2x00_abort_command(%ld): done.\n", |
788 | ha->host_no)); | 798 | vha->host_no)); |
789 | } | 799 | } |
790 | 800 | ||
791 | return rval; | 801 | return rval; |
@@ -797,40 +807,40 @@ qla2x00_abort_target(struct fc_port *fcport, unsigned int l) | |||
797 | int rval, rval2; | 807 | int rval, rval2; |
798 | mbx_cmd_t mc; | 808 | mbx_cmd_t mc; |
799 | mbx_cmd_t *mcp = &mc; | 809 | mbx_cmd_t *mcp = &mc; |
800 | scsi_qla_host_t *ha; | 810 | scsi_qla_host_t *vha; |
801 | 811 | ||
802 | DEBUG11(printk("%s(%ld): entered.\n", __func__, fcport->ha->host_no)); | 812 | DEBUG11(printk("%s(%ld): entered.\n", __func__, fcport->vha->host_no)); |
803 | 813 | ||
804 | l = l; | 814 | l = l; |
805 | ha = fcport->ha; | 815 | vha = fcport->vha; |
806 | mcp->mb[0] = MBC_ABORT_TARGET; | 816 | mcp->mb[0] = MBC_ABORT_TARGET; |
807 | mcp->out_mb = MBX_9|MBX_2|MBX_1|MBX_0; | 817 | mcp->out_mb = MBX_9|MBX_2|MBX_1|MBX_0; |
808 | if (HAS_EXTENDED_IDS(ha)) { | 818 | if (HAS_EXTENDED_IDS(vha->hw)) { |
809 | mcp->mb[1] = fcport->loop_id; | 819 | mcp->mb[1] = fcport->loop_id; |
810 | mcp->mb[10] = 0; | 820 | mcp->mb[10] = 0; |
811 | mcp->out_mb |= MBX_10; | 821 | mcp->out_mb |= MBX_10; |
812 | } else { | 822 | } else { |
813 | mcp->mb[1] = fcport->loop_id << 8; | 823 | mcp->mb[1] = fcport->loop_id << 8; |
814 | } | 824 | } |
815 | mcp->mb[2] = ha->loop_reset_delay; | 825 | mcp->mb[2] = vha->hw->loop_reset_delay; |
816 | mcp->mb[9] = ha->vp_idx; | 826 | mcp->mb[9] = vha->vp_idx; |
817 | 827 | ||
818 | mcp->in_mb = MBX_0; | 828 | mcp->in_mb = MBX_0; |
819 | mcp->tov = MBX_TOV_SECONDS; | 829 | mcp->tov = MBX_TOV_SECONDS; |
820 | mcp->flags = 0; | 830 | mcp->flags = 0; |
821 | rval = qla2x00_mailbox_command(ha, mcp); | 831 | rval = qla2x00_mailbox_command(vha, mcp); |
822 | if (rval != QLA_SUCCESS) { | 832 | if (rval != QLA_SUCCESS) { |
823 | DEBUG2_3_11(printk("%s(%ld): failed=%x.\n", __func__, | 833 | DEBUG2_3_11(printk("%s(%ld): failed=%x.\n", __func__, |
824 | ha->host_no, rval)); | 834 | vha->host_no, rval)); |
825 | } | 835 | } |
826 | 836 | ||
827 | /* Issue marker IOCB. */ | 837 | /* Issue marker IOCB. */ |
828 | rval2 = qla2x00_marker(ha, fcport->loop_id, 0, MK_SYNC_ID); | 838 | rval2 = qla2x00_marker(vha, fcport->loop_id, 0, MK_SYNC_ID); |
829 | if (rval2 != QLA_SUCCESS) { | 839 | if (rval2 != QLA_SUCCESS) { |
830 | DEBUG2_3_11(printk("%s(%ld): failed to issue Marker IOCB " | 840 | DEBUG2_3_11(printk("%s(%ld): failed to issue Marker IOCB " |
831 | "(%x).\n", __func__, ha->host_no, rval2)); | 841 | "(%x).\n", __func__, vha->host_no, rval2)); |
832 | } else { | 842 | } else { |
833 | DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no)); | 843 | DEBUG11(printk("%s(%ld): done.\n", __func__, vha->host_no)); |
834 | } | 844 | } |
835 | 845 | ||
836 | return rval; | 846 | return rval; |
@@ -842,37 +852,37 @@ qla2x00_lun_reset(struct fc_port *fcport, unsigned int l) | |||
842 | int rval, rval2; | 852 | int rval, rval2; |
843 | mbx_cmd_t mc; | 853 | mbx_cmd_t mc; |
844 | mbx_cmd_t *mcp = &mc; | 854 | mbx_cmd_t *mcp = &mc; |
845 | scsi_qla_host_t *ha; | 855 | scsi_qla_host_t *vha; |
846 | 856 | ||
847 | DEBUG11(printk("%s(%ld): entered.\n", __func__, fcport->ha->host_no)); | 857 | DEBUG11(printk("%s(%ld): entered.\n", __func__, fcport->vha->host_no)); |
848 | 858 | ||
849 | ha = fcport->ha; | 859 | vha = fcport->vha; |
850 | mcp->mb[0] = MBC_LUN_RESET; | 860 | mcp->mb[0] = MBC_LUN_RESET; |
851 | mcp->out_mb = MBX_9|MBX_3|MBX_2|MBX_1|MBX_0; | 861 | mcp->out_mb = MBX_9|MBX_3|MBX_2|MBX_1|MBX_0; |
852 | if (HAS_EXTENDED_IDS(ha)) | 862 | if (HAS_EXTENDED_IDS(vha->hw)) |
853 | mcp->mb[1] = fcport->loop_id; | 863 | mcp->mb[1] = fcport->loop_id; |
854 | else | 864 | else |
855 | mcp->mb[1] = fcport->loop_id << 8; | 865 | mcp->mb[1] = fcport->loop_id << 8; |
856 | mcp->mb[2] = l; | 866 | mcp->mb[2] = l; |
857 | mcp->mb[3] = 0; | 867 | mcp->mb[3] = 0; |
858 | mcp->mb[9] = ha->vp_idx; | 868 | mcp->mb[9] = vha->vp_idx; |
859 | 869 | ||
860 | mcp->in_mb = MBX_0; | 870 | mcp->in_mb = MBX_0; |
861 | mcp->tov = MBX_TOV_SECONDS; | 871 | mcp->tov = MBX_TOV_SECONDS; |
862 | mcp->flags = 0; | 872 | mcp->flags = 0; |
863 | rval = qla2x00_mailbox_command(ha, mcp); | 873 | rval = qla2x00_mailbox_command(vha, mcp); |
864 | if (rval != QLA_SUCCESS) { | 874 | if (rval != QLA_SUCCESS) { |
865 | DEBUG2_3_11(printk("%s(%ld): failed=%x.\n", __func__, | 875 | DEBUG2_3_11(printk("%s(%ld): failed=%x.\n", __func__, |
866 | ha->host_no, rval)); | 876 | vha->host_no, rval)); |
867 | } | 877 | } |
868 | 878 | ||
869 | /* Issue marker IOCB. */ | 879 | /* Issue marker IOCB. */ |
870 | rval2 = qla2x00_marker(ha, fcport->loop_id, l, MK_SYNC_ID_LUN); | 880 | rval2 = qla2x00_marker(vha, fcport->loop_id, l, MK_SYNC_ID_LUN); |
871 | if (rval2 != QLA_SUCCESS) { | 881 | if (rval2 != QLA_SUCCESS) { |
872 | DEBUG2_3_11(printk("%s(%ld): failed to issue Marker IOCB " | 882 | DEBUG2_3_11(printk("%s(%ld): failed to issue Marker IOCB " |
873 | "(%x).\n", __func__, ha->host_no, rval2)); | 883 | "(%x).\n", __func__, vha->host_no, rval2)); |
874 | } else { | 884 | } else { |
875 | DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no)); | 885 | DEBUG11(printk("%s(%ld): done.\n", __func__, vha->host_no)); |
876 | } | 886 | } |
877 | 887 | ||
878 | return rval; | 888 | return rval; |
@@ -899,7 +909,7 @@ qla2x00_lun_reset(struct fc_port *fcport, unsigned int l) | |||
899 | * Kernel context. | 909 | * Kernel context. |
900 | */ | 910 | */ |
901 | int | 911 | int |
902 | qla2x00_get_adapter_id(scsi_qla_host_t *ha, uint16_t *id, uint8_t *al_pa, | 912 | qla2x00_get_adapter_id(scsi_qla_host_t *vha, uint16_t *id, uint8_t *al_pa, |
903 | uint8_t *area, uint8_t *domain, uint16_t *top, uint16_t *sw_cap) | 913 | uint8_t *area, uint8_t *domain, uint16_t *top, uint16_t *sw_cap) |
904 | { | 914 | { |
905 | int rval; | 915 | int rval; |
@@ -907,15 +917,15 @@ qla2x00_get_adapter_id(scsi_qla_host_t *ha, uint16_t *id, uint8_t *al_pa, | |||
907 | mbx_cmd_t *mcp = &mc; | 917 | mbx_cmd_t *mcp = &mc; |
908 | 918 | ||
909 | DEBUG11(printk("qla2x00_get_adapter_id(%ld): entered.\n", | 919 | DEBUG11(printk("qla2x00_get_adapter_id(%ld): entered.\n", |
910 | ha->host_no)); | 920 | vha->host_no)); |
911 | 921 | ||
912 | mcp->mb[0] = MBC_GET_ADAPTER_LOOP_ID; | 922 | mcp->mb[0] = MBC_GET_ADAPTER_LOOP_ID; |
913 | mcp->mb[9] = ha->vp_idx; | 923 | mcp->mb[9] = vha->vp_idx; |
914 | mcp->out_mb = MBX_9|MBX_0; | 924 | mcp->out_mb = MBX_9|MBX_0; |
915 | mcp->in_mb = MBX_9|MBX_7|MBX_6|MBX_3|MBX_2|MBX_1|MBX_0; | 925 | mcp->in_mb = MBX_9|MBX_7|MBX_6|MBX_3|MBX_2|MBX_1|MBX_0; |
916 | mcp->tov = MBX_TOV_SECONDS; | 926 | mcp->tov = MBX_TOV_SECONDS; |
917 | mcp->flags = 0; | 927 | mcp->flags = 0; |
918 | rval = qla2x00_mailbox_command(ha, mcp); | 928 | rval = qla2x00_mailbox_command(vha, mcp); |
919 | if (mcp->mb[0] == MBS_COMMAND_ERROR) | 929 | if (mcp->mb[0] == MBS_COMMAND_ERROR) |
920 | rval = QLA_COMMAND_ERROR; | 930 | rval = QLA_COMMAND_ERROR; |
921 | else if (mcp->mb[0] == MBS_INVALID_COMMAND) | 931 | else if (mcp->mb[0] == MBS_INVALID_COMMAND) |
@@ -932,11 +942,11 @@ qla2x00_get_adapter_id(scsi_qla_host_t *ha, uint16_t *id, uint8_t *al_pa, | |||
932 | if (rval != QLA_SUCCESS) { | 942 | if (rval != QLA_SUCCESS) { |
933 | /*EMPTY*/ | 943 | /*EMPTY*/ |
934 | DEBUG2_3_11(printk("qla2x00_get_adapter_id(%ld): failed=%x.\n", | 944 | DEBUG2_3_11(printk("qla2x00_get_adapter_id(%ld): failed=%x.\n", |
935 | ha->host_no, rval)); | 945 | vha->host_no, rval)); |
936 | } else { | 946 | } else { |
937 | /*EMPTY*/ | 947 | /*EMPTY*/ |
938 | DEBUG11(printk("qla2x00_get_adapter_id(%ld): done.\n", | 948 | DEBUG11(printk("qla2x00_get_adapter_id(%ld): done.\n", |
939 | ha->host_no)); | 949 | vha->host_no)); |
940 | } | 950 | } |
941 | 951 | ||
942 | return rval; | 952 | return rval; |
@@ -958,7 +968,7 @@ qla2x00_get_adapter_id(scsi_qla_host_t *ha, uint16_t *id, uint8_t *al_pa, | |||
958 | * Kernel context. | 968 | * Kernel context. |
959 | */ | 969 | */ |
960 | int | 970 | int |
961 | qla2x00_get_retry_cnt(scsi_qla_host_t *ha, uint8_t *retry_cnt, uint8_t *tov, | 971 | qla2x00_get_retry_cnt(scsi_qla_host_t *vha, uint8_t *retry_cnt, uint8_t *tov, |
962 | uint16_t *r_a_tov) | 972 | uint16_t *r_a_tov) |
963 | { | 973 | { |
964 | int rval; | 974 | int rval; |
@@ -967,19 +977,19 @@ qla2x00_get_retry_cnt(scsi_qla_host_t *ha, uint8_t *retry_cnt, uint8_t *tov, | |||
967 | mbx_cmd_t *mcp = &mc; | 977 | mbx_cmd_t *mcp = &mc; |
968 | 978 | ||
969 | DEBUG11(printk("qla2x00_get_retry_cnt(%ld): entered.\n", | 979 | DEBUG11(printk("qla2x00_get_retry_cnt(%ld): entered.\n", |
970 | ha->host_no)); | 980 | vha->host_no)); |
971 | 981 | ||
972 | mcp->mb[0] = MBC_GET_RETRY_COUNT; | 982 | mcp->mb[0] = MBC_GET_RETRY_COUNT; |
973 | mcp->out_mb = MBX_0; | 983 | mcp->out_mb = MBX_0; |
974 | mcp->in_mb = MBX_3|MBX_2|MBX_1|MBX_0; | 984 | mcp->in_mb = MBX_3|MBX_2|MBX_1|MBX_0; |
975 | mcp->tov = MBX_TOV_SECONDS; | 985 | mcp->tov = MBX_TOV_SECONDS; |
976 | mcp->flags = 0; | 986 | mcp->flags = 0; |
977 | rval = qla2x00_mailbox_command(ha, mcp); | 987 | rval = qla2x00_mailbox_command(vha, mcp); |
978 | 988 | ||
979 | if (rval != QLA_SUCCESS) { | 989 | if (rval != QLA_SUCCESS) { |
980 | /*EMPTY*/ | 990 | /*EMPTY*/ |
981 | DEBUG2_3_11(printk("qla2x00_get_retry_cnt(%ld): failed = %x.\n", | 991 | DEBUG2_3_11(printk("qla2x00_get_retry_cnt(%ld): failed = %x.\n", |
982 | ha->host_no, mcp->mb[0])); | 992 | vha->host_no, mcp->mb[0])); |
983 | } else { | 993 | } else { |
984 | /* Convert returned data and check our values. */ | 994 | /* Convert returned data and check our values. */ |
985 | *r_a_tov = mcp->mb[3] / 2; | 995 | *r_a_tov = mcp->mb[3] / 2; |
@@ -991,7 +1001,7 @@ qla2x00_get_retry_cnt(scsi_qla_host_t *ha, uint8_t *retry_cnt, uint8_t *tov, | |||
991 | } | 1001 | } |
992 | 1002 | ||
993 | DEBUG11(printk("qla2x00_get_retry_cnt(%ld): done. mb3=%d " | 1003 | DEBUG11(printk("qla2x00_get_retry_cnt(%ld): done. mb3=%d " |
994 | "ratov=%d.\n", ha->host_no, mcp->mb[3], ratov)); | 1004 | "ratov=%d.\n", vha->host_no, mcp->mb[3], ratov)); |
995 | } | 1005 | } |
996 | 1006 | ||
997 | return rval; | 1007 | return rval; |
@@ -1015,14 +1025,15 @@ qla2x00_get_retry_cnt(scsi_qla_host_t *ha, uint8_t *retry_cnt, uint8_t *tov, | |||
1015 | * Kernel context. | 1025 | * Kernel context. |
1016 | */ | 1026 | */ |
1017 | int | 1027 | int |
1018 | qla2x00_init_firmware(scsi_qla_host_t *ha, uint16_t size) | 1028 | qla2x00_init_firmware(scsi_qla_host_t *vha, uint16_t size) |
1019 | { | 1029 | { |
1020 | int rval; | 1030 | int rval; |
1021 | mbx_cmd_t mc; | 1031 | mbx_cmd_t mc; |
1022 | mbx_cmd_t *mcp = &mc; | 1032 | mbx_cmd_t *mcp = &mc; |
1033 | struct qla_hw_data *ha = vha->hw; | ||
1023 | 1034 | ||
1024 | DEBUG11(printk("qla2x00_init_firmware(%ld): entered.\n", | 1035 | DEBUG11(printk("qla2x00_init_firmware(%ld): entered.\n", |
1025 | ha->host_no)); | 1036 | vha->host_no)); |
1026 | 1037 | ||
1027 | if (ha->flags.npiv_supported) | 1038 | if (ha->flags.npiv_supported) |
1028 | mcp->mb[0] = MBC_MID_INITIALIZE_FIRMWARE; | 1039 | mcp->mb[0] = MBC_MID_INITIALIZE_FIRMWARE; |
@@ -1040,17 +1051,17 @@ qla2x00_init_firmware(scsi_qla_host_t *ha, uint16_t size) | |||
1040 | mcp->buf_size = size; | 1051 | mcp->buf_size = size; |
1041 | mcp->flags = MBX_DMA_OUT; | 1052 | mcp->flags = MBX_DMA_OUT; |
1042 | mcp->tov = MBX_TOV_SECONDS; | 1053 | mcp->tov = MBX_TOV_SECONDS; |
1043 | rval = qla2x00_mailbox_command(ha, mcp); | 1054 | rval = qla2x00_mailbox_command(vha, mcp); |
1044 | 1055 | ||
1045 | if (rval != QLA_SUCCESS) { | 1056 | if (rval != QLA_SUCCESS) { |
1046 | /*EMPTY*/ | 1057 | /*EMPTY*/ |
1047 | DEBUG2_3_11(printk("qla2x00_init_firmware(%ld): failed=%x " | 1058 | DEBUG2_3_11(printk("qla2x00_init_firmware(%ld): failed=%x " |
1048 | "mb0=%x.\n", | 1059 | "mb0=%x.\n", |
1049 | ha->host_no, rval, mcp->mb[0])); | 1060 | vha->host_no, rval, mcp->mb[0])); |
1050 | } else { | 1061 | } else { |
1051 | /*EMPTY*/ | 1062 | /*EMPTY*/ |
1052 | DEBUG11(printk("qla2x00_init_firmware(%ld): done.\n", | 1063 | DEBUG11(printk("qla2x00_init_firmware(%ld): done.\n", |
1053 | ha->host_no)); | 1064 | vha->host_no)); |
1054 | } | 1065 | } |
1055 | 1066 | ||
1056 | return rval; | 1067 | return rval; |
@@ -1073,7 +1084,7 @@ qla2x00_init_firmware(scsi_qla_host_t *ha, uint16_t size) | |||
1073 | * Kernel context. | 1084 | * Kernel context. |
1074 | */ | 1085 | */ |
1075 | int | 1086 | int |
1076 | qla2x00_get_port_database(scsi_qla_host_t *ha, fc_port_t *fcport, uint8_t opt) | 1087 | qla2x00_get_port_database(scsi_qla_host_t *vha, fc_port_t *fcport, uint8_t opt) |
1077 | { | 1088 | { |
1078 | int rval; | 1089 | int rval; |
1079 | mbx_cmd_t mc; | 1090 | mbx_cmd_t mc; |
@@ -1081,14 +1092,15 @@ qla2x00_get_port_database(scsi_qla_host_t *ha, fc_port_t *fcport, uint8_t opt) | |||
1081 | port_database_t *pd; | 1092 | port_database_t *pd; |
1082 | struct port_database_24xx *pd24; | 1093 | struct port_database_24xx *pd24; |
1083 | dma_addr_t pd_dma; | 1094 | dma_addr_t pd_dma; |
1095 | struct qla_hw_data *ha = vha->hw; | ||
1084 | 1096 | ||
1085 | DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no)); | 1097 | DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no)); |
1086 | 1098 | ||
1087 | pd24 = NULL; | 1099 | pd24 = NULL; |
1088 | pd = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &pd_dma); | 1100 | pd = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &pd_dma); |
1089 | if (pd == NULL) { | 1101 | if (pd == NULL) { |
1090 | DEBUG2_3(printk("%s(%ld): failed to allocate Port Database " | 1102 | DEBUG2_3(printk("%s(%ld): failed to allocate Port Database " |
1091 | "structure.\n", __func__, ha->host_no)); | 1103 | "structure.\n", __func__, vha->host_no)); |
1092 | return QLA_MEMORY_ALLOC_FAILED; | 1104 | return QLA_MEMORY_ALLOC_FAILED; |
1093 | } | 1105 | } |
1094 | memset(pd, 0, max(PORT_DATABASE_SIZE, PORT_DATABASE_24XX_SIZE)); | 1106 | memset(pd, 0, max(PORT_DATABASE_SIZE, PORT_DATABASE_24XX_SIZE)); |
@@ -1100,7 +1112,7 @@ qla2x00_get_port_database(scsi_qla_host_t *ha, fc_port_t *fcport, uint8_t opt) | |||
1100 | mcp->mb[3] = LSW(pd_dma); | 1112 | mcp->mb[3] = LSW(pd_dma); |
1101 | mcp->mb[6] = MSW(MSD(pd_dma)); | 1113 | mcp->mb[6] = MSW(MSD(pd_dma)); |
1102 | mcp->mb[7] = LSW(MSD(pd_dma)); | 1114 | mcp->mb[7] = LSW(MSD(pd_dma)); |
1103 | mcp->mb[9] = ha->vp_idx; | 1115 | mcp->mb[9] = vha->vp_idx; |
1104 | mcp->out_mb = MBX_9|MBX_7|MBX_6|MBX_3|MBX_2|MBX_0; | 1116 | mcp->out_mb = MBX_9|MBX_7|MBX_6|MBX_3|MBX_2|MBX_0; |
1105 | mcp->in_mb = MBX_0; | 1117 | mcp->in_mb = MBX_0; |
1106 | if (IS_FWI2_CAPABLE(ha)) { | 1118 | if (IS_FWI2_CAPABLE(ha)) { |
@@ -1120,7 +1132,7 @@ qla2x00_get_port_database(scsi_qla_host_t *ha, fc_port_t *fcport, uint8_t opt) | |||
1120 | PORT_DATABASE_24XX_SIZE : PORT_DATABASE_SIZE; | 1132 | PORT_DATABASE_24XX_SIZE : PORT_DATABASE_SIZE; |
1121 | mcp->flags = MBX_DMA_IN; | 1133 | mcp->flags = MBX_DMA_IN; |
1122 | mcp->tov = (ha->login_timeout * 2) + (ha->login_timeout / 2); | 1134 | mcp->tov = (ha->login_timeout * 2) + (ha->login_timeout / 2); |
1123 | rval = qla2x00_mailbox_command(ha, mcp); | 1135 | rval = qla2x00_mailbox_command(vha, mcp); |
1124 | if (rval != QLA_SUCCESS) | 1136 | if (rval != QLA_SUCCESS) |
1125 | goto gpd_error_out; | 1137 | goto gpd_error_out; |
1126 | 1138 | ||
@@ -1132,7 +1144,7 @@ qla2x00_get_port_database(scsi_qla_host_t *ha, fc_port_t *fcport, uint8_t opt) | |||
1132 | pd24->last_login_state != PDS_PRLI_COMPLETE) { | 1144 | pd24->last_login_state != PDS_PRLI_COMPLETE) { |
1133 | DEBUG2(printk("%s(%ld): Unable to verify " | 1145 | DEBUG2(printk("%s(%ld): Unable to verify " |
1134 | "login-state (%x/%x) for loop_id %x\n", | 1146 | "login-state (%x/%x) for loop_id %x\n", |
1135 | __func__, ha->host_no, | 1147 | __func__, vha->host_no, |
1136 | pd24->current_login_state, | 1148 | pd24->current_login_state, |
1137 | pd24->last_login_state, fcport->loop_id)); | 1149 | pd24->last_login_state, fcport->loop_id)); |
1138 | rval = QLA_FUNCTION_FAILED; | 1150 | rval = QLA_FUNCTION_FAILED; |
@@ -1192,9 +1204,9 @@ gpd_error_out: | |||
1192 | 1204 | ||
1193 | if (rval != QLA_SUCCESS) { | 1205 | if (rval != QLA_SUCCESS) { |
1194 | DEBUG2_3_11(printk("%s(%ld): failed=%x mb[0]=%x mb[1]=%x.\n", | 1206 | DEBUG2_3_11(printk("%s(%ld): failed=%x mb[0]=%x mb[1]=%x.\n", |
1195 | __func__, ha->host_no, rval, mcp->mb[0], mcp->mb[1])); | 1207 | __func__, vha->host_no, rval, mcp->mb[0], mcp->mb[1])); |
1196 | } else { | 1208 | } else { |
1197 | DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no)); | 1209 | DEBUG11(printk("%s(%ld): done.\n", __func__, vha->host_no)); |
1198 | } | 1210 | } |
1199 | 1211 | ||
1200 | return rval; | 1212 | return rval; |
@@ -1217,21 +1229,21 @@ gpd_error_out: | |||
1217 | * Kernel context. | 1229 | * Kernel context. |
1218 | */ | 1230 | */ |
1219 | int | 1231 | int |
1220 | qla2x00_get_firmware_state(scsi_qla_host_t *ha, uint16_t *states) | 1232 | qla2x00_get_firmware_state(scsi_qla_host_t *vha, uint16_t *states) |
1221 | { | 1233 | { |
1222 | int rval; | 1234 | int rval; |
1223 | mbx_cmd_t mc; | 1235 | mbx_cmd_t mc; |
1224 | mbx_cmd_t *mcp = &mc; | 1236 | mbx_cmd_t *mcp = &mc; |
1225 | 1237 | ||
1226 | DEBUG11(printk("qla2x00_get_firmware_state(%ld): entered.\n", | 1238 | DEBUG11(printk("qla2x00_get_firmware_state(%ld): entered.\n", |
1227 | ha->host_no)); | 1239 | vha->host_no)); |
1228 | 1240 | ||
1229 | mcp->mb[0] = MBC_GET_FIRMWARE_STATE; | 1241 | mcp->mb[0] = MBC_GET_FIRMWARE_STATE; |
1230 | mcp->out_mb = MBX_0; | 1242 | mcp->out_mb = MBX_0; |
1231 | mcp->in_mb = MBX_3|MBX_2|MBX_1|MBX_0; | 1243 | mcp->in_mb = MBX_3|MBX_2|MBX_1|MBX_0; |
1232 | mcp->tov = MBX_TOV_SECONDS; | 1244 | mcp->tov = MBX_TOV_SECONDS; |
1233 | mcp->flags = 0; | 1245 | mcp->flags = 0; |
1234 | rval = qla2x00_mailbox_command(ha, mcp); | 1246 | rval = qla2x00_mailbox_command(vha, mcp); |
1235 | 1247 | ||
1236 | /* Return firmware states. */ | 1248 | /* Return firmware states. */ |
1237 | states[0] = mcp->mb[1]; | 1249 | states[0] = mcp->mb[1]; |
@@ -1241,11 +1253,11 @@ qla2x00_get_firmware_state(scsi_qla_host_t *ha, uint16_t *states) | |||
1241 | if (rval != QLA_SUCCESS) { | 1253 | if (rval != QLA_SUCCESS) { |
1242 | /*EMPTY*/ | 1254 | /*EMPTY*/ |
1243 | DEBUG2_3_11(printk("qla2x00_get_firmware_state(%ld): " | 1255 | DEBUG2_3_11(printk("qla2x00_get_firmware_state(%ld): " |
1244 | "failed=%x.\n", ha->host_no, rval)); | 1256 | "failed=%x.\n", vha->host_no, rval)); |
1245 | } else { | 1257 | } else { |
1246 | /*EMPTY*/ | 1258 | /*EMPTY*/ |
1247 | DEBUG11(printk("qla2x00_get_firmware_state(%ld): done.\n", | 1259 | DEBUG11(printk("qla2x00_get_firmware_state(%ld): done.\n", |
1248 | ha->host_no)); | 1260 | vha->host_no)); |
1249 | } | 1261 | } |
1250 | 1262 | ||
1251 | return rval; | 1263 | return rval; |
@@ -1270,7 +1282,7 @@ qla2x00_get_firmware_state(scsi_qla_host_t *ha, uint16_t *states) | |||
1270 | * Kernel context. | 1282 | * Kernel context. |
1271 | */ | 1283 | */ |
1272 | int | 1284 | int |
1273 | qla2x00_get_port_name(scsi_qla_host_t *ha, uint16_t loop_id, uint8_t *name, | 1285 | qla2x00_get_port_name(scsi_qla_host_t *vha, uint16_t loop_id, uint8_t *name, |
1274 | uint8_t opt) | 1286 | uint8_t opt) |
1275 | { | 1287 | { |
1276 | int rval; | 1288 | int rval; |
@@ -1278,12 +1290,12 @@ qla2x00_get_port_name(scsi_qla_host_t *ha, uint16_t loop_id, uint8_t *name, | |||
1278 | mbx_cmd_t *mcp = &mc; | 1290 | mbx_cmd_t *mcp = &mc; |
1279 | 1291 | ||
1280 | DEBUG11(printk("qla2x00_get_port_name(%ld): entered.\n", | 1292 | DEBUG11(printk("qla2x00_get_port_name(%ld): entered.\n", |
1281 | ha->host_no)); | 1293 | vha->host_no)); |
1282 | 1294 | ||
1283 | mcp->mb[0] = MBC_GET_PORT_NAME; | 1295 | mcp->mb[0] = MBC_GET_PORT_NAME; |
1284 | mcp->mb[9] = ha->vp_idx; | 1296 | mcp->mb[9] = vha->vp_idx; |
1285 | mcp->out_mb = MBX_9|MBX_1|MBX_0; | 1297 | mcp->out_mb = MBX_9|MBX_1|MBX_0; |
1286 | if (HAS_EXTENDED_IDS(ha)) { | 1298 | if (HAS_EXTENDED_IDS(vha->hw)) { |
1287 | mcp->mb[1] = loop_id; | 1299 | mcp->mb[1] = loop_id; |
1288 | mcp->mb[10] = opt; | 1300 | mcp->mb[10] = opt; |
1289 | mcp->out_mb |= MBX_10; | 1301 | mcp->out_mb |= MBX_10; |
@@ -1294,12 +1306,12 @@ qla2x00_get_port_name(scsi_qla_host_t *ha, uint16_t loop_id, uint8_t *name, | |||
1294 | mcp->in_mb = MBX_7|MBX_6|MBX_3|MBX_2|MBX_1|MBX_0; | 1306 | mcp->in_mb = MBX_7|MBX_6|MBX_3|MBX_2|MBX_1|MBX_0; |
1295 | mcp->tov = MBX_TOV_SECONDS; | 1307 | mcp->tov = MBX_TOV_SECONDS; |
1296 | mcp->flags = 0; | 1308 | mcp->flags = 0; |
1297 | rval = qla2x00_mailbox_command(ha, mcp); | 1309 | rval = qla2x00_mailbox_command(vha, mcp); |
1298 | 1310 | ||
1299 | if (rval != QLA_SUCCESS) { | 1311 | if (rval != QLA_SUCCESS) { |
1300 | /*EMPTY*/ | 1312 | /*EMPTY*/ |
1301 | DEBUG2_3_11(printk("qla2x00_get_port_name(%ld): failed=%x.\n", | 1313 | DEBUG2_3_11(printk("qla2x00_get_port_name(%ld): failed=%x.\n", |
1302 | ha->host_no, rval)); | 1314 | vha->host_no, rval)); |
1303 | } else { | 1315 | } else { |
1304 | if (name != NULL) { | 1316 | if (name != NULL) { |
1305 | /* This function returns name in big endian. */ | 1317 | /* This function returns name in big endian. */ |
@@ -1314,7 +1326,7 @@ qla2x00_get_port_name(scsi_qla_host_t *ha, uint16_t loop_id, uint8_t *name, | |||
1314 | } | 1326 | } |
1315 | 1327 | ||
1316 | DEBUG11(printk("qla2x00_get_port_name(%ld): done.\n", | 1328 | DEBUG11(printk("qla2x00_get_port_name(%ld): done.\n", |
1317 | ha->host_no)); | 1329 | vha->host_no)); |
1318 | } | 1330 | } |
1319 | 1331 | ||
1320 | return rval; | 1332 | return rval; |
@@ -1336,45 +1348,45 @@ qla2x00_get_port_name(scsi_qla_host_t *ha, uint16_t loop_id, uint8_t *name, | |||
1336 | * Kernel context. | 1348 | * Kernel context. |
1337 | */ | 1349 | */ |
1338 | int | 1350 | int |
1339 | qla2x00_lip_reset(scsi_qla_host_t *ha) | 1351 | qla2x00_lip_reset(scsi_qla_host_t *vha) |
1340 | { | 1352 | { |
1341 | int rval; | 1353 | int rval; |
1342 | mbx_cmd_t mc; | 1354 | mbx_cmd_t mc; |
1343 | mbx_cmd_t *mcp = &mc; | 1355 | mbx_cmd_t *mcp = &mc; |
1344 | 1356 | ||
1345 | DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no)); | 1357 | DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no)); |
1346 | 1358 | ||
1347 | if (IS_FWI2_CAPABLE(ha)) { | 1359 | if (IS_FWI2_CAPABLE(vha->hw)) { |
1348 | mcp->mb[0] = MBC_LIP_FULL_LOGIN; | 1360 | mcp->mb[0] = MBC_LIP_FULL_LOGIN; |
1349 | mcp->mb[1] = BIT_6; | 1361 | mcp->mb[1] = BIT_6; |
1350 | mcp->mb[2] = 0; | 1362 | mcp->mb[2] = 0; |
1351 | mcp->mb[3] = ha->loop_reset_delay; | 1363 | mcp->mb[3] = vha->hw->loop_reset_delay; |
1352 | mcp->out_mb = MBX_3|MBX_2|MBX_1|MBX_0; | 1364 | mcp->out_mb = MBX_3|MBX_2|MBX_1|MBX_0; |
1353 | } else { | 1365 | } else { |
1354 | mcp->mb[0] = MBC_LIP_RESET; | 1366 | mcp->mb[0] = MBC_LIP_RESET; |
1355 | mcp->out_mb = MBX_3|MBX_2|MBX_1|MBX_0; | 1367 | mcp->out_mb = MBX_3|MBX_2|MBX_1|MBX_0; |
1356 | if (HAS_EXTENDED_IDS(ha)) { | 1368 | if (HAS_EXTENDED_IDS(vha->hw)) { |
1357 | mcp->mb[1] = 0x00ff; | 1369 | mcp->mb[1] = 0x00ff; |
1358 | mcp->mb[10] = 0; | 1370 | mcp->mb[10] = 0; |
1359 | mcp->out_mb |= MBX_10; | 1371 | mcp->out_mb |= MBX_10; |
1360 | } else { | 1372 | } else { |
1361 | mcp->mb[1] = 0xff00; | 1373 | mcp->mb[1] = 0xff00; |
1362 | } | 1374 | } |
1363 | mcp->mb[2] = ha->loop_reset_delay; | 1375 | mcp->mb[2] = vha->hw->loop_reset_delay; |
1364 | mcp->mb[3] = 0; | 1376 | mcp->mb[3] = 0; |
1365 | } | 1377 | } |
1366 | mcp->in_mb = MBX_0; | 1378 | mcp->in_mb = MBX_0; |
1367 | mcp->tov = MBX_TOV_SECONDS; | 1379 | mcp->tov = MBX_TOV_SECONDS; |
1368 | mcp->flags = 0; | 1380 | mcp->flags = 0; |
1369 | rval = qla2x00_mailbox_command(ha, mcp); | 1381 | rval = qla2x00_mailbox_command(vha, mcp); |
1370 | 1382 | ||
1371 | if (rval != QLA_SUCCESS) { | 1383 | if (rval != QLA_SUCCESS) { |
1372 | /*EMPTY*/ | 1384 | /*EMPTY*/ |
1373 | DEBUG2_3_11(printk("%s(%ld): failed=%x.\n", | 1385 | DEBUG2_3_11(printk("%s(%ld): failed=%x.\n", |
1374 | __func__, ha->host_no, rval)); | 1386 | __func__, vha->host_no, rval)); |
1375 | } else { | 1387 | } else { |
1376 | /*EMPTY*/ | 1388 | /*EMPTY*/ |
1377 | DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no)); | 1389 | DEBUG11(printk("%s(%ld): done.\n", __func__, vha->host_no)); |
1378 | } | 1390 | } |
1379 | 1391 | ||
1380 | return rval; | 1392 | return rval; |
@@ -1399,7 +1411,7 @@ qla2x00_lip_reset(scsi_qla_host_t *ha) | |||
1399 | * Kernel context. | 1411 | * Kernel context. |
1400 | */ | 1412 | */ |
1401 | int | 1413 | int |
1402 | qla2x00_send_sns(scsi_qla_host_t *ha, dma_addr_t sns_phys_address, | 1414 | qla2x00_send_sns(scsi_qla_host_t *vha, dma_addr_t sns_phys_address, |
1403 | uint16_t cmd_size, size_t buf_size) | 1415 | uint16_t cmd_size, size_t buf_size) |
1404 | { | 1416 | { |
1405 | int rval; | 1417 | int rval; |
@@ -1407,10 +1419,11 @@ qla2x00_send_sns(scsi_qla_host_t *ha, dma_addr_t sns_phys_address, | |||
1407 | mbx_cmd_t *mcp = &mc; | 1419 | mbx_cmd_t *mcp = &mc; |
1408 | 1420 | ||
1409 | DEBUG11(printk("qla2x00_send_sns(%ld): entered.\n", | 1421 | DEBUG11(printk("qla2x00_send_sns(%ld): entered.\n", |
1410 | ha->host_no)); | 1422 | vha->host_no)); |
1411 | 1423 | ||
1412 | DEBUG11(printk("qla2x00_send_sns: retry cnt=%d ratov=%d total " | 1424 | DEBUG11(printk("qla2x00_send_sns: retry cnt=%d ratov=%d total " |
1413 | "tov=%d.\n", ha->retry_count, ha->login_timeout, mcp->tov)); | 1425 | "tov=%d.\n", vha->hw->retry_count, vha->hw->login_timeout, |
1426 | mcp->tov)); | ||
1414 | 1427 | ||
1415 | mcp->mb[0] = MBC_SEND_SNS_COMMAND; | 1428 | mcp->mb[0] = MBC_SEND_SNS_COMMAND; |
1416 | mcp->mb[1] = cmd_size; | 1429 | mcp->mb[1] = cmd_size; |
@@ -1422,25 +1435,25 @@ qla2x00_send_sns(scsi_qla_host_t *ha, dma_addr_t sns_phys_address, | |||
1422 | mcp->in_mb = MBX_0|MBX_1; | 1435 | mcp->in_mb = MBX_0|MBX_1; |
1423 | mcp->buf_size = buf_size; | 1436 | mcp->buf_size = buf_size; |
1424 | mcp->flags = MBX_DMA_OUT|MBX_DMA_IN; | 1437 | mcp->flags = MBX_DMA_OUT|MBX_DMA_IN; |
1425 | mcp->tov = (ha->login_timeout * 2) + (ha->login_timeout / 2); | 1438 | mcp->tov = (vha->hw->login_timeout * 2) + (vha->hw->login_timeout / 2); |
1426 | rval = qla2x00_mailbox_command(ha, mcp); | 1439 | rval = qla2x00_mailbox_command(vha, mcp); |
1427 | 1440 | ||
1428 | if (rval != QLA_SUCCESS) { | 1441 | if (rval != QLA_SUCCESS) { |
1429 | /*EMPTY*/ | 1442 | /*EMPTY*/ |
1430 | DEBUG(printk("qla2x00_send_sns(%ld): failed=%x mb[0]=%x " | 1443 | DEBUG(printk("qla2x00_send_sns(%ld): failed=%x mb[0]=%x " |
1431 | "mb[1]=%x.\n", ha->host_no, rval, mcp->mb[0], mcp->mb[1])); | 1444 | "mb[1]=%x.\n", vha->host_no, rval, mcp->mb[0], mcp->mb[1])); |
1432 | DEBUG2_3_11(printk("qla2x00_send_sns(%ld): failed=%x mb[0]=%x " | 1445 | DEBUG2_3_11(printk("qla2x00_send_sns(%ld): failed=%x mb[0]=%x " |
1433 | "mb[1]=%x.\n", ha->host_no, rval, mcp->mb[0], mcp->mb[1])); | 1446 | "mb[1]=%x.\n", vha->host_no, rval, mcp->mb[0], mcp->mb[1])); |
1434 | } else { | 1447 | } else { |
1435 | /*EMPTY*/ | 1448 | /*EMPTY*/ |
1436 | DEBUG11(printk("qla2x00_send_sns(%ld): done.\n", ha->host_no)); | 1449 | DEBUG11(printk("qla2x00_send_sns(%ld): done.\n", vha->host_no)); |
1437 | } | 1450 | } |
1438 | 1451 | ||
1439 | return rval; | 1452 | return rval; |
1440 | } | 1453 | } |
1441 | 1454 | ||
1442 | int | 1455 | int |
1443 | qla24xx_login_fabric(scsi_qla_host_t *ha, uint16_t loop_id, uint8_t domain, | 1456 | qla24xx_login_fabric(scsi_qla_host_t *vha, uint16_t loop_id, uint8_t domain, |
1444 | uint8_t area, uint8_t al_pa, uint16_t *mb, uint8_t opt) | 1457 | uint8_t area, uint8_t al_pa, uint16_t *mb, uint8_t opt) |
1445 | { | 1458 | { |
1446 | int rval; | 1459 | int rval; |
@@ -1448,13 +1461,14 @@ qla24xx_login_fabric(scsi_qla_host_t *ha, uint16_t loop_id, uint8_t domain, | |||
1448 | struct logio_entry_24xx *lg; | 1461 | struct logio_entry_24xx *lg; |
1449 | dma_addr_t lg_dma; | 1462 | dma_addr_t lg_dma; |
1450 | uint32_t iop[2]; | 1463 | uint32_t iop[2]; |
1464 | struct qla_hw_data *ha = vha->hw; | ||
1451 | 1465 | ||
1452 | DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no)); | 1466 | DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no)); |
1453 | 1467 | ||
1454 | lg = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &lg_dma); | 1468 | lg = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &lg_dma); |
1455 | if (lg == NULL) { | 1469 | if (lg == NULL) { |
1456 | DEBUG2_3(printk("%s(%ld): failed to allocate Login IOCB.\n", | 1470 | DEBUG2_3(printk("%s(%ld): failed to allocate Login IOCB.\n", |
1457 | __func__, ha->host_no)); | 1471 | __func__, vha->host_no)); |
1458 | return QLA_MEMORY_ALLOC_FAILED; | 1472 | return QLA_MEMORY_ALLOC_FAILED; |
1459 | } | 1473 | } |
1460 | memset(lg, 0, sizeof(struct logio_entry_24xx)); | 1474 | memset(lg, 0, sizeof(struct logio_entry_24xx)); |
@@ -1470,14 +1484,14 @@ qla24xx_login_fabric(scsi_qla_host_t *ha, uint16_t loop_id, uint8_t domain, | |||
1470 | lg->port_id[0] = al_pa; | 1484 | lg->port_id[0] = al_pa; |
1471 | lg->port_id[1] = area; | 1485 | lg->port_id[1] = area; |
1472 | lg->port_id[2] = domain; | 1486 | lg->port_id[2] = domain; |
1473 | lg->vp_index = ha->vp_idx; | 1487 | lg->vp_index = vha->vp_idx; |
1474 | rval = qla2x00_issue_iocb(ha, lg, lg_dma, 0); | 1488 | rval = qla2x00_issue_iocb(vha, lg, lg_dma, 0); |
1475 | if (rval != QLA_SUCCESS) { | 1489 | if (rval != QLA_SUCCESS) { |
1476 | DEBUG2_3_11(printk("%s(%ld): failed to issue Login IOCB " | 1490 | DEBUG2_3_11(printk("%s(%ld): failed to issue Login IOCB " |
1477 | "(%x).\n", __func__, ha->host_no, rval)); | 1491 | "(%x).\n", __func__, vha->host_no, rval)); |
1478 | } else if (lg->entry_status != 0) { | 1492 | } else if (lg->entry_status != 0) { |
1479 | DEBUG2_3_11(printk("%s(%ld): failed to complete IOCB " | 1493 | DEBUG2_3_11(printk("%s(%ld): failed to complete IOCB " |
1480 | "-- error status (%x).\n", __func__, ha->host_no, | 1494 | "-- error status (%x).\n", __func__, vha->host_no, |
1481 | lg->entry_status)); | 1495 | lg->entry_status)); |
1482 | rval = QLA_FUNCTION_FAILED; | 1496 | rval = QLA_FUNCTION_FAILED; |
1483 | } else if (lg->comp_status != __constant_cpu_to_le16(CS_COMPLETE)) { | 1497 | } else if (lg->comp_status != __constant_cpu_to_le16(CS_COMPLETE)) { |
@@ -1486,7 +1500,7 @@ qla24xx_login_fabric(scsi_qla_host_t *ha, uint16_t loop_id, uint8_t domain, | |||
1486 | 1500 | ||
1487 | DEBUG2_3_11(printk("%s(%ld): failed to complete IOCB " | 1501 | DEBUG2_3_11(printk("%s(%ld): failed to complete IOCB " |
1488 | "-- completion status (%x) ioparam=%x/%x.\n", __func__, | 1502 | "-- completion status (%x) ioparam=%x/%x.\n", __func__, |
1489 | ha->host_no, le16_to_cpu(lg->comp_status), iop[0], | 1503 | vha->host_no, le16_to_cpu(lg->comp_status), iop[0], |
1490 | iop[1])); | 1504 | iop[1])); |
1491 | 1505 | ||
1492 | switch (iop[0]) { | 1506 | switch (iop[0]) { |
@@ -1515,7 +1529,7 @@ qla24xx_login_fabric(scsi_qla_host_t *ha, uint16_t loop_id, uint8_t domain, | |||
1515 | break; | 1529 | break; |
1516 | } | 1530 | } |
1517 | } else { | 1531 | } else { |
1518 | DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no)); | 1532 | DEBUG11(printk("%s(%ld): done.\n", __func__, vha->host_no)); |
1519 | 1533 | ||
1520 | iop[0] = le32_to_cpu(lg->io_parameter[0]); | 1534 | iop[0] = le32_to_cpu(lg->io_parameter[0]); |
1521 | 1535 | ||
@@ -1562,14 +1576,15 @@ qla24xx_login_fabric(scsi_qla_host_t *ha, uint16_t loop_id, uint8_t domain, | |||
1562 | * Kernel context. | 1576 | * Kernel context. |
1563 | */ | 1577 | */ |
1564 | int | 1578 | int |
1565 | qla2x00_login_fabric(scsi_qla_host_t *ha, uint16_t loop_id, uint8_t domain, | 1579 | qla2x00_login_fabric(scsi_qla_host_t *vha, uint16_t loop_id, uint8_t domain, |
1566 | uint8_t area, uint8_t al_pa, uint16_t *mb, uint8_t opt) | 1580 | uint8_t area, uint8_t al_pa, uint16_t *mb, uint8_t opt) |
1567 | { | 1581 | { |
1568 | int rval; | 1582 | int rval; |
1569 | mbx_cmd_t mc; | 1583 | mbx_cmd_t mc; |
1570 | mbx_cmd_t *mcp = &mc; | 1584 | mbx_cmd_t *mcp = &mc; |
1585 | struct qla_hw_data *ha = vha->hw; | ||
1571 | 1586 | ||
1572 | DEBUG11(printk("qla2x00_login_fabric(%ld): entered.\n", ha->host_no)); | 1587 | DEBUG11(printk("qla2x00_login_fabric(%ld): entered.\n", vha->host_no)); |
1573 | 1588 | ||
1574 | mcp->mb[0] = MBC_LOGIN_FABRIC_PORT; | 1589 | mcp->mb[0] = MBC_LOGIN_FABRIC_PORT; |
1575 | mcp->out_mb = MBX_3|MBX_2|MBX_1|MBX_0; | 1590 | mcp->out_mb = MBX_3|MBX_2|MBX_1|MBX_0; |
@@ -1586,7 +1601,7 @@ qla2x00_login_fabric(scsi_qla_host_t *ha, uint16_t loop_id, uint8_t domain, | |||
1586 | mcp->in_mb = MBX_7|MBX_6|MBX_2|MBX_1|MBX_0; | 1601 | mcp->in_mb = MBX_7|MBX_6|MBX_2|MBX_1|MBX_0; |
1587 | mcp->tov = (ha->login_timeout * 2) + (ha->login_timeout / 2); | 1602 | mcp->tov = (ha->login_timeout * 2) + (ha->login_timeout / 2); |
1588 | mcp->flags = 0; | 1603 | mcp->flags = 0; |
1589 | rval = qla2x00_mailbox_command(ha, mcp); | 1604 | rval = qla2x00_mailbox_command(vha, mcp); |
1590 | 1605 | ||
1591 | /* Return mailbox statuses. */ | 1606 | /* Return mailbox statuses. */ |
1592 | if (mb != NULL) { | 1607 | if (mb != NULL) { |
@@ -1613,12 +1628,12 @@ qla2x00_login_fabric(scsi_qla_host_t *ha, uint16_t loop_id, uint8_t domain, | |||
1613 | 1628 | ||
1614 | /*EMPTY*/ | 1629 | /*EMPTY*/ |
1615 | DEBUG2_3_11(printk("qla2x00_login_fabric(%ld): failed=%x " | 1630 | DEBUG2_3_11(printk("qla2x00_login_fabric(%ld): failed=%x " |
1616 | "mb[0]=%x mb[1]=%x mb[2]=%x.\n", ha->host_no, rval, | 1631 | "mb[0]=%x mb[1]=%x mb[2]=%x.\n", vha->host_no, rval, |
1617 | mcp->mb[0], mcp->mb[1], mcp->mb[2])); | 1632 | mcp->mb[0], mcp->mb[1], mcp->mb[2])); |
1618 | } else { | 1633 | } else { |
1619 | /*EMPTY*/ | 1634 | /*EMPTY*/ |
1620 | DEBUG11(printk("qla2x00_login_fabric(%ld): done.\n", | 1635 | DEBUG11(printk("qla2x00_login_fabric(%ld): done.\n", |
1621 | ha->host_no)); | 1636 | vha->host_no)); |
1622 | } | 1637 | } |
1623 | 1638 | ||
1624 | return rval; | 1639 | return rval; |
@@ -1641,19 +1656,20 @@ qla2x00_login_fabric(scsi_qla_host_t *ha, uint16_t loop_id, uint8_t domain, | |||
1641 | * | 1656 | * |
1642 | */ | 1657 | */ |
1643 | int | 1658 | int |
1644 | qla2x00_login_local_device(scsi_qla_host_t *ha, fc_port_t *fcport, | 1659 | qla2x00_login_local_device(scsi_qla_host_t *vha, fc_port_t *fcport, |
1645 | uint16_t *mb_ret, uint8_t opt) | 1660 | uint16_t *mb_ret, uint8_t opt) |
1646 | { | 1661 | { |
1647 | int rval; | 1662 | int rval; |
1648 | mbx_cmd_t mc; | 1663 | mbx_cmd_t mc; |
1649 | mbx_cmd_t *mcp = &mc; | 1664 | mbx_cmd_t *mcp = &mc; |
1665 | struct qla_hw_data *ha = vha->hw; | ||
1650 | 1666 | ||
1651 | if (IS_FWI2_CAPABLE(ha)) | 1667 | if (IS_FWI2_CAPABLE(ha)) |
1652 | return qla24xx_login_fabric(ha, fcport->loop_id, | 1668 | return qla24xx_login_fabric(vha, fcport->loop_id, |
1653 | fcport->d_id.b.domain, fcport->d_id.b.area, | 1669 | fcport->d_id.b.domain, fcport->d_id.b.area, |
1654 | fcport->d_id.b.al_pa, mb_ret, opt); | 1670 | fcport->d_id.b.al_pa, mb_ret, opt); |
1655 | 1671 | ||
1656 | DEBUG3(printk("%s(%ld): entered.\n", __func__, ha->host_no)); | 1672 | DEBUG3(printk("%s(%ld): entered.\n", __func__, vha->host_no)); |
1657 | 1673 | ||
1658 | mcp->mb[0] = MBC_LOGIN_LOOP_PORT; | 1674 | mcp->mb[0] = MBC_LOGIN_LOOP_PORT; |
1659 | if (HAS_EXTENDED_IDS(ha)) | 1675 | if (HAS_EXTENDED_IDS(ha)) |
@@ -1665,7 +1681,7 @@ qla2x00_login_local_device(scsi_qla_host_t *ha, fc_port_t *fcport, | |||
1665 | mcp->in_mb = MBX_7|MBX_6|MBX_1|MBX_0; | 1681 | mcp->in_mb = MBX_7|MBX_6|MBX_1|MBX_0; |
1666 | mcp->tov = (ha->login_timeout * 2) + (ha->login_timeout / 2); | 1682 | mcp->tov = (ha->login_timeout * 2) + (ha->login_timeout / 2); |
1667 | mcp->flags = 0; | 1683 | mcp->flags = 0; |
1668 | rval = qla2x00_mailbox_command(ha, mcp); | 1684 | rval = qla2x00_mailbox_command(vha, mcp); |
1669 | 1685 | ||
1670 | /* Return mailbox statuses. */ | 1686 | /* Return mailbox statuses. */ |
1671 | if (mb_ret != NULL) { | 1687 | if (mb_ret != NULL) { |
@@ -1686,33 +1702,34 @@ qla2x00_login_local_device(scsi_qla_host_t *ha, fc_port_t *fcport, | |||
1686 | rval = QLA_SUCCESS; | 1702 | rval = QLA_SUCCESS; |
1687 | 1703 | ||
1688 | DEBUG(printk("%s(%ld): failed=%x mb[0]=%x mb[1]=%x " | 1704 | DEBUG(printk("%s(%ld): failed=%x mb[0]=%x mb[1]=%x " |
1689 | "mb[6]=%x mb[7]=%x.\n", __func__, ha->host_no, rval, | 1705 | "mb[6]=%x mb[7]=%x.\n", __func__, vha->host_no, rval, |
1690 | mcp->mb[0], mcp->mb[1], mcp->mb[6], mcp->mb[7])); | 1706 | mcp->mb[0], mcp->mb[1], mcp->mb[6], mcp->mb[7])); |
1691 | DEBUG2_3(printk("%s(%ld): failed=%x mb[0]=%x mb[1]=%x " | 1707 | DEBUG2_3(printk("%s(%ld): failed=%x mb[0]=%x mb[1]=%x " |
1692 | "mb[6]=%x mb[7]=%x.\n", __func__, ha->host_no, rval, | 1708 | "mb[6]=%x mb[7]=%x.\n", __func__, vha->host_no, rval, |
1693 | mcp->mb[0], mcp->mb[1], mcp->mb[6], mcp->mb[7])); | 1709 | mcp->mb[0], mcp->mb[1], mcp->mb[6], mcp->mb[7])); |
1694 | } else { | 1710 | } else { |
1695 | /*EMPTY*/ | 1711 | /*EMPTY*/ |
1696 | DEBUG3(printk("%s(%ld): done.\n", __func__, ha->host_no)); | 1712 | DEBUG3(printk("%s(%ld): done.\n", __func__, vha->host_no)); |
1697 | } | 1713 | } |
1698 | 1714 | ||
1699 | return (rval); | 1715 | return (rval); |
1700 | } | 1716 | } |
1701 | 1717 | ||
1702 | int | 1718 | int |
1703 | qla24xx_fabric_logout(scsi_qla_host_t *ha, uint16_t loop_id, uint8_t domain, | 1719 | qla24xx_fabric_logout(scsi_qla_host_t *vha, uint16_t loop_id, uint8_t domain, |
1704 | uint8_t area, uint8_t al_pa) | 1720 | uint8_t area, uint8_t al_pa) |
1705 | { | 1721 | { |
1706 | int rval; | 1722 | int rval; |
1707 | struct logio_entry_24xx *lg; | 1723 | struct logio_entry_24xx *lg; |
1708 | dma_addr_t lg_dma; | 1724 | dma_addr_t lg_dma; |
1725 | struct qla_hw_data *ha = vha->hw; | ||
1709 | 1726 | ||
1710 | DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no)); | 1727 | DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no)); |
1711 | 1728 | ||
1712 | lg = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &lg_dma); | 1729 | lg = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &lg_dma); |
1713 | if (lg == NULL) { | 1730 | if (lg == NULL) { |
1714 | DEBUG2_3(printk("%s(%ld): failed to allocate Logout IOCB.\n", | 1731 | DEBUG2_3(printk("%s(%ld): failed to allocate Logout IOCB.\n", |
1715 | __func__, ha->host_no)); | 1732 | __func__, vha->host_no)); |
1716 | return QLA_MEMORY_ALLOC_FAILED; | 1733 | return QLA_MEMORY_ALLOC_FAILED; |
1717 | } | 1734 | } |
1718 | memset(lg, 0, sizeof(struct logio_entry_24xx)); | 1735 | memset(lg, 0, sizeof(struct logio_entry_24xx)); |
@@ -1725,25 +1742,25 @@ qla24xx_fabric_logout(scsi_qla_host_t *ha, uint16_t loop_id, uint8_t domain, | |||
1725 | lg->port_id[0] = al_pa; | 1742 | lg->port_id[0] = al_pa; |
1726 | lg->port_id[1] = area; | 1743 | lg->port_id[1] = area; |
1727 | lg->port_id[2] = domain; | 1744 | lg->port_id[2] = domain; |
1728 | lg->vp_index = ha->vp_idx; | 1745 | lg->vp_index = vha->vp_idx; |
1729 | rval = qla2x00_issue_iocb(ha, lg, lg_dma, 0); | 1746 | rval = qla2x00_issue_iocb(vha, lg, lg_dma, 0); |
1730 | if (rval != QLA_SUCCESS) { | 1747 | if (rval != QLA_SUCCESS) { |
1731 | DEBUG2_3_11(printk("%s(%ld): failed to issue Logout IOCB " | 1748 | DEBUG2_3_11(printk("%s(%ld): failed to issue Logout IOCB " |
1732 | "(%x).\n", __func__, ha->host_no, rval)); | 1749 | "(%x).\n", __func__, vha->host_no, rval)); |
1733 | } else if (lg->entry_status != 0) { | 1750 | } else if (lg->entry_status != 0) { |
1734 | DEBUG2_3_11(printk("%s(%ld): failed to complete IOCB " | 1751 | DEBUG2_3_11(printk("%s(%ld): failed to complete IOCB " |
1735 | "-- error status (%x).\n", __func__, ha->host_no, | 1752 | "-- error status (%x).\n", __func__, vha->host_no, |
1736 | lg->entry_status)); | 1753 | lg->entry_status)); |
1737 | rval = QLA_FUNCTION_FAILED; | 1754 | rval = QLA_FUNCTION_FAILED; |
1738 | } else if (lg->comp_status != __constant_cpu_to_le16(CS_COMPLETE)) { | 1755 | } else if (lg->comp_status != __constant_cpu_to_le16(CS_COMPLETE)) { |
1739 | DEBUG2_3_11(printk("%s(%ld): failed to complete IOCB " | 1756 | DEBUG2_3_11(printk("%s(%ld): failed to complete IOCB " |
1740 | "-- completion status (%x) ioparam=%x/%x.\n", __func__, | 1757 | "-- completion status (%x) ioparam=%x/%x.\n", __func__, |
1741 | ha->host_no, le16_to_cpu(lg->comp_status), | 1758 | vha->host_no, le16_to_cpu(lg->comp_status), |
1742 | le32_to_cpu(lg->io_parameter[0]), | 1759 | le32_to_cpu(lg->io_parameter[0]), |
1743 | le32_to_cpu(lg->io_parameter[1]))); | 1760 | le32_to_cpu(lg->io_parameter[1]))); |
1744 | } else { | 1761 | } else { |
1745 | /*EMPTY*/ | 1762 | /*EMPTY*/ |
1746 | DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no)); | 1763 | DEBUG11(printk("%s(%ld): done.\n", __func__, vha->host_no)); |
1747 | } | 1764 | } |
1748 | 1765 | ||
1749 | dma_pool_free(ha->s_dma_pool, lg, lg_dma); | 1766 | dma_pool_free(ha->s_dma_pool, lg, lg_dma); |
@@ -1768,7 +1785,7 @@ qla24xx_fabric_logout(scsi_qla_host_t *ha, uint16_t loop_id, uint8_t domain, | |||
1768 | * Kernel context. | 1785 | * Kernel context. |
1769 | */ | 1786 | */ |
1770 | int | 1787 | int |
1771 | qla2x00_fabric_logout(scsi_qla_host_t *ha, uint16_t loop_id, uint8_t domain, | 1788 | qla2x00_fabric_logout(scsi_qla_host_t *vha, uint16_t loop_id, uint8_t domain, |
1772 | uint8_t area, uint8_t al_pa) | 1789 | uint8_t area, uint8_t al_pa) |
1773 | { | 1790 | { |
1774 | int rval; | 1791 | int rval; |
@@ -1776,11 +1793,11 @@ qla2x00_fabric_logout(scsi_qla_host_t *ha, uint16_t loop_id, uint8_t domain, | |||
1776 | mbx_cmd_t *mcp = &mc; | 1793 | mbx_cmd_t *mcp = &mc; |
1777 | 1794 | ||
1778 | DEBUG11(printk("qla2x00_fabric_logout(%ld): entered.\n", | 1795 | DEBUG11(printk("qla2x00_fabric_logout(%ld): entered.\n", |
1779 | ha->host_no)); | 1796 | vha->host_no)); |
1780 | 1797 | ||
1781 | mcp->mb[0] = MBC_LOGOUT_FABRIC_PORT; | 1798 | mcp->mb[0] = MBC_LOGOUT_FABRIC_PORT; |
1782 | mcp->out_mb = MBX_1|MBX_0; | 1799 | mcp->out_mb = MBX_1|MBX_0; |
1783 | if (HAS_EXTENDED_IDS(ha)) { | 1800 | if (HAS_EXTENDED_IDS(vha->hw)) { |
1784 | mcp->mb[1] = loop_id; | 1801 | mcp->mb[1] = loop_id; |
1785 | mcp->mb[10] = 0; | 1802 | mcp->mb[10] = 0; |
1786 | mcp->out_mb |= MBX_10; | 1803 | mcp->out_mb |= MBX_10; |
@@ -1791,16 +1808,16 @@ qla2x00_fabric_logout(scsi_qla_host_t *ha, uint16_t loop_id, uint8_t domain, | |||
1791 | mcp->in_mb = MBX_1|MBX_0; | 1808 | mcp->in_mb = MBX_1|MBX_0; |
1792 | mcp->tov = MBX_TOV_SECONDS; | 1809 | mcp->tov = MBX_TOV_SECONDS; |
1793 | mcp->flags = 0; | 1810 | mcp->flags = 0; |
1794 | rval = qla2x00_mailbox_command(ha, mcp); | 1811 | rval = qla2x00_mailbox_command(vha, mcp); |
1795 | 1812 | ||
1796 | if (rval != QLA_SUCCESS) { | 1813 | if (rval != QLA_SUCCESS) { |
1797 | /*EMPTY*/ | 1814 | /*EMPTY*/ |
1798 | DEBUG2_3_11(printk("qla2x00_fabric_logout(%ld): failed=%x " | 1815 | DEBUG2_3_11(printk("qla2x00_fabric_logout(%ld): failed=%x " |
1799 | "mbx1=%x.\n", ha->host_no, rval, mcp->mb[1])); | 1816 | "mbx1=%x.\n", vha->host_no, rval, mcp->mb[1])); |
1800 | } else { | 1817 | } else { |
1801 | /*EMPTY*/ | 1818 | /*EMPTY*/ |
1802 | DEBUG11(printk("qla2x00_fabric_logout(%ld): done.\n", | 1819 | DEBUG11(printk("qla2x00_fabric_logout(%ld): done.\n", |
1803 | ha->host_no)); | 1820 | vha->host_no)); |
1804 | } | 1821 | } |
1805 | 1822 | ||
1806 | return rval; | 1823 | return rval; |
@@ -1822,33 +1839,33 @@ qla2x00_fabric_logout(scsi_qla_host_t *ha, uint16_t loop_id, uint8_t domain, | |||
1822 | * Kernel context. | 1839 | * Kernel context. |
1823 | */ | 1840 | */ |
1824 | int | 1841 | int |
1825 | qla2x00_full_login_lip(scsi_qla_host_t *ha) | 1842 | qla2x00_full_login_lip(scsi_qla_host_t *vha) |
1826 | { | 1843 | { |
1827 | int rval; | 1844 | int rval; |
1828 | mbx_cmd_t mc; | 1845 | mbx_cmd_t mc; |
1829 | mbx_cmd_t *mcp = &mc; | 1846 | mbx_cmd_t *mcp = &mc; |
1830 | 1847 | ||
1831 | DEBUG11(printk("qla2x00_full_login_lip(%ld): entered.\n", | 1848 | DEBUG11(printk("qla2x00_full_login_lip(%ld): entered.\n", |
1832 | ha->host_no)); | 1849 | vha->host_no)); |
1833 | 1850 | ||
1834 | mcp->mb[0] = MBC_LIP_FULL_LOGIN; | 1851 | mcp->mb[0] = MBC_LIP_FULL_LOGIN; |
1835 | mcp->mb[1] = IS_FWI2_CAPABLE(ha) ? BIT_3: 0; | 1852 | mcp->mb[1] = IS_FWI2_CAPABLE(vha->hw) ? BIT_3 : 0; |
1836 | mcp->mb[2] = 0; | 1853 | mcp->mb[2] = 0; |
1837 | mcp->mb[3] = 0; | 1854 | mcp->mb[3] = 0; |
1838 | mcp->out_mb = MBX_3|MBX_2|MBX_1|MBX_0; | 1855 | mcp->out_mb = MBX_3|MBX_2|MBX_1|MBX_0; |
1839 | mcp->in_mb = MBX_0; | 1856 | mcp->in_mb = MBX_0; |
1840 | mcp->tov = MBX_TOV_SECONDS; | 1857 | mcp->tov = MBX_TOV_SECONDS; |
1841 | mcp->flags = 0; | 1858 | mcp->flags = 0; |
1842 | rval = qla2x00_mailbox_command(ha, mcp); | 1859 | rval = qla2x00_mailbox_command(vha, mcp); |
1843 | 1860 | ||
1844 | if (rval != QLA_SUCCESS) { | 1861 | if (rval != QLA_SUCCESS) { |
1845 | /*EMPTY*/ | 1862 | /*EMPTY*/ |
1846 | DEBUG2_3_11(printk("qla2x00_full_login_lip(%ld): failed=%x.\n", | 1863 | DEBUG2_3_11(printk("qla2x00_full_login_lip(%ld): failed=%x.\n", |
1847 | ha->host_no, rval)); | 1864 | vha->host_no, rval)); |
1848 | } else { | 1865 | } else { |
1849 | /*EMPTY*/ | 1866 | /*EMPTY*/ |
1850 | DEBUG11(printk("qla2x00_full_login_lip(%ld): done.\n", | 1867 | DEBUG11(printk("qla2x00_full_login_lip(%ld): done.\n", |
1851 | ha->host_no)); | 1868 | vha->host_no)); |
1852 | } | 1869 | } |
1853 | 1870 | ||
1854 | return rval; | 1871 | return rval; |
@@ -1867,7 +1884,7 @@ qla2x00_full_login_lip(scsi_qla_host_t *ha) | |||
1867 | * Kernel context. | 1884 | * Kernel context. |
1868 | */ | 1885 | */ |
1869 | int | 1886 | int |
1870 | qla2x00_get_id_list(scsi_qla_host_t *ha, void *id_list, dma_addr_t id_list_dma, | 1887 | qla2x00_get_id_list(scsi_qla_host_t *vha, void *id_list, dma_addr_t id_list_dma, |
1871 | uint16_t *entries) | 1888 | uint16_t *entries) |
1872 | { | 1889 | { |
1873 | int rval; | 1890 | int rval; |
@@ -1875,20 +1892,20 @@ qla2x00_get_id_list(scsi_qla_host_t *ha, void *id_list, dma_addr_t id_list_dma, | |||
1875 | mbx_cmd_t *mcp = &mc; | 1892 | mbx_cmd_t *mcp = &mc; |
1876 | 1893 | ||
1877 | DEBUG11(printk("qla2x00_get_id_list(%ld): entered.\n", | 1894 | DEBUG11(printk("qla2x00_get_id_list(%ld): entered.\n", |
1878 | ha->host_no)); | 1895 | vha->host_no)); |
1879 | 1896 | ||
1880 | if (id_list == NULL) | 1897 | if (id_list == NULL) |
1881 | return QLA_FUNCTION_FAILED; | 1898 | return QLA_FUNCTION_FAILED; |
1882 | 1899 | ||
1883 | mcp->mb[0] = MBC_GET_ID_LIST; | 1900 | mcp->mb[0] = MBC_GET_ID_LIST; |
1884 | mcp->out_mb = MBX_0; | 1901 | mcp->out_mb = MBX_0; |
1885 | if (IS_FWI2_CAPABLE(ha)) { | 1902 | if (IS_FWI2_CAPABLE(vha->hw)) { |
1886 | mcp->mb[2] = MSW(id_list_dma); | 1903 | mcp->mb[2] = MSW(id_list_dma); |
1887 | mcp->mb[3] = LSW(id_list_dma); | 1904 | mcp->mb[3] = LSW(id_list_dma); |
1888 | mcp->mb[6] = MSW(MSD(id_list_dma)); | 1905 | mcp->mb[6] = MSW(MSD(id_list_dma)); |
1889 | mcp->mb[7] = LSW(MSD(id_list_dma)); | 1906 | mcp->mb[7] = LSW(MSD(id_list_dma)); |
1890 | mcp->mb[8] = 0; | 1907 | mcp->mb[8] = 0; |
1891 | mcp->mb[9] = ha->vp_idx; | 1908 | mcp->mb[9] = vha->vp_idx; |
1892 | mcp->out_mb |= MBX_9|MBX_8|MBX_7|MBX_6|MBX_3|MBX_2; | 1909 | mcp->out_mb |= MBX_9|MBX_8|MBX_7|MBX_6|MBX_3|MBX_2; |
1893 | } else { | 1910 | } else { |
1894 | mcp->mb[1] = MSW(id_list_dma); | 1911 | mcp->mb[1] = MSW(id_list_dma); |
@@ -1900,16 +1917,16 @@ qla2x00_get_id_list(scsi_qla_host_t *ha, void *id_list, dma_addr_t id_list_dma, | |||
1900 | mcp->in_mb = MBX_1|MBX_0; | 1917 | mcp->in_mb = MBX_1|MBX_0; |
1901 | mcp->tov = MBX_TOV_SECONDS; | 1918 | mcp->tov = MBX_TOV_SECONDS; |
1902 | mcp->flags = 0; | 1919 | mcp->flags = 0; |
1903 | rval = qla2x00_mailbox_command(ha, mcp); | 1920 | rval = qla2x00_mailbox_command(vha, mcp); |
1904 | 1921 | ||
1905 | if (rval != QLA_SUCCESS) { | 1922 | if (rval != QLA_SUCCESS) { |
1906 | /*EMPTY*/ | 1923 | /*EMPTY*/ |
1907 | DEBUG2_3_11(printk("qla2x00_get_id_list(%ld): failed=%x.\n", | 1924 | DEBUG2_3_11(printk("qla2x00_get_id_list(%ld): failed=%x.\n", |
1908 | ha->host_no, rval)); | 1925 | vha->host_no, rval)); |
1909 | } else { | 1926 | } else { |
1910 | *entries = mcp->mb[1]; | 1927 | *entries = mcp->mb[1]; |
1911 | DEBUG11(printk("qla2x00_get_id_list(%ld): done.\n", | 1928 | DEBUG11(printk("qla2x00_get_id_list(%ld): done.\n", |
1912 | ha->host_no)); | 1929 | vha->host_no)); |
1913 | } | 1930 | } |
1914 | 1931 | ||
1915 | return rval; | 1932 | return rval; |
@@ -1929,7 +1946,7 @@ qla2x00_get_id_list(scsi_qla_host_t *ha, void *id_list, dma_addr_t id_list_dma, | |||
1929 | * Kernel context. | 1946 | * Kernel context. |
1930 | */ | 1947 | */ |
1931 | int | 1948 | int |
1932 | qla2x00_get_resource_cnts(scsi_qla_host_t *ha, uint16_t *cur_xchg_cnt, | 1949 | qla2x00_get_resource_cnts(scsi_qla_host_t *vha, uint16_t *cur_xchg_cnt, |
1933 | uint16_t *orig_xchg_cnt, uint16_t *cur_iocb_cnt, | 1950 | uint16_t *orig_xchg_cnt, uint16_t *cur_iocb_cnt, |
1934 | uint16_t *orig_iocb_cnt, uint16_t *max_npiv_vports) | 1951 | uint16_t *orig_iocb_cnt, uint16_t *max_npiv_vports) |
1935 | { | 1952 | { |
@@ -1937,22 +1954,22 @@ qla2x00_get_resource_cnts(scsi_qla_host_t *ha, uint16_t *cur_xchg_cnt, | |||
1937 | mbx_cmd_t mc; | 1954 | mbx_cmd_t mc; |
1938 | mbx_cmd_t *mcp = &mc; | 1955 | mbx_cmd_t *mcp = &mc; |
1939 | 1956 | ||
1940 | DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no)); | 1957 | DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no)); |
1941 | 1958 | ||
1942 | mcp->mb[0] = MBC_GET_RESOURCE_COUNTS; | 1959 | mcp->mb[0] = MBC_GET_RESOURCE_COUNTS; |
1943 | mcp->out_mb = MBX_0; | 1960 | mcp->out_mb = MBX_0; |
1944 | mcp->in_mb = MBX_11|MBX_10|MBX_7|MBX_6|MBX_3|MBX_2|MBX_1|MBX_0; | 1961 | mcp->in_mb = MBX_11|MBX_10|MBX_7|MBX_6|MBX_3|MBX_2|MBX_1|MBX_0; |
1945 | mcp->tov = MBX_TOV_SECONDS; | 1962 | mcp->tov = MBX_TOV_SECONDS; |
1946 | mcp->flags = 0; | 1963 | mcp->flags = 0; |
1947 | rval = qla2x00_mailbox_command(ha, mcp); | 1964 | rval = qla2x00_mailbox_command(vha, mcp); |
1948 | 1965 | ||
1949 | if (rval != QLA_SUCCESS) { | 1966 | if (rval != QLA_SUCCESS) { |
1950 | /*EMPTY*/ | 1967 | /*EMPTY*/ |
1951 | DEBUG2_3_11(printk("%s(%ld): failed = %x.\n", __func__, | 1968 | DEBUG2_3_11(printk("%s(%ld): failed = %x.\n", __func__, |
1952 | ha->host_no, mcp->mb[0])); | 1969 | vha->host_no, mcp->mb[0])); |
1953 | } else { | 1970 | } else { |
1954 | DEBUG11(printk("%s(%ld): done. mb1=%x mb2=%x mb3=%x mb6=%x " | 1971 | DEBUG11(printk("%s(%ld): done. mb1=%x mb2=%x mb3=%x mb6=%x " |
1955 | "mb7=%x mb10=%x mb11=%x.\n", __func__, ha->host_no, | 1972 | "mb7=%x mb10=%x mb11=%x.\n", __func__, vha->host_no, |
1956 | mcp->mb[1], mcp->mb[2], mcp->mb[3], mcp->mb[6], mcp->mb[7], | 1973 | mcp->mb[1], mcp->mb[2], mcp->mb[3], mcp->mb[6], mcp->mb[7], |
1957 | mcp->mb[10], mcp->mb[11])); | 1974 | mcp->mb[10], mcp->mb[11])); |
1958 | 1975 | ||
@@ -1964,7 +1981,7 @@ qla2x00_get_resource_cnts(scsi_qla_host_t *ha, uint16_t *cur_xchg_cnt, | |||
1964 | *cur_iocb_cnt = mcp->mb[7]; | 1981 | *cur_iocb_cnt = mcp->mb[7]; |
1965 | if (orig_iocb_cnt) | 1982 | if (orig_iocb_cnt) |
1966 | *orig_iocb_cnt = mcp->mb[10]; | 1983 | *orig_iocb_cnt = mcp->mb[10]; |
1967 | if (ha->flags.npiv_supported && max_npiv_vports) | 1984 | if (vha->hw->flags.npiv_supported && max_npiv_vports) |
1968 | *max_npiv_vports = mcp->mb[11]; | 1985 | *max_npiv_vports = mcp->mb[11]; |
1969 | } | 1986 | } |
1970 | 1987 | ||
@@ -1987,18 +2004,19 @@ qla2x00_get_resource_cnts(scsi_qla_host_t *ha, uint16_t *cur_xchg_cnt, | |||
1987 | * Kernel context. | 2004 | * Kernel context. |
1988 | */ | 2005 | */ |
1989 | int | 2006 | int |
1990 | qla2x00_get_fcal_position_map(scsi_qla_host_t *ha, char *pos_map) | 2007 | qla2x00_get_fcal_position_map(scsi_qla_host_t *vha, char *pos_map) |
1991 | { | 2008 | { |
1992 | int rval; | 2009 | int rval; |
1993 | mbx_cmd_t mc; | 2010 | mbx_cmd_t mc; |
1994 | mbx_cmd_t *mcp = &mc; | 2011 | mbx_cmd_t *mcp = &mc; |
1995 | char *pmap; | 2012 | char *pmap; |
1996 | dma_addr_t pmap_dma; | 2013 | dma_addr_t pmap_dma; |
2014 | struct qla_hw_data *ha = vha->hw; | ||
1997 | 2015 | ||
1998 | pmap = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &pmap_dma); | 2016 | pmap = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &pmap_dma); |
1999 | if (pmap == NULL) { | 2017 | if (pmap == NULL) { |
2000 | DEBUG2_3_11(printk("%s(%ld): **** Mem Alloc Failed ****", | 2018 | DEBUG2_3_11(printk("%s(%ld): **** Mem Alloc Failed ****", |
2001 | __func__, ha->host_no)); | 2019 | __func__, vha->host_no)); |
2002 | return QLA_MEMORY_ALLOC_FAILED; | 2020 | return QLA_MEMORY_ALLOC_FAILED; |
2003 | } | 2021 | } |
2004 | memset(pmap, 0, FCAL_MAP_SIZE); | 2022 | memset(pmap, 0, FCAL_MAP_SIZE); |
@@ -2013,11 +2031,11 @@ qla2x00_get_fcal_position_map(scsi_qla_host_t *ha, char *pos_map) | |||
2013 | mcp->buf_size = FCAL_MAP_SIZE; | 2031 | mcp->buf_size = FCAL_MAP_SIZE; |
2014 | mcp->flags = MBX_DMA_IN; | 2032 | mcp->flags = MBX_DMA_IN; |
2015 | mcp->tov = (ha->login_timeout * 2) + (ha->login_timeout / 2); | 2033 | mcp->tov = (ha->login_timeout * 2) + (ha->login_timeout / 2); |
2016 | rval = qla2x00_mailbox_command(ha, mcp); | 2034 | rval = qla2x00_mailbox_command(vha, mcp); |
2017 | 2035 | ||
2018 | if (rval == QLA_SUCCESS) { | 2036 | if (rval == QLA_SUCCESS) { |
2019 | DEBUG11(printk("%s(%ld): (mb0=%x/mb1=%x) FC/AL Position Map " | 2037 | DEBUG11(printk("%s(%ld): (mb0=%x/mb1=%x) FC/AL Position Map " |
2020 | "size (%x)\n", __func__, ha->host_no, mcp->mb[0], | 2038 | "size (%x)\n", __func__, vha->host_no, mcp->mb[0], |
2021 | mcp->mb[1], (unsigned)pmap[0])); | 2039 | mcp->mb[1], (unsigned)pmap[0])); |
2022 | DEBUG11(qla2x00_dump_buffer(pmap, pmap[0] + 1)); | 2040 | DEBUG11(qla2x00_dump_buffer(pmap, pmap[0] + 1)); |
2023 | 2041 | ||
@@ -2028,9 +2046,9 @@ qla2x00_get_fcal_position_map(scsi_qla_host_t *ha, char *pos_map) | |||
2028 | 2046 | ||
2029 | if (rval != QLA_SUCCESS) { | 2047 | if (rval != QLA_SUCCESS) { |
2030 | DEBUG2_3_11(printk("%s(%ld): failed=%x.\n", __func__, | 2048 | DEBUG2_3_11(printk("%s(%ld): failed=%x.\n", __func__, |
2031 | ha->host_no, rval)); | 2049 | vha->host_no, rval)); |
2032 | } else { | 2050 | } else { |
2033 | DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no)); | 2051 | DEBUG11(printk("%s(%ld): done.\n", __func__, vha->host_no)); |
2034 | } | 2052 | } |
2035 | 2053 | ||
2036 | return rval; | 2054 | return rval; |
@@ -2051,15 +2069,16 @@ qla2x00_get_fcal_position_map(scsi_qla_host_t *ha, char *pos_map) | |||
2051 | * BIT_1 = mailbox error. | 2069 | * BIT_1 = mailbox error. |
2052 | */ | 2070 | */ |
2053 | int | 2071 | int |
2054 | qla2x00_get_link_status(scsi_qla_host_t *ha, uint16_t loop_id, | 2072 | qla2x00_get_link_status(scsi_qla_host_t *vha, uint16_t loop_id, |
2055 | struct link_statistics *stats, dma_addr_t stats_dma) | 2073 | struct link_statistics *stats, dma_addr_t stats_dma) |
2056 | { | 2074 | { |
2057 | int rval; | 2075 | int rval; |
2058 | mbx_cmd_t mc; | 2076 | mbx_cmd_t mc; |
2059 | mbx_cmd_t *mcp = &mc; | 2077 | mbx_cmd_t *mcp = &mc; |
2060 | uint32_t *siter, *diter, dwords; | 2078 | uint32_t *siter, *diter, dwords; |
2079 | struct qla_hw_data *ha = vha->hw; | ||
2061 | 2080 | ||
2062 | DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no)); | 2081 | DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no)); |
2063 | 2082 | ||
2064 | mcp->mb[0] = MBC_GET_LINK_STATUS; | 2083 | mcp->mb[0] = MBC_GET_LINK_STATUS; |
2065 | mcp->mb[2] = MSW(stats_dma); | 2084 | mcp->mb[2] = MSW(stats_dma); |
@@ -2084,12 +2103,12 @@ qla2x00_get_link_status(scsi_qla_host_t *ha, uint16_t loop_id, | |||
2084 | } | 2103 | } |
2085 | mcp->tov = MBX_TOV_SECONDS; | 2104 | mcp->tov = MBX_TOV_SECONDS; |
2086 | mcp->flags = IOCTL_CMD; | 2105 | mcp->flags = IOCTL_CMD; |
2087 | rval = qla2x00_mailbox_command(ha, mcp); | 2106 | rval = qla2x00_mailbox_command(vha, mcp); |
2088 | 2107 | ||
2089 | if (rval == QLA_SUCCESS) { | 2108 | if (rval == QLA_SUCCESS) { |
2090 | if (mcp->mb[0] != MBS_COMMAND_COMPLETE) { | 2109 | if (mcp->mb[0] != MBS_COMMAND_COMPLETE) { |
2091 | DEBUG2_3_11(printk("%s(%ld): cmd failed. mbx0=%x.\n", | 2110 | DEBUG2_3_11(printk("%s(%ld): cmd failed. mbx0=%x.\n", |
2092 | __func__, ha->host_no, mcp->mb[0])); | 2111 | __func__, vha->host_no, mcp->mb[0])); |
2093 | rval = QLA_FUNCTION_FAILED; | 2112 | rval = QLA_FUNCTION_FAILED; |
2094 | } else { | 2113 | } else { |
2095 | /* Copy over data -- firmware data is LE. */ | 2114 | /* Copy over data -- firmware data is LE. */ |
@@ -2101,14 +2120,14 @@ qla2x00_get_link_status(scsi_qla_host_t *ha, uint16_t loop_id, | |||
2101 | } else { | 2120 | } else { |
2102 | /* Failed. */ | 2121 | /* Failed. */ |
2103 | DEBUG2_3_11(printk("%s(%ld): failed=%x.\n", __func__, | 2122 | DEBUG2_3_11(printk("%s(%ld): failed=%x.\n", __func__, |
2104 | ha->host_no, rval)); | 2123 | vha->host_no, rval)); |
2105 | } | 2124 | } |
2106 | 2125 | ||
2107 | return rval; | 2126 | return rval; |
2108 | } | 2127 | } |
2109 | 2128 | ||
2110 | int | 2129 | int |
2111 | qla24xx_get_isp_stats(scsi_qla_host_t *ha, struct link_statistics *stats, | 2130 | qla24xx_get_isp_stats(scsi_qla_host_t *vha, struct link_statistics *stats, |
2112 | dma_addr_t stats_dma) | 2131 | dma_addr_t stats_dma) |
2113 | { | 2132 | { |
2114 | int rval; | 2133 | int rval; |
@@ -2116,7 +2135,7 @@ qla24xx_get_isp_stats(scsi_qla_host_t *ha, struct link_statistics *stats, | |||
2116 | mbx_cmd_t *mcp = &mc; | 2135 | mbx_cmd_t *mcp = &mc; |
2117 | uint32_t *siter, *diter, dwords; | 2136 | uint32_t *siter, *diter, dwords; |
2118 | 2137 | ||
2119 | DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no)); | 2138 | DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no)); |
2120 | 2139 | ||
2121 | mcp->mb[0] = MBC_GET_LINK_PRIV_STATS; | 2140 | mcp->mb[0] = MBC_GET_LINK_PRIV_STATS; |
2122 | mcp->mb[2] = MSW(stats_dma); | 2141 | mcp->mb[2] = MSW(stats_dma); |
@@ -2124,18 +2143,18 @@ qla24xx_get_isp_stats(scsi_qla_host_t *ha, struct link_statistics *stats, | |||
2124 | mcp->mb[6] = MSW(MSD(stats_dma)); | 2143 | mcp->mb[6] = MSW(MSD(stats_dma)); |
2125 | mcp->mb[7] = LSW(MSD(stats_dma)); | 2144 | mcp->mb[7] = LSW(MSD(stats_dma)); |
2126 | mcp->mb[8] = sizeof(struct link_statistics) / 4; | 2145 | mcp->mb[8] = sizeof(struct link_statistics) / 4; |
2127 | mcp->mb[9] = ha->vp_idx; | 2146 | mcp->mb[9] = vha->vp_idx; |
2128 | mcp->mb[10] = 0; | 2147 | mcp->mb[10] = 0; |
2129 | mcp->out_mb = MBX_10|MBX_9|MBX_8|MBX_7|MBX_6|MBX_3|MBX_2|MBX_0; | 2148 | mcp->out_mb = MBX_10|MBX_9|MBX_8|MBX_7|MBX_6|MBX_3|MBX_2|MBX_0; |
2130 | mcp->in_mb = MBX_2|MBX_1|MBX_0; | 2149 | mcp->in_mb = MBX_2|MBX_1|MBX_0; |
2131 | mcp->tov = MBX_TOV_SECONDS; | 2150 | mcp->tov = MBX_TOV_SECONDS; |
2132 | mcp->flags = IOCTL_CMD; | 2151 | mcp->flags = IOCTL_CMD; |
2133 | rval = qla2x00_mailbox_command(ha, mcp); | 2152 | rval = qla2x00_mailbox_command(vha, mcp); |
2134 | 2153 | ||
2135 | if (rval == QLA_SUCCESS) { | 2154 | if (rval == QLA_SUCCESS) { |
2136 | if (mcp->mb[0] != MBS_COMMAND_COMPLETE) { | 2155 | if (mcp->mb[0] != MBS_COMMAND_COMPLETE) { |
2137 | DEBUG2_3_11(printk("%s(%ld): cmd failed. mbx0=%x.\n", | 2156 | DEBUG2_3_11(printk("%s(%ld): cmd failed. mbx0=%x.\n", |
2138 | __func__, ha->host_no, mcp->mb[0])); | 2157 | __func__, vha->host_no, mcp->mb[0])); |
2139 | rval = QLA_FUNCTION_FAILED; | 2158 | rval = QLA_FUNCTION_FAILED; |
2140 | } else { | 2159 | } else { |
2141 | /* Copy over data -- firmware data is LE. */ | 2160 | /* Copy over data -- firmware data is LE. */ |
@@ -2147,14 +2166,14 @@ qla24xx_get_isp_stats(scsi_qla_host_t *ha, struct link_statistics *stats, | |||
2147 | } else { | 2166 | } else { |
2148 | /* Failed. */ | 2167 | /* Failed. */ |
2149 | DEBUG2_3_11(printk("%s(%ld): failed=%x.\n", __func__, | 2168 | DEBUG2_3_11(printk("%s(%ld): failed=%x.\n", __func__, |
2150 | ha->host_no, rval)); | 2169 | vha->host_no, rval)); |
2151 | } | 2170 | } |
2152 | 2171 | ||
2153 | return rval; | 2172 | return rval; |
2154 | } | 2173 | } |
2155 | 2174 | ||
2156 | int | 2175 | int |
2157 | qla24xx_abort_command(scsi_qla_host_t *ha, srb_t *sp) | 2176 | qla24xx_abort_command(scsi_qla_host_t *vha, srb_t *sp) |
2158 | { | 2177 | { |
2159 | int rval; | 2178 | int rval; |
2160 | fc_port_t *fcport; | 2179 | fc_port_t *fcport; |
@@ -2163,18 +2182,19 @@ qla24xx_abort_command(scsi_qla_host_t *ha, srb_t *sp) | |||
2163 | struct abort_entry_24xx *abt; | 2182 | struct abort_entry_24xx *abt; |
2164 | dma_addr_t abt_dma; | 2183 | dma_addr_t abt_dma; |
2165 | uint32_t handle; | 2184 | uint32_t handle; |
2166 | scsi_qla_host_t *pha = to_qla_parent(ha); | 2185 | struct qla_hw_data *ha = vha->hw; |
2186 | struct req_que *req = ha->req; | ||
2167 | 2187 | ||
2168 | DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no)); | 2188 | DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no)); |
2169 | 2189 | ||
2170 | fcport = sp->fcport; | 2190 | fcport = sp->fcport; |
2171 | 2191 | ||
2172 | spin_lock_irqsave(&pha->hardware_lock, flags); | 2192 | spin_lock_irqsave(&ha->hardware_lock, flags); |
2173 | for (handle = 1; handle < MAX_OUTSTANDING_COMMANDS; handle++) { | 2193 | for (handle = 1; handle < MAX_OUTSTANDING_COMMANDS; handle++) { |
2174 | if (pha->outstanding_cmds[handle] == sp) | 2194 | if (req->outstanding_cmds[handle] == sp) |
2175 | break; | 2195 | break; |
2176 | } | 2196 | } |
2177 | spin_unlock_irqrestore(&pha->hardware_lock, flags); | 2197 | spin_unlock_irqrestore(&ha->hardware_lock, flags); |
2178 | if (handle == MAX_OUTSTANDING_COMMANDS) { | 2198 | if (handle == MAX_OUTSTANDING_COMMANDS) { |
2179 | /* Command not found. */ | 2199 | /* Command not found. */ |
2180 | return QLA_FUNCTION_FAILED; | 2200 | return QLA_FUNCTION_FAILED; |
@@ -2183,7 +2203,7 @@ qla24xx_abort_command(scsi_qla_host_t *ha, srb_t *sp) | |||
2183 | abt = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &abt_dma); | 2203 | abt = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &abt_dma); |
2184 | if (abt == NULL) { | 2204 | if (abt == NULL) { |
2185 | DEBUG2_3(printk("%s(%ld): failed to allocate Abort IOCB.\n", | 2205 | DEBUG2_3(printk("%s(%ld): failed to allocate Abort IOCB.\n", |
2186 | __func__, ha->host_no)); | 2206 | __func__, vha->host_no)); |
2187 | return QLA_MEMORY_ALLOC_FAILED; | 2207 | return QLA_MEMORY_ALLOC_FAILED; |
2188 | } | 2208 | } |
2189 | memset(abt, 0, sizeof(struct abort_entry_24xx)); | 2209 | memset(abt, 0, sizeof(struct abort_entry_24xx)); |
@@ -2196,22 +2216,22 @@ qla24xx_abort_command(scsi_qla_host_t *ha, srb_t *sp) | |||
2196 | abt->port_id[1] = fcport->d_id.b.area; | 2216 | abt->port_id[1] = fcport->d_id.b.area; |
2197 | abt->port_id[2] = fcport->d_id.b.domain; | 2217 | abt->port_id[2] = fcport->d_id.b.domain; |
2198 | abt->vp_index = fcport->vp_idx; | 2218 | abt->vp_index = fcport->vp_idx; |
2199 | rval = qla2x00_issue_iocb(ha, abt, abt_dma, 0); | 2219 | rval = qla2x00_issue_iocb(vha, abt, abt_dma, 0); |
2200 | if (rval != QLA_SUCCESS) { | 2220 | if (rval != QLA_SUCCESS) { |
2201 | DEBUG2_3_11(printk("%s(%ld): failed to issue IOCB (%x).\n", | 2221 | DEBUG2_3_11(printk("%s(%ld): failed to issue IOCB (%x).\n", |
2202 | __func__, ha->host_no, rval)); | 2222 | __func__, vha->host_no, rval)); |
2203 | } else if (abt->entry_status != 0) { | 2223 | } else if (abt->entry_status != 0) { |
2204 | DEBUG2_3_11(printk("%s(%ld): failed to complete IOCB " | 2224 | DEBUG2_3_11(printk("%s(%ld): failed to complete IOCB " |
2205 | "-- error status (%x).\n", __func__, ha->host_no, | 2225 | "-- error status (%x).\n", __func__, vha->host_no, |
2206 | abt->entry_status)); | 2226 | abt->entry_status)); |
2207 | rval = QLA_FUNCTION_FAILED; | 2227 | rval = QLA_FUNCTION_FAILED; |
2208 | } else if (abt->nport_handle != __constant_cpu_to_le16(0)) { | 2228 | } else if (abt->nport_handle != __constant_cpu_to_le16(0)) { |
2209 | DEBUG2_3_11(printk("%s(%ld): failed to complete IOCB " | 2229 | DEBUG2_3_11(printk("%s(%ld): failed to complete IOCB " |
2210 | "-- completion status (%x).\n", __func__, ha->host_no, | 2230 | "-- completion status (%x).\n", __func__, vha->host_no, |
2211 | le16_to_cpu(abt->nport_handle))); | 2231 | le16_to_cpu(abt->nport_handle))); |
2212 | rval = QLA_FUNCTION_FAILED; | 2232 | rval = QLA_FUNCTION_FAILED; |
2213 | } else { | 2233 | } else { |
2214 | DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no)); | 2234 | DEBUG11(printk("%s(%ld): done.\n", __func__, vha->host_no)); |
2215 | } | 2235 | } |
2216 | 2236 | ||
2217 | dma_pool_free(ha->s_dma_pool, abt, abt_dma); | 2237 | dma_pool_free(ha->s_dma_pool, abt, abt_dma); |
@@ -2233,16 +2253,17 @@ __qla24xx_issue_tmf(char *name, uint32_t type, struct fc_port *fcport, | |||
2233 | int rval, rval2; | 2253 | int rval, rval2; |
2234 | struct tsk_mgmt_cmd *tsk; | 2254 | struct tsk_mgmt_cmd *tsk; |
2235 | dma_addr_t tsk_dma; | 2255 | dma_addr_t tsk_dma; |
2236 | scsi_qla_host_t *ha, *pha; | 2256 | scsi_qla_host_t *vha; |
2257 | struct qla_hw_data *ha; | ||
2237 | 2258 | ||
2238 | DEBUG11(printk("%s(%ld): entered.\n", __func__, fcport->ha->host_no)); | 2259 | DEBUG11(printk("%s(%ld): entered.\n", __func__, fcport->ha->host_no)); |
2239 | 2260 | ||
2240 | ha = fcport->ha; | 2261 | vha = fcport->vha; |
2241 | pha = to_qla_parent(ha); | 2262 | ha = vha->hw; |
2242 | tsk = dma_pool_alloc(pha->s_dma_pool, GFP_KERNEL, &tsk_dma); | 2263 | tsk = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &tsk_dma); |
2243 | if (tsk == NULL) { | 2264 | if (tsk == NULL) { |
2244 | DEBUG2_3(printk("%s(%ld): failed to allocate Task Management " | 2265 | DEBUG2_3(printk("%s(%ld): failed to allocate Task Management " |
2245 | "IOCB.\n", __func__, ha->host_no)); | 2266 | "IOCB.\n", __func__, vha->host_no)); |
2246 | return QLA_MEMORY_ALLOC_FAILED; | 2267 | return QLA_MEMORY_ALLOC_FAILED; |
2247 | } | 2268 | } |
2248 | memset(tsk, 0, sizeof(struct tsk_mgmt_cmd)); | 2269 | memset(tsk, 0, sizeof(struct tsk_mgmt_cmd)); |
@@ -2262,34 +2283,34 @@ __qla24xx_issue_tmf(char *name, uint32_t type, struct fc_port *fcport, | |||
2262 | sizeof(tsk->p.tsk.lun)); | 2283 | sizeof(tsk->p.tsk.lun)); |
2263 | } | 2284 | } |
2264 | 2285 | ||
2265 | rval = qla2x00_issue_iocb(ha, tsk, tsk_dma, 0); | 2286 | rval = qla2x00_issue_iocb(vha, tsk, tsk_dma, 0); |
2266 | if (rval != QLA_SUCCESS) { | 2287 | if (rval != QLA_SUCCESS) { |
2267 | DEBUG2_3_11(printk("%s(%ld): failed to issue %s Reset IOCB " | 2288 | DEBUG2_3_11(printk("%s(%ld): failed to issue %s Reset IOCB " |
2268 | "(%x).\n", __func__, ha->host_no, name, rval)); | 2289 | "(%x).\n", __func__, vha->host_no, name, rval)); |
2269 | } else if (tsk->p.sts.entry_status != 0) { | 2290 | } else if (tsk->p.sts.entry_status != 0) { |
2270 | DEBUG2_3_11(printk("%s(%ld): failed to complete IOCB " | 2291 | DEBUG2_3_11(printk("%s(%ld): failed to complete IOCB " |
2271 | "-- error status (%x).\n", __func__, ha->host_no, | 2292 | "-- error status (%x).\n", __func__, vha->host_no, |
2272 | tsk->p.sts.entry_status)); | 2293 | tsk->p.sts.entry_status)); |
2273 | rval = QLA_FUNCTION_FAILED; | 2294 | rval = QLA_FUNCTION_FAILED; |
2274 | } else if (tsk->p.sts.comp_status != | 2295 | } else if (tsk->p.sts.comp_status != |
2275 | __constant_cpu_to_le16(CS_COMPLETE)) { | 2296 | __constant_cpu_to_le16(CS_COMPLETE)) { |
2276 | DEBUG2_3_11(printk("%s(%ld): failed to complete IOCB " | 2297 | DEBUG2_3_11(printk("%s(%ld): failed to complete IOCB " |
2277 | "-- completion status (%x).\n", __func__, | 2298 | "-- completion status (%x).\n", __func__, |
2278 | ha->host_no, le16_to_cpu(tsk->p.sts.comp_status))); | 2299 | vha->host_no, le16_to_cpu(tsk->p.sts.comp_status))); |
2279 | rval = QLA_FUNCTION_FAILED; | 2300 | rval = QLA_FUNCTION_FAILED; |
2280 | } | 2301 | } |
2281 | 2302 | ||
2282 | /* Issue marker IOCB. */ | 2303 | /* Issue marker IOCB. */ |
2283 | rval2 = qla2x00_marker(ha, fcport->loop_id, l, | 2304 | rval2 = qla2x00_marker(vha, fcport->loop_id, l, |
2284 | type == TCF_LUN_RESET ? MK_SYNC_ID_LUN: MK_SYNC_ID); | 2305 | type == TCF_LUN_RESET ? MK_SYNC_ID_LUN: MK_SYNC_ID); |
2285 | if (rval2 != QLA_SUCCESS) { | 2306 | if (rval2 != QLA_SUCCESS) { |
2286 | DEBUG2_3_11(printk("%s(%ld): failed to issue Marker IOCB " | 2307 | DEBUG2_3_11(printk("%s(%ld): failed to issue Marker IOCB " |
2287 | "(%x).\n", __func__, ha->host_no, rval2)); | 2308 | "(%x).\n", __func__, vha->host_no, rval2)); |
2288 | } else { | 2309 | } else { |
2289 | DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no)); | 2310 | DEBUG11(printk("%s(%ld): done.\n", __func__, vha->host_no)); |
2290 | } | 2311 | } |
2291 | 2312 | ||
2292 | dma_pool_free(pha->s_dma_pool, tsk, tsk_dma); | 2313 | dma_pool_free(ha->s_dma_pool, tsk, tsk_dma); |
2293 | 2314 | ||
2294 | return rval; | 2315 | return rval; |
2295 | } | 2316 | } |
@@ -2307,29 +2328,30 @@ qla24xx_lun_reset(struct fc_port *fcport, unsigned int l) | |||
2307 | } | 2328 | } |
2308 | 2329 | ||
2309 | int | 2330 | int |
2310 | qla2x00_system_error(scsi_qla_host_t *ha) | 2331 | qla2x00_system_error(scsi_qla_host_t *vha) |
2311 | { | 2332 | { |
2312 | int rval; | 2333 | int rval; |
2313 | mbx_cmd_t mc; | 2334 | mbx_cmd_t mc; |
2314 | mbx_cmd_t *mcp = &mc; | 2335 | mbx_cmd_t *mcp = &mc; |
2336 | struct qla_hw_data *ha = vha->hw; | ||
2315 | 2337 | ||
2316 | if (!IS_QLA23XX(ha) && !IS_FWI2_CAPABLE(ha)) | 2338 | if (!IS_QLA23XX(ha) && !IS_FWI2_CAPABLE(ha)) |
2317 | return QLA_FUNCTION_FAILED; | 2339 | return QLA_FUNCTION_FAILED; |
2318 | 2340 | ||
2319 | DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no)); | 2341 | DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no)); |
2320 | 2342 | ||
2321 | mcp->mb[0] = MBC_GEN_SYSTEM_ERROR; | 2343 | mcp->mb[0] = MBC_GEN_SYSTEM_ERROR; |
2322 | mcp->out_mb = MBX_0; | 2344 | mcp->out_mb = MBX_0; |
2323 | mcp->in_mb = MBX_0; | 2345 | mcp->in_mb = MBX_0; |
2324 | mcp->tov = 5; | 2346 | mcp->tov = 5; |
2325 | mcp->flags = 0; | 2347 | mcp->flags = 0; |
2326 | rval = qla2x00_mailbox_command(ha, mcp); | 2348 | rval = qla2x00_mailbox_command(vha, mcp); |
2327 | 2349 | ||
2328 | if (rval != QLA_SUCCESS) { | 2350 | if (rval != QLA_SUCCESS) { |
2329 | DEBUG2_3_11(printk("%s(%ld): failed=%x.\n", __func__, | 2351 | DEBUG2_3_11(printk("%s(%ld): failed=%x.\n", __func__, |
2330 | ha->host_no, rval)); | 2352 | vha->host_no, rval)); |
2331 | } else { | 2353 | } else { |
2332 | DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no)); | 2354 | DEBUG11(printk("%s(%ld): done.\n", __func__, vha->host_no)); |
2333 | } | 2355 | } |
2334 | 2356 | ||
2335 | return rval; | 2357 | return rval; |
@@ -2342,14 +2364,14 @@ qla2x00_system_error(scsi_qla_host_t *ha) | |||
2342 | * Returns | 2364 | * Returns |
2343 | */ | 2365 | */ |
2344 | int | 2366 | int |
2345 | qla2x00_set_serdes_params(scsi_qla_host_t *ha, uint16_t sw_em_1g, | 2367 | qla2x00_set_serdes_params(scsi_qla_host_t *vha, uint16_t sw_em_1g, |
2346 | uint16_t sw_em_2g, uint16_t sw_em_4g) | 2368 | uint16_t sw_em_2g, uint16_t sw_em_4g) |
2347 | { | 2369 | { |
2348 | int rval; | 2370 | int rval; |
2349 | mbx_cmd_t mc; | 2371 | mbx_cmd_t mc; |
2350 | mbx_cmd_t *mcp = &mc; | 2372 | mbx_cmd_t *mcp = &mc; |
2351 | 2373 | ||
2352 | DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no)); | 2374 | DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no)); |
2353 | 2375 | ||
2354 | mcp->mb[0] = MBC_SERDES_PARAMS; | 2376 | mcp->mb[0] = MBC_SERDES_PARAMS; |
2355 | mcp->mb[1] = BIT_0; | 2377 | mcp->mb[1] = BIT_0; |
@@ -2360,61 +2382,61 @@ qla2x00_set_serdes_params(scsi_qla_host_t *ha, uint16_t sw_em_1g, | |||
2360 | mcp->in_mb = MBX_0; | 2382 | mcp->in_mb = MBX_0; |
2361 | mcp->tov = MBX_TOV_SECONDS; | 2383 | mcp->tov = MBX_TOV_SECONDS; |
2362 | mcp->flags = 0; | 2384 | mcp->flags = 0; |
2363 | rval = qla2x00_mailbox_command(ha, mcp); | 2385 | rval = qla2x00_mailbox_command(vha, mcp); |
2364 | 2386 | ||
2365 | if (rval != QLA_SUCCESS) { | 2387 | if (rval != QLA_SUCCESS) { |
2366 | /*EMPTY*/ | 2388 | /*EMPTY*/ |
2367 | DEBUG2_3_11(printk("%s(%ld): failed=%x (%x).\n", __func__, | 2389 | DEBUG2_3_11(printk("%s(%ld): failed=%x (%x).\n", __func__, |
2368 | ha->host_no, rval, mcp->mb[0])); | 2390 | vha->host_no, rval, mcp->mb[0])); |
2369 | } else { | 2391 | } else { |
2370 | /*EMPTY*/ | 2392 | /*EMPTY*/ |
2371 | DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no)); | 2393 | DEBUG11(printk("%s(%ld): done.\n", __func__, vha->host_no)); |
2372 | } | 2394 | } |
2373 | 2395 | ||
2374 | return rval; | 2396 | return rval; |
2375 | } | 2397 | } |
2376 | 2398 | ||
2377 | int | 2399 | int |
2378 | qla2x00_stop_firmware(scsi_qla_host_t *ha) | 2400 | qla2x00_stop_firmware(scsi_qla_host_t *vha) |
2379 | { | 2401 | { |
2380 | int rval; | 2402 | int rval; |
2381 | mbx_cmd_t mc; | 2403 | mbx_cmd_t mc; |
2382 | mbx_cmd_t *mcp = &mc; | 2404 | mbx_cmd_t *mcp = &mc; |
2383 | 2405 | ||
2384 | if (!IS_FWI2_CAPABLE(ha)) | 2406 | if (!IS_FWI2_CAPABLE(vha->hw)) |
2385 | return QLA_FUNCTION_FAILED; | 2407 | return QLA_FUNCTION_FAILED; |
2386 | 2408 | ||
2387 | DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no)); | 2409 | DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no)); |
2388 | 2410 | ||
2389 | mcp->mb[0] = MBC_STOP_FIRMWARE; | 2411 | mcp->mb[0] = MBC_STOP_FIRMWARE; |
2390 | mcp->out_mb = MBX_0; | 2412 | mcp->out_mb = MBX_0; |
2391 | mcp->in_mb = MBX_0; | 2413 | mcp->in_mb = MBX_0; |
2392 | mcp->tov = 5; | 2414 | mcp->tov = 5; |
2393 | mcp->flags = 0; | 2415 | mcp->flags = 0; |
2394 | rval = qla2x00_mailbox_command(ha, mcp); | 2416 | rval = qla2x00_mailbox_command(vha, mcp); |
2395 | 2417 | ||
2396 | if (rval != QLA_SUCCESS) { | 2418 | if (rval != QLA_SUCCESS) { |
2397 | DEBUG2_3_11(printk("%s(%ld): failed=%x.\n", __func__, | 2419 | DEBUG2_3_11(printk("%s(%ld): failed=%x.\n", __func__, |
2398 | ha->host_no, rval)); | 2420 | vha->host_no, rval)); |
2399 | } else { | 2421 | } else { |
2400 | DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no)); | 2422 | DEBUG11(printk("%s(%ld): done.\n", __func__, vha->host_no)); |
2401 | } | 2423 | } |
2402 | 2424 | ||
2403 | return rval; | 2425 | return rval; |
2404 | } | 2426 | } |
2405 | 2427 | ||
2406 | int | 2428 | int |
2407 | qla2x00_enable_eft_trace(scsi_qla_host_t *ha, dma_addr_t eft_dma, | 2429 | qla2x00_enable_eft_trace(scsi_qla_host_t *vha, dma_addr_t eft_dma, |
2408 | uint16_t buffers) | 2430 | uint16_t buffers) |
2409 | { | 2431 | { |
2410 | int rval; | 2432 | int rval; |
2411 | mbx_cmd_t mc; | 2433 | mbx_cmd_t mc; |
2412 | mbx_cmd_t *mcp = &mc; | 2434 | mbx_cmd_t *mcp = &mc; |
2413 | 2435 | ||
2414 | if (!IS_FWI2_CAPABLE(ha)) | 2436 | if (!IS_FWI2_CAPABLE(vha->hw)) |
2415 | return QLA_FUNCTION_FAILED; | 2437 | return QLA_FUNCTION_FAILED; |
2416 | 2438 | ||
2417 | DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no)); | 2439 | DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no)); |
2418 | 2440 | ||
2419 | mcp->mb[0] = MBC_TRACE_CONTROL; | 2441 | mcp->mb[0] = MBC_TRACE_CONTROL; |
2420 | mcp->mb[1] = TC_EFT_ENABLE; | 2442 | mcp->mb[1] = TC_EFT_ENABLE; |
@@ -2428,28 +2450,28 @@ qla2x00_enable_eft_trace(scsi_qla_host_t *ha, dma_addr_t eft_dma, | |||
2428 | mcp->in_mb = MBX_1|MBX_0; | 2450 | mcp->in_mb = MBX_1|MBX_0; |
2429 | mcp->tov = MBX_TOV_SECONDS; | 2451 | mcp->tov = MBX_TOV_SECONDS; |
2430 | mcp->flags = 0; | 2452 | mcp->flags = 0; |
2431 | rval = qla2x00_mailbox_command(ha, mcp); | 2453 | rval = qla2x00_mailbox_command(vha, mcp); |
2432 | if (rval != QLA_SUCCESS) { | 2454 | if (rval != QLA_SUCCESS) { |
2433 | DEBUG2_3_11(printk("%s(%ld): failed=%x mb[0]=%x mb[1]=%x.\n", | 2455 | DEBUG2_3_11(printk("%s(%ld): failed=%x mb[0]=%x mb[1]=%x.\n", |
2434 | __func__, ha->host_no, rval, mcp->mb[0], mcp->mb[1])); | 2456 | __func__, vha->host_no, rval, mcp->mb[0], mcp->mb[1])); |
2435 | } else { | 2457 | } else { |
2436 | DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no)); | 2458 | DEBUG11(printk("%s(%ld): done.\n", __func__, vha->host_no)); |
2437 | } | 2459 | } |
2438 | 2460 | ||
2439 | return rval; | 2461 | return rval; |
2440 | } | 2462 | } |
2441 | 2463 | ||
2442 | int | 2464 | int |
2443 | qla2x00_disable_eft_trace(scsi_qla_host_t *ha) | 2465 | qla2x00_disable_eft_trace(scsi_qla_host_t *vha) |
2444 | { | 2466 | { |
2445 | int rval; | 2467 | int rval; |
2446 | mbx_cmd_t mc; | 2468 | mbx_cmd_t mc; |
2447 | mbx_cmd_t *mcp = &mc; | 2469 | mbx_cmd_t *mcp = &mc; |
2448 | 2470 | ||
2449 | if (!IS_FWI2_CAPABLE(ha)) | 2471 | if (!IS_FWI2_CAPABLE(vha->hw)) |
2450 | return QLA_FUNCTION_FAILED; | 2472 | return QLA_FUNCTION_FAILED; |
2451 | 2473 | ||
2452 | DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no)); | 2474 | DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no)); |
2453 | 2475 | ||
2454 | mcp->mb[0] = MBC_TRACE_CONTROL; | 2476 | mcp->mb[0] = MBC_TRACE_CONTROL; |
2455 | mcp->mb[1] = TC_EFT_DISABLE; | 2477 | mcp->mb[1] = TC_EFT_DISABLE; |
@@ -2457,29 +2479,29 @@ qla2x00_disable_eft_trace(scsi_qla_host_t *ha) | |||
2457 | mcp->in_mb = MBX_1|MBX_0; | 2479 | mcp->in_mb = MBX_1|MBX_0; |
2458 | mcp->tov = MBX_TOV_SECONDS; | 2480 | mcp->tov = MBX_TOV_SECONDS; |
2459 | mcp->flags = 0; | 2481 | mcp->flags = 0; |
2460 | rval = qla2x00_mailbox_command(ha, mcp); | 2482 | rval = qla2x00_mailbox_command(vha, mcp); |
2461 | if (rval != QLA_SUCCESS) { | 2483 | if (rval != QLA_SUCCESS) { |
2462 | DEBUG2_3_11(printk("%s(%ld): failed=%x mb[0]=%x mb[1]=%x.\n", | 2484 | DEBUG2_3_11(printk("%s(%ld): failed=%x mb[0]=%x mb[1]=%x.\n", |
2463 | __func__, ha->host_no, rval, mcp->mb[0], mcp->mb[1])); | 2485 | __func__, vha->host_no, rval, mcp->mb[0], mcp->mb[1])); |
2464 | } else { | 2486 | } else { |
2465 | DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no)); | 2487 | DEBUG11(printk("%s(%ld): done.\n", __func__, vha->host_no)); |
2466 | } | 2488 | } |
2467 | 2489 | ||
2468 | return rval; | 2490 | return rval; |
2469 | } | 2491 | } |
2470 | 2492 | ||
2471 | int | 2493 | int |
2472 | qla2x00_enable_fce_trace(scsi_qla_host_t *ha, dma_addr_t fce_dma, | 2494 | qla2x00_enable_fce_trace(scsi_qla_host_t *vha, dma_addr_t fce_dma, |
2473 | uint16_t buffers, uint16_t *mb, uint32_t *dwords) | 2495 | uint16_t buffers, uint16_t *mb, uint32_t *dwords) |
2474 | { | 2496 | { |
2475 | int rval; | 2497 | int rval; |
2476 | mbx_cmd_t mc; | 2498 | mbx_cmd_t mc; |
2477 | mbx_cmd_t *mcp = &mc; | 2499 | mbx_cmd_t *mcp = &mc; |
2478 | 2500 | ||
2479 | if (!IS_QLA25XX(ha)) | 2501 | if (!IS_QLA25XX(vha->hw)) |
2480 | return QLA_FUNCTION_FAILED; | 2502 | return QLA_FUNCTION_FAILED; |
2481 | 2503 | ||
2482 | DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no)); | 2504 | DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no)); |
2483 | 2505 | ||
2484 | mcp->mb[0] = MBC_TRACE_CONTROL; | 2506 | mcp->mb[0] = MBC_TRACE_CONTROL; |
2485 | mcp->mb[1] = TC_FCE_ENABLE; | 2507 | mcp->mb[1] = TC_FCE_ENABLE; |
@@ -2497,12 +2519,12 @@ qla2x00_enable_fce_trace(scsi_qla_host_t *ha, dma_addr_t fce_dma, | |||
2497 | mcp->in_mb = MBX_6|MBX_5|MBX_4|MBX_3|MBX_2|MBX_1|MBX_0; | 2519 | mcp->in_mb = MBX_6|MBX_5|MBX_4|MBX_3|MBX_2|MBX_1|MBX_0; |
2498 | mcp->tov = MBX_TOV_SECONDS; | 2520 | mcp->tov = MBX_TOV_SECONDS; |
2499 | mcp->flags = 0; | 2521 | mcp->flags = 0; |
2500 | rval = qla2x00_mailbox_command(ha, mcp); | 2522 | rval = qla2x00_mailbox_command(vha, mcp); |
2501 | if (rval != QLA_SUCCESS) { | 2523 | if (rval != QLA_SUCCESS) { |
2502 | DEBUG2_3_11(printk("%s(%ld): failed=%x mb[0]=%x mb[1]=%x.\n", | 2524 | DEBUG2_3_11(printk("%s(%ld): failed=%x mb[0]=%x mb[1]=%x.\n", |
2503 | __func__, ha->host_no, rval, mcp->mb[0], mcp->mb[1])); | 2525 | __func__, vha->host_no, rval, mcp->mb[0], mcp->mb[1])); |
2504 | } else { | 2526 | } else { |
2505 | DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no)); | 2527 | DEBUG11(printk("%s(%ld): done.\n", __func__, vha->host_no)); |
2506 | 2528 | ||
2507 | if (mb) | 2529 | if (mb) |
2508 | memcpy(mb, mcp->mb, 8 * sizeof(*mb)); | 2530 | memcpy(mb, mcp->mb, 8 * sizeof(*mb)); |
@@ -2514,16 +2536,16 @@ qla2x00_enable_fce_trace(scsi_qla_host_t *ha, dma_addr_t fce_dma, | |||
2514 | } | 2536 | } |
2515 | 2537 | ||
2516 | int | 2538 | int |
2517 | qla2x00_disable_fce_trace(scsi_qla_host_t *ha, uint64_t *wr, uint64_t *rd) | 2539 | qla2x00_disable_fce_trace(scsi_qla_host_t *vha, uint64_t *wr, uint64_t *rd) |
2518 | { | 2540 | { |
2519 | int rval; | 2541 | int rval; |
2520 | mbx_cmd_t mc; | 2542 | mbx_cmd_t mc; |
2521 | mbx_cmd_t *mcp = &mc; | 2543 | mbx_cmd_t *mcp = &mc; |
2522 | 2544 | ||
2523 | if (!IS_FWI2_CAPABLE(ha)) | 2545 | if (!IS_FWI2_CAPABLE(vha->hw)) |
2524 | return QLA_FUNCTION_FAILED; | 2546 | return QLA_FUNCTION_FAILED; |
2525 | 2547 | ||
2526 | DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no)); | 2548 | DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no)); |
2527 | 2549 | ||
2528 | mcp->mb[0] = MBC_TRACE_CONTROL; | 2550 | mcp->mb[0] = MBC_TRACE_CONTROL; |
2529 | mcp->mb[1] = TC_FCE_DISABLE; | 2551 | mcp->mb[1] = TC_FCE_DISABLE; |
@@ -2533,12 +2555,12 @@ qla2x00_disable_fce_trace(scsi_qla_host_t *ha, uint64_t *wr, uint64_t *rd) | |||
2533 | MBX_1|MBX_0; | 2555 | MBX_1|MBX_0; |
2534 | mcp->tov = MBX_TOV_SECONDS; | 2556 | mcp->tov = MBX_TOV_SECONDS; |
2535 | mcp->flags = 0; | 2557 | mcp->flags = 0; |
2536 | rval = qla2x00_mailbox_command(ha, mcp); | 2558 | rval = qla2x00_mailbox_command(vha, mcp); |
2537 | if (rval != QLA_SUCCESS) { | 2559 | if (rval != QLA_SUCCESS) { |
2538 | DEBUG2_3_11(printk("%s(%ld): failed=%x mb[0]=%x mb[1]=%x.\n", | 2560 | DEBUG2_3_11(printk("%s(%ld): failed=%x mb[0]=%x mb[1]=%x.\n", |
2539 | __func__, ha->host_no, rval, mcp->mb[0], mcp->mb[1])); | 2561 | __func__, vha->host_no, rval, mcp->mb[0], mcp->mb[1])); |
2540 | } else { | 2562 | } else { |
2541 | DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no)); | 2563 | DEBUG11(printk("%s(%ld): done.\n", __func__, vha->host_no)); |
2542 | 2564 | ||
2543 | if (wr) | 2565 | if (wr) |
2544 | *wr = (uint64_t) mcp->mb[5] << 48 | | 2566 | *wr = (uint64_t) mcp->mb[5] << 48 | |
@@ -2556,17 +2578,17 @@ qla2x00_disable_fce_trace(scsi_qla_host_t *ha, uint64_t *wr, uint64_t *rd) | |||
2556 | } | 2578 | } |
2557 | 2579 | ||
2558 | int | 2580 | int |
2559 | qla2x00_read_sfp(scsi_qla_host_t *ha, dma_addr_t sfp_dma, uint16_t addr, | 2581 | qla2x00_read_sfp(scsi_qla_host_t *vha, dma_addr_t sfp_dma, uint16_t addr, |
2560 | uint16_t off, uint16_t count) | 2582 | uint16_t off, uint16_t count) |
2561 | { | 2583 | { |
2562 | int rval; | 2584 | int rval; |
2563 | mbx_cmd_t mc; | 2585 | mbx_cmd_t mc; |
2564 | mbx_cmd_t *mcp = &mc; | 2586 | mbx_cmd_t *mcp = &mc; |
2565 | 2587 | ||
2566 | if (!IS_FWI2_CAPABLE(ha)) | 2588 | if (!IS_FWI2_CAPABLE(vha->hw)) |
2567 | return QLA_FUNCTION_FAILED; | 2589 | return QLA_FUNCTION_FAILED; |
2568 | 2590 | ||
2569 | DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no)); | 2591 | DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no)); |
2570 | 2592 | ||
2571 | mcp->mb[0] = MBC_READ_SFP; | 2593 | mcp->mb[0] = MBC_READ_SFP; |
2572 | mcp->mb[1] = addr; | 2594 | mcp->mb[1] = addr; |
@@ -2581,30 +2603,30 @@ qla2x00_read_sfp(scsi_qla_host_t *ha, dma_addr_t sfp_dma, uint16_t addr, | |||
2581 | mcp->in_mb = MBX_0; | 2603 | mcp->in_mb = MBX_0; |
2582 | mcp->tov = MBX_TOV_SECONDS; | 2604 | mcp->tov = MBX_TOV_SECONDS; |
2583 | mcp->flags = 0; | 2605 | mcp->flags = 0; |
2584 | rval = qla2x00_mailbox_command(ha, mcp); | 2606 | rval = qla2x00_mailbox_command(vha, mcp); |
2585 | 2607 | ||
2586 | if (rval != QLA_SUCCESS) { | 2608 | if (rval != QLA_SUCCESS) { |
2587 | DEBUG2_3_11(printk("%s(%ld): failed=%x (%x).\n", __func__, | 2609 | DEBUG2_3_11(printk("%s(%ld): failed=%x (%x).\n", __func__, |
2588 | ha->host_no, rval, mcp->mb[0])); | 2610 | vha->host_no, rval, mcp->mb[0])); |
2589 | } else { | 2611 | } else { |
2590 | DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no)); | 2612 | DEBUG11(printk("%s(%ld): done.\n", __func__, vha->host_no)); |
2591 | } | 2613 | } |
2592 | 2614 | ||
2593 | return rval; | 2615 | return rval; |
2594 | } | 2616 | } |
2595 | 2617 | ||
2596 | int | 2618 | int |
2597 | qla2x00_set_idma_speed(scsi_qla_host_t *ha, uint16_t loop_id, | 2619 | qla2x00_set_idma_speed(scsi_qla_host_t *vha, uint16_t loop_id, |
2598 | uint16_t port_speed, uint16_t *mb) | 2620 | uint16_t port_speed, uint16_t *mb) |
2599 | { | 2621 | { |
2600 | int rval; | 2622 | int rval; |
2601 | mbx_cmd_t mc; | 2623 | mbx_cmd_t mc; |
2602 | mbx_cmd_t *mcp = &mc; | 2624 | mbx_cmd_t *mcp = &mc; |
2603 | 2625 | ||
2604 | if (!IS_IIDMA_CAPABLE(ha)) | 2626 | if (!IS_IIDMA_CAPABLE(vha->hw)) |
2605 | return QLA_FUNCTION_FAILED; | 2627 | return QLA_FUNCTION_FAILED; |
2606 | 2628 | ||
2607 | DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no)); | 2629 | DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no)); |
2608 | 2630 | ||
2609 | mcp->mb[0] = MBC_PORT_PARAMS; | 2631 | mcp->mb[0] = MBC_PORT_PARAMS; |
2610 | mcp->mb[1] = loop_id; | 2632 | mcp->mb[1] = loop_id; |
@@ -2615,7 +2637,7 @@ qla2x00_set_idma_speed(scsi_qla_host_t *ha, uint16_t loop_id, | |||
2615 | mcp->in_mb = MBX_5|MBX_4|MBX_3|MBX_1|MBX_0; | 2637 | mcp->in_mb = MBX_5|MBX_4|MBX_3|MBX_1|MBX_0; |
2616 | mcp->tov = MBX_TOV_SECONDS; | 2638 | mcp->tov = MBX_TOV_SECONDS; |
2617 | mcp->flags = 0; | 2639 | mcp->flags = 0; |
2618 | rval = qla2x00_mailbox_command(ha, mcp); | 2640 | rval = qla2x00_mailbox_command(vha, mcp); |
2619 | 2641 | ||
2620 | /* Return mailbox statuses. */ | 2642 | /* Return mailbox statuses. */ |
2621 | if (mb != NULL) { | 2643 | if (mb != NULL) { |
@@ -2628,28 +2650,29 @@ qla2x00_set_idma_speed(scsi_qla_host_t *ha, uint16_t loop_id, | |||
2628 | 2650 | ||
2629 | if (rval != QLA_SUCCESS) { | 2651 | if (rval != QLA_SUCCESS) { |
2630 | DEBUG2_3_11(printk("%s(%ld): failed=%x.\n", __func__, | 2652 | DEBUG2_3_11(printk("%s(%ld): failed=%x.\n", __func__, |
2631 | ha->host_no, rval)); | 2653 | vha->host_no, rval)); |
2632 | } else { | 2654 | } else { |
2633 | DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no)); | 2655 | DEBUG11(printk("%s(%ld): done.\n", __func__, vha->host_no)); |
2634 | } | 2656 | } |
2635 | 2657 | ||
2636 | return rval; | 2658 | return rval; |
2637 | } | 2659 | } |
2638 | 2660 | ||
2639 | void | 2661 | void |
2640 | qla24xx_report_id_acquisition(scsi_qla_host_t *ha, | 2662 | qla24xx_report_id_acquisition(scsi_qla_host_t *vha, |
2641 | struct vp_rpt_id_entry_24xx *rptid_entry) | 2663 | struct vp_rpt_id_entry_24xx *rptid_entry) |
2642 | { | 2664 | { |
2643 | uint8_t vp_idx; | 2665 | uint8_t vp_idx; |
2644 | uint16_t stat = le16_to_cpu(rptid_entry->vp_idx); | 2666 | uint16_t stat = le16_to_cpu(rptid_entry->vp_idx); |
2645 | scsi_qla_host_t *vha; | 2667 | struct qla_hw_data *ha = vha->hw; |
2668 | scsi_qla_host_t *vp; | ||
2646 | 2669 | ||
2647 | if (rptid_entry->entry_status != 0) | 2670 | if (rptid_entry->entry_status != 0) |
2648 | return; | 2671 | return; |
2649 | 2672 | ||
2650 | if (rptid_entry->format == 0) { | 2673 | if (rptid_entry->format == 0) { |
2651 | DEBUG15(printk("%s:format 0 : scsi(%ld) number of VPs setup %d," | 2674 | DEBUG15(printk("%s:format 0 : scsi(%ld) number of VPs setup %d," |
2652 | " number of VPs acquired %d\n", __func__, ha->host_no, | 2675 | " number of VPs acquired %d\n", __func__, vha->host_no, |
2653 | MSB(rptid_entry->vp_count), LSB(rptid_entry->vp_count))); | 2676 | MSB(rptid_entry->vp_count), LSB(rptid_entry->vp_count))); |
2654 | DEBUG15(printk("%s primary port id %02x%02x%02x\n", __func__, | 2677 | DEBUG15(printk("%s primary port id %02x%02x%02x\n", __func__, |
2655 | rptid_entry->port_id[2], rptid_entry->port_id[1], | 2678 | rptid_entry->port_id[2], rptid_entry->port_id[1], |
@@ -2658,7 +2681,7 @@ qla24xx_report_id_acquisition(scsi_qla_host_t *ha, | |||
2658 | vp_idx = LSB(stat); | 2681 | vp_idx = LSB(stat); |
2659 | DEBUG15(printk("%s:format 1: scsi(%ld): VP[%d] enabled " | 2682 | DEBUG15(printk("%s:format 1: scsi(%ld): VP[%d] enabled " |
2660 | "- status %d - " | 2683 | "- status %d - " |
2661 | "with port id %02x%02x%02x\n",__func__,ha->host_no, | 2684 | "with port id %02x%02x%02x\n", __func__, vha->host_no, |
2662 | vp_idx, MSB(stat), | 2685 | vp_idx, MSB(stat), |
2663 | rptid_entry->port_id[2], rptid_entry->port_id[1], | 2686 | rptid_entry->port_id[2], rptid_entry->port_id[1], |
2664 | rptid_entry->port_id[0])); | 2687 | rptid_entry->port_id[0])); |
@@ -2668,25 +2691,24 @@ qla24xx_report_id_acquisition(scsi_qla_host_t *ha, | |||
2668 | if (MSB(stat) == 1) | 2691 | if (MSB(stat) == 1) |
2669 | return; | 2692 | return; |
2670 | 2693 | ||
2671 | list_for_each_entry(vha, &ha->vp_list, vp_list) | 2694 | list_for_each_entry(vp, &ha->vp_list, list) |
2672 | if (vp_idx == vha->vp_idx) | 2695 | if (vp_idx == vp->vp_idx) |
2673 | break; | 2696 | break; |
2674 | 2697 | if (!vp) | |
2675 | if (!vha) | ||
2676 | return; | 2698 | return; |
2677 | 2699 | ||
2678 | vha->d_id.b.domain = rptid_entry->port_id[2]; | 2700 | vp->d_id.b.domain = rptid_entry->port_id[2]; |
2679 | vha->d_id.b.area = rptid_entry->port_id[1]; | 2701 | vp->d_id.b.area = rptid_entry->port_id[1]; |
2680 | vha->d_id.b.al_pa = rptid_entry->port_id[0]; | 2702 | vp->d_id.b.al_pa = rptid_entry->port_id[0]; |
2681 | 2703 | ||
2682 | /* | 2704 | /* |
2683 | * Cannot configure here as we are still sitting on the | 2705 | * Cannot configure here as we are still sitting on the |
2684 | * response queue. Handle it in dpc context. | 2706 | * response queue. Handle it in dpc context. |
2685 | */ | 2707 | */ |
2686 | set_bit(VP_IDX_ACQUIRED, &vha->vp_flags); | 2708 | set_bit(VP_IDX_ACQUIRED, &vp->vp_flags); |
2687 | set_bit(VP_DPC_NEEDED, &ha->dpc_flags); | 2709 | set_bit(VP_DPC_NEEDED, &vha->dpc_flags); |
2688 | 2710 | ||
2689 | qla2xxx_wake_dpc(ha); | 2711 | qla2xxx_wake_dpc(vha); |
2690 | } | 2712 | } |
2691 | } | 2713 | } |
2692 | 2714 | ||
@@ -2709,15 +2731,15 @@ qla24xx_modify_vp_config(scsi_qla_host_t *vha) | |||
2709 | int rval; | 2731 | int rval; |
2710 | struct vp_config_entry_24xx *vpmod; | 2732 | struct vp_config_entry_24xx *vpmod; |
2711 | dma_addr_t vpmod_dma; | 2733 | dma_addr_t vpmod_dma; |
2712 | scsi_qla_host_t *pha; | 2734 | struct qla_hw_data *ha = vha->hw; |
2735 | struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev); | ||
2713 | 2736 | ||
2714 | /* This can be called by the parent */ | 2737 | /* This can be called by the parent */ |
2715 | pha = to_qla_parent(vha); | ||
2716 | 2738 | ||
2717 | vpmod = dma_pool_alloc(pha->s_dma_pool, GFP_KERNEL, &vpmod_dma); | 2739 | vpmod = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &vpmod_dma); |
2718 | if (!vpmod) { | 2740 | if (!vpmod) { |
2719 | DEBUG2_3(printk("%s(%ld): failed to allocate Modify VP " | 2741 | DEBUG2_3(printk("%s(%ld): failed to allocate Modify VP " |
2720 | "IOCB.\n", __func__, pha->host_no)); | 2742 | "IOCB.\n", __func__, vha->host_no)); |
2721 | return QLA_MEMORY_ALLOC_FAILED; | 2743 | return QLA_MEMORY_ALLOC_FAILED; |
2722 | } | 2744 | } |
2723 | 2745 | ||
@@ -2732,26 +2754,27 @@ qla24xx_modify_vp_config(scsi_qla_host_t *vha) | |||
2732 | memcpy(vpmod->port_name_idx1, vha->port_name, WWN_SIZE); | 2754 | memcpy(vpmod->port_name_idx1, vha->port_name, WWN_SIZE); |
2733 | vpmod->entry_count = 1; | 2755 | vpmod->entry_count = 1; |
2734 | 2756 | ||
2735 | rval = qla2x00_issue_iocb(pha, vpmod, vpmod_dma, 0); | 2757 | rval = qla2x00_issue_iocb(base_vha, vpmod, vpmod_dma, 0); |
2736 | if (rval != QLA_SUCCESS) { | 2758 | if (rval != QLA_SUCCESS) { |
2737 | DEBUG2_3_11(printk("%s(%ld): failed to issue VP config IOCB" | 2759 | DEBUG2_3_11(printk("%s(%ld): failed to issue VP config IOCB" |
2738 | "(%x).\n", __func__, pha->host_no, rval)); | 2760 | "(%x).\n", __func__, base_vha->host_no, rval)); |
2739 | } else if (vpmod->comp_status != 0) { | 2761 | } else if (vpmod->comp_status != 0) { |
2740 | DEBUG2_3_11(printk("%s(%ld): failed to complete IOCB " | 2762 | DEBUG2_3_11(printk("%s(%ld): failed to complete IOCB " |
2741 | "-- error status (%x).\n", __func__, pha->host_no, | 2763 | "-- error status (%x).\n", __func__, base_vha->host_no, |
2742 | vpmod->comp_status)); | 2764 | vpmod->comp_status)); |
2743 | rval = QLA_FUNCTION_FAILED; | 2765 | rval = QLA_FUNCTION_FAILED; |
2744 | } else if (vpmod->comp_status != __constant_cpu_to_le16(CS_COMPLETE)) { | 2766 | } else if (vpmod->comp_status != __constant_cpu_to_le16(CS_COMPLETE)) { |
2745 | DEBUG2_3_11(printk("%s(%ld): failed to complete IOCB " | 2767 | DEBUG2_3_11(printk("%s(%ld): failed to complete IOCB " |
2746 | "-- completion status (%x).\n", __func__, pha->host_no, | 2768 | "-- completion status (%x).\n", __func__, base_vha->host_no, |
2747 | le16_to_cpu(vpmod->comp_status))); | 2769 | le16_to_cpu(vpmod->comp_status))); |
2748 | rval = QLA_FUNCTION_FAILED; | 2770 | rval = QLA_FUNCTION_FAILED; |
2749 | } else { | 2771 | } else { |
2750 | /* EMPTY */ | 2772 | /* EMPTY */ |
2751 | DEBUG11(printk("%s(%ld): done.\n", __func__, pha->host_no)); | 2773 | DEBUG11(printk("%s(%ld): done.\n", __func__, |
2774 | base_vha->host_no)); | ||
2752 | fc_vport_set_state(vha->fc_vport, FC_VPORT_INITIALIZING); | 2775 | fc_vport_set_state(vha->fc_vport, FC_VPORT_INITIALIZING); |
2753 | } | 2776 | } |
2754 | dma_pool_free(pha->s_dma_pool, vpmod, vpmod_dma); | 2777 | dma_pool_free(ha->s_dma_pool, vpmod, vpmod_dma); |
2755 | 2778 | ||
2756 | return rval; | 2779 | return rval; |
2757 | } | 2780 | } |
@@ -2778,11 +2801,12 @@ qla24xx_control_vp(scsi_qla_host_t *vha, int cmd) | |||
2778 | int map, pos; | 2801 | int map, pos; |
2779 | struct vp_ctrl_entry_24xx *vce; | 2802 | struct vp_ctrl_entry_24xx *vce; |
2780 | dma_addr_t vce_dma; | 2803 | dma_addr_t vce_dma; |
2781 | scsi_qla_host_t *ha = vha->parent; | 2804 | struct qla_hw_data *ha = vha->hw; |
2782 | int vp_index = vha->vp_idx; | 2805 | int vp_index = vha->vp_idx; |
2806 | struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev); | ||
2783 | 2807 | ||
2784 | DEBUG11(printk("%s(%ld): entered. Enabling index %d\n", __func__, | 2808 | DEBUG11(printk("%s(%ld): entered. Enabling index %d\n", __func__, |
2785 | ha->host_no, vp_index)); | 2809 | vha->host_no, vp_index)); |
2786 | 2810 | ||
2787 | if (vp_index == 0 || vp_index >= ha->max_npiv_vports) | 2811 | if (vp_index == 0 || vp_index >= ha->max_npiv_vports) |
2788 | return QLA_PARAMETER_ERROR; | 2812 | return QLA_PARAMETER_ERROR; |
@@ -2791,7 +2815,7 @@ qla24xx_control_vp(scsi_qla_host_t *vha, int cmd) | |||
2791 | if (!vce) { | 2815 | if (!vce) { |
2792 | DEBUG2_3(printk("%s(%ld): " | 2816 | DEBUG2_3(printk("%s(%ld): " |
2793 | "failed to allocate VP Control IOCB.\n", __func__, | 2817 | "failed to allocate VP Control IOCB.\n", __func__, |
2794 | ha->host_no)); | 2818 | base_vha->host_no)); |
2795 | return QLA_MEMORY_ALLOC_FAILED; | 2819 | return QLA_MEMORY_ALLOC_FAILED; |
2796 | } | 2820 | } |
2797 | memset(vce, 0, sizeof(struct vp_ctrl_entry_24xx)); | 2821 | memset(vce, 0, sizeof(struct vp_ctrl_entry_24xx)); |
@@ -2810,30 +2834,30 @@ qla24xx_control_vp(scsi_qla_host_t *vha, int cmd) | |||
2810 | vce->vp_idx_map[map] |= 1 << pos; | 2834 | vce->vp_idx_map[map] |= 1 << pos; |
2811 | mutex_unlock(&ha->vport_lock); | 2835 | mutex_unlock(&ha->vport_lock); |
2812 | 2836 | ||
2813 | rval = qla2x00_issue_iocb(ha, vce, vce_dma, 0); | 2837 | rval = qla2x00_issue_iocb(base_vha, vce, vce_dma, 0); |
2814 | if (rval != QLA_SUCCESS) { | 2838 | if (rval != QLA_SUCCESS) { |
2815 | DEBUG2_3_11(printk("%s(%ld): failed to issue VP control IOCB" | 2839 | DEBUG2_3_11(printk("%s(%ld): failed to issue VP control IOCB" |
2816 | "(%x).\n", __func__, ha->host_no, rval)); | 2840 | "(%x).\n", __func__, base_vha->host_no, rval)); |
2817 | printk("%s(%ld): failed to issue VP control IOCB" | 2841 | printk("%s(%ld): failed to issue VP control IOCB" |
2818 | "(%x).\n", __func__, ha->host_no, rval); | 2842 | "(%x).\n", __func__, base_vha->host_no, rval); |
2819 | } else if (vce->entry_status != 0) { | 2843 | } else if (vce->entry_status != 0) { |
2820 | DEBUG2_3_11(printk("%s(%ld): failed to complete IOCB " | 2844 | DEBUG2_3_11(printk("%s(%ld): failed to complete IOCB " |
2821 | "-- error status (%x).\n", __func__, ha->host_no, | 2845 | "-- error status (%x).\n", __func__, base_vha->host_no, |
2822 | vce->entry_status)); | 2846 | vce->entry_status)); |
2823 | printk("%s(%ld): failed to complete IOCB " | 2847 | printk("%s(%ld): failed to complete IOCB " |
2824 | "-- error status (%x).\n", __func__, ha->host_no, | 2848 | "-- error status (%x).\n", __func__, base_vha->host_no, |
2825 | vce->entry_status); | 2849 | vce->entry_status); |
2826 | rval = QLA_FUNCTION_FAILED; | 2850 | rval = QLA_FUNCTION_FAILED; |
2827 | } else if (vce->comp_status != __constant_cpu_to_le16(CS_COMPLETE)) { | 2851 | } else if (vce->comp_status != __constant_cpu_to_le16(CS_COMPLETE)) { |
2828 | DEBUG2_3_11(printk("%s(%ld): failed to complete IOCB " | 2852 | DEBUG2_3_11(printk("%s(%ld): failed to complete IOCB " |
2829 | "-- completion status (%x).\n", __func__, ha->host_no, | 2853 | "-- completion status (%x).\n", __func__, base_vha->host_no, |
2830 | le16_to_cpu(vce->comp_status))); | 2854 | le16_to_cpu(vce->comp_status))); |
2831 | printk("%s(%ld): failed to complete IOCB " | 2855 | printk("%s(%ld): failed to complete IOCB " |
2832 | "-- completion status (%x).\n", __func__, ha->host_no, | 2856 | "-- completion status (%x).\n", __func__, base_vha->host_no, |
2833 | le16_to_cpu(vce->comp_status)); | 2857 | le16_to_cpu(vce->comp_status)); |
2834 | rval = QLA_FUNCTION_FAILED; | 2858 | rval = QLA_FUNCTION_FAILED; |
2835 | } else { | 2859 | } else { |
2836 | DEBUG2(printk("%s(%ld): done.\n", __func__, ha->host_no)); | 2860 | DEBUG2(printk("%s(%ld): done.\n", __func__, base_vha->host_no)); |
2837 | } | 2861 | } |
2838 | 2862 | ||
2839 | dma_pool_free(ha->s_dma_pool, vce, vce_dma); | 2863 | dma_pool_free(ha->s_dma_pool, vce, vce_dma); |
@@ -2863,7 +2887,7 @@ qla24xx_control_vp(scsi_qla_host_t *vha, int cmd) | |||
2863 | */ | 2887 | */ |
2864 | 2888 | ||
2865 | int | 2889 | int |
2866 | qla2x00_send_change_request(scsi_qla_host_t *ha, uint16_t format, | 2890 | qla2x00_send_change_request(scsi_qla_host_t *vha, uint16_t format, |
2867 | uint16_t vp_idx) | 2891 | uint16_t vp_idx) |
2868 | { | 2892 | { |
2869 | int rval; | 2893 | int rval; |
@@ -2884,7 +2908,7 @@ qla2x00_send_change_request(scsi_qla_host_t *ha, uint16_t format, | |||
2884 | mcp->in_mb = MBX_0|MBX_1; | 2908 | mcp->in_mb = MBX_0|MBX_1; |
2885 | mcp->tov = MBX_TOV_SECONDS; | 2909 | mcp->tov = MBX_TOV_SECONDS; |
2886 | mcp->flags = 0; | 2910 | mcp->flags = 0; |
2887 | rval = qla2x00_mailbox_command(ha, mcp); | 2911 | rval = qla2x00_mailbox_command(vha, mcp); |
2888 | 2912 | ||
2889 | if (rval == QLA_SUCCESS) { | 2913 | if (rval == QLA_SUCCESS) { |
2890 | if (mcp->mb[0] != MBS_COMMAND_COMPLETE) { | 2914 | if (mcp->mb[0] != MBS_COMMAND_COMPLETE) { |
@@ -2897,16 +2921,16 @@ qla2x00_send_change_request(scsi_qla_host_t *ha, uint16_t format, | |||
2897 | } | 2921 | } |
2898 | 2922 | ||
2899 | int | 2923 | int |
2900 | qla2x00_dump_ram(scsi_qla_host_t *ha, dma_addr_t req_dma, uint32_t addr, | 2924 | qla2x00_dump_ram(scsi_qla_host_t *vha, dma_addr_t req_dma, uint32_t addr, |
2901 | uint32_t size) | 2925 | uint32_t size) |
2902 | { | 2926 | { |
2903 | int rval; | 2927 | int rval; |
2904 | mbx_cmd_t mc; | 2928 | mbx_cmd_t mc; |
2905 | mbx_cmd_t *mcp = &mc; | 2929 | mbx_cmd_t *mcp = &mc; |
2906 | 2930 | ||
2907 | DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no)); | 2931 | DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no)); |
2908 | 2932 | ||
2909 | if (MSW(addr) || IS_FWI2_CAPABLE(ha)) { | 2933 | if (MSW(addr) || IS_FWI2_CAPABLE(vha->hw)) { |
2910 | mcp->mb[0] = MBC_DUMP_RISC_RAM_EXTENDED; | 2934 | mcp->mb[0] = MBC_DUMP_RISC_RAM_EXTENDED; |
2911 | mcp->mb[8] = MSW(addr); | 2935 | mcp->mb[8] = MSW(addr); |
2912 | mcp->out_mb = MBX_8|MBX_0; | 2936 | mcp->out_mb = MBX_8|MBX_0; |
@@ -2920,7 +2944,7 @@ qla2x00_dump_ram(scsi_qla_host_t *ha, dma_addr_t req_dma, uint32_t addr, | |||
2920 | mcp->mb[6] = MSW(MSD(req_dma)); | 2944 | mcp->mb[6] = MSW(MSD(req_dma)); |
2921 | mcp->mb[7] = LSW(MSD(req_dma)); | 2945 | mcp->mb[7] = LSW(MSD(req_dma)); |
2922 | mcp->out_mb |= MBX_7|MBX_6|MBX_3|MBX_2|MBX_1; | 2946 | mcp->out_mb |= MBX_7|MBX_6|MBX_3|MBX_2|MBX_1; |
2923 | if (IS_FWI2_CAPABLE(ha)) { | 2947 | if (IS_FWI2_CAPABLE(vha->hw)) { |
2924 | mcp->mb[4] = MSW(size); | 2948 | mcp->mb[4] = MSW(size); |
2925 | mcp->mb[5] = LSW(size); | 2949 | mcp->mb[5] = LSW(size); |
2926 | mcp->out_mb |= MBX_5|MBX_4; | 2950 | mcp->out_mb |= MBX_5|MBX_4; |
@@ -2932,13 +2956,13 @@ qla2x00_dump_ram(scsi_qla_host_t *ha, dma_addr_t req_dma, uint32_t addr, | |||
2932 | mcp->in_mb = MBX_0; | 2956 | mcp->in_mb = MBX_0; |
2933 | mcp->tov = MBX_TOV_SECONDS; | 2957 | mcp->tov = MBX_TOV_SECONDS; |
2934 | mcp->flags = 0; | 2958 | mcp->flags = 0; |
2935 | rval = qla2x00_mailbox_command(ha, mcp); | 2959 | rval = qla2x00_mailbox_command(vha, mcp); |
2936 | 2960 | ||
2937 | if (rval != QLA_SUCCESS) { | 2961 | if (rval != QLA_SUCCESS) { |
2938 | DEBUG2_3_11(printk("%s(%ld): failed=%x mb[0]=%x.\n", __func__, | 2962 | DEBUG2_3_11(printk("%s(%ld): failed=%x mb[0]=%x.\n", __func__, |
2939 | ha->host_no, rval, mcp->mb[0])); | 2963 | vha->host_no, rval, mcp->mb[0])); |
2940 | } else { | 2964 | } else { |
2941 | DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no)); | 2965 | DEBUG11(printk("%s(%ld): done.\n", __func__, vha->host_no)); |
2942 | } | 2966 | } |
2943 | 2967 | ||
2944 | return rval; | 2968 | return rval; |
@@ -2954,20 +2978,21 @@ struct cs84xx_mgmt_cmd { | |||
2954 | }; | 2978 | }; |
2955 | 2979 | ||
2956 | int | 2980 | int |
2957 | qla84xx_verify_chip(struct scsi_qla_host *ha, uint16_t *status) | 2981 | qla84xx_verify_chip(struct scsi_qla_host *vha, uint16_t *status) |
2958 | { | 2982 | { |
2959 | int rval, retry; | 2983 | int rval, retry; |
2960 | struct cs84xx_mgmt_cmd *mn; | 2984 | struct cs84xx_mgmt_cmd *mn; |
2961 | dma_addr_t mn_dma; | 2985 | dma_addr_t mn_dma; |
2962 | uint16_t options; | 2986 | uint16_t options; |
2963 | unsigned long flags; | 2987 | unsigned long flags; |
2988 | struct qla_hw_data *ha = vha->hw; | ||
2964 | 2989 | ||
2965 | DEBUG16(printk("%s(%ld): entered.\n", __func__, ha->host_no)); | 2990 | DEBUG16(printk("%s(%ld): entered.\n", __func__, vha->host_no)); |
2966 | 2991 | ||
2967 | mn = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &mn_dma); | 2992 | mn = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &mn_dma); |
2968 | if (mn == NULL) { | 2993 | if (mn == NULL) { |
2969 | DEBUG2_3(printk("%s(%ld): failed to allocate Verify ISP84XX " | 2994 | DEBUG2_3(printk("%s(%ld): failed to allocate Verify ISP84XX " |
2970 | "IOCB.\n", __func__, ha->host_no)); | 2995 | "IOCB.\n", __func__, vha->host_no)); |
2971 | return QLA_MEMORY_ALLOC_FAILED; | 2996 | return QLA_MEMORY_ALLOC_FAILED; |
2972 | } | 2997 | } |
2973 | 2998 | ||
@@ -2986,19 +3011,19 @@ qla84xx_verify_chip(struct scsi_qla_host *ha, uint16_t *status) | |||
2986 | mn->p.req.options = cpu_to_le16(options); | 3011 | mn->p.req.options = cpu_to_le16(options); |
2987 | 3012 | ||
2988 | DEBUG16(printk("%s(%ld): Dump of Verify Request.\n", __func__, | 3013 | DEBUG16(printk("%s(%ld): Dump of Verify Request.\n", __func__, |
2989 | ha->host_no)); | 3014 | vha->host_no)); |
2990 | DEBUG16(qla2x00_dump_buffer((uint8_t *)mn, | 3015 | DEBUG16(qla2x00_dump_buffer((uint8_t *)mn, |
2991 | sizeof(*mn))); | 3016 | sizeof(*mn))); |
2992 | 3017 | ||
2993 | rval = qla2x00_issue_iocb_timeout(ha, mn, mn_dma, 0, 120); | 3018 | rval = qla2x00_issue_iocb_timeout(vha, mn, mn_dma, 0, 120); |
2994 | if (rval != QLA_SUCCESS) { | 3019 | if (rval != QLA_SUCCESS) { |
2995 | DEBUG2_16(printk("%s(%ld): failed to issue Verify " | 3020 | DEBUG2_16(printk("%s(%ld): failed to issue Verify " |
2996 | "IOCB (%x).\n", __func__, ha->host_no, rval)); | 3021 | "IOCB (%x).\n", __func__, vha->host_no, rval)); |
2997 | goto verify_done; | 3022 | goto verify_done; |
2998 | } | 3023 | } |
2999 | 3024 | ||
3000 | DEBUG16(printk("%s(%ld): Dump of Verify Response.\n", __func__, | 3025 | DEBUG16(printk("%s(%ld): Dump of Verify Response.\n", __func__, |
3001 | ha->host_no)); | 3026 | vha->host_no)); |
3002 | DEBUG16(qla2x00_dump_buffer((uint8_t *)mn, | 3027 | DEBUG16(qla2x00_dump_buffer((uint8_t *)mn, |
3003 | sizeof(*mn))); | 3028 | sizeof(*mn))); |
3004 | 3029 | ||
@@ -3006,21 +3031,21 @@ qla84xx_verify_chip(struct scsi_qla_host *ha, uint16_t *status) | |||
3006 | status[1] = status[0] == CS_VCS_CHIP_FAILURE ? | 3031 | status[1] = status[0] == CS_VCS_CHIP_FAILURE ? |
3007 | le16_to_cpu(mn->p.rsp.failure_code) : 0; | 3032 | le16_to_cpu(mn->p.rsp.failure_code) : 0; |
3008 | DEBUG2_16(printk("%s(%ld): cs=%x fc=%x\n", __func__, | 3033 | DEBUG2_16(printk("%s(%ld): cs=%x fc=%x\n", __func__, |
3009 | ha->host_no, status[0], status[1])); | 3034 | vha->host_no, status[0], status[1])); |
3010 | 3035 | ||
3011 | if (status[0] != CS_COMPLETE) { | 3036 | if (status[0] != CS_COMPLETE) { |
3012 | rval = QLA_FUNCTION_FAILED; | 3037 | rval = QLA_FUNCTION_FAILED; |
3013 | if (!(options & VCO_DONT_UPDATE_FW)) { | 3038 | if (!(options & VCO_DONT_UPDATE_FW)) { |
3014 | DEBUG2_16(printk("%s(%ld): Firmware update " | 3039 | DEBUG2_16(printk("%s(%ld): Firmware update " |
3015 | "failed. Retrying without update " | 3040 | "failed. Retrying without update " |
3016 | "firmware.\n", __func__, ha->host_no)); | 3041 | "firmware.\n", __func__, vha->host_no)); |
3017 | options |= VCO_DONT_UPDATE_FW; | 3042 | options |= VCO_DONT_UPDATE_FW; |
3018 | options &= ~VCO_FORCE_UPDATE; | 3043 | options &= ~VCO_FORCE_UPDATE; |
3019 | retry = 1; | 3044 | retry = 1; |
3020 | } | 3045 | } |
3021 | } else { | 3046 | } else { |
3022 | DEBUG2_16(printk("%s(%ld): firmware updated to %x.\n", | 3047 | DEBUG2_16(printk("%s(%ld): firmware updated to %x.\n", |
3023 | __func__, ha->host_no, | 3048 | __func__, vha->host_no, |
3024 | le32_to_cpu(mn->p.rsp.fw_ver))); | 3049 | le32_to_cpu(mn->p.rsp.fw_ver))); |
3025 | 3050 | ||
3026 | /* NOTE: we only update OP firmware. */ | 3051 | /* NOTE: we only update OP firmware. */ |
@@ -3037,9 +3062,9 @@ verify_done: | |||
3037 | 3062 | ||
3038 | if (rval != QLA_SUCCESS) { | 3063 | if (rval != QLA_SUCCESS) { |
3039 | DEBUG2_16(printk("%s(%ld): failed=%x.\n", __func__, | 3064 | DEBUG2_16(printk("%s(%ld): failed=%x.\n", __func__, |
3040 | ha->host_no, rval)); | 3065 | vha->host_no, rval)); |
3041 | } else { | 3066 | } else { |
3042 | DEBUG16(printk("%s(%ld): done.\n", __func__, ha->host_no)); | 3067 | DEBUG16(printk("%s(%ld): done.\n", __func__, vha->host_no)); |
3043 | } | 3068 | } |
3044 | 3069 | ||
3045 | return rval; | 3070 | return rval; |