diff options
author | David C Somayajulu <david.somayajulu@qlogic.com> | 2007-05-23 21:03:27 -0400 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.il.steeleye.com> | 2007-05-26 12:47:49 -0400 |
commit | c0e344c9b7971996e4fe409d7b8ba9ceb7b7583d (patch) | |
tree | cc5aebdd66650861c3cf6ad3b1a08d704405e18c /drivers/scsi/qla4xxx/ql4_mbx.c | |
parent | 401425b1ea005b39dcc544bffea833f338ba84f6 (diff) |
[SCSI] qla4xxx: ql4_mbx.c remove dead code bugfixes
All all inbound mbx registers for all mbx commands. Remove dead code.
Signed-off-by: David Somayajulu <david.somayajulu@qlogic.com>
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/qla4xxx/ql4_mbx.c')
-rw-r--r-- | drivers/scsi/qla4xxx/ql4_mbx.c | 274 |
1 files changed, 103 insertions, 171 deletions
diff --git a/drivers/scsi/qla4xxx/ql4_mbx.c b/drivers/scsi/qla4xxx/ql4_mbx.c index f116ff917237..35cd73c72a68 100644 --- a/drivers/scsi/qla4xxx/ql4_mbx.c +++ b/drivers/scsi/qla4xxx/ql4_mbx.c | |||
@@ -6,6 +6,9 @@ | |||
6 | */ | 6 | */ |
7 | 7 | ||
8 | #include "ql4_def.h" | 8 | #include "ql4_def.h" |
9 | #include "ql4_glbl.h" | ||
10 | #include "ql4_dbg.h" | ||
11 | #include "ql4_inline.h" | ||
9 | 12 | ||
10 | 13 | ||
11 | /** | 14 | /** |
@@ -169,84 +172,6 @@ mbox_exit: | |||
169 | return status; | 172 | return status; |
170 | } | 173 | } |
171 | 174 | ||
172 | |||
173 | #if 0 | ||
174 | |||
175 | /** | ||
176 | * qla4xxx_issue_iocb - issue mailbox iocb command | ||
177 | * @ha: adapter state pointer. | ||
178 | * @buffer: buffer pointer. | ||
179 | * @phys_addr: physical address of buffer. | ||
180 | * @size: size of buffer. | ||
181 | * | ||
182 | * Issues iocbs via mailbox commands. | ||
183 | * TARGET_QUEUE_LOCK must be released. | ||
184 | * ADAPTER_STATE_LOCK must be released. | ||
185 | **/ | ||
186 | int | ||
187 | qla4xxx_issue_iocb(struct scsi_qla_host * ha, void *buffer, | ||
188 | dma_addr_t phys_addr, size_t size) | ||
189 | { | ||
190 | uint32_t mbox_cmd[MBOX_REG_COUNT]; | ||
191 | uint32_t mbox_sts[MBOX_REG_COUNT]; | ||
192 | int status; | ||
193 | |||
194 | memset(&mbox_cmd, 0, sizeof(mbox_cmd)); | ||
195 | memset(&mbox_sts, 0, sizeof(mbox_sts)); | ||
196 | mbox_cmd[0] = MBOX_CMD_EXECUTE_IOCB_A64; | ||
197 | mbox_cmd[1] = 0; | ||
198 | mbox_cmd[2] = LSDW(phys_addr); | ||
199 | mbox_cmd[3] = MSDW(phys_addr); | ||
200 | status = qla4xxx_mailbox_command(ha, 4, 1, &mbox_cmd[0], &mbox_sts[0]); | ||
201 | return status; | ||
202 | } | ||
203 | |||
204 | int qla4xxx_conn_close_sess_logout(struct scsi_qla_host * ha, | ||
205 | uint16_t fw_ddb_index, | ||
206 | uint16_t connection_id, | ||
207 | uint16_t option) | ||
208 | { | ||
209 | uint32_t mbox_cmd[MBOX_REG_COUNT]; | ||
210 | uint32_t mbox_sts[MBOX_REG_COUNT]; | ||
211 | |||
212 | memset(&mbox_cmd, 0, sizeof(mbox_cmd)); | ||
213 | memset(&mbox_sts, 0, sizeof(mbox_sts)); | ||
214 | mbox_cmd[0] = MBOX_CMD_CONN_CLOSE_SESS_LOGOUT; | ||
215 | mbox_cmd[1] = fw_ddb_index; | ||
216 | mbox_cmd[2] = connection_id; | ||
217 | mbox_cmd[3] = LOGOUT_OPTION_RELOGIN; | ||
218 | if (qla4xxx_mailbox_command(ha, 4, 2, &mbox_cmd[0], &mbox_sts[0]) != | ||
219 | QLA_SUCCESS) { | ||
220 | DEBUG2(printk("scsi%ld: %s: MBOX_CMD_CONN_CLOSE_SESS_LOGOUT " | ||
221 | "option %04x failed sts %04X %04X", | ||
222 | ha->host_no, __func__, | ||
223 | option, mbox_sts[0], mbox_sts[1])); | ||
224 | if (mbox_sts[0] == 0x4005) | ||
225 | DEBUG2(printk("%s reason %04X\n", __func__, | ||
226 | mbox_sts[1])); | ||
227 | } | ||
228 | return QLA_SUCCESS; | ||
229 | } | ||
230 | |||
231 | int qla4xxx_clear_database_entry(struct scsi_qla_host * ha, | ||
232 | uint16_t fw_ddb_index) | ||
233 | { | ||
234 | uint32_t mbox_cmd[MBOX_REG_COUNT]; | ||
235 | uint32_t mbox_sts[MBOX_REG_COUNT]; | ||
236 | |||
237 | memset(&mbox_cmd, 0, sizeof(mbox_cmd)); | ||
238 | memset(&mbox_sts, 0, sizeof(mbox_sts)); | ||
239 | mbox_cmd[0] = MBOX_CMD_CLEAR_DATABASE_ENTRY; | ||
240 | mbox_cmd[1] = fw_ddb_index; | ||
241 | if (qla4xxx_mailbox_command(ha, 2, 5, &mbox_cmd[0], &mbox_sts[0]) != | ||
242 | QLA_SUCCESS) | ||
243 | return QLA_ERROR; | ||
244 | |||
245 | return QLA_SUCCESS; | ||
246 | } | ||
247 | |||
248 | #endif /* 0 */ | ||
249 | |||
250 | /** | 175 | /** |
251 | * qla4xxx_initialize_fw_cb - initializes firmware control block. | 176 | * qla4xxx_initialize_fw_cb - initializes firmware control block. |
252 | * @ha: Pointer to host adapter structure. | 177 | * @ha: Pointer to host adapter structure. |
@@ -272,10 +197,13 @@ int qla4xxx_initialize_fw_cb(struct scsi_qla_host * ha) | |||
272 | /* Get Initialize Firmware Control Block. */ | 197 | /* Get Initialize Firmware Control Block. */ |
273 | memset(&mbox_cmd, 0, sizeof(mbox_cmd)); | 198 | memset(&mbox_cmd, 0, sizeof(mbox_cmd)); |
274 | memset(&mbox_sts, 0, sizeof(mbox_sts)); | 199 | memset(&mbox_sts, 0, sizeof(mbox_sts)); |
200 | |||
275 | mbox_cmd[0] = MBOX_CMD_GET_INIT_FW_CTRL_BLOCK; | 201 | mbox_cmd[0] = MBOX_CMD_GET_INIT_FW_CTRL_BLOCK; |
276 | mbox_cmd[2] = LSDW(init_fw_cb_dma); | 202 | mbox_cmd[2] = LSDW(init_fw_cb_dma); |
277 | mbox_cmd[3] = MSDW(init_fw_cb_dma); | 203 | mbox_cmd[3] = MSDW(init_fw_cb_dma); |
278 | if (qla4xxx_mailbox_command(ha, 4, 1, &mbox_cmd[0], &mbox_sts[0]) != | 204 | mbox_cmd[4] = sizeof(struct init_fw_ctrl_blk); |
205 | |||
206 | if (qla4xxx_mailbox_command(ha, MBOX_REG_COUNT, 1, &mbox_cmd[0], &mbox_sts[0]) != | ||
279 | QLA_SUCCESS) { | 207 | QLA_SUCCESS) { |
280 | dma_free_coherent(&ha->pdev->dev, | 208 | dma_free_coherent(&ha->pdev->dev, |
281 | sizeof(struct init_fw_ctrl_blk), | 209 | sizeof(struct init_fw_ctrl_blk), |
@@ -287,51 +215,56 @@ int qla4xxx_initialize_fw_cb(struct scsi_qla_host * ha) | |||
287 | qla4xxx_init_rings(ha); | 215 | qla4xxx_init_rings(ha); |
288 | 216 | ||
289 | /* Fill in the request and response queue information. */ | 217 | /* Fill in the request and response queue information. */ |
290 | init_fw_cb->ReqQConsumerIndex = cpu_to_le16(ha->request_out); | 218 | init_fw_cb->pri.rqq_consumer_idx = cpu_to_le16(ha->request_out); |
291 | init_fw_cb->ComplQProducerIndex = cpu_to_le16(ha->response_in); | 219 | init_fw_cb->pri.compq_producer_idx = cpu_to_le16(ha->response_in); |
292 | init_fw_cb->ReqQLen = __constant_cpu_to_le16(REQUEST_QUEUE_DEPTH); | 220 | init_fw_cb->pri.rqq_len = __constant_cpu_to_le16(REQUEST_QUEUE_DEPTH); |
293 | init_fw_cb->ComplQLen = __constant_cpu_to_le16(RESPONSE_QUEUE_DEPTH); | 221 | init_fw_cb->pri.compq_len = __constant_cpu_to_le16(RESPONSE_QUEUE_DEPTH); |
294 | init_fw_cb->ReqQAddrLo = cpu_to_le32(LSDW(ha->request_dma)); | 222 | init_fw_cb->pri.rqq_addr_lo = cpu_to_le32(LSDW(ha->request_dma)); |
295 | init_fw_cb->ReqQAddrHi = cpu_to_le32(MSDW(ha->request_dma)); | 223 | init_fw_cb->pri.rqq_addr_hi = cpu_to_le32(MSDW(ha->request_dma)); |
296 | init_fw_cb->ComplQAddrLo = cpu_to_le32(LSDW(ha->response_dma)); | 224 | init_fw_cb->pri.compq_addr_lo = cpu_to_le32(LSDW(ha->response_dma)); |
297 | init_fw_cb->ComplQAddrHi = cpu_to_le32(MSDW(ha->response_dma)); | 225 | init_fw_cb->pri.compq_addr_hi = cpu_to_le32(MSDW(ha->response_dma)); |
298 | init_fw_cb->ShadowRegBufAddrLo = | 226 | init_fw_cb->pri.shdwreg_addr_lo = |
299 | cpu_to_le32(LSDW(ha->shadow_regs_dma)); | 227 | cpu_to_le32(LSDW(ha->shadow_regs_dma)); |
300 | init_fw_cb->ShadowRegBufAddrHi = | 228 | init_fw_cb->pri.shdwreg_addr_hi = |
301 | cpu_to_le32(MSDW(ha->shadow_regs_dma)); | 229 | cpu_to_le32(MSDW(ha->shadow_regs_dma)); |
302 | 230 | ||
303 | /* Set up required options. */ | 231 | /* Set up required options. */ |
304 | init_fw_cb->FwOptions |= | 232 | init_fw_cb->pri.fw_options |= |
305 | __constant_cpu_to_le16(FWOPT_SESSION_MODE | | 233 | __constant_cpu_to_le16(FWOPT_SESSION_MODE | |
306 | FWOPT_INITIATOR_MODE); | 234 | FWOPT_INITIATOR_MODE); |
307 | init_fw_cb->FwOptions &= __constant_cpu_to_le16(~FWOPT_TARGET_MODE); | 235 | init_fw_cb->pri.fw_options &= __constant_cpu_to_le16(~FWOPT_TARGET_MODE); |
308 | 236 | ||
309 | /* Save some info in adapter structure. */ | 237 | /* Save some info in adapter structure. */ |
310 | ha->firmware_options = le16_to_cpu(init_fw_cb->FwOptions); | 238 | ha->firmware_options = le16_to_cpu(init_fw_cb->pri.fw_options); |
311 | ha->tcp_options = le16_to_cpu(init_fw_cb->TCPOptions); | 239 | ha->tcp_options = le16_to_cpu(init_fw_cb->pri.ipv4_tcp_opts); |
312 | ha->heartbeat_interval = init_fw_cb->HeartbeatInterval; | 240 | ha->heartbeat_interval = init_fw_cb->pri.hb_interval; |
313 | memcpy(ha->ip_address, init_fw_cb->IPAddr, | 241 | memcpy(ha->ip_address, init_fw_cb->pri.ipv4_addr, |
314 | min(sizeof(ha->ip_address), sizeof(init_fw_cb->IPAddr))); | 242 | min(sizeof(ha->ip_address), sizeof(init_fw_cb->pri.ipv4_addr))); |
315 | memcpy(ha->subnet_mask, init_fw_cb->SubnetMask, | 243 | memcpy(ha->subnet_mask, init_fw_cb->pri.ipv4_subnet, |
316 | min(sizeof(ha->subnet_mask), sizeof(init_fw_cb->SubnetMask))); | 244 | min(sizeof(ha->subnet_mask), sizeof(init_fw_cb->pri.ipv4_subnet))); |
317 | memcpy(ha->gateway, init_fw_cb->GatewayIPAddr, | 245 | memcpy(ha->gateway, init_fw_cb->pri.ipv4_gw_addr, |
318 | min(sizeof(ha->gateway), sizeof(init_fw_cb->GatewayIPAddr))); | 246 | min(sizeof(ha->gateway), sizeof(init_fw_cb->pri.ipv4_gw_addr))); |
319 | memcpy(ha->name_string, init_fw_cb->iSCSINameString, | 247 | memcpy(ha->name_string, init_fw_cb->pri.iscsi_name, |
320 | min(sizeof(ha->name_string), | 248 | min(sizeof(ha->name_string), |
321 | sizeof(init_fw_cb->iSCSINameString))); | 249 | sizeof(init_fw_cb->pri.iscsi_name))); |
322 | memcpy(ha->alias, init_fw_cb->Alias, | 250 | /*memcpy(ha->alias, init_fw_cb->Alias, |
323 | min(sizeof(ha->alias), sizeof(init_fw_cb->Alias))); | 251 | min(sizeof(ha->alias), sizeof(init_fw_cb->Alias)));*/ |
324 | 252 | ||
325 | /* Save Command Line Paramater info */ | 253 | /* Save Command Line Paramater info */ |
326 | ha->port_down_retry_count = le16_to_cpu(init_fw_cb->KeepAliveTimeout); | 254 | ha->port_down_retry_count = le16_to_cpu(init_fw_cb->pri.conn_ka_timeout); |
327 | ha->discovery_wait = ql4xdiscoverywait; | 255 | ha->discovery_wait = ql4xdiscoverywait; |
328 | 256 | ||
329 | /* Send Initialize Firmware Control Block. */ | 257 | /* Send Initialize Firmware Control Block. */ |
258 | memset(&mbox_cmd, 0, sizeof(mbox_cmd)); | ||
259 | memset(&mbox_sts, 0, sizeof(mbox_sts)); | ||
260 | |||
330 | mbox_cmd[0] = MBOX_CMD_INITIALIZE_FIRMWARE; | 261 | mbox_cmd[0] = MBOX_CMD_INITIALIZE_FIRMWARE; |
331 | mbox_cmd[1] = 0; | 262 | mbox_cmd[1] = 0; |
332 | mbox_cmd[2] = LSDW(init_fw_cb_dma); | 263 | mbox_cmd[2] = LSDW(init_fw_cb_dma); |
333 | mbox_cmd[3] = MSDW(init_fw_cb_dma); | 264 | mbox_cmd[3] = MSDW(init_fw_cb_dma); |
334 | if (qla4xxx_mailbox_command(ha, 4, 1, &mbox_cmd[0], &mbox_sts[0]) == | 265 | mbox_cmd[4] = sizeof(struct init_fw_ctrl_blk); |
266 | |||
267 | if (qla4xxx_mailbox_command(ha, MBOX_REG_COUNT, 1, &mbox_cmd[0], &mbox_sts[0]) == | ||
335 | QLA_SUCCESS) | 268 | QLA_SUCCESS) |
336 | status = QLA_SUCCESS; | 269 | status = QLA_SUCCESS; |
337 | else { | 270 | else { |
@@ -368,12 +301,14 @@ int qla4xxx_get_dhcp_ip_address(struct scsi_qla_host * ha) | |||
368 | /* Get Initialize Firmware Control Block. */ | 301 | /* Get Initialize Firmware Control Block. */ |
369 | memset(&mbox_cmd, 0, sizeof(mbox_cmd)); | 302 | memset(&mbox_cmd, 0, sizeof(mbox_cmd)); |
370 | memset(&mbox_sts, 0, sizeof(mbox_sts)); | 303 | memset(&mbox_sts, 0, sizeof(mbox_sts)); |
304 | |||
371 | memset(init_fw_cb, 0, sizeof(struct init_fw_ctrl_blk)); | 305 | memset(init_fw_cb, 0, sizeof(struct init_fw_ctrl_blk)); |
372 | mbox_cmd[0] = MBOX_CMD_GET_INIT_FW_CTRL_BLOCK; | 306 | mbox_cmd[0] = MBOX_CMD_GET_INIT_FW_CTRL_BLOCK; |
373 | mbox_cmd[2] = LSDW(init_fw_cb_dma); | 307 | mbox_cmd[2] = LSDW(init_fw_cb_dma); |
374 | mbox_cmd[3] = MSDW(init_fw_cb_dma); | 308 | mbox_cmd[3] = MSDW(init_fw_cb_dma); |
309 | mbox_cmd[4] = sizeof(struct init_fw_ctrl_blk); | ||
375 | 310 | ||
376 | if (qla4xxx_mailbox_command(ha, 4, 1, &mbox_cmd[0], &mbox_sts[0]) != | 311 | if (qla4xxx_mailbox_command(ha, MBOX_REG_COUNT, 1, &mbox_cmd[0], &mbox_sts[0]) != |
377 | QLA_SUCCESS) { | 312 | QLA_SUCCESS) { |
378 | DEBUG2(printk("scsi%ld: %s: Failed to get init_fw_ctrl_blk\n", | 313 | DEBUG2(printk("scsi%ld: %s: Failed to get init_fw_ctrl_blk\n", |
379 | ha->host_no, __func__)); | 314 | ha->host_no, __func__)); |
@@ -384,12 +319,12 @@ int qla4xxx_get_dhcp_ip_address(struct scsi_qla_host * ha) | |||
384 | } | 319 | } |
385 | 320 | ||
386 | /* Save IP Address. */ | 321 | /* Save IP Address. */ |
387 | memcpy(ha->ip_address, init_fw_cb->IPAddr, | 322 | memcpy(ha->ip_address, init_fw_cb->pri.ipv4_addr, |
388 | min(sizeof(ha->ip_address), sizeof(init_fw_cb->IPAddr))); | 323 | min(sizeof(ha->ip_address), sizeof(init_fw_cb->pri.ipv4_addr))); |
389 | memcpy(ha->subnet_mask, init_fw_cb->SubnetMask, | 324 | memcpy(ha->subnet_mask, init_fw_cb->pri.ipv4_subnet, |
390 | min(sizeof(ha->subnet_mask), sizeof(init_fw_cb->SubnetMask))); | 325 | min(sizeof(ha->subnet_mask), sizeof(init_fw_cb->pri.ipv4_subnet))); |
391 | memcpy(ha->gateway, init_fw_cb->GatewayIPAddr, | 326 | memcpy(ha->gateway, init_fw_cb->pri.ipv4_gw_addr, |
392 | min(sizeof(ha->gateway), sizeof(init_fw_cb->GatewayIPAddr))); | 327 | min(sizeof(ha->gateway), sizeof(init_fw_cb->pri.ipv4_gw_addr))); |
393 | 328 | ||
394 | dma_free_coherent(&ha->pdev->dev, sizeof(struct init_fw_ctrl_blk), | 329 | dma_free_coherent(&ha->pdev->dev, sizeof(struct init_fw_ctrl_blk), |
395 | init_fw_cb, init_fw_cb_dma); | 330 | init_fw_cb, init_fw_cb_dma); |
@@ -409,8 +344,10 @@ int qla4xxx_get_firmware_state(struct scsi_qla_host * ha) | |||
409 | /* Get firmware version */ | 344 | /* Get firmware version */ |
410 | memset(&mbox_cmd, 0, sizeof(mbox_cmd)); | 345 | memset(&mbox_cmd, 0, sizeof(mbox_cmd)); |
411 | memset(&mbox_sts, 0, sizeof(mbox_sts)); | 346 | memset(&mbox_sts, 0, sizeof(mbox_sts)); |
347 | |||
412 | mbox_cmd[0] = MBOX_CMD_GET_FW_STATE; | 348 | mbox_cmd[0] = MBOX_CMD_GET_FW_STATE; |
413 | if (qla4xxx_mailbox_command(ha, 1, 4, &mbox_cmd[0], &mbox_sts[0]) != | 349 | |
350 | if (qla4xxx_mailbox_command(ha, MBOX_REG_COUNT, 4, &mbox_cmd[0], &mbox_sts[0]) != | ||
414 | QLA_SUCCESS) { | 351 | QLA_SUCCESS) { |
415 | DEBUG2(printk("scsi%ld: %s: MBOX_CMD_GET_FW_STATE failed w/ " | 352 | DEBUG2(printk("scsi%ld: %s: MBOX_CMD_GET_FW_STATE failed w/ " |
416 | "status %04X\n", ha->host_no, __func__, | 353 | "status %04X\n", ha->host_no, __func__, |
@@ -438,8 +375,10 @@ int qla4xxx_get_firmware_status(struct scsi_qla_host * ha) | |||
438 | /* Get firmware version */ | 375 | /* Get firmware version */ |
439 | memset(&mbox_cmd, 0, sizeof(mbox_cmd)); | 376 | memset(&mbox_cmd, 0, sizeof(mbox_cmd)); |
440 | memset(&mbox_sts, 0, sizeof(mbox_sts)); | 377 | memset(&mbox_sts, 0, sizeof(mbox_sts)); |
378 | |||
441 | mbox_cmd[0] = MBOX_CMD_GET_FW_STATUS; | 379 | mbox_cmd[0] = MBOX_CMD_GET_FW_STATUS; |
442 | if (qla4xxx_mailbox_command(ha, 1, 3, &mbox_cmd[0], &mbox_sts[0]) != | 380 | |
381 | if (qla4xxx_mailbox_command(ha, MBOX_REG_COUNT, 3, &mbox_cmd[0], &mbox_sts[0]) != | ||
443 | QLA_SUCCESS) { | 382 | QLA_SUCCESS) { |
444 | DEBUG2(printk("scsi%ld: %s: MBOX_CMD_GET_FW_STATUS failed w/ " | 383 | DEBUG2(printk("scsi%ld: %s: MBOX_CMD_GET_FW_STATUS failed w/ " |
445 | "status %04X\n", ha->host_no, __func__, | 384 | "status %04X\n", ha->host_no, __func__, |
@@ -491,11 +430,14 @@ int qla4xxx_get_fwddb_entry(struct scsi_qla_host *ha, | |||
491 | } | 430 | } |
492 | memset(&mbox_cmd, 0, sizeof(mbox_cmd)); | 431 | memset(&mbox_cmd, 0, sizeof(mbox_cmd)); |
493 | memset(&mbox_sts, 0, sizeof(mbox_sts)); | 432 | memset(&mbox_sts, 0, sizeof(mbox_sts)); |
433 | |||
494 | mbox_cmd[0] = MBOX_CMD_GET_DATABASE_ENTRY; | 434 | mbox_cmd[0] = MBOX_CMD_GET_DATABASE_ENTRY; |
495 | mbox_cmd[1] = (uint32_t) fw_ddb_index; | 435 | mbox_cmd[1] = (uint32_t) fw_ddb_index; |
496 | mbox_cmd[2] = LSDW(fw_ddb_entry_dma); | 436 | mbox_cmd[2] = LSDW(fw_ddb_entry_dma); |
497 | mbox_cmd[3] = MSDW(fw_ddb_entry_dma); | 437 | mbox_cmd[3] = MSDW(fw_ddb_entry_dma); |
498 | if (qla4xxx_mailbox_command(ha, 4, 7, &mbox_cmd[0], &mbox_sts[0]) == | 438 | mbox_cmd[4] = sizeof(struct dev_db_entry); |
439 | |||
440 | if (qla4xxx_mailbox_command(ha, MBOX_REG_COUNT, 7, &mbox_cmd[0], &mbox_sts[0]) == | ||
499 | QLA_ERROR) { | 441 | QLA_ERROR) { |
500 | DEBUG2(printk("scsi%ld: %s: MBOX_CMD_GET_DATABASE_ENTRY failed" | 442 | DEBUG2(printk("scsi%ld: %s: MBOX_CMD_GET_DATABASE_ENTRY failed" |
501 | " with status 0x%04X\n", ha->host_no, __func__, | 443 | " with status 0x%04X\n", ha->host_no, __func__, |
@@ -512,11 +454,11 @@ int qla4xxx_get_fwddb_entry(struct scsi_qla_host *ha, | |||
512 | dev_info(&ha->pdev->dev, "DDB[%d] MB0 %04x Tot %d Next %d " | 454 | dev_info(&ha->pdev->dev, "DDB[%d] MB0 %04x Tot %d Next %d " |
513 | "State %04x ConnErr %08x %d.%d.%d.%d:%04d \"%s\"\n", | 455 | "State %04x ConnErr %08x %d.%d.%d.%d:%04d \"%s\"\n", |
514 | fw_ddb_index, mbox_sts[0], mbox_sts[2], mbox_sts[3], | 456 | fw_ddb_index, mbox_sts[0], mbox_sts[2], mbox_sts[3], |
515 | mbox_sts[4], mbox_sts[5], fw_ddb_entry->ipAddr[0], | 457 | mbox_sts[4], mbox_sts[5], fw_ddb_entry->ip_addr[0], |
516 | fw_ddb_entry->ipAddr[1], fw_ddb_entry->ipAddr[2], | 458 | fw_ddb_entry->ip_addr[1], fw_ddb_entry->ip_addr[2], |
517 | fw_ddb_entry->ipAddr[3], | 459 | fw_ddb_entry->ip_addr[3], |
518 | le16_to_cpu(fw_ddb_entry->portNumber), | 460 | le16_to_cpu(fw_ddb_entry->port), |
519 | fw_ddb_entry->iscsiName); | 461 | fw_ddb_entry->iscsi_name); |
520 | } | 462 | } |
521 | if (num_valid_ddb_entries) | 463 | if (num_valid_ddb_entries) |
522 | *num_valid_ddb_entries = mbox_sts[2]; | 464 | *num_valid_ddb_entries = mbox_sts[2]; |
@@ -571,35 +513,10 @@ int qla4xxx_set_ddb_entry(struct scsi_qla_host * ha, uint16_t fw_ddb_index, | |||
571 | mbox_cmd[1] = (uint32_t) fw_ddb_index; | 513 | mbox_cmd[1] = (uint32_t) fw_ddb_index; |
572 | mbox_cmd[2] = LSDW(fw_ddb_entry_dma); | 514 | mbox_cmd[2] = LSDW(fw_ddb_entry_dma); |
573 | mbox_cmd[3] = MSDW(fw_ddb_entry_dma); | 515 | mbox_cmd[3] = MSDW(fw_ddb_entry_dma); |
574 | return qla4xxx_mailbox_command(ha, 4, 1, &mbox_cmd[0], &mbox_sts[0]); | 516 | mbox_cmd[4] = sizeof(struct dev_db_entry); |
575 | } | ||
576 | 517 | ||
577 | #if 0 | 518 | return qla4xxx_mailbox_command(ha, MBOX_REG_COUNT, 1, &mbox_cmd[0], &mbox_sts[0]); |
578 | int qla4xxx_conn_open_session_login(struct scsi_qla_host * ha, | ||
579 | uint16_t fw_ddb_index) | ||
580 | { | ||
581 | int status = QLA_ERROR; | ||
582 | uint32_t mbox_cmd[MBOX_REG_COUNT]; | ||
583 | uint32_t mbox_sts[MBOX_REG_COUNT]; | ||
584 | |||
585 | /* Do not wait for completion. The firmware will send us an | ||
586 | * ASTS_DATABASE_CHANGED (0x8014) to notify us of the login status. | ||
587 | */ | ||
588 | memset(&mbox_cmd, 0, sizeof(mbox_cmd)); | ||
589 | memset(&mbox_sts, 0, sizeof(mbox_sts)); | ||
590 | mbox_cmd[0] = MBOX_CMD_CONN_OPEN_SESS_LOGIN; | ||
591 | mbox_cmd[1] = (uint32_t) fw_ddb_index; | ||
592 | mbox_cmd[2] = 0; | ||
593 | mbox_cmd[3] = 0; | ||
594 | mbox_cmd[4] = 0; | ||
595 | status = qla4xxx_mailbox_command(ha, 4, 0, &mbox_cmd[0], &mbox_sts[0]); | ||
596 | DEBUG2(printk("%s fw_ddb_index=%d status=%d mbx0_1=0x%x :0x%x\n", | ||
597 | __func__, fw_ddb_index, status, mbox_sts[0], | ||
598 | mbox_sts[1]);) | ||
599 | |||
600 | return status; | ||
601 | } | 519 | } |
602 | #endif /* 0 */ | ||
603 | 520 | ||
604 | /** | 521 | /** |
605 | * qla4xxx_get_crash_record - retrieves crash record. | 522 | * qla4xxx_get_crash_record - retrieves crash record. |
@@ -614,12 +531,14 @@ void qla4xxx_get_crash_record(struct scsi_qla_host * ha) | |||
614 | struct crash_record *crash_record = NULL; | 531 | struct crash_record *crash_record = NULL; |
615 | dma_addr_t crash_record_dma = 0; | 532 | dma_addr_t crash_record_dma = 0; |
616 | uint32_t crash_record_size = 0; | 533 | uint32_t crash_record_size = 0; |
534 | |||
617 | memset(&mbox_cmd, 0, sizeof(mbox_cmd)); | 535 | memset(&mbox_cmd, 0, sizeof(mbox_cmd)); |
618 | memset(&mbox_sts, 0, sizeof(mbox_cmd)); | 536 | memset(&mbox_sts, 0, sizeof(mbox_cmd)); |
619 | 537 | ||
620 | /* Get size of crash record. */ | 538 | /* Get size of crash record. */ |
621 | mbox_cmd[0] = MBOX_CMD_GET_CRASH_RECORD; | 539 | mbox_cmd[0] = MBOX_CMD_GET_CRASH_RECORD; |
622 | if (qla4xxx_mailbox_command(ha, 5, 5, &mbox_cmd[0], &mbox_sts[0]) != | 540 | |
541 | if (qla4xxx_mailbox_command(ha, MBOX_REG_COUNT, 5, &mbox_cmd[0], &mbox_sts[0]) != | ||
623 | QLA_SUCCESS) { | 542 | QLA_SUCCESS) { |
624 | DEBUG2(printk("scsi%ld: %s: ERROR: Unable to retrieve size!\n", | 543 | DEBUG2(printk("scsi%ld: %s: ERROR: Unable to retrieve size!\n", |
625 | ha->host_no, __func__)); | 544 | ha->host_no, __func__)); |
@@ -639,11 +558,15 @@ void qla4xxx_get_crash_record(struct scsi_qla_host * ha) | |||
639 | goto exit_get_crash_record; | 558 | goto exit_get_crash_record; |
640 | 559 | ||
641 | /* Get Crash Record. */ | 560 | /* Get Crash Record. */ |
561 | memset(&mbox_cmd, 0, sizeof(mbox_cmd)); | ||
562 | memset(&mbox_sts, 0, sizeof(mbox_cmd)); | ||
563 | |||
642 | mbox_cmd[0] = MBOX_CMD_GET_CRASH_RECORD; | 564 | mbox_cmd[0] = MBOX_CMD_GET_CRASH_RECORD; |
643 | mbox_cmd[2] = LSDW(crash_record_dma); | 565 | mbox_cmd[2] = LSDW(crash_record_dma); |
644 | mbox_cmd[3] = MSDW(crash_record_dma); | 566 | mbox_cmd[3] = MSDW(crash_record_dma); |
645 | mbox_cmd[4] = crash_record_size; | 567 | mbox_cmd[4] = crash_record_size; |
646 | if (qla4xxx_mailbox_command(ha, 5, 5, &mbox_cmd[0], &mbox_sts[0]) != | 568 | |
569 | if (qla4xxx_mailbox_command(ha, MBOX_REG_COUNT, 5, &mbox_cmd[0], &mbox_sts[0]) != | ||
647 | QLA_SUCCESS) | 570 | QLA_SUCCESS) |
648 | goto exit_get_crash_record; | 571 | goto exit_get_crash_record; |
649 | 572 | ||
@@ -655,7 +578,6 @@ exit_get_crash_record: | |||
655 | crash_record, crash_record_dma); | 578 | crash_record, crash_record_dma); |
656 | } | 579 | } |
657 | 580 | ||
658 | #if 0 | ||
659 | /** | 581 | /** |
660 | * qla4xxx_get_conn_event_log - retrieves connection event log | 582 | * qla4xxx_get_conn_event_log - retrieves connection event log |
661 | * @ha: Pointer to host adapter structure. | 583 | * @ha: Pointer to host adapter structure. |
@@ -678,7 +600,8 @@ void qla4xxx_get_conn_event_log(struct scsi_qla_host * ha) | |||
678 | 600 | ||
679 | /* Get size of crash record. */ | 601 | /* Get size of crash record. */ |
680 | mbox_cmd[0] = MBOX_CMD_GET_CONN_EVENT_LOG; | 602 | mbox_cmd[0] = MBOX_CMD_GET_CONN_EVENT_LOG; |
681 | if (qla4xxx_mailbox_command(ha, 4, 5, &mbox_cmd[0], &mbox_sts[0]) != | 603 | |
604 | if (qla4xxx_mailbox_command(ha, MBOX_REG_COUNT, 5, &mbox_cmd[0], &mbox_sts[0]) != | ||
682 | QLA_SUCCESS) | 605 | QLA_SUCCESS) |
683 | goto exit_get_event_log; | 606 | goto exit_get_event_log; |
684 | 607 | ||
@@ -693,10 +616,14 @@ void qla4xxx_get_conn_event_log(struct scsi_qla_host * ha) | |||
693 | goto exit_get_event_log; | 616 | goto exit_get_event_log; |
694 | 617 | ||
695 | /* Get Crash Record. */ | 618 | /* Get Crash Record. */ |
619 | memset(&mbox_cmd, 0, sizeof(mbox_cmd)); | ||
620 | memset(&mbox_sts, 0, sizeof(mbox_cmd)); | ||
621 | |||
696 | mbox_cmd[0] = MBOX_CMD_GET_CONN_EVENT_LOG; | 622 | mbox_cmd[0] = MBOX_CMD_GET_CONN_EVENT_LOG; |
697 | mbox_cmd[2] = LSDW(event_log_dma); | 623 | mbox_cmd[2] = LSDW(event_log_dma); |
698 | mbox_cmd[3] = MSDW(event_log_dma); | 624 | mbox_cmd[3] = MSDW(event_log_dma); |
699 | if (qla4xxx_mailbox_command(ha, 4, 5, &mbox_cmd[0], &mbox_sts[0]) != | 625 | |
626 | if (qla4xxx_mailbox_command(ha, MBOX_REG_COUNT, 5, &mbox_cmd[0], &mbox_sts[0]) != | ||
700 | QLA_SUCCESS) { | 627 | QLA_SUCCESS) { |
701 | DEBUG2(printk("scsi%ld: %s: ERROR: Unable to retrieve event " | 628 | DEBUG2(printk("scsi%ld: %s: ERROR: Unable to retrieve event " |
702 | "log!\n", ha->host_no, __func__)); | 629 | "log!\n", ha->host_no, __func__)); |
@@ -745,7 +672,6 @@ exit_get_event_log: | |||
745 | dma_free_coherent(&ha->pdev->dev, event_log_size, event_log, | 672 | dma_free_coherent(&ha->pdev->dev, event_log_size, event_log, |
746 | event_log_dma); | 673 | event_log_dma); |
747 | } | 674 | } |
748 | #endif /* 0 */ | ||
749 | 675 | ||
750 | /** | 676 | /** |
751 | * qla4xxx_reset_lun - issues LUN Reset | 677 | * qla4xxx_reset_lun - issues LUN Reset |
@@ -773,11 +699,13 @@ int qla4xxx_reset_lun(struct scsi_qla_host * ha, struct ddb_entry * ddb_entry, | |||
773 | */ | 699 | */ |
774 | memset(&mbox_cmd, 0, sizeof(mbox_cmd)); | 700 | memset(&mbox_cmd, 0, sizeof(mbox_cmd)); |
775 | memset(&mbox_sts, 0, sizeof(mbox_sts)); | 701 | memset(&mbox_sts, 0, sizeof(mbox_sts)); |
702 | |||
776 | mbox_cmd[0] = MBOX_CMD_LUN_RESET; | 703 | mbox_cmd[0] = MBOX_CMD_LUN_RESET; |
777 | mbox_cmd[1] = ddb_entry->fw_ddb_index; | 704 | mbox_cmd[1] = ddb_entry->fw_ddb_index; |
778 | mbox_cmd[2] = lun << 8; | 705 | mbox_cmd[2] = lun << 8; |
779 | mbox_cmd[5] = 0x01; /* Immediate Command Enable */ | 706 | mbox_cmd[5] = 0x01; /* Immediate Command Enable */ |
780 | qla4xxx_mailbox_command(ha, 6, 1, &mbox_cmd[0], &mbox_sts[0]); | 707 | |
708 | qla4xxx_mailbox_command(ha, MBOX_REG_COUNT, 1, &mbox_cmd[0], &mbox_sts[0]); | ||
781 | if (mbox_sts[0] != MBOX_STS_COMMAND_COMPLETE && | 709 | if (mbox_sts[0] != MBOX_STS_COMMAND_COMPLETE && |
782 | mbox_sts[0] != MBOX_STS_COMMAND_ERROR) | 710 | mbox_sts[0] != MBOX_STS_COMMAND_ERROR) |
783 | status = QLA_ERROR; | 711 | status = QLA_ERROR; |
@@ -794,12 +722,14 @@ int qla4xxx_get_flash(struct scsi_qla_host * ha, dma_addr_t dma_addr, | |||
794 | 722 | ||
795 | memset(&mbox_cmd, 0, sizeof(mbox_cmd)); | 723 | memset(&mbox_cmd, 0, sizeof(mbox_cmd)); |
796 | memset(&mbox_sts, 0, sizeof(mbox_sts)); | 724 | memset(&mbox_sts, 0, sizeof(mbox_sts)); |
725 | |||
797 | mbox_cmd[0] = MBOX_CMD_READ_FLASH; | 726 | mbox_cmd[0] = MBOX_CMD_READ_FLASH; |
798 | mbox_cmd[1] = LSDW(dma_addr); | 727 | mbox_cmd[1] = LSDW(dma_addr); |
799 | mbox_cmd[2] = MSDW(dma_addr); | 728 | mbox_cmd[2] = MSDW(dma_addr); |
800 | mbox_cmd[3] = offset; | 729 | mbox_cmd[3] = offset; |
801 | mbox_cmd[4] = len; | 730 | mbox_cmd[4] = len; |
802 | if (qla4xxx_mailbox_command(ha, 5, 2, &mbox_cmd[0], &mbox_sts[0]) != | 731 | |
732 | if (qla4xxx_mailbox_command(ha, MBOX_REG_COUNT, 2, &mbox_cmd[0], &mbox_sts[0]) != | ||
803 | QLA_SUCCESS) { | 733 | QLA_SUCCESS) { |
804 | DEBUG2(printk("scsi%ld: %s: MBOX_CMD_READ_FLASH, failed w/ " | 734 | DEBUG2(printk("scsi%ld: %s: MBOX_CMD_READ_FLASH, failed w/ " |
805 | "status %04X %04X, offset %08x, len %08x\n", ha->host_no, | 735 | "status %04X %04X, offset %08x, len %08x\n", ha->host_no, |
@@ -825,8 +755,10 @@ int qla4xxx_get_fw_version(struct scsi_qla_host * ha) | |||
825 | /* Get firmware version. */ | 755 | /* Get firmware version. */ |
826 | memset(&mbox_cmd, 0, sizeof(mbox_cmd)); | 756 | memset(&mbox_cmd, 0, sizeof(mbox_cmd)); |
827 | memset(&mbox_sts, 0, sizeof(mbox_sts)); | 757 | memset(&mbox_sts, 0, sizeof(mbox_sts)); |
758 | |||
828 | mbox_cmd[0] = MBOX_CMD_ABOUT_FW; | 759 | mbox_cmd[0] = MBOX_CMD_ABOUT_FW; |
829 | if (qla4xxx_mailbox_command(ha, 4, 5, &mbox_cmd[0], &mbox_sts[0]) != | 760 | |
761 | if (qla4xxx_mailbox_command(ha, MBOX_REG_COUNT, 5, &mbox_cmd[0], &mbox_sts[0]) != | ||
830 | QLA_SUCCESS) { | 762 | QLA_SUCCESS) { |
831 | DEBUG2(printk("scsi%ld: %s: MBOX_CMD_ABOUT_FW failed w/ " | 763 | DEBUG2(printk("scsi%ld: %s: MBOX_CMD_ABOUT_FW failed w/ " |
832 | "status %04X\n", ha->host_no, __func__, mbox_sts[0])); | 764 | "status %04X\n", ha->host_no, __func__, mbox_sts[0])); |
@@ -855,7 +787,7 @@ static int qla4xxx_get_default_ddb(struct scsi_qla_host *ha, | |||
855 | mbox_cmd[2] = LSDW(dma_addr); | 787 | mbox_cmd[2] = LSDW(dma_addr); |
856 | mbox_cmd[3] = MSDW(dma_addr); | 788 | mbox_cmd[3] = MSDW(dma_addr); |
857 | 789 | ||
858 | if (qla4xxx_mailbox_command(ha, 4, 1, &mbox_cmd[0], &mbox_sts[0]) != | 790 | if (qla4xxx_mailbox_command(ha, MBOX_REG_COUNT, 1, &mbox_cmd[0], &mbox_sts[0]) != |
859 | QLA_SUCCESS) { | 791 | QLA_SUCCESS) { |
860 | DEBUG2(printk("scsi%ld: %s: failed status %04X\n", | 792 | DEBUG2(printk("scsi%ld: %s: failed status %04X\n", |
861 | ha->host_no, __func__, mbox_sts[0])); | 793 | ha->host_no, __func__, mbox_sts[0])); |
@@ -875,7 +807,7 @@ static int qla4xxx_req_ddb_entry(struct scsi_qla_host *ha, uint32_t *ddb_index) | |||
875 | mbox_cmd[0] = MBOX_CMD_REQUEST_DATABASE_ENTRY; | 807 | mbox_cmd[0] = MBOX_CMD_REQUEST_DATABASE_ENTRY; |
876 | mbox_cmd[1] = MAX_PRST_DEV_DB_ENTRIES; | 808 | mbox_cmd[1] = MAX_PRST_DEV_DB_ENTRIES; |
877 | 809 | ||
878 | if (qla4xxx_mailbox_command(ha, 2, 3, &mbox_cmd[0], &mbox_sts[0]) != | 810 | if (qla4xxx_mailbox_command(ha, MBOX_REG_COUNT, 3, &mbox_cmd[0], &mbox_sts[0]) != |
879 | QLA_SUCCESS) { | 811 | QLA_SUCCESS) { |
880 | if (mbox_sts[0] == MBOX_STS_COMMAND_ERROR) { | 812 | if (mbox_sts[0] == MBOX_STS_COMMAND_ERROR) { |
881 | *ddb_index = mbox_sts[2]; | 813 | *ddb_index = mbox_sts[2]; |
@@ -918,23 +850,23 @@ int qla4xxx_send_tgts(struct scsi_qla_host *ha, char *ip, uint16_t port) | |||
918 | if (ret_val != QLA_SUCCESS) | 850 | if (ret_val != QLA_SUCCESS) |
919 | goto qla4xxx_send_tgts_exit; | 851 | goto qla4xxx_send_tgts_exit; |
920 | 852 | ||
921 | memset((void *)fw_ddb_entry->iSCSIAlias, 0, | 853 | memset(fw_ddb_entry->iscsi_alias, 0, |
922 | sizeof(fw_ddb_entry->iSCSIAlias)); | 854 | sizeof(fw_ddb_entry->iscsi_alias)); |
923 | 855 | ||
924 | memset((void *)fw_ddb_entry->iscsiName, 0, | 856 | memset(fw_ddb_entry->iscsi_name, 0, |
925 | sizeof(fw_ddb_entry->iscsiName)); | 857 | sizeof(fw_ddb_entry->iscsi_name)); |
926 | 858 | ||
927 | memset((void *)fw_ddb_entry->ipAddr, 0, sizeof(fw_ddb_entry->ipAddr)); | 859 | memset(fw_ddb_entry->ip_addr, 0, sizeof(fw_ddb_entry->ip_addr)); |
928 | memset((void *)fw_ddb_entry->targetAddr, 0, | 860 | memset(fw_ddb_entry->tgt_addr, 0, |
929 | sizeof(fw_ddb_entry->targetAddr)); | 861 | sizeof(fw_ddb_entry->tgt_addr)); |
930 | 862 | ||
931 | fw_ddb_entry->options = (DDB_OPT_DISC_SESSION | DDB_OPT_TARGET); | 863 | fw_ddb_entry->options = (DDB_OPT_DISC_SESSION | DDB_OPT_TARGET); |
932 | fw_ddb_entry->portNumber = cpu_to_le16(ntohs(port)); | 864 | fw_ddb_entry->port = cpu_to_le16(ntohs(port)); |
933 | 865 | ||
934 | fw_ddb_entry->ipAddr[0] = *ip; | 866 | fw_ddb_entry->ip_addr[0] = *ip; |
935 | fw_ddb_entry->ipAddr[1] = *(ip + 1); | 867 | fw_ddb_entry->ip_addr[1] = *(ip + 1); |
936 | fw_ddb_entry->ipAddr[2] = *(ip + 2); | 868 | fw_ddb_entry->ip_addr[2] = *(ip + 2); |
937 | fw_ddb_entry->ipAddr[3] = *(ip + 3); | 869 | fw_ddb_entry->ip_addr[3] = *(ip + 3); |
938 | 870 | ||
939 | ret_val = qla4xxx_set_ddb_entry(ha, ddb_index, fw_ddb_entry_dma); | 871 | ret_val = qla4xxx_set_ddb_entry(ha, ddb_index, fw_ddb_entry_dma); |
940 | 872 | ||