diff options
author | Jaroslav Kysela <perex@hera.kernel.org> | 2005-06-21 10:39:41 -0400 |
---|---|---|
committer | Jaroslav Kysela <perex@hera.kernel.org> | 2005-06-21 10:39:41 -0400 |
commit | fae6ec69c84d71b1d5bda9ede1a262c1681684aa (patch) | |
tree | eb4aff9a5c2b7d04ce09a3717bb1dd4a79fe7595 /drivers/scsi/qla2xxx/qla_os.c | |
parent | bbc0274e9bb2e3f1d724d445a2bd32566b9b66f7 (diff) | |
parent | 1d345dac1f30af1cd9f3a1faa12f9f18f17f236e (diff) |
Merge with /pub/scm/linux/kernel/git/torvalds/linux-2.6.git
Diffstat (limited to 'drivers/scsi/qla2xxx/qla_os.c')
-rw-r--r-- | drivers/scsi/qla2xxx/qla_os.c | 173 |
1 files changed, 49 insertions, 124 deletions
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index 579448222d69..0b12498b7672 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c | |||
@@ -36,27 +36,12 @@ char qla2x00_version_str[40]; | |||
36 | /* | 36 | /* |
37 | * SRB allocation cache | 37 | * SRB allocation cache |
38 | */ | 38 | */ |
39 | char srb_cachep_name[16]; | 39 | static kmem_cache_t *srb_cachep; |
40 | kmem_cache_t *srb_cachep; | ||
41 | |||
42 | /* | ||
43 | * Stats for all adpaters. | ||
44 | */ | ||
45 | struct _qla2x00stats qla2x00_stats; | ||
46 | 40 | ||
47 | /* | 41 | /* |
48 | * Ioctl related information. | 42 | * Ioctl related information. |
49 | */ | 43 | */ |
50 | int num_hosts; | 44 | static int num_hosts; |
51 | int apiHBAInstance; | ||
52 | |||
53 | /* | ||
54 | * Module parameter information and variables | ||
55 | */ | ||
56 | int ql2xmaxqdepth; | ||
57 | module_param(ql2xmaxqdepth, int, S_IRUGO|S_IWUSR); | ||
58 | MODULE_PARM_DESC(ql2xmaxqdepth, | ||
59 | "Maximum queue depth to report for target devices."); | ||
60 | 45 | ||
61 | int ql2xlogintimeout = 20; | 46 | int ql2xlogintimeout = 20; |
62 | module_param(ql2xlogintimeout, int, S_IRUGO|S_IRUSR); | 47 | module_param(ql2xlogintimeout, int, S_IRUGO|S_IRUSR); |
@@ -69,12 +54,6 @@ MODULE_PARM_DESC(qlport_down_retry, | |||
69 | "Maximum number of command retries to a port that returns" | 54 | "Maximum number of command retries to a port that returns" |
70 | "a PORT-DOWN status."); | 55 | "a PORT-DOWN status."); |
71 | 56 | ||
72 | int ql2xretrycount = 20; | ||
73 | module_param(ql2xretrycount, int, S_IRUGO|S_IWUSR); | ||
74 | MODULE_PARM_DESC(ql2xretrycount, | ||
75 | "Maximum number of mid-layer retries allowed for a command. " | ||
76 | "Default value is 20, "); | ||
77 | |||
78 | int ql2xplogiabsentdevice; | 57 | int ql2xplogiabsentdevice; |
79 | module_param(ql2xplogiabsentdevice, int, S_IRUGO|S_IWUSR); | 58 | module_param(ql2xplogiabsentdevice, int, S_IRUGO|S_IWUSR); |
80 | MODULE_PARM_DESC(ql2xplogiabsentdevice, | 59 | MODULE_PARM_DESC(ql2xplogiabsentdevice, |
@@ -95,25 +74,6 @@ MODULE_PARM_DESC(ql2xintrdelaytimer, | |||
95 | "ZIO: Waiting time for Firmware before it generates an " | 74 | "ZIO: Waiting time for Firmware before it generates an " |
96 | "interrupt to the host to notify completion of request."); | 75 | "interrupt to the host to notify completion of request."); |
97 | 76 | ||
98 | int ConfigRequired; | ||
99 | module_param(ConfigRequired, int, S_IRUGO|S_IRUSR); | ||
100 | MODULE_PARM_DESC(ConfigRequired, | ||
101 | "If 1, then only configured devices passed in through the" | ||
102 | "ql2xopts parameter will be presented to the OS"); | ||
103 | |||
104 | int Bind = BIND_BY_PORT_NAME; | ||
105 | module_param(Bind, int, S_IRUGO|S_IRUSR); | ||
106 | MODULE_PARM_DESC(Bind, | ||
107 | "Target persistent binding method: " | ||
108 | "0 by Portname (default); 1 by PortID; 2 by Nodename. "); | ||
109 | |||
110 | int ql2xsuspendcount = SUSPEND_COUNT; | ||
111 | module_param(ql2xsuspendcount, int, S_IRUGO|S_IWUSR); | ||
112 | MODULE_PARM_DESC(ql2xsuspendcount, | ||
113 | "Number of 6-second suspend iterations to perform while a " | ||
114 | "target returns a <NOT READY> status. Default is 10 " | ||
115 | "iterations."); | ||
116 | |||
117 | int ql2xloginretrycount = 0; | 77 | int ql2xloginretrycount = 0; |
118 | module_param(ql2xloginretrycount, int, S_IRUGO|S_IRUSR); | 78 | module_param(ql2xloginretrycount, int, S_IRUGO|S_IRUSR); |
119 | MODULE_PARM_DESC(ql2xloginretrycount, | 79 | MODULE_PARM_DESC(ql2xloginretrycount, |
@@ -330,7 +290,6 @@ qla2x00_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) | |||
330 | sp->fcport = fcport; | 290 | sp->fcport = fcport; |
331 | sp->cmd = cmd; | 291 | sp->cmd = cmd; |
332 | sp->flags = 0; | 292 | sp->flags = 0; |
333 | sp->err_id = 0; | ||
334 | 293 | ||
335 | CMD_SP(cmd) = (void *)sp; | 294 | CMD_SP(cmd) = (void *)sp; |
336 | cmd->scsi_done = done; | 295 | cmd->scsi_done = done; |
@@ -474,7 +433,6 @@ qla2x00_wait_for_loop_ready(scsi_qla_host_t *ha) | |||
474 | 433 | ||
475 | while ((!atomic_read(&ha->loop_down_timer) && | 434 | while ((!atomic_read(&ha->loop_down_timer) && |
476 | atomic_read(&ha->loop_state) == LOOP_DOWN) || | 435 | atomic_read(&ha->loop_state) == LOOP_DOWN) || |
477 | test_bit(CFG_ACTIVE, &ha->cfg_flags) || | ||
478 | atomic_read(&ha->loop_state) != LOOP_READY) { | 436 | atomic_read(&ha->loop_state) != LOOP_READY) { |
479 | msleep(1000); | 437 | msleep(1000); |
480 | if (time_after_eq(jiffies, loop_timeout)) { | 438 | if (time_after_eq(jiffies, loop_timeout)) { |
@@ -507,6 +465,7 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd) | |||
507 | int ret, i; | 465 | int ret, i; |
508 | unsigned int id, lun; | 466 | unsigned int id, lun; |
509 | unsigned long serial; | 467 | unsigned long serial; |
468 | unsigned long flags; | ||
510 | 469 | ||
511 | if (!CMD_SP(cmd)) | 470 | if (!CMD_SP(cmd)) |
512 | return FAILED; | 471 | return FAILED; |
@@ -518,8 +477,7 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd) | |||
518 | serial = cmd->serial_number; | 477 | serial = cmd->serial_number; |
519 | 478 | ||
520 | /* Check active list for command command. */ | 479 | /* Check active list for command command. */ |
521 | spin_unlock_irq(ha->host->host_lock); | 480 | spin_lock_irqsave(&ha->hardware_lock, flags); |
522 | spin_lock(&ha->hardware_lock); | ||
523 | for (i = 1; i < MAX_OUTSTANDING_COMMANDS; i++) { | 481 | for (i = 1; i < MAX_OUTSTANDING_COMMANDS; i++) { |
524 | sp = ha->outstanding_cmds[i]; | 482 | sp = ha->outstanding_cmds[i]; |
525 | 483 | ||
@@ -534,7 +492,7 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd) | |||
534 | sp->state)); | 492 | sp->state)); |
535 | DEBUG3(qla2x00_print_scsi_cmd(cmd);) | 493 | DEBUG3(qla2x00_print_scsi_cmd(cmd);) |
536 | 494 | ||
537 | spin_unlock(&ha->hardware_lock); | 495 | spin_unlock_irqrestore(&ha->hardware_lock, flags); |
538 | if (qla2x00_abort_command(ha, sp)) { | 496 | if (qla2x00_abort_command(ha, sp)) { |
539 | DEBUG2(printk("%s(%ld): abort_command " | 497 | DEBUG2(printk("%s(%ld): abort_command " |
540 | "mbx failed.\n", __func__, ha->host_no)); | 498 | "mbx failed.\n", __func__, ha->host_no)); |
@@ -543,22 +501,20 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd) | |||
543 | "mbx success.\n", __func__, ha->host_no)); | 501 | "mbx success.\n", __func__, ha->host_no)); |
544 | ret = SUCCESS; | 502 | ret = SUCCESS; |
545 | } | 503 | } |
546 | spin_lock(&ha->hardware_lock); | 504 | spin_lock_irqsave(&ha->hardware_lock, flags); |
547 | 505 | ||
548 | break; | 506 | break; |
549 | } | 507 | } |
508 | spin_unlock_irqrestore(&ha->hardware_lock, flags); | ||
550 | 509 | ||
551 | /* Wait for the command to be returned. */ | 510 | /* Wait for the command to be returned. */ |
552 | if (ret == SUCCESS) { | 511 | if (ret == SUCCESS) { |
553 | spin_unlock(&ha->hardware_lock); | ||
554 | if (qla2x00_eh_wait_on_command(ha, cmd) != QLA_SUCCESS) { | 512 | if (qla2x00_eh_wait_on_command(ha, cmd) != QLA_SUCCESS) { |
555 | qla_printk(KERN_ERR, ha, | 513 | qla_printk(KERN_ERR, ha, |
556 | "scsi(%ld:%d:%d): Abort handler timed out -- %lx " | 514 | "scsi(%ld:%d:%d): Abort handler timed out -- %lx " |
557 | "%x.\n", ha->host_no, id, lun, serial, ret); | 515 | "%x.\n", ha->host_no, id, lun, serial, ret); |
558 | } | 516 | } |
559 | spin_lock(&ha->hardware_lock); | ||
560 | } | 517 | } |
561 | spin_lock_irq(ha->host->host_lock); | ||
562 | 518 | ||
563 | qla_printk(KERN_INFO, ha, | 519 | qla_printk(KERN_INFO, ha, |
564 | "scsi(%ld:%d:%d): Abort command issued -- %lx %x.\n", ha->host_no, | 520 | "scsi(%ld:%d:%d): Abort command issued -- %lx %x.\n", ha->host_no, |
@@ -588,6 +544,7 @@ qla2x00_eh_wait_for_pending_target_commands(scsi_qla_host_t *ha, unsigned int t) | |||
588 | int status; | 544 | int status; |
589 | srb_t *sp; | 545 | srb_t *sp; |
590 | struct scsi_cmnd *cmd; | 546 | struct scsi_cmnd *cmd; |
547 | unsigned long flags; | ||
591 | 548 | ||
592 | status = 0; | 549 | status = 0; |
593 | 550 | ||
@@ -596,11 +553,11 @@ qla2x00_eh_wait_for_pending_target_commands(scsi_qla_host_t *ha, unsigned int t) | |||
596 | * array | 553 | * array |
597 | */ | 554 | */ |
598 | for (cnt = 1; cnt < MAX_OUTSTANDING_COMMANDS; cnt++) { | 555 | for (cnt = 1; cnt < MAX_OUTSTANDING_COMMANDS; cnt++) { |
599 | spin_lock(&ha->hardware_lock); | 556 | spin_lock_irqsave(&ha->hardware_lock, flags); |
600 | sp = ha->outstanding_cmds[cnt]; | 557 | sp = ha->outstanding_cmds[cnt]; |
601 | if (sp) { | 558 | if (sp) { |
602 | cmd = sp->cmd; | 559 | cmd = sp->cmd; |
603 | spin_unlock(&ha->hardware_lock); | 560 | spin_unlock_irqrestore(&ha->hardware_lock, flags); |
604 | if (cmd->device->id == t) { | 561 | if (cmd->device->id == t) { |
605 | if (!qla2x00_eh_wait_on_command(ha, cmd)) { | 562 | if (!qla2x00_eh_wait_on_command(ha, cmd)) { |
606 | status = 1; | 563 | status = 1; |
@@ -608,7 +565,7 @@ qla2x00_eh_wait_for_pending_target_commands(scsi_qla_host_t *ha, unsigned int t) | |||
608 | } | 565 | } |
609 | } | 566 | } |
610 | } else { | 567 | } else { |
611 | spin_unlock(&ha->hardware_lock); | 568 | spin_unlock_irqrestore(&ha->hardware_lock, flags); |
612 | } | 569 | } |
613 | } | 570 | } |
614 | return (status); | 571 | return (status); |
@@ -657,12 +614,8 @@ qla2xxx_eh_device_reset(struct scsi_cmnd *cmd) | |||
657 | qla_printk(KERN_INFO, ha, | 614 | qla_printk(KERN_INFO, ha, |
658 | "scsi(%ld:%d:%d): DEVICE RESET ISSUED.\n", ha->host_no, id, lun); | 615 | "scsi(%ld:%d:%d): DEVICE RESET ISSUED.\n", ha->host_no, id, lun); |
659 | 616 | ||
660 | spin_unlock_irq(ha->host->host_lock); | 617 | if (qla2x00_wait_for_hba_online(ha) != QLA_SUCCESS) |
661 | |||
662 | if (qla2x00_wait_for_hba_online(ha) != QLA_SUCCESS) { | ||
663 | spin_lock_irq(ha->host->host_lock); | ||
664 | goto eh_dev_reset_done; | 618 | goto eh_dev_reset_done; |
665 | } | ||
666 | 619 | ||
667 | if (qla2x00_wait_for_loop_ready(ha) == QLA_SUCCESS) { | 620 | if (qla2x00_wait_for_loop_ready(ha) == QLA_SUCCESS) { |
668 | if (qla2x00_device_reset(ha, fcport) == 0) | 621 | if (qla2x00_device_reset(ha, fcport) == 0) |
@@ -713,8 +666,6 @@ qla2xxx_eh_device_reset(struct scsi_cmnd *cmd) | |||
713 | "scsi(%ld:%d:%d): DEVICE RESET SUCCEEDED.\n", ha->host_no, id, lun); | 666 | "scsi(%ld:%d:%d): DEVICE RESET SUCCEEDED.\n", ha->host_no, id, lun); |
714 | 667 | ||
715 | eh_dev_reset_done: | 668 | eh_dev_reset_done: |
716 | spin_lock_irq(ha->host->host_lock); | ||
717 | |||
718 | return ret; | 669 | return ret; |
719 | } | 670 | } |
720 | 671 | ||
@@ -740,6 +691,7 @@ qla2x00_eh_wait_for_pending_commands(scsi_qla_host_t *ha) | |||
740 | int status; | 691 | int status; |
741 | srb_t *sp; | 692 | srb_t *sp; |
742 | struct scsi_cmnd *cmd; | 693 | struct scsi_cmnd *cmd; |
694 | unsigned long flags; | ||
743 | 695 | ||
744 | status = 1; | 696 | status = 1; |
745 | 697 | ||
@@ -748,17 +700,17 @@ qla2x00_eh_wait_for_pending_commands(scsi_qla_host_t *ha) | |||
748 | * array | 700 | * array |
749 | */ | 701 | */ |
750 | for (cnt = 1; cnt < MAX_OUTSTANDING_COMMANDS; cnt++) { | 702 | for (cnt = 1; cnt < MAX_OUTSTANDING_COMMANDS; cnt++) { |
751 | spin_lock(&ha->hardware_lock); | 703 | spin_lock_irqsave(&ha->hardware_lock, flags); |
752 | sp = ha->outstanding_cmds[cnt]; | 704 | sp = ha->outstanding_cmds[cnt]; |
753 | if (sp) { | 705 | if (sp) { |
754 | cmd = sp->cmd; | 706 | cmd = sp->cmd; |
755 | spin_unlock(&ha->hardware_lock); | 707 | spin_unlock_irqrestore(&ha->hardware_lock, flags); |
756 | status = qla2x00_eh_wait_on_command(ha, cmd); | 708 | status = qla2x00_eh_wait_on_command(ha, cmd); |
757 | if (status == 0) | 709 | if (status == 0) |
758 | break; | 710 | break; |
759 | } | 711 | } |
760 | else { | 712 | else { |
761 | spin_unlock(&ha->hardware_lock); | 713 | spin_unlock_irqrestore(&ha->hardware_lock, flags); |
762 | } | 714 | } |
763 | } | 715 | } |
764 | return (status); | 716 | return (status); |
@@ -803,8 +755,6 @@ qla2xxx_eh_bus_reset(struct scsi_cmnd *cmd) | |||
803 | qla_printk(KERN_INFO, ha, | 755 | qla_printk(KERN_INFO, ha, |
804 | "scsi(%ld:%d:%d): LOOP RESET ISSUED.\n", ha->host_no, id, lun); | 756 | "scsi(%ld:%d:%d): LOOP RESET ISSUED.\n", ha->host_no, id, lun); |
805 | 757 | ||
806 | spin_unlock_irq(ha->host->host_lock); | ||
807 | |||
808 | if (qla2x00_wait_for_hba_online(ha) != QLA_SUCCESS) { | 758 | if (qla2x00_wait_for_hba_online(ha) != QLA_SUCCESS) { |
809 | DEBUG2(printk("%s failed:board disabled\n",__func__)); | 759 | DEBUG2(printk("%s failed:board disabled\n",__func__)); |
810 | goto eh_bus_reset_done; | 760 | goto eh_bus_reset_done; |
@@ -826,8 +776,6 @@ eh_bus_reset_done: | |||
826 | qla_printk(KERN_INFO, ha, "%s: reset %s\n", __func__, | 776 | qla_printk(KERN_INFO, ha, "%s: reset %s\n", __func__, |
827 | (ret == FAILED) ? "failed" : "succeded"); | 777 | (ret == FAILED) ? "failed" : "succeded"); |
828 | 778 | ||
829 | spin_lock_irq(ha->host->host_lock); | ||
830 | |||
831 | return ret; | 779 | return ret; |
832 | } | 780 | } |
833 | 781 | ||
@@ -869,8 +817,6 @@ qla2xxx_eh_host_reset(struct scsi_cmnd *cmd) | |||
869 | qla_printk(KERN_INFO, ha, | 817 | qla_printk(KERN_INFO, ha, |
870 | "scsi(%ld:%d:%d): ADAPTER RESET ISSUED.\n", ha->host_no, id, lun); | 818 | "scsi(%ld:%d:%d): ADAPTER RESET ISSUED.\n", ha->host_no, id, lun); |
871 | 819 | ||
872 | spin_unlock_irq(ha->host->host_lock); | ||
873 | |||
874 | if (qla2x00_wait_for_hba_online(ha) != QLA_SUCCESS) | 820 | if (qla2x00_wait_for_hba_online(ha) != QLA_SUCCESS) |
875 | goto eh_host_reset_lock; | 821 | goto eh_host_reset_lock; |
876 | 822 | ||
@@ -899,8 +845,6 @@ qla2xxx_eh_host_reset(struct scsi_cmnd *cmd) | |||
899 | ret = SUCCESS; | 845 | ret = SUCCESS; |
900 | 846 | ||
901 | eh_host_reset_lock: | 847 | eh_host_reset_lock: |
902 | spin_lock_irq(ha->host->host_lock); | ||
903 | |||
904 | qla_printk(KERN_INFO, ha, "%s: reset %s\n", __func__, | 848 | qla_printk(KERN_INFO, ha, "%s: reset %s\n", __func__, |
905 | (ret == FAILED) ? "failed" : "succeded"); | 849 | (ret == FAILED) ? "failed" : "succeded"); |
906 | 850 | ||
@@ -1148,7 +1092,7 @@ iospace_error_exit: | |||
1148 | */ | 1092 | */ |
1149 | int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info) | 1093 | int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info) |
1150 | { | 1094 | { |
1151 | int ret; | 1095 | int ret = -ENODEV; |
1152 | device_reg_t __iomem *reg; | 1096 | device_reg_t __iomem *reg; |
1153 | struct Scsi_Host *host; | 1097 | struct Scsi_Host *host; |
1154 | scsi_qla_host_t *ha; | 1098 | scsi_qla_host_t *ha; |
@@ -1159,7 +1103,7 @@ int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info) | |||
1159 | fc_port_t *fcport; | 1103 | fc_port_t *fcport; |
1160 | 1104 | ||
1161 | if (pci_enable_device(pdev)) | 1105 | if (pci_enable_device(pdev)) |
1162 | return -1; | 1106 | goto probe_out; |
1163 | 1107 | ||
1164 | host = scsi_host_alloc(&qla2x00_driver_template, | 1108 | host = scsi_host_alloc(&qla2x00_driver_template, |
1165 | sizeof(scsi_qla_host_t)); | 1109 | sizeof(scsi_qla_host_t)); |
@@ -1181,9 +1125,8 @@ int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info) | |||
1181 | 1125 | ||
1182 | /* Configure PCI I/O space */ | 1126 | /* Configure PCI I/O space */ |
1183 | ret = qla2x00_iospace_config(ha); | 1127 | ret = qla2x00_iospace_config(ha); |
1184 | if (ret != 0) { | 1128 | if (ret) |
1185 | goto probe_alloc_failed; | 1129 | goto probe_failed; |
1186 | } | ||
1187 | 1130 | ||
1188 | /* Sanitize the information from PCI BIOS. */ | 1131 | /* Sanitize the information from PCI BIOS. */ |
1189 | host->irq = pdev->irq; | 1132 | host->irq = pdev->irq; |
@@ -1194,34 +1137,24 @@ int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info) | |||
1194 | 1137 | ||
1195 | spin_lock_init(&ha->hardware_lock); | 1138 | spin_lock_init(&ha->hardware_lock); |
1196 | 1139 | ||
1197 | /* 4.23 Initialize /proc/scsi/qla2x00 counters */ | ||
1198 | ha->actthreads = 0; | ||
1199 | ha->qthreads = 0; | ||
1200 | ha->total_isr_cnt = 0; | ||
1201 | ha->total_isp_aborts = 0; | ||
1202 | ha->total_lip_cnt = 0; | ||
1203 | ha->total_dev_errs = 0; | ||
1204 | ha->total_ios = 0; | ||
1205 | ha->total_bytes = 0; | ||
1206 | |||
1207 | ha->prev_topology = 0; | 1140 | ha->prev_topology = 0; |
1208 | ha->ports = MAX_BUSES; | 1141 | ha->ports = MAX_BUSES; |
1209 | 1142 | ||
1210 | if (IS_QLA2100(ha)) { | 1143 | if (IS_QLA2100(ha)) { |
1211 | ha->max_targets = MAX_TARGETS_2100; | 1144 | host->max_id = MAX_TARGETS_2100; |
1212 | ha->mbx_count = MAILBOX_REGISTER_COUNT_2100; | 1145 | ha->mbx_count = MAILBOX_REGISTER_COUNT_2100; |
1213 | ha->request_q_length = REQUEST_ENTRY_CNT_2100; | 1146 | ha->request_q_length = REQUEST_ENTRY_CNT_2100; |
1214 | ha->response_q_length = RESPONSE_ENTRY_CNT_2100; | 1147 | ha->response_q_length = RESPONSE_ENTRY_CNT_2100; |
1215 | ha->last_loop_id = SNS_LAST_LOOP_ID_2100; | 1148 | ha->last_loop_id = SNS_LAST_LOOP_ID_2100; |
1216 | host->sg_tablesize = 32; | 1149 | host->sg_tablesize = 32; |
1217 | } else if (IS_QLA2200(ha)) { | 1150 | } else if (IS_QLA2200(ha)) { |
1218 | ha->max_targets = MAX_TARGETS_2200; | 1151 | host->max_id = MAX_TARGETS_2200; |
1219 | ha->mbx_count = MAILBOX_REGISTER_COUNT; | 1152 | ha->mbx_count = MAILBOX_REGISTER_COUNT; |
1220 | ha->request_q_length = REQUEST_ENTRY_CNT_2200; | 1153 | ha->request_q_length = REQUEST_ENTRY_CNT_2200; |
1221 | ha->response_q_length = RESPONSE_ENTRY_CNT_2100; | 1154 | ha->response_q_length = RESPONSE_ENTRY_CNT_2100; |
1222 | ha->last_loop_id = SNS_LAST_LOOP_ID_2100; | 1155 | ha->last_loop_id = SNS_LAST_LOOP_ID_2100; |
1223 | } else /*if (IS_QLA2300(ha))*/ { | 1156 | } else /*if (IS_QLA2300(ha))*/ { |
1224 | ha->max_targets = MAX_TARGETS_2200; | 1157 | host->max_id = MAX_TARGETS_2200; |
1225 | ha->mbx_count = MAILBOX_REGISTER_COUNT; | 1158 | ha->mbx_count = MAILBOX_REGISTER_COUNT; |
1226 | ha->request_q_length = REQUEST_ENTRY_CNT_2200; | 1159 | ha->request_q_length = REQUEST_ENTRY_CNT_2200; |
1227 | ha->response_q_length = RESPONSE_ENTRY_CNT_2300; | 1160 | ha->response_q_length = RESPONSE_ENTRY_CNT_2300; |
@@ -1256,23 +1189,10 @@ int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info) | |||
1256 | qla_printk(KERN_WARNING, ha, | 1189 | qla_printk(KERN_WARNING, ha, |
1257 | "[ERROR] Failed to allocate memory for adapter\n"); | 1190 | "[ERROR] Failed to allocate memory for adapter\n"); |
1258 | 1191 | ||
1259 | goto probe_alloc_failed; | 1192 | ret = -ENOMEM; |
1193 | goto probe_failed; | ||
1260 | } | 1194 | } |
1261 | 1195 | ||
1262 | pci_set_drvdata(pdev, ha); | ||
1263 | host->this_id = 255; | ||
1264 | host->cmd_per_lun = 3; | ||
1265 | host->unique_id = ha->instance; | ||
1266 | host->max_cmd_len = MAX_CMDSZ; | ||
1267 | host->max_channel = ha->ports - 1; | ||
1268 | host->max_id = ha->max_targets; | ||
1269 | host->max_lun = ha->max_luns; | ||
1270 | host->transportt = qla2xxx_transport_template; | ||
1271 | if (scsi_add_host(host, &pdev->dev)) | ||
1272 | goto probe_alloc_failed; | ||
1273 | |||
1274 | qla2x00_alloc_sysfs_attr(ha); | ||
1275 | |||
1276 | if (qla2x00_initialize_adapter(ha) && | 1196 | if (qla2x00_initialize_adapter(ha) && |
1277 | !(ha->device_flags & DFLG_NO_CABLE)) { | 1197 | !(ha->device_flags & DFLG_NO_CABLE)) { |
1278 | 1198 | ||
@@ -1283,11 +1203,10 @@ int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info) | |||
1283 | "Adapter flags %x.\n", | 1203 | "Adapter flags %x.\n", |
1284 | ha->host_no, ha->device_flags)); | 1204 | ha->host_no, ha->device_flags)); |
1285 | 1205 | ||
1206 | ret = -ENODEV; | ||
1286 | goto probe_failed; | 1207 | goto probe_failed; |
1287 | } | 1208 | } |
1288 | 1209 | ||
1289 | qla2x00_init_host_attr(ha); | ||
1290 | |||
1291 | /* | 1210 | /* |
1292 | * Startup the kernel thread for this host adapter | 1211 | * Startup the kernel thread for this host adapter |
1293 | */ | 1212 | */ |
@@ -1297,17 +1216,26 @@ int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info) | |||
1297 | qla_printk(KERN_WARNING, ha, | 1216 | qla_printk(KERN_WARNING, ha, |
1298 | "Unable to start DPC thread!\n"); | 1217 | "Unable to start DPC thread!\n"); |
1299 | 1218 | ||
1219 | ret = -ENODEV; | ||
1300 | goto probe_failed; | 1220 | goto probe_failed; |
1301 | } | 1221 | } |
1302 | wait_for_completion(&ha->dpc_inited); | 1222 | wait_for_completion(&ha->dpc_inited); |
1303 | 1223 | ||
1224 | host->this_id = 255; | ||
1225 | host->cmd_per_lun = 3; | ||
1226 | host->unique_id = ha->instance; | ||
1227 | host->max_cmd_len = MAX_CMDSZ; | ||
1228 | host->max_channel = ha->ports - 1; | ||
1229 | host->max_lun = MAX_LUNS; | ||
1230 | host->transportt = qla2xxx_transport_template; | ||
1231 | |||
1304 | if (IS_QLA2100(ha) || IS_QLA2200(ha)) | 1232 | if (IS_QLA2100(ha) || IS_QLA2200(ha)) |
1305 | ret = request_irq(host->irq, qla2100_intr_handler, | 1233 | ret = request_irq(host->irq, qla2100_intr_handler, |
1306 | SA_INTERRUPT|SA_SHIRQ, ha->brd_info->drv_name, ha); | 1234 | SA_INTERRUPT|SA_SHIRQ, ha->brd_info->drv_name, ha); |
1307 | else | 1235 | else |
1308 | ret = request_irq(host->irq, qla2300_intr_handler, | 1236 | ret = request_irq(host->irq, qla2300_intr_handler, |
1309 | SA_INTERRUPT|SA_SHIRQ, ha->brd_info->drv_name, ha); | 1237 | SA_INTERRUPT|SA_SHIRQ, ha->brd_info->drv_name, ha); |
1310 | if (ret != 0) { | 1238 | if (ret) { |
1311 | qla_printk(KERN_WARNING, ha, | 1239 | qla_printk(KERN_WARNING, ha, |
1312 | "Failed to reserve interrupt %d already in use.\n", | 1240 | "Failed to reserve interrupt %d already in use.\n", |
1313 | host->irq); | 1241 | host->irq); |
@@ -1361,9 +1289,18 @@ int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info) | |||
1361 | msleep(10); | 1289 | msleep(10); |
1362 | } | 1290 | } |
1363 | 1291 | ||
1292 | pci_set_drvdata(pdev, ha); | ||
1364 | ha->flags.init_done = 1; | 1293 | ha->flags.init_done = 1; |
1365 | num_hosts++; | 1294 | num_hosts++; |
1366 | 1295 | ||
1296 | ret = scsi_add_host(host, &pdev->dev); | ||
1297 | if (ret) | ||
1298 | goto probe_failed; | ||
1299 | |||
1300 | qla2x00_alloc_sysfs_attr(ha); | ||
1301 | |||
1302 | qla2x00_init_host_attr(ha); | ||
1303 | |||
1367 | qla_printk(KERN_INFO, ha, "\n" | 1304 | qla_printk(KERN_INFO, ha, "\n" |
1368 | " QLogic Fibre Channel HBA Driver: %s\n" | 1305 | " QLogic Fibre Channel HBA Driver: %s\n" |
1369 | " QLogic %s - %s\n" | 1306 | " QLogic %s - %s\n" |
@@ -1382,9 +1319,6 @@ int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info) | |||
1382 | probe_failed: | 1319 | probe_failed: |
1383 | fc_remove_host(ha->host); | 1320 | fc_remove_host(ha->host); |
1384 | 1321 | ||
1385 | scsi_remove_host(host); | ||
1386 | |||
1387 | probe_alloc_failed: | ||
1388 | qla2x00_free_device(ha); | 1322 | qla2x00_free_device(ha); |
1389 | 1323 | ||
1390 | scsi_host_put(host); | 1324 | scsi_host_put(host); |
@@ -1392,7 +1326,8 @@ probe_alloc_failed: | |||
1392 | probe_disable_device: | 1326 | probe_disable_device: |
1393 | pci_disable_device(pdev); | 1327 | pci_disable_device(pdev); |
1394 | 1328 | ||
1395 | return -1; | 1329 | probe_out: |
1330 | return ret; | ||
1396 | } | 1331 | } |
1397 | EXPORT_SYMBOL_GPL(qla2x00_probe_one); | 1332 | EXPORT_SYMBOL_GPL(qla2x00_probe_one); |
1398 | 1333 | ||
@@ -2336,8 +2271,7 @@ static int __init | |||
2336 | qla2x00_module_init(void) | 2271 | qla2x00_module_init(void) |
2337 | { | 2272 | { |
2338 | /* Allocate cache for SRBs. */ | 2273 | /* Allocate cache for SRBs. */ |
2339 | sprintf(srb_cachep_name, "qla2xxx_srbs"); | 2274 | srb_cachep = kmem_cache_create("qla2xxx_srbs", sizeof(srb_t), 0, |
2340 | srb_cachep = kmem_cache_create(srb_cachep_name, sizeof(srb_t), 0, | ||
2341 | SLAB_HWCACHE_ALIGN, NULL, NULL); | 2275 | SLAB_HWCACHE_ALIGN, NULL, NULL); |
2342 | if (srb_cachep == NULL) { | 2276 | if (srb_cachep == NULL) { |
2343 | printk(KERN_ERR | 2277 | printk(KERN_ERR |
@@ -2365,16 +2299,7 @@ qla2x00_module_init(void) | |||
2365 | static void __exit | 2299 | static void __exit |
2366 | qla2x00_module_exit(void) | 2300 | qla2x00_module_exit(void) |
2367 | { | 2301 | { |
2368 | /* Free SRBs cache. */ | 2302 | kmem_cache_destroy(srb_cachep); |
2369 | if (srb_cachep != NULL) { | ||
2370 | if (kmem_cache_destroy(srb_cachep) != 0) { | ||
2371 | printk(KERN_ERR | ||
2372 | "qla2xxx: Unable to free SRB cache...Memory pools " | ||
2373 | "still active?\n"); | ||
2374 | } | ||
2375 | srb_cachep = NULL; | ||
2376 | } | ||
2377 | |||
2378 | fc_release_transport(qla2xxx_transport_template); | 2303 | fc_release_transport(qla2xxx_transport_template); |
2379 | } | 2304 | } |
2380 | 2305 | ||