aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/qla4xxx
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2006-12-06 10:01:18 -0500
committerDavid Howells <dhowells@warthog.cambridge.redhat.com>2006-12-06 10:01:18 -0500
commit4796b71fbb907ce6b8a9acf1852d3646a80b4576 (patch)
tree6263f165446c581efdbb760205c1f85378fe6259 /drivers/scsi/qla4xxx
parent6d5aefb8eaa38e44b5b8cf60c812aceafc02d924 (diff)
parentec0bf39a471bf6fcd01def2bd677128cea940b73 (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
Conflicts: drivers/pcmcia/ds.c Fix up merge failures with Linus's head and fix new compile failures. Signed-Off-By: David Howells <dhowells@redhat.com>
Diffstat (limited to 'drivers/scsi/qla4xxx')
-rw-r--r--drivers/scsi/qla4xxx/ql4_dbg.c4
-rw-r--r--drivers/scsi/qla4xxx/ql4_def.h105
-rw-r--r--drivers/scsi/qla4xxx/ql4_fw.h7
-rw-r--r--drivers/scsi/qla4xxx/ql4_glbl.h3
-rw-r--r--drivers/scsi/qla4xxx/ql4_init.c47
-rw-r--r--drivers/scsi/qla4xxx/ql4_inline.h4
-rw-r--r--drivers/scsi/qla4xxx/ql4_iocb.c6
-rw-r--r--drivers/scsi/qla4xxx/ql4_isr.c1
-rw-r--r--drivers/scsi/qla4xxx/ql4_nvram.c70
-rw-r--r--drivers/scsi/qla4xxx/ql4_nvram.h4
-rw-r--r--drivers/scsi/qla4xxx/ql4_os.c117
-rw-r--r--drivers/scsi/qla4xxx/ql4_version.h7
12 files changed, 148 insertions, 227 deletions
diff --git a/drivers/scsi/qla4xxx/ql4_dbg.c b/drivers/scsi/qla4xxx/ql4_dbg.c
index 752031fadfef..7b4e077a39c1 100644
--- a/drivers/scsi/qla4xxx/ql4_dbg.c
+++ b/drivers/scsi/qla4xxx/ql4_dbg.c
@@ -71,7 +71,7 @@ void __dump_registers(struct scsi_qla_host *ha)
71 readw(&ha->reg->u1.isp4010.nvram)); 71 readw(&ha->reg->u1.isp4010.nvram));
72 } 72 }
73 73
74 else if (is_qla4022(ha)) { 74 else if (is_qla4022(ha) | is_qla4032(ha)) {
75 printk(KERN_INFO "0x%02X intr_mask = 0x%08X\n", 75 printk(KERN_INFO "0x%02X intr_mask = 0x%08X\n",
76 (uint8_t) offsetof(struct isp_reg, 76 (uint8_t) offsetof(struct isp_reg,
77 u1.isp4022.intr_mask), 77 u1.isp4022.intr_mask),
@@ -119,7 +119,7 @@ void __dump_registers(struct scsi_qla_host *ha)
119 readw(&ha->reg->u2.isp4010.port_err_status)); 119 readw(&ha->reg->u2.isp4010.port_err_status));
120 } 120 }
121 121
122 else if (is_qla4022(ha)) { 122 else if (is_qla4022(ha) | is_qla4032(ha)) {
123 printk(KERN_INFO "Page 0 Registers:\n"); 123 printk(KERN_INFO "Page 0 Registers:\n");
124 printk(KERN_INFO "0x%02X ext_hw_conf = 0x%08X\n", 124 printk(KERN_INFO "0x%02X ext_hw_conf = 0x%08X\n",
125 (uint8_t) offsetof(struct isp_reg, 125 (uint8_t) offsetof(struct isp_reg,
diff --git a/drivers/scsi/qla4xxx/ql4_def.h b/drivers/scsi/qla4xxx/ql4_def.h
index a7f6c7b1c590..4249e52a5592 100644
--- a/drivers/scsi/qla4xxx/ql4_def.h
+++ b/drivers/scsi/qla4xxx/ql4_def.h
@@ -40,7 +40,11 @@
40 40
41#ifndef PCI_DEVICE_ID_QLOGIC_ISP4022 41#ifndef PCI_DEVICE_ID_QLOGIC_ISP4022
42#define PCI_DEVICE_ID_QLOGIC_ISP4022 0x4022 42#define PCI_DEVICE_ID_QLOGIC_ISP4022 0x4022
43#endif /* */ 43#endif
44
45#ifndef PCI_DEVICE_ID_QLOGIC_ISP4032
46#define PCI_DEVICE_ID_QLOGIC_ISP4032 0x4032
47#endif
44 48
45#define QLA_SUCCESS 0 49#define QLA_SUCCESS 0
46#define QLA_ERROR 1 50#define QLA_ERROR 1
@@ -277,7 +281,6 @@ struct scsi_qla_host {
277#define AF_INTERRUPTS_ON 6 /* 0x00000040 Not Used */ 281#define AF_INTERRUPTS_ON 6 /* 0x00000040 Not Used */
278#define AF_GET_CRASH_RECORD 7 /* 0x00000080 */ 282#define AF_GET_CRASH_RECORD 7 /* 0x00000080 */
279#define AF_LINK_UP 8 /* 0x00000100 */ 283#define AF_LINK_UP 8 /* 0x00000100 */
280#define AF_TOPCAT_CHIP_PRESENT 9 /* 0x00000200 */
281#define AF_IRQ_ATTACHED 10 /* 0x00000400 */ 284#define AF_IRQ_ATTACHED 10 /* 0x00000400 */
282#define AF_ISNS_CMD_IN_PROCESS 12 /* 0x00001000 */ 285#define AF_ISNS_CMD_IN_PROCESS 12 /* 0x00001000 */
283#define AF_ISNS_CMD_DONE 13 /* 0x00002000 */ 286#define AF_ISNS_CMD_DONE 13 /* 0x00002000 */
@@ -317,16 +320,17 @@ struct scsi_qla_host {
317 /* NVRAM registers */ 320 /* NVRAM registers */
318 struct eeprom_data *nvram; 321 struct eeprom_data *nvram;
319 spinlock_t hardware_lock ____cacheline_aligned; 322 spinlock_t hardware_lock ____cacheline_aligned;
320 spinlock_t list_lock;
321 uint32_t eeprom_cmd_data; 323 uint32_t eeprom_cmd_data;
322 324
323 /* Counters for general statistics */ 325 /* Counters for general statistics */
326 uint64_t isr_count;
324 uint64_t adapter_error_count; 327 uint64_t adapter_error_count;
325 uint64_t device_error_count; 328 uint64_t device_error_count;
326 uint64_t total_io_count; 329 uint64_t total_io_count;
327 uint64_t total_mbytes_xferred; 330 uint64_t total_mbytes_xferred;
328 uint64_t link_failure_count; 331 uint64_t link_failure_count;
329 uint64_t invalid_crc_count; 332 uint64_t invalid_crc_count;
333 uint32_t bytes_xfered;
330 uint32_t spurious_int_count; 334 uint32_t spurious_int_count;
331 uint32_t aborted_io_count; 335 uint32_t aborted_io_count;
332 uint32_t io_timeout_count; 336 uint32_t io_timeout_count;
@@ -438,6 +442,11 @@ static inline int is_qla4022(struct scsi_qla_host *ha)
438 return ha->pdev->device == PCI_DEVICE_ID_QLOGIC_ISP4022; 442 return ha->pdev->device == PCI_DEVICE_ID_QLOGIC_ISP4022;
439} 443}
440 444
445static inline int is_qla4032(struct scsi_qla_host *ha)
446{
447 return ha->pdev->device == PCI_DEVICE_ID_QLOGIC_ISP4032;
448}
449
441static inline int adapter_up(struct scsi_qla_host *ha) 450static inline int adapter_up(struct scsi_qla_host *ha)
442{ 451{
443 return (test_bit(AF_ONLINE, &ha->flags) != 0) && 452 return (test_bit(AF_ONLINE, &ha->flags) != 0) &&
@@ -451,58 +460,58 @@ static inline struct scsi_qla_host* to_qla_host(struct Scsi_Host *shost)
451 460
452static inline void __iomem* isp_semaphore(struct scsi_qla_host *ha) 461static inline void __iomem* isp_semaphore(struct scsi_qla_host *ha)
453{ 462{
454 return (is_qla4022(ha) ? 463 return (is_qla4010(ha) ?
455 &ha->reg->u1.isp4022.semaphore : 464 &ha->reg->u1.isp4010.nvram :
456 &ha->reg->u1.isp4010.nvram); 465 &ha->reg->u1.isp4022.semaphore);
457} 466}
458 467
459static inline void __iomem* isp_nvram(struct scsi_qla_host *ha) 468static inline void __iomem* isp_nvram(struct scsi_qla_host *ha)
460{ 469{
461 return (is_qla4022(ha) ? 470 return (is_qla4010(ha) ?
462 &ha->reg->u1.isp4022.nvram : 471 &ha->reg->u1.isp4010.nvram :
463 &ha->reg->u1.isp4010.nvram); 472 &ha->reg->u1.isp4022.nvram);
464} 473}
465 474
466static inline void __iomem* isp_ext_hw_conf(struct scsi_qla_host *ha) 475static inline void __iomem* isp_ext_hw_conf(struct scsi_qla_host *ha)
467{ 476{
468 return (is_qla4022(ha) ? 477 return (is_qla4010(ha) ?
469 &ha->reg->u2.isp4022.p0.ext_hw_conf : 478 &ha->reg->u2.isp4010.ext_hw_conf :
470 &ha->reg->u2.isp4010.ext_hw_conf); 479 &ha->reg->u2.isp4022.p0.ext_hw_conf);
471} 480}
472 481
473static inline void __iomem* isp_port_status(struct scsi_qla_host *ha) 482static inline void __iomem* isp_port_status(struct scsi_qla_host *ha)
474{ 483{
475 return (is_qla4022(ha) ? 484 return (is_qla4010(ha) ?
476 &ha->reg->u2.isp4022.p0.port_status : 485 &ha->reg->u2.isp4010.port_status :
477 &ha->reg->u2.isp4010.port_status); 486 &ha->reg->u2.isp4022.p0.port_status);
478} 487}
479 488
480static inline void __iomem* isp_port_ctrl(struct scsi_qla_host *ha) 489static inline void __iomem* isp_port_ctrl(struct scsi_qla_host *ha)
481{ 490{
482 return (is_qla4022(ha) ? 491 return (is_qla4010(ha) ?
483 &ha->reg->u2.isp4022.p0.port_ctrl : 492 &ha->reg->u2.isp4010.port_ctrl :
484 &ha->reg->u2.isp4010.port_ctrl); 493 &ha->reg->u2.isp4022.p0.port_ctrl);
485} 494}
486 495
487static inline void __iomem* isp_port_error_status(struct scsi_qla_host *ha) 496static inline void __iomem* isp_port_error_status(struct scsi_qla_host *ha)
488{ 497{
489 return (is_qla4022(ha) ? 498 return (is_qla4010(ha) ?
490 &ha->reg->u2.isp4022.p0.port_err_status : 499 &ha->reg->u2.isp4010.port_err_status :
491 &ha->reg->u2.isp4010.port_err_status); 500 &ha->reg->u2.isp4022.p0.port_err_status);
492} 501}
493 502
494static inline void __iomem * isp_gp_out(struct scsi_qla_host *ha) 503static inline void __iomem * isp_gp_out(struct scsi_qla_host *ha)
495{ 504{
496 return (is_qla4022(ha) ? 505 return (is_qla4010(ha) ?
497 &ha->reg->u2.isp4022.p0.gp_out : 506 &ha->reg->u2.isp4010.gp_out :
498 &ha->reg->u2.isp4010.gp_out); 507 &ha->reg->u2.isp4022.p0.gp_out);
499} 508}
500 509
501static inline int eeprom_ext_hw_conf_offset(struct scsi_qla_host *ha) 510static inline int eeprom_ext_hw_conf_offset(struct scsi_qla_host *ha)
502{ 511{
503 return (is_qla4022(ha) ? 512 return (is_qla4010(ha) ?
504 offsetof(struct eeprom_data, isp4022.ext_hw_conf) / 2 : 513 offsetof(struct eeprom_data, isp4010.ext_hw_conf) / 2 :
505 offsetof(struct eeprom_data, isp4010.ext_hw_conf) / 2); 514 offsetof(struct eeprom_data, isp4022.ext_hw_conf) / 2);
506} 515}
507 516
508int ql4xxx_sem_spinlock(struct scsi_qla_host * ha, u32 sem_mask, u32 sem_bits); 517int ql4xxx_sem_spinlock(struct scsi_qla_host * ha, u32 sem_mask, u32 sem_bits);
@@ -511,59 +520,59 @@ int ql4xxx_sem_lock(struct scsi_qla_host * ha, u32 sem_mask, u32 sem_bits);
511 520
512static inline int ql4xxx_lock_flash(struct scsi_qla_host *a) 521static inline int ql4xxx_lock_flash(struct scsi_qla_host *a)
513{ 522{
514 if (is_qla4022(a)) 523 if (is_qla4010(a))
524 return ql4xxx_sem_spinlock(a, QL4010_FLASH_SEM_MASK,
525 QL4010_FLASH_SEM_BITS);
526 else
515 return ql4xxx_sem_spinlock(a, QL4022_FLASH_SEM_MASK, 527 return ql4xxx_sem_spinlock(a, QL4022_FLASH_SEM_MASK,
516 (QL4022_RESOURCE_BITS_BASE_CODE | 528 (QL4022_RESOURCE_BITS_BASE_CODE |
517 (a->mac_index)) << 13); 529 (a->mac_index)) << 13);
518 else
519 return ql4xxx_sem_spinlock(a, QL4010_FLASH_SEM_MASK,
520 QL4010_FLASH_SEM_BITS);
521} 530}
522 531
523static inline void ql4xxx_unlock_flash(struct scsi_qla_host *a) 532static inline void ql4xxx_unlock_flash(struct scsi_qla_host *a)
524{ 533{
525 if (is_qla4022(a)) 534 if (is_qla4010(a))
526 ql4xxx_sem_unlock(a, QL4022_FLASH_SEM_MASK);
527 else
528 ql4xxx_sem_unlock(a, QL4010_FLASH_SEM_MASK); 535 ql4xxx_sem_unlock(a, QL4010_FLASH_SEM_MASK);
536 else
537 ql4xxx_sem_unlock(a, QL4022_FLASH_SEM_MASK);
529} 538}
530 539
531static inline int ql4xxx_lock_nvram(struct scsi_qla_host *a) 540static inline int ql4xxx_lock_nvram(struct scsi_qla_host *a)
532{ 541{
533 if (is_qla4022(a)) 542 if (is_qla4010(a))
543 return ql4xxx_sem_spinlock(a, QL4010_NVRAM_SEM_MASK,
544 QL4010_NVRAM_SEM_BITS);
545 else
534 return ql4xxx_sem_spinlock(a, QL4022_NVRAM_SEM_MASK, 546 return ql4xxx_sem_spinlock(a, QL4022_NVRAM_SEM_MASK,
535 (QL4022_RESOURCE_BITS_BASE_CODE | 547 (QL4022_RESOURCE_BITS_BASE_CODE |
536 (a->mac_index)) << 10); 548 (a->mac_index)) << 10);
537 else
538 return ql4xxx_sem_spinlock(a, QL4010_NVRAM_SEM_MASK,
539 QL4010_NVRAM_SEM_BITS);
540} 549}
541 550
542static inline void ql4xxx_unlock_nvram(struct scsi_qla_host *a) 551static inline void ql4xxx_unlock_nvram(struct scsi_qla_host *a)
543{ 552{
544 if (is_qla4022(a)) 553 if (is_qla4010(a))
545 ql4xxx_sem_unlock(a, QL4022_NVRAM_SEM_MASK);
546 else
547 ql4xxx_sem_unlock(a, QL4010_NVRAM_SEM_MASK); 554 ql4xxx_sem_unlock(a, QL4010_NVRAM_SEM_MASK);
555 else
556 ql4xxx_sem_unlock(a, QL4022_NVRAM_SEM_MASK);
548} 557}
549 558
550static inline int ql4xxx_lock_drvr(struct scsi_qla_host *a) 559static inline int ql4xxx_lock_drvr(struct scsi_qla_host *a)
551{ 560{
552 if (is_qla4022(a)) 561 if (is_qla4010(a))
562 return ql4xxx_sem_lock(a, QL4010_DRVR_SEM_MASK,
563 QL4010_DRVR_SEM_BITS);
564 else
553 return ql4xxx_sem_lock(a, QL4022_DRVR_SEM_MASK, 565 return ql4xxx_sem_lock(a, QL4022_DRVR_SEM_MASK,
554 (QL4022_RESOURCE_BITS_BASE_CODE | 566 (QL4022_RESOURCE_BITS_BASE_CODE |
555 (a->mac_index)) << 1); 567 (a->mac_index)) << 1);
556 else
557 return ql4xxx_sem_lock(a, QL4010_DRVR_SEM_MASK,
558 QL4010_DRVR_SEM_BITS);
559} 568}
560 569
561static inline void ql4xxx_unlock_drvr(struct scsi_qla_host *a) 570static inline void ql4xxx_unlock_drvr(struct scsi_qla_host *a)
562{ 571{
563 if (is_qla4022(a)) 572 if (is_qla4010(a))
564 ql4xxx_sem_unlock(a, QL4022_DRVR_SEM_MASK);
565 else
566 ql4xxx_sem_unlock(a, QL4010_DRVR_SEM_MASK); 573 ql4xxx_sem_unlock(a, QL4010_DRVR_SEM_MASK);
574 else
575 ql4xxx_sem_unlock(a, QL4022_DRVR_SEM_MASK);
567} 576}
568 577
569/*---------------------------------------------------------------------------*/ 578/*---------------------------------------------------------------------------*/
diff --git a/drivers/scsi/qla4xxx/ql4_fw.h b/drivers/scsi/qla4xxx/ql4_fw.h
index 427489de64bc..4eea8c571916 100644
--- a/drivers/scsi/qla4xxx/ql4_fw.h
+++ b/drivers/scsi/qla4xxx/ql4_fw.h
@@ -296,7 +296,6 @@ static inline uint32_t clr_rmask(uint32_t val)
296/* ISP Semaphore definitions */ 296/* ISP Semaphore definitions */
297 297
298/* ISP General Purpose Output definitions */ 298/* ISP General Purpose Output definitions */
299#define GPOR_TOPCAT_RESET 0x00000004
300 299
301/* shadow registers (DMA'd from HA to system memory. read only) */ 300/* shadow registers (DMA'd from HA to system memory. read only) */
302struct shadow_regs { 301struct shadow_regs {
@@ -339,10 +338,13 @@ union external_hw_config_reg {
339/* Mailbox command definitions */ 338/* Mailbox command definitions */
340#define MBOX_CMD_ABOUT_FW 0x0009 339#define MBOX_CMD_ABOUT_FW 0x0009
341#define MBOX_CMD_LUN_RESET 0x0016 340#define MBOX_CMD_LUN_RESET 0x0016
341#define MBOX_CMD_GET_MANAGEMENT_DATA 0x001E
342#define MBOX_CMD_GET_FW_STATUS 0x001F 342#define MBOX_CMD_GET_FW_STATUS 0x001F
343#define MBOX_CMD_SET_ISNS_SERVICE 0x0021 343#define MBOX_CMD_SET_ISNS_SERVICE 0x0021
344#define ISNS_DISABLE 0 344#define ISNS_DISABLE 0
345#define ISNS_ENABLE 1 345#define ISNS_ENABLE 1
346#define MBOX_CMD_COPY_FLASH 0x0024
347#define MBOX_CMD_WRITE_FLASH 0x0025
346#define MBOX_CMD_READ_FLASH 0x0026 348#define MBOX_CMD_READ_FLASH 0x0026
347#define MBOX_CMD_CLEAR_DATABASE_ENTRY 0x0031 349#define MBOX_CMD_CLEAR_DATABASE_ENTRY 0x0031
348#define MBOX_CMD_CONN_CLOSE_SESS_LOGOUT 0x0056 350#define MBOX_CMD_CONN_CLOSE_SESS_LOGOUT 0x0056
@@ -360,10 +362,13 @@ union external_hw_config_reg {
360#define DDB_DS_SESSION_FAILED 0x06 362#define DDB_DS_SESSION_FAILED 0x06
361#define DDB_DS_LOGIN_IN_PROCESS 0x07 363#define DDB_DS_LOGIN_IN_PROCESS 0x07
362#define MBOX_CMD_GET_FW_STATE 0x0069 364#define MBOX_CMD_GET_FW_STATE 0x0069
365#define MBOX_CMD_GET_INIT_FW_CTRL_BLOCK_DEFAULTS 0x006A
366#define MBOX_CMD_RESTORE_FACTORY_DEFAULTS 0x0087
363 367
364/* Mailbox 1 */ 368/* Mailbox 1 */
365#define FW_STATE_READY 0x0000 369#define FW_STATE_READY 0x0000
366#define FW_STATE_CONFIG_WAIT 0x0001 370#define FW_STATE_CONFIG_WAIT 0x0001
371#define FW_STATE_WAIT_LOGIN 0x0002
367#define FW_STATE_ERROR 0x0004 372#define FW_STATE_ERROR 0x0004
368#define FW_STATE_DHCP_IN_PROGRESS 0x0008 373#define FW_STATE_DHCP_IN_PROGRESS 0x0008
369 374
diff --git a/drivers/scsi/qla4xxx/ql4_glbl.h b/drivers/scsi/qla4xxx/ql4_glbl.h
index 1b221ff0f6f7..2122967bbf0b 100644
--- a/drivers/scsi/qla4xxx/ql4_glbl.h
+++ b/drivers/scsi/qla4xxx/ql4_glbl.h
@@ -8,6 +8,7 @@
8#ifndef __QLA4x_GBL_H 8#ifndef __QLA4x_GBL_H
9#define __QLA4x_GBL_H 9#define __QLA4x_GBL_H
10 10
11int ql4xxx_lock_drvr_wait(struct scsi_qla_host *a);
11int qla4xxx_send_tgts(struct scsi_qla_host *ha, char *ip, uint16_t port); 12int qla4xxx_send_tgts(struct scsi_qla_host *ha, char *ip, uint16_t port);
12int qla4xxx_send_command_to_isp(struct scsi_qla_host *ha, struct srb * srb); 13int qla4xxx_send_command_to_isp(struct scsi_qla_host *ha, struct srb * srb);
13int qla4xxx_initialize_adapter(struct scsi_qla_host * ha, 14int qla4xxx_initialize_adapter(struct scsi_qla_host * ha,
@@ -75,4 +76,4 @@ int qla4xxx_process_ddb_changed(struct scsi_qla_host * ha,
75extern int ql4xextended_error_logging; 76extern int ql4xextended_error_logging;
76extern int ql4xdiscoverywait; 77extern int ql4xdiscoverywait;
77extern int ql4xdontresethba; 78extern int ql4xdontresethba;
78#endif /* _QLA4x_GBL_H */ 79#endif /* _QLA4x_GBL_H */
diff --git a/drivers/scsi/qla4xxx/ql4_init.c b/drivers/scsi/qla4xxx/ql4_init.c
index bb3a1c11f44c..cc210f297a78 100644
--- a/drivers/scsi/qla4xxx/ql4_init.c
+++ b/drivers/scsi/qla4xxx/ql4_init.c
@@ -259,10 +259,16 @@ static int qla4xxx_fw_ready(struct scsi_qla_host *ha)
259 "seconds expired= %d\n", ha->host_no, __func__, 259 "seconds expired= %d\n", ha->host_no, __func__,
260 ha->firmware_state, ha->addl_fw_state, 260 ha->firmware_state, ha->addl_fw_state,
261 timeout_count)); 261 timeout_count));
262 if (is_qla4032(ha) &&
263 !(ha->addl_fw_state & FW_ADDSTATE_LINK_UP) &&
264 (timeout_count < ADAPTER_INIT_TOV - 5)) {
265 break;
266 }
267
262 msleep(1000); 268 msleep(1000);
263 } /* end of for */ 269 } /* end of for */
264 270
265 if (timeout_count <= 0) 271 if (timeout_count == 0)
266 DEBUG2(printk("scsi%ld: %s: FW Initialization timed out!\n", 272 DEBUG2(printk("scsi%ld: %s: FW Initialization timed out!\n",
267 ha->host_no, __func__)); 273 ha->host_no, __func__));
268 274
@@ -806,32 +812,6 @@ int qla4xxx_relogin_device(struct scsi_qla_host *ha,
806 return QLA_SUCCESS; 812 return QLA_SUCCESS;
807} 813}
808 814
809/**
810 * qla4010_get_topcat_presence - check if it is QLA4040 TopCat Chip
811 * @ha: Pointer to host adapter structure.
812 *
813 **/
814static int qla4010_get_topcat_presence(struct scsi_qla_host *ha)
815{
816 unsigned long flags;
817 uint16_t topcat;
818
819 if (ql4xxx_lock_nvram(ha) != QLA_SUCCESS)
820 return QLA_ERROR;
821 spin_lock_irqsave(&ha->hardware_lock, flags);
822 topcat = rd_nvram_word(ha, offsetof(struct eeprom_data,
823 isp4010.topcat));
824 spin_unlock_irqrestore(&ha->hardware_lock, flags);
825
826 if ((topcat & TOPCAT_MASK) == TOPCAT_PRESENT)
827 set_bit(AF_TOPCAT_CHIP_PRESENT, &ha->flags);
828 else
829 clear_bit(AF_TOPCAT_CHIP_PRESENT, &ha->flags);
830 ql4xxx_unlock_nvram(ha);
831 return QLA_SUCCESS;
832}
833
834
835static int qla4xxx_config_nvram(struct scsi_qla_host *ha) 815static int qla4xxx_config_nvram(struct scsi_qla_host *ha)
836{ 816{
837 unsigned long flags; 817 unsigned long flags;
@@ -866,7 +846,7 @@ static int qla4xxx_config_nvram(struct scsi_qla_host *ha)
866 /* set defaults */ 846 /* set defaults */
867 if (is_qla4010(ha)) 847 if (is_qla4010(ha))
868 extHwConfig.Asuint32_t = 0x1912; 848 extHwConfig.Asuint32_t = 0x1912;
869 else if (is_qla4022(ha)) 849 else if (is_qla4022(ha) | is_qla4032(ha))
870 extHwConfig.Asuint32_t = 0x0023; 850 extHwConfig.Asuint32_t = 0x0023;
871 } 851 }
872 DEBUG(printk("scsi%ld: %s: Setting extHwConfig to 0xFFFF%04x\n", 852 DEBUG(printk("scsi%ld: %s: Setting extHwConfig to 0xFFFF%04x\n",
@@ -927,7 +907,7 @@ static int qla4xxx_start_firmware_from_flash(struct scsi_qla_host *ha)
927 907
928 spin_lock_irqsave(&ha->hardware_lock, flags); 908 spin_lock_irqsave(&ha->hardware_lock, flags);
929 writel(jiffies, &ha->reg->mailbox[7]); 909 writel(jiffies, &ha->reg->mailbox[7]);
930 if (is_qla4022(ha)) 910 if (is_qla4022(ha) | is_qla4032(ha))
931 writel(set_rmask(NVR_WRITE_ENABLE), 911 writel(set_rmask(NVR_WRITE_ENABLE),
932 &ha->reg->u1.isp4022.nvram); 912 &ha->reg->u1.isp4022.nvram);
933 913
@@ -978,7 +958,7 @@ static int qla4xxx_start_firmware_from_flash(struct scsi_qla_host *ha)
978 return status; 958 return status;
979} 959}
980 960
981static int ql4xxx_lock_drvr_wait(struct scsi_qla_host *a) 961int ql4xxx_lock_drvr_wait(struct scsi_qla_host *a)
982{ 962{
983#define QL4_LOCK_DRVR_WAIT 300 963#define QL4_LOCK_DRVR_WAIT 300
984#define QL4_LOCK_DRVR_SLEEP 100 964#define QL4_LOCK_DRVR_SLEEP 100
@@ -1018,12 +998,7 @@ static int qla4xxx_start_firmware(struct scsi_qla_host *ha)
1018 int soft_reset = 1; 998 int soft_reset = 1;
1019 int config_chip = 0; 999 int config_chip = 0;
1020 1000
1021 if (is_qla4010(ha)){ 1001 if (is_qla4022(ha) | is_qla4032(ha))
1022 if (qla4010_get_topcat_presence(ha) != QLA_SUCCESS)
1023 return QLA_ERROR;
1024 }
1025
1026 if (is_qla4022(ha))
1027 ql4xxx_set_mac_number(ha); 1002 ql4xxx_set_mac_number(ha);
1028 1003
1029 if (ql4xxx_lock_drvr_wait(ha) != QLA_SUCCESS) 1004 if (ql4xxx_lock_drvr_wait(ha) != QLA_SUCCESS)
diff --git a/drivers/scsi/qla4xxx/ql4_inline.h b/drivers/scsi/qla4xxx/ql4_inline.h
index 0d61797af7da..6375eb017dd3 100644
--- a/drivers/scsi/qla4xxx/ql4_inline.h
+++ b/drivers/scsi/qla4xxx/ql4_inline.h
@@ -38,7 +38,7 @@ qla4xxx_lookup_ddb_by_fw_index(struct scsi_qla_host *ha, uint32_t fw_ddb_index)
38static inline void 38static inline void
39__qla4xxx_enable_intrs(struct scsi_qla_host *ha) 39__qla4xxx_enable_intrs(struct scsi_qla_host *ha)
40{ 40{
41 if (is_qla4022(ha)) { 41 if (is_qla4022(ha) | is_qla4032(ha)) {
42 writel(set_rmask(IMR_SCSI_INTR_ENABLE), 42 writel(set_rmask(IMR_SCSI_INTR_ENABLE),
43 &ha->reg->u1.isp4022.intr_mask); 43 &ha->reg->u1.isp4022.intr_mask);
44 readl(&ha->reg->u1.isp4022.intr_mask); 44 readl(&ha->reg->u1.isp4022.intr_mask);
@@ -52,7 +52,7 @@ __qla4xxx_enable_intrs(struct scsi_qla_host *ha)
52static inline void 52static inline void
53__qla4xxx_disable_intrs(struct scsi_qla_host *ha) 53__qla4xxx_disable_intrs(struct scsi_qla_host *ha)
54{ 54{
55 if (is_qla4022(ha)) { 55 if (is_qla4022(ha) | is_qla4032(ha)) {
56 writel(clr_rmask(IMR_SCSI_INTR_ENABLE), 56 writel(clr_rmask(IMR_SCSI_INTR_ENABLE),
57 &ha->reg->u1.isp4022.intr_mask); 57 &ha->reg->u1.isp4022.intr_mask);
58 readl(&ha->reg->u1.isp4022.intr_mask); 58 readl(&ha->reg->u1.isp4022.intr_mask);
diff --git a/drivers/scsi/qla4xxx/ql4_iocb.c b/drivers/scsi/qla4xxx/ql4_iocb.c
index c0a254b89a30..d41ce380eedc 100644
--- a/drivers/scsi/qla4xxx/ql4_iocb.c
+++ b/drivers/scsi/qla4xxx/ql4_iocb.c
@@ -294,6 +294,12 @@ int qla4xxx_send_command_to_isp(struct scsi_qla_host *ha, struct srb * srb)
294 cmd_entry->control_flags = CF_WRITE; 294 cmd_entry->control_flags = CF_WRITE;
295 else if (cmd->sc_data_direction == DMA_FROM_DEVICE) 295 else if (cmd->sc_data_direction == DMA_FROM_DEVICE)
296 cmd_entry->control_flags = CF_READ; 296 cmd_entry->control_flags = CF_READ;
297
298 ha->bytes_xfered += cmd->request_bufflen;
299 if (ha->bytes_xfered & ~0xFFFFF){
300 ha->total_mbytes_xferred += ha->bytes_xfered >> 20;
301 ha->bytes_xfered &= 0xFFFFF;
302 }
297 } 303 }
298 304
299 /* Set tagged queueing control flags */ 305 /* Set tagged queueing control flags */
diff --git a/drivers/scsi/qla4xxx/ql4_isr.c b/drivers/scsi/qla4xxx/ql4_isr.c
index 1e283321a59d..ef975e0dc87f 100644
--- a/drivers/scsi/qla4xxx/ql4_isr.c
+++ b/drivers/scsi/qla4xxx/ql4_isr.c
@@ -627,6 +627,7 @@ irqreturn_t qla4xxx_intr_handler(int irq, void *dev_id)
627 627
628 spin_lock_irqsave(&ha->hardware_lock, flags); 628 spin_lock_irqsave(&ha->hardware_lock, flags);
629 629
630 ha->isr_count++;
630 /* 631 /*
631 * Repeatedly service interrupts up to a maximum of 632 * Repeatedly service interrupts up to a maximum of
632 * MAX_REQS_SERVICED_PER_INTR 633 * MAX_REQS_SERVICED_PER_INTR
diff --git a/drivers/scsi/qla4xxx/ql4_nvram.c b/drivers/scsi/qla4xxx/ql4_nvram.c
index e3957ca5b645..58afd135aa1d 100644
--- a/drivers/scsi/qla4xxx/ql4_nvram.c
+++ b/drivers/scsi/qla4xxx/ql4_nvram.c
@@ -7,15 +7,22 @@
7 7
8#include "ql4_def.h" 8#include "ql4_def.h"
9 9
10static inline void eeprom_cmd(uint32_t cmd, struct scsi_qla_host *ha)
11{
12 writel(cmd, isp_nvram(ha));
13 readl(isp_nvram(ha));
14 udelay(1);
15}
16
10static inline int eeprom_size(struct scsi_qla_host *ha) 17static inline int eeprom_size(struct scsi_qla_host *ha)
11{ 18{
12 return is_qla4022(ha) ? FM93C86A_SIZE_16 : FM93C66A_SIZE_16; 19 return is_qla4010(ha) ? FM93C66A_SIZE_16 : FM93C86A_SIZE_16;
13} 20}
14 21
15static inline int eeprom_no_addr_bits(struct scsi_qla_host *ha) 22static inline int eeprom_no_addr_bits(struct scsi_qla_host *ha)
16{ 23{
17 return is_qla4022(ha) ? FM93C86A_NO_ADDR_BITS_16 : 24 return is_qla4010(ha) ? FM93C56A_NO_ADDR_BITS_16 :
18 FM93C56A_NO_ADDR_BITS_16; 25 FM93C86A_NO_ADDR_BITS_16 ;
19} 26}
20 27
21static inline int eeprom_no_data_bits(struct scsi_qla_host *ha) 28static inline int eeprom_no_data_bits(struct scsi_qla_host *ha)
@@ -28,8 +35,7 @@ static int fm93c56a_select(struct scsi_qla_host * ha)
28 DEBUG5(printk(KERN_ERR "fm93c56a_select:\n")); 35 DEBUG5(printk(KERN_ERR "fm93c56a_select:\n"));
29 36
30 ha->eeprom_cmd_data = AUBURN_EEPROM_CS_1 | 0x000f0000; 37 ha->eeprom_cmd_data = AUBURN_EEPROM_CS_1 | 0x000f0000;
31 writel(ha->eeprom_cmd_data, isp_nvram(ha)); 38 eeprom_cmd(ha->eeprom_cmd_data, ha);
32 readl(isp_nvram(ha));
33 return 1; 39 return 1;
34} 40}
35 41
@@ -41,12 +47,13 @@ static int fm93c56a_cmd(struct scsi_qla_host * ha, int cmd, int addr)
41 int previousBit; 47 int previousBit;
42 48
43 /* Clock in a zero, then do the start bit. */ 49 /* Clock in a zero, then do the start bit. */
44 writel(ha->eeprom_cmd_data | AUBURN_EEPROM_DO_1, isp_nvram(ha)); 50 eeprom_cmd(ha->eeprom_cmd_data | AUBURN_EEPROM_DO_1, ha);
45 writel(ha->eeprom_cmd_data | AUBURN_EEPROM_DO_1 | 51
46 AUBURN_EEPROM_CLK_RISE, isp_nvram(ha)); 52 eeprom_cmd(ha->eeprom_cmd_data | AUBURN_EEPROM_DO_1 |
47 writel(ha->eeprom_cmd_data | AUBURN_EEPROM_DO_1 | 53 AUBURN_EEPROM_CLK_RISE, ha);
48 AUBURN_EEPROM_CLK_FALL, isp_nvram(ha)); 54 eeprom_cmd(ha->eeprom_cmd_data | AUBURN_EEPROM_DO_1 |
49 readl(isp_nvram(ha)); 55 AUBURN_EEPROM_CLK_FALL, ha);
56
50 mask = 1 << (FM93C56A_CMD_BITS - 1); 57 mask = 1 << (FM93C56A_CMD_BITS - 1);
51 58
52 /* Force the previous data bit to be different. */ 59 /* Force the previous data bit to be different. */
@@ -60,14 +67,14 @@ static int fm93c56a_cmd(struct scsi_qla_host * ha, int cmd, int addr)
60 * If the bit changed, then change the DO state to 67 * If the bit changed, then change the DO state to
61 * match. 68 * match.
62 */ 69 */
63 writel(ha->eeprom_cmd_data | dataBit, isp_nvram(ha)); 70 eeprom_cmd(ha->eeprom_cmd_data | dataBit, ha);
64 previousBit = dataBit; 71 previousBit = dataBit;
65 } 72 }
66 writel(ha->eeprom_cmd_data | dataBit | 73 eeprom_cmd(ha->eeprom_cmd_data | dataBit |
67 AUBURN_EEPROM_CLK_RISE, isp_nvram(ha)); 74 AUBURN_EEPROM_CLK_RISE, ha);
68 writel(ha->eeprom_cmd_data | dataBit | 75 eeprom_cmd(ha->eeprom_cmd_data | dataBit |
69 AUBURN_EEPROM_CLK_FALL, isp_nvram(ha)); 76 AUBURN_EEPROM_CLK_FALL, ha);
70 readl(isp_nvram(ha)); 77
71 cmd = cmd << 1; 78 cmd = cmd << 1;
72 } 79 }
73 mask = 1 << (eeprom_no_addr_bits(ha) - 1); 80 mask = 1 << (eeprom_no_addr_bits(ha) - 1);
@@ -82,14 +89,15 @@ static int fm93c56a_cmd(struct scsi_qla_host * ha, int cmd, int addr)
82 * If the bit changed, then change the DO state to 89 * If the bit changed, then change the DO state to
83 * match. 90 * match.
84 */ 91 */
85 writel(ha->eeprom_cmd_data | dataBit, isp_nvram(ha)); 92 eeprom_cmd(ha->eeprom_cmd_data | dataBit, ha);
93
86 previousBit = dataBit; 94 previousBit = dataBit;
87 } 95 }
88 writel(ha->eeprom_cmd_data | dataBit | 96 eeprom_cmd(ha->eeprom_cmd_data | dataBit |
89 AUBURN_EEPROM_CLK_RISE, isp_nvram(ha)); 97 AUBURN_EEPROM_CLK_RISE, ha);
90 writel(ha->eeprom_cmd_data | dataBit | 98 eeprom_cmd(ha->eeprom_cmd_data | dataBit |
91 AUBURN_EEPROM_CLK_FALL, isp_nvram(ha)); 99 AUBURN_EEPROM_CLK_FALL, ha);
92 readl(isp_nvram(ha)); 100
93 addr = addr << 1; 101 addr = addr << 1;
94 } 102 }
95 return 1; 103 return 1;
@@ -98,8 +106,7 @@ static int fm93c56a_cmd(struct scsi_qla_host * ha, int cmd, int addr)
98static int fm93c56a_deselect(struct scsi_qla_host * ha) 106static int fm93c56a_deselect(struct scsi_qla_host * ha)
99{ 107{
100 ha->eeprom_cmd_data = AUBURN_EEPROM_CS_0 | 0x000f0000; 108 ha->eeprom_cmd_data = AUBURN_EEPROM_CS_0 | 0x000f0000;
101 writel(ha->eeprom_cmd_data, isp_nvram(ha)); 109 eeprom_cmd(ha->eeprom_cmd_data, ha);
102 readl(isp_nvram(ha));
103 return 1; 110 return 1;
104} 111}
105 112
@@ -112,12 +119,13 @@ static int fm93c56a_datain(struct scsi_qla_host * ha, unsigned short *value)
112 /* Read the data bits 119 /* Read the data bits
113 * The first bit is a dummy. Clock right over it. */ 120 * The first bit is a dummy. Clock right over it. */
114 for (i = 0; i < eeprom_no_data_bits(ha); i++) { 121 for (i = 0; i < eeprom_no_data_bits(ha); i++) {
115 writel(ha->eeprom_cmd_data | 122 eeprom_cmd(ha->eeprom_cmd_data |
116 AUBURN_EEPROM_CLK_RISE, isp_nvram(ha)); 123 AUBURN_EEPROM_CLK_RISE, ha);
117 writel(ha->eeprom_cmd_data | 124 eeprom_cmd(ha->eeprom_cmd_data |
118 AUBURN_EEPROM_CLK_FALL, isp_nvram(ha)); 125 AUBURN_EEPROM_CLK_FALL, ha);
119 dataBit = 126
120 (readw(isp_nvram(ha)) & AUBURN_EEPROM_DI_1) ? 1 : 0; 127 dataBit = (readw(isp_nvram(ha)) & AUBURN_EEPROM_DI_1) ? 1 : 0;
128
121 data = (data << 1) | dataBit; 129 data = (data << 1) | dataBit;
122 } 130 }
123 131
diff --git a/drivers/scsi/qla4xxx/ql4_nvram.h b/drivers/scsi/qla4xxx/ql4_nvram.h
index 08e2aed8c6cc..b47b4fc59d83 100644
--- a/drivers/scsi/qla4xxx/ql4_nvram.h
+++ b/drivers/scsi/qla4xxx/ql4_nvram.h
@@ -134,9 +134,7 @@ struct eeprom_data {
134 u16 phyConfig; /* x36 */ 134 u16 phyConfig; /* x36 */
135#define PHY_CONFIG_PHY_ADDR_MASK 0x1f 135#define PHY_CONFIG_PHY_ADDR_MASK 0x1f
136#define PHY_CONFIG_ENABLE_FW_MANAGEMENT_MASK 0x20 136#define PHY_CONFIG_ENABLE_FW_MANAGEMENT_MASK 0x20
137 u16 topcat; /* x38 */ 137 u16 reserved_56; /* x38 */
138#define TOPCAT_PRESENT 0x0100
139#define TOPCAT_MASK 0xFF00
140 138
141#define EEPROM_UNUSED_1_SIZE 2 139#define EEPROM_UNUSED_1_SIZE 2
142 u8 unused_1[EEPROM_UNUSED_1_SIZE]; /* x3A */ 140 u8 unused_1[EEPROM_UNUSED_1_SIZE]; /* x3A */
diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
index bbbc9d039baa..969c9e431028 100644
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -708,10 +708,10 @@ static int qla4xxx_cmd_wait(struct scsi_qla_host *ha)
708} 708}
709 709
710/** 710/**
711 * qla4010_soft_reset - performs soft reset. 711 * qla4xxx_soft_reset - performs soft reset.
712 * @ha: Pointer to host adapter structure. 712 * @ha: Pointer to host adapter structure.
713 **/ 713 **/
714static int qla4010_soft_reset(struct scsi_qla_host *ha) 714int qla4xxx_soft_reset(struct scsi_qla_host *ha)
715{ 715{
716 uint32_t max_wait_time; 716 uint32_t max_wait_time;
717 unsigned long flags = 0; 717 unsigned long flags = 0;
@@ -817,29 +817,6 @@ static int qla4010_soft_reset(struct scsi_qla_host *ha)
817} 817}
818 818
819/** 819/**
820 * qla4xxx_topcat_reset - performs hard reset of TopCat Chip.
821 * @ha: Pointer to host adapter structure.
822 **/
823static int qla4xxx_topcat_reset(struct scsi_qla_host *ha)
824{
825 unsigned long flags;
826
827 ql4xxx_lock_nvram(ha);
828 spin_lock_irqsave(&ha->hardware_lock, flags);
829 writel(set_rmask(GPOR_TOPCAT_RESET), isp_gp_out(ha));
830 readl(isp_gp_out(ha));
831 mdelay(1);
832
833 writel(clr_rmask(GPOR_TOPCAT_RESET), isp_gp_out(ha));
834 readl(isp_gp_out(ha));
835 spin_unlock_irqrestore(&ha->hardware_lock, flags);
836 mdelay(2523);
837
838 ql4xxx_unlock_nvram(ha);
839 return QLA_SUCCESS;
840}
841
842/**
843 * qla4xxx_flush_active_srbs - returns all outstanding i/o requests to O.S. 820 * qla4xxx_flush_active_srbs - returns all outstanding i/o requests to O.S.
844 * @ha: Pointer to host adapter structure. 821 * @ha: Pointer to host adapter structure.
845 * 822 *
@@ -867,26 +844,6 @@ static void qla4xxx_flush_active_srbs(struct scsi_qla_host *ha)
867} 844}
868 845
869/** 846/**
870 * qla4xxx_hard_reset - performs HBA Hard Reset
871 * @ha: Pointer to host adapter structure.
872 **/
873static int qla4xxx_hard_reset(struct scsi_qla_host *ha)
874{
875 /* The QLA4010 really doesn't have an equivalent to a hard reset */
876 qla4xxx_flush_active_srbs(ha);
877 if (test_bit(AF_TOPCAT_CHIP_PRESENT, &ha->flags)) {
878 int status = QLA_ERROR;
879
880 if ((qla4010_soft_reset(ha) == QLA_SUCCESS) &&
881 (qla4xxx_topcat_reset(ha) == QLA_SUCCESS) &&
882 (qla4010_soft_reset(ha) == QLA_SUCCESS))
883 status = QLA_SUCCESS;
884 return status;
885 } else
886 return qla4010_soft_reset(ha);
887}
888
889/**
890 * qla4xxx_recover_adapter - recovers adapter after a fatal error 847 * qla4xxx_recover_adapter - recovers adapter after a fatal error
891 * @ha: Pointer to host adapter structure. 848 * @ha: Pointer to host adapter structure.
892 * @renew_ddb_list: Indicates what to do with the adapter's ddb list 849 * @renew_ddb_list: Indicates what to do with the adapter's ddb list
@@ -919,18 +876,11 @@ static int qla4xxx_recover_adapter(struct scsi_qla_host *ha,
919 if (status == QLA_SUCCESS) { 876 if (status == QLA_SUCCESS) {
920 DEBUG2(printk("scsi%ld: %s - Performing soft reset..\n", 877 DEBUG2(printk("scsi%ld: %s - Performing soft reset..\n",
921 ha->host_no, __func__)); 878 ha->host_no, __func__));
922 status = qla4xxx_soft_reset(ha); 879 qla4xxx_flush_active_srbs(ha);
923 } 880 if (ql4xxx_lock_drvr_wait(ha) == QLA_SUCCESS)
924 /* FIXMEkaren: Do we want to keep interrupts enabled and process 881 status = qla4xxx_soft_reset(ha);
925 AENs after soft reset */ 882 else
926 883 status = QLA_ERROR;
927 /* If firmware (SOFT) reset failed, or if all outstanding
928 * commands have not returned, then do a HARD reset.
929 */
930 if (status == QLA_ERROR) {
931 DEBUG2(printk("scsi%ld: %s - Performing hard reset..\n",
932 ha->host_no, __func__));
933 status = qla4xxx_hard_reset(ha);
934 } 884 }
935 885
936 /* Flush any pending ddb changed AENs */ 886 /* Flush any pending ddb changed AENs */
@@ -1017,13 +967,9 @@ static void qla4xxx_do_dpc(struct work_struct *work)
1017 container_of(work, struct scsi_qla_host, dpc_work); 967 container_of(work, struct scsi_qla_host, dpc_work);
1018 struct ddb_entry *ddb_entry, *dtemp; 968 struct ddb_entry *ddb_entry, *dtemp;
1019 969
1020 DEBUG2(printk("scsi%ld: %s: DPC handler waking up.\n", 970 DEBUG2(printk("scsi%ld: %s: DPC handler waking up."
1021 ha->host_no, __func__)); 971 "flags = 0x%08lx, dpc_flags = 0x%08lx\n",
1022 972 ha->host_no, __func__, ha->flags, ha->dpc_flags));
1023 DEBUG2(printk("scsi%ld: %s: ha->flags = 0x%08lx\n",
1024 ha->host_no, __func__, ha->flags));
1025 DEBUG2(printk("scsi%ld: %s: ha->dpc_flags = 0x%08lx\n",
1026 ha->host_no, __func__, ha->dpc_flags));
1027 973
1028 /* Initialization not yet finished. Don't do anything yet. */ 974 /* Initialization not yet finished. Don't do anything yet. */
1029 if (!test_bit(AF_INIT_DONE, &ha->flags)) 975 if (!test_bit(AF_INIT_DONE, &ha->flags))
@@ -1033,16 +979,8 @@ static void qla4xxx_do_dpc(struct work_struct *work)
1033 test_bit(DPC_RESET_HA, &ha->dpc_flags) || 979 test_bit(DPC_RESET_HA, &ha->dpc_flags) ||
1034 test_bit(DPC_RESET_HA_INTR, &ha->dpc_flags) || 980 test_bit(DPC_RESET_HA_INTR, &ha->dpc_flags) ||
1035 test_bit(DPC_RESET_HA_DESTROY_DDB_LIST, &ha->dpc_flags)) { 981 test_bit(DPC_RESET_HA_DESTROY_DDB_LIST, &ha->dpc_flags)) {
1036 if (test_bit(DPC_RESET_HA_DESTROY_DDB_LIST, &ha->dpc_flags)) 982 if (test_bit(DPC_RESET_HA_DESTROY_DDB_LIST, &ha->dpc_flags) ||
1037 /* 983 test_bit(DPC_RESET_HA, &ha->dpc_flags))
1038 * dg 09/23 Never initialize ddb list
1039 * once we up and running
1040 * qla4xxx_recover_adapter(ha,
1041 * REBUILD_DDB_LIST);
1042 */
1043 qla4xxx_recover_adapter(ha, PRESERVE_DDB_LIST);
1044
1045 if (test_bit(DPC_RESET_HA, &ha->dpc_flags))
1046 qla4xxx_recover_adapter(ha, PRESERVE_DDB_LIST); 984 qla4xxx_recover_adapter(ha, PRESERVE_DDB_LIST);
1047 985
1048 if (test_and_clear_bit(DPC_RESET_HA_INTR, &ha->dpc_flags)) { 986 if (test_and_clear_bit(DPC_RESET_HA_INTR, &ha->dpc_flags)) {
@@ -1123,7 +1061,8 @@ static void qla4xxx_free_adapter(struct scsi_qla_host *ha)
1123 destroy_workqueue(ha->dpc_thread); 1061 destroy_workqueue(ha->dpc_thread);
1124 1062
1125 /* Issue Soft Reset to put firmware in unknown state */ 1063 /* Issue Soft Reset to put firmware in unknown state */
1126 qla4xxx_soft_reset(ha); 1064 if (ql4xxx_lock_drvr_wait(ha) == QLA_SUCCESS)
1065 qla4xxx_soft_reset(ha);
1127 1066
1128 /* Remove timer thread, if present */ 1067 /* Remove timer thread, if present */
1129 if (ha->timer_active) 1068 if (ha->timer_active)
@@ -1262,7 +1201,6 @@ static int __devinit qla4xxx_probe_adapter(struct pci_dev *pdev,
1262 init_waitqueue_head(&ha->mailbox_wait_queue); 1201 init_waitqueue_head(&ha->mailbox_wait_queue);
1263 1202
1264 spin_lock_init(&ha->hardware_lock); 1203 spin_lock_init(&ha->hardware_lock);
1265 spin_lock_init(&ha->list_lock);
1266 1204
1267 /* Allocate dma buffers */ 1205 /* Allocate dma buffers */
1268 if (qla4xxx_mem_alloc(ha)) { 1206 if (qla4xxx_mem_alloc(ha)) {
@@ -1469,27 +1407,6 @@ struct srb * qla4xxx_del_from_active_array(struct scsi_qla_host *ha, uint32_t in
1469} 1407}
1470 1408
1471/** 1409/**
1472 * qla4xxx_soft_reset - performs a SOFT RESET of hba.
1473 * @ha: Pointer to host adapter structure.
1474 **/
1475int qla4xxx_soft_reset(struct scsi_qla_host *ha)
1476{
1477
1478 DEBUG2(printk(KERN_WARNING "scsi%ld: %s: chip reset!\n", ha->host_no,
1479 __func__));
1480 if (test_bit(AF_TOPCAT_CHIP_PRESENT, &ha->flags)) {
1481 int status = QLA_ERROR;
1482
1483 if ((qla4010_soft_reset(ha) == QLA_SUCCESS) &&
1484 (qla4xxx_topcat_reset(ha) == QLA_SUCCESS) &&
1485 (qla4010_soft_reset(ha) == QLA_SUCCESS) )
1486 status = QLA_SUCCESS;
1487 return status;
1488 } else
1489 return qla4010_soft_reset(ha);
1490}
1491
1492/**
1493 * qla4xxx_eh_wait_on_command - waits for command to be returned by firmware 1410 * qla4xxx_eh_wait_on_command - waits for command to be returned by firmware
1494 * @ha: actual ha whose done queue will contain the comd returned by firmware. 1411 * @ha: actual ha whose done queue will contain the comd returned by firmware.
1495 * @cmd: Scsi Command to wait on. 1412 * @cmd: Scsi Command to wait on.
@@ -1687,6 +1604,12 @@ static struct pci_device_id qla4xxx_pci_tbl[] = {
1687 .subvendor = PCI_ANY_ID, 1604 .subvendor = PCI_ANY_ID,
1688 .subdevice = PCI_ANY_ID, 1605 .subdevice = PCI_ANY_ID,
1689 }, 1606 },
1607 {
1608 .vendor = PCI_VENDOR_ID_QLOGIC,
1609 .device = PCI_DEVICE_ID_QLOGIC_ISP4032,
1610 .subvendor = PCI_ANY_ID,
1611 .subdevice = PCI_ANY_ID,
1612 },
1690 {0, 0}, 1613 {0, 0},
1691}; 1614};
1692MODULE_DEVICE_TABLE(pci, qla4xxx_pci_tbl); 1615MODULE_DEVICE_TABLE(pci, qla4xxx_pci_tbl);
diff --git a/drivers/scsi/qla4xxx/ql4_version.h b/drivers/scsi/qla4xxx/ql4_version.h
index b3fe7e68988e..454e19c8ad68 100644
--- a/drivers/scsi/qla4xxx/ql4_version.h
+++ b/drivers/scsi/qla4xxx/ql4_version.h
@@ -5,9 +5,4 @@
5 * See LICENSE.qla4xxx for copyright and licensing details. 5 * See LICENSE.qla4xxx for copyright and licensing details.
6 */ 6 */
7 7
8#define QLA4XXX_DRIVER_VERSION "5.00.05b9-k" 8#define QLA4XXX_DRIVER_VERSION "5.00.07-k"
9
10#define QL4_DRIVER_MAJOR_VER 5
11#define QL4_DRIVER_MINOR_VER 0
12#define QL4_DRIVER_PATCH_VER 5
13#define QL4_DRIVER_BETA_VER 9