aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/qla2xxx/qla_init.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/qla2xxx/qla_init.c')
-rw-r--r--drivers/scsi/qla2xxx/qla_init.c252
1 files changed, 135 insertions, 117 deletions
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index 7629558eba25..27b7f9259f28 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -34,17 +34,13 @@
34/* 34/*
35* QLogic ISP2x00 Hardware Support Function Prototypes. 35* QLogic ISP2x00 Hardware Support Function Prototypes.
36*/ 36*/
37static int qla2x00_pci_config(scsi_qla_host_t *);
38static int qla2x00_isp_firmware(scsi_qla_host_t *); 37static int qla2x00_isp_firmware(scsi_qla_host_t *);
39static void qla2x00_reset_chip(scsi_qla_host_t *);
40static int qla2x00_chip_diag(scsi_qla_host_t *);
41static void qla2x00_resize_request_q(scsi_qla_host_t *); 38static void qla2x00_resize_request_q(scsi_qla_host_t *);
42static int qla2x00_setup_chip(scsi_qla_host_t *); 39static int qla2x00_setup_chip(scsi_qla_host_t *);
43static void qla2x00_init_response_q_entries(scsi_qla_host_t *); 40static void qla2x00_init_response_q_entries(scsi_qla_host_t *);
44static int qla2x00_init_rings(scsi_qla_host_t *); 41static int qla2x00_init_rings(scsi_qla_host_t *);
45static int qla2x00_fw_ready(scsi_qla_host_t *); 42static int qla2x00_fw_ready(scsi_qla_host_t *);
46static int qla2x00_configure_hba(scsi_qla_host_t *); 43static int qla2x00_configure_hba(scsi_qla_host_t *);
47static int qla2x00_nvram_config(scsi_qla_host_t *);
48static int qla2x00_configure_loop(scsi_qla_host_t *); 44static int qla2x00_configure_loop(scsi_qla_host_t *);
49static int qla2x00_configure_local_loop(scsi_qla_host_t *); 45static int qla2x00_configure_local_loop(scsi_qla_host_t *);
50static void qla2x00_update_fcport(scsi_qla_host_t *, fc_port_t *); 46static void qla2x00_update_fcport(scsi_qla_host_t *, fc_port_t *);
@@ -55,7 +51,6 @@ static int qla2x00_fabric_dev_login(scsi_qla_host_t *, fc_port_t *,
55 uint16_t *); 51 uint16_t *);
56 52
57static int qla2x00_restart_isp(scsi_qla_host_t *); 53static int qla2x00_restart_isp(scsi_qla_host_t *);
58static void qla2x00_reset_adapter(scsi_qla_host_t *);
59 54
60/****************************************************************************/ 55/****************************************************************************/
61/* QLogic ISP2x00 Hardware Support Functions. */ 56/* QLogic ISP2x00 Hardware Support Functions. */
@@ -92,17 +87,17 @@ qla2x00_initialize_adapter(scsi_qla_host_t *ha)
92 ha->isp_abort_cnt = 0; 87 ha->isp_abort_cnt = 0;
93 ha->beacon_blink_led = 0; 88 ha->beacon_blink_led = 0;
94 89
95 rval = qla2x00_pci_config(ha); 90 rval = ha->isp_ops.pci_config(ha);
96 if (rval) { 91 if (rval) {
97 DEBUG2(printk("scsi(%ld): Unable to configure PCI space=n", 92 DEBUG2(printk("scsi(%ld): Unable to configure PCI space=n",
98 ha->host_no)); 93 ha->host_no));
99 return (rval); 94 return (rval);
100 } 95 }
101 96
102 qla2x00_reset_chip(ha); 97 ha->isp_ops.reset_chip(ha);
103 98
104 qla_printk(KERN_INFO, ha, "Configure NVRAM parameters...\n"); 99 qla_printk(KERN_INFO, ha, "Configure NVRAM parameters...\n");
105 qla2x00_nvram_config(ha); 100 ha->isp_ops.nvram_config(ha);
106 101
107 qla_printk(KERN_INFO, ha, "Verifying loaded RISC code...\n"); 102 qla_printk(KERN_INFO, ha, "Verifying loaded RISC code...\n");
108 103
@@ -115,7 +110,7 @@ qla2x00_initialize_adapter(scsi_qla_host_t *ha)
115 110
116 /* If firmware needs to be loaded */ 111 /* If firmware needs to be loaded */
117 if (qla2x00_isp_firmware(ha) != QLA_SUCCESS) { 112 if (qla2x00_isp_firmware(ha) != QLA_SUCCESS) {
118 if ((rval = qla2x00_chip_diag(ha)) == QLA_SUCCESS) { 113 if ((rval = ha->isp_ops.chip_diag(ha)) == QLA_SUCCESS) {
119 rval = qla2x00_setup_chip(ha); 114 rval = qla2x00_setup_chip(ha);
120 } 115 }
121 } 116 }
@@ -190,110 +185,130 @@ check_fw_ready_again:
190} 185}
191 186
192/** 187/**
193 * qla2x00_pci_config() - Setup device PCI configuration registers. 188 * qla2100_pci_config() - Setup ISP21xx PCI configuration registers.
194 * @ha: HA context 189 * @ha: HA context
195 * 190 *
196 * Returns 0 on success. 191 * Returns 0 on success.
197 */ 192 */
198static int 193int
199qla2x00_pci_config(scsi_qla_host_t *ha) 194qla2100_pci_config(scsi_qla_host_t *ha)
200{ 195{
201 uint16_t w, mwi; 196 uint16_t w, mwi;
202 unsigned long flags = 0; 197 unsigned long flags;
203 uint32_t cnt;
204 198
205 qla_printk(KERN_INFO, ha, "Configuring PCI space...\n"); 199 qla_printk(KERN_INFO, ha, "Configuring PCI space...\n");
206 200
207 /*
208 * Turn on PCI master; for system BIOSes that don't turn it on by
209 * default.
210 */
211 pci_set_master(ha->pdev); 201 pci_set_master(ha->pdev);
212 mwi = 0; 202 mwi = 0;
213 if (pci_set_mwi(ha->pdev)) 203 if (pci_set_mwi(ha->pdev))
214 mwi = PCI_COMMAND_INVALIDATE; 204 mwi = PCI_COMMAND_INVALIDATE;
215 pci_read_config_word(ha->pdev, PCI_REVISION_ID, &ha->revision); 205 pci_read_config_word(ha->pdev, PCI_REVISION_ID, &ha->revision);
216 206
217 if (!ha->iobase)
218 return (QLA_FUNCTION_FAILED);
219
220 /*
221 * We want to respect framework's setting of PCI configuration space
222 * command register and also want to make sure that all bits of
223 * interest to us are properly set in command register.
224 */
225 pci_read_config_word(ha->pdev, PCI_COMMAND, &w); 207 pci_read_config_word(ha->pdev, PCI_COMMAND, &w);
226 w |= mwi | (PCI_COMMAND_PARITY | PCI_COMMAND_SERR); 208 w |= mwi | (PCI_COMMAND_PARITY | PCI_COMMAND_SERR);
209 pci_write_config_word(ha->pdev, PCI_COMMAND, w);
210
211 /* Reset expansion ROM address decode enable */
212 pci_read_config_word(ha->pdev, PCI_ROM_ADDRESS, &w);
213 w &= ~PCI_ROM_ADDRESS_ENABLE;
214 pci_write_config_word(ha->pdev, PCI_ROM_ADDRESS, w);
227 215
228 /* Get PCI bus information. */ 216 /* Get PCI bus information. */
229 spin_lock_irqsave(&ha->hardware_lock, flags); 217 spin_lock_irqsave(&ha->hardware_lock, flags);
230 ha->pci_attr = RD_REG_WORD(&ha->iobase->ctrl_status); 218 ha->pci_attr = RD_REG_WORD(&ha->iobase->ctrl_status);
231 spin_unlock_irqrestore(&ha->hardware_lock, flags); 219 spin_unlock_irqrestore(&ha->hardware_lock, flags);
232 220
233 if (!IS_QLA2100(ha) && !IS_QLA2200(ha)) { 221 return QLA_SUCCESS;
234 pci_write_config_byte(ha->pdev, PCI_LATENCY_TIMER, 0x80); 222}
235 223
236 /* PCI Specification Revision 2.3 changes */ 224/**
237 if (IS_QLA2322(ha) || IS_QLA6322(ha)) 225 * qla2300_pci_config() - Setup ISP23xx PCI configuration registers.
238 /* Command Register - Reset Interrupt Disable. */ 226 * @ha: HA context
239 w &= ~PCI_COMMAND_INTX_DISABLE; 227 *
228 * Returns 0 on success.
229 */
230int
231qla2300_pci_config(scsi_qla_host_t *ha)
232{
233 uint16_t w, mwi;
234 unsigned long flags = 0;
235 uint32_t cnt;
240 236
241 /* 237 qla_printk(KERN_INFO, ha, "Configuring PCI space...\n");
242 * If this is a 2300 card and not 2312, reset the
243 * COMMAND_INVALIDATE due to a bug in the 2300. Unfortunately,
244 * the 2310 also reports itself as a 2300 so we need to get the
245 * fb revision level -- a 6 indicates it really is a 2300 and
246 * not a 2310.
247 */
248 if (IS_QLA2300(ha)) {
249 spin_lock_irqsave(&ha->hardware_lock, flags);
250 238
251 /* Pause RISC. */ 239 pci_set_master(ha->pdev);
252 WRT_REG_WORD(&ha->iobase->hccr, HCCR_PAUSE_RISC); 240 mwi = 0;
253 for (cnt = 0; cnt < 30000; cnt++) { 241 if (pci_set_mwi(ha->pdev))
254 if ((RD_REG_WORD(&ha->iobase->hccr) & 242 mwi = PCI_COMMAND_INVALIDATE;
255 HCCR_RISC_PAUSE) != 0) 243 pci_read_config_word(ha->pdev, PCI_REVISION_ID, &ha->revision);
256 break;
257
258 udelay(10);
259 }
260 244
261 /* Select FPM registers. */ 245 pci_read_config_word(ha->pdev, PCI_COMMAND, &w);
262 WRT_REG_WORD(&ha->iobase->ctrl_status, 0x20); 246 w |= mwi | (PCI_COMMAND_PARITY | PCI_COMMAND_SERR);
263 RD_REG_WORD(&ha->iobase->ctrl_status);
264 247
265 /* Get the fb rev level */ 248 if (IS_QLA2322(ha) || IS_QLA6322(ha))
266 ha->fb_rev = RD_FB_CMD_REG(ha, ha->iobase); 249 w &= ~PCI_COMMAND_INTX_DISABLE;
267 250
268 if (ha->fb_rev == FPM_2300) 251 /*
269 w &= ~PCI_COMMAND_INVALIDATE; 252 * If this is a 2300 card and not 2312, reset the
253 * COMMAND_INVALIDATE due to a bug in the 2300. Unfortunately,
254 * the 2310 also reports itself as a 2300 so we need to get the
255 * fb revision level -- a 6 indicates it really is a 2300 and
256 * not a 2310.
257 */
258 if (IS_QLA2300(ha)) {
259 spin_lock_irqsave(&ha->hardware_lock, flags);
270 260
271 /* Deselect FPM registers. */ 261 /* Pause RISC. */
272 WRT_REG_WORD(&ha->iobase->ctrl_status, 0x0); 262 WRT_REG_WORD(&ha->iobase->hccr, HCCR_PAUSE_RISC);
273 RD_REG_WORD(&ha->iobase->ctrl_status); 263 for (cnt = 0; cnt < 30000; cnt++) {
264 if ((RD_REG_WORD(&ha->iobase->hccr) &
265 HCCR_RISC_PAUSE) != 0)
266 break;
274 267
275 /* Release RISC module. */ 268 udelay(10);
276 WRT_REG_WORD(&ha->iobase->hccr, HCCR_RELEASE_RISC); 269 }
277 for (cnt = 0; cnt < 30000; cnt++) {
278 if ((RD_REG_WORD(&ha->iobase->hccr) &
279 HCCR_RISC_PAUSE) == 0)
280 break;
281
282 udelay(10);
283 }
284 270
285 spin_unlock_irqrestore(&ha->hardware_lock, flags); 271 /* Select FPM registers. */
272 WRT_REG_WORD(&ha->iobase->ctrl_status, 0x20);
273 RD_REG_WORD(&ha->iobase->ctrl_status);
274
275 /* Get the fb rev level */
276 ha->fb_rev = RD_FB_CMD_REG(ha, ha->iobase);
277
278 if (ha->fb_rev == FPM_2300)
279 w &= ~PCI_COMMAND_INVALIDATE;
280
281 /* Deselect FPM registers. */
282 WRT_REG_WORD(&ha->iobase->ctrl_status, 0x0);
283 RD_REG_WORD(&ha->iobase->ctrl_status);
284
285 /* Release RISC module. */
286 WRT_REG_WORD(&ha->iobase->hccr, HCCR_RELEASE_RISC);
287 for (cnt = 0; cnt < 30000; cnt++) {
288 if ((RD_REG_WORD(&ha->iobase->hccr) &
289 HCCR_RISC_PAUSE) == 0)
290 break;
291
292 udelay(10);
286 } 293 }
287 }
288 294
295 spin_unlock_irqrestore(&ha->hardware_lock, flags);
296 }
289 pci_write_config_word(ha->pdev, PCI_COMMAND, w); 297 pci_write_config_word(ha->pdev, PCI_COMMAND, w);
290 298
299 pci_write_config_byte(ha->pdev, PCI_LATENCY_TIMER, 0x80);
300
291 /* Reset expansion ROM address decode enable */ 301 /* Reset expansion ROM address decode enable */
292 pci_read_config_word(ha->pdev, PCI_ROM_ADDRESS, &w); 302 pci_read_config_word(ha->pdev, PCI_ROM_ADDRESS, &w);
293 w &= ~PCI_ROM_ADDRESS_ENABLE; 303 w &= ~PCI_ROM_ADDRESS_ENABLE;
294 pci_write_config_word(ha->pdev, PCI_ROM_ADDRESS, w); 304 pci_write_config_word(ha->pdev, PCI_ROM_ADDRESS, w);
295 305
296 return (QLA_SUCCESS); 306 /* Get PCI bus information. */
307 spin_lock_irqsave(&ha->hardware_lock, flags);
308 ha->pci_attr = RD_REG_WORD(&ha->iobase->ctrl_status);
309 spin_unlock_irqrestore(&ha->hardware_lock, flags);
310
311 return QLA_SUCCESS;
297} 312}
298 313
299/** 314/**
@@ -333,7 +348,7 @@ qla2x00_isp_firmware(scsi_qla_host_t *ha)
333 * 348 *
334 * Returns 0 on success. 349 * Returns 0 on success.
335 */ 350 */
336static void 351void
337qla2x00_reset_chip(scsi_qla_host_t *ha) 352qla2x00_reset_chip(scsi_qla_host_t *ha)
338{ 353{
339 unsigned long flags = 0; 354 unsigned long flags = 0;
@@ -342,8 +357,7 @@ qla2x00_reset_chip(scsi_qla_host_t *ha)
342 unsigned long mbx_flags = 0; 357 unsigned long mbx_flags = 0;
343 uint16_t cmd; 358 uint16_t cmd;
344 359
345 /* Disable ISP interrupts. */ 360 ha->isp_ops.disable_intrs(ha);
346 qla2x00_disable_intrs(ha);
347 361
348 spin_lock_irqsave(&ha->hardware_lock, flags); 362 spin_lock_irqsave(&ha->hardware_lock, flags);
349 363
@@ -487,7 +501,7 @@ qla2x00_reset_chip(scsi_qla_host_t *ha)
487 * 501 *
488 * Returns 0 on success. 502 * Returns 0 on success.
489 */ 503 */
490static int 504int
491qla2x00_chip_diag(scsi_qla_host_t *ha) 505qla2x00_chip_diag(scsi_qla_host_t *ha)
492{ 506{
493 int rval; 507 int rval;
@@ -802,7 +816,7 @@ qla2x00_init_response_q_entries(scsi_qla_host_t *ha)
802 * 816 *
803 * Returns 0 on success. 817 * Returns 0 on success.
804 */ 818 */
805static void 819void
806qla2x00_update_fw_options(scsi_qla_host_t *ha) 820qla2x00_update_fw_options(scsi_qla_host_t *ha)
807{ 821{
808 uint16_t swing, emphasis, tx_sens, rx_sens; 822 uint16_t swing, emphasis, tx_sens, rx_sens;
@@ -872,6 +886,28 @@ qla2x00_update_fw_options(scsi_qla_host_t *ha)
872 qla2x00_set_fw_options(ha, ha->fw_options); 886 qla2x00_set_fw_options(ha, ha->fw_options);
873} 887}
874 888
889void
890qla2x00_config_rings(struct scsi_qla_host *ha)
891{
892 device_reg_t __iomem *reg = ha->iobase;
893
894 /* Setup ring parameters in initialization control block. */
895 ha->init_cb->request_q_outpointer = __constant_cpu_to_le16(0);
896 ha->init_cb->response_q_inpointer = __constant_cpu_to_le16(0);
897 ha->init_cb->request_q_length = cpu_to_le16(ha->request_q_length);
898 ha->init_cb->response_q_length = cpu_to_le16(ha->response_q_length);
899 ha->init_cb->request_q_address[0] = cpu_to_le32(LSD(ha->request_dma));
900 ha->init_cb->request_q_address[1] = cpu_to_le32(MSD(ha->request_dma));
901 ha->init_cb->response_q_address[0] = cpu_to_le32(LSD(ha->response_dma));
902 ha->init_cb->response_q_address[1] = cpu_to_le32(MSD(ha->response_dma));
903
904 WRT_REG_WORD(ISP_REQ_Q_IN(ha, reg), 0);
905 WRT_REG_WORD(ISP_REQ_Q_OUT(ha, reg), 0);
906 WRT_REG_WORD(ISP_RSP_Q_IN(ha, reg), 0);
907 WRT_REG_WORD(ISP_RSP_Q_OUT(ha, reg), 0);
908 RD_REG_WORD(ISP_RSP_Q_OUT(ha, reg)); /* PCI Posting. */
909}
910
875/** 911/**
876 * qla2x00_init_rings() - Initializes firmware. 912 * qla2x00_init_rings() - Initializes firmware.
877 * @ha: HA context 913 * @ha: HA context
@@ -887,7 +923,6 @@ qla2x00_init_rings(scsi_qla_host_t *ha)
887 int rval; 923 int rval;
888 unsigned long flags = 0; 924 unsigned long flags = 0;
889 int cnt; 925 int cnt;
890 device_reg_t __iomem *reg = ha->iobase;
891 926
892 spin_lock_irqsave(&ha->hardware_lock, flags); 927 spin_lock_irqsave(&ha->hardware_lock, flags);
893 928
@@ -908,29 +943,15 @@ qla2x00_init_rings(scsi_qla_host_t *ha)
908 ha->response_ring_ptr = ha->response_ring; 943 ha->response_ring_ptr = ha->response_ring;
909 ha->rsp_ring_index = 0; 944 ha->rsp_ring_index = 0;
910 945
911 /* Setup ring parameters in initialization control block. */
912 ha->init_cb->request_q_outpointer = __constant_cpu_to_le16(0);
913 ha->init_cb->response_q_inpointer = __constant_cpu_to_le16(0);
914 ha->init_cb->request_q_length = cpu_to_le16(ha->request_q_length);
915 ha->init_cb->response_q_length = cpu_to_le16(ha->response_q_length);
916 ha->init_cb->request_q_address[0] = cpu_to_le32(LSD(ha->request_dma));
917 ha->init_cb->request_q_address[1] = cpu_to_le32(MSD(ha->request_dma));
918 ha->init_cb->response_q_address[0] = cpu_to_le32(LSD(ha->response_dma));
919 ha->init_cb->response_q_address[1] = cpu_to_le32(MSD(ha->response_dma));
920
921 /* Initialize response queue entries */ 946 /* Initialize response queue entries */
922 qla2x00_init_response_q_entries(ha); 947 qla2x00_init_response_q_entries(ha);
923 948
924 WRT_REG_WORD(ISP_REQ_Q_IN(ha, reg), 0); 949 ha->isp_ops.config_rings(ha);
925 WRT_REG_WORD(ISP_REQ_Q_OUT(ha, reg), 0);
926 WRT_REG_WORD(ISP_RSP_Q_IN(ha, reg), 0);
927 WRT_REG_WORD(ISP_RSP_Q_OUT(ha, reg), 0);
928 RD_REG_WORD(ISP_RSP_Q_OUT(ha, reg)); /* PCI Posting. */
929 950
930 spin_unlock_irqrestore(&ha->hardware_lock, flags); 951 spin_unlock_irqrestore(&ha->hardware_lock, flags);
931 952
932 /* Update any ISP specific firmware options before initialization. */ 953 /* Update any ISP specific firmware options before initialization. */
933 qla2x00_update_fw_options(ha); 954 ha->isp_ops.update_fw_options(ha);
934 955
935 DEBUG(printk("scsi(%ld): Issue init firmware.\n", ha->host_no)); 956 DEBUG(printk("scsi(%ld): Issue init firmware.\n", ha->host_no));
936 rval = qla2x00_init_firmware(ha, sizeof(init_cb_t)); 957 rval = qla2x00_init_firmware(ha, sizeof(init_cb_t));
@@ -1165,7 +1186,7 @@ qla2x00_configure_hba(scsi_qla_host_t *ha)
1165* Returns: 1186* Returns:
1166* 0 = success. 1187* 0 = success.
1167*/ 1188*/
1168static int 1189int
1169qla2x00_nvram_config(scsi_qla_host_t *ha) 1190qla2x00_nvram_config(scsi_qla_host_t *ha)
1170{ 1191{
1171 int rval; 1192 int rval;
@@ -1698,15 +1719,13 @@ qla2x00_configure_local_loop(scsi_qla_host_t *ha)
1698 domain = ((struct gid_list_info *)id_iter)->domain; 1719 domain = ((struct gid_list_info *)id_iter)->domain;
1699 area = ((struct gid_list_info *)id_iter)->area; 1720 area = ((struct gid_list_info *)id_iter)->area;
1700 al_pa = ((struct gid_list_info *)id_iter)->al_pa; 1721 al_pa = ((struct gid_list_info *)id_iter)->al_pa;
1701 if (IS_QLA2100(ha) || IS_QLA2200(ha)) { 1722 if (IS_QLA2100(ha) || IS_QLA2200(ha))
1702 loop_id = (uint16_t) 1723 loop_id = (uint16_t)
1703 ((struct gid_list_info *)id_iter)->loop_id_2100; 1724 ((struct gid_list_info *)id_iter)->loop_id_2100;
1704 id_iter += 4; 1725 else
1705 } else {
1706 loop_id = le16_to_cpu( 1726 loop_id = le16_to_cpu(
1707 ((struct gid_list_info *)id_iter)->loop_id); 1727 ((struct gid_list_info *)id_iter)->loop_id);
1708 id_iter += 6; 1728 id_iter += ha->gid_list_info_size;
1709 }
1710 1729
1711 /* Bypass reserved domain fields. */ 1730 /* Bypass reserved domain fields. */
1712 if ((domain & 0xf0) == 0xf0) 1731 if ((domain & 0xf0) == 0xf0)
@@ -1937,8 +1956,8 @@ qla2x00_configure_fabric(scsi_qla_host_t *ha)
1937 } 1956 }
1938 do { 1957 do {
1939 /* Ensure we are logged into the SNS. */ 1958 /* Ensure we are logged into the SNS. */
1940 qla2x00_login_fabric(ha, SIMPLE_NAME_SERVER, 0xff, 0xff, 0xfc, 1959 ha->isp_ops.fabric_login(ha, SIMPLE_NAME_SERVER, 0xff, 0xff,
1941 mb, BIT_1 | BIT_0); 1960 0xfc, mb, BIT_1 | BIT_0);
1942 if (mb[0] != MBS_COMMAND_COMPLETE) { 1961 if (mb[0] != MBS_COMMAND_COMPLETE) {
1943 DEBUG2(qla_printk(KERN_INFO, ha, 1962 DEBUG2(qla_printk(KERN_INFO, ha,
1944 "Failed SNS login: loop_id=%x mb[0]=%x mb[1]=%x " 1963 "Failed SNS login: loop_id=%x mb[0]=%x mb[1]=%x "
@@ -1992,7 +2011,7 @@ qla2x00_configure_fabric(scsi_qla_host_t *ha)
1992 fcport->port_type != FCT_INITIATOR && 2011 fcport->port_type != FCT_INITIATOR &&
1993 fcport->port_type != FCT_BROADCAST) { 2012 fcport->port_type != FCT_BROADCAST) {
1994 2013
1995 qla2x00_fabric_logout(ha, 2014 ha->isp_ops.fabric_logout(ha,
1996 fcport->loop_id); 2015 fcport->loop_id);
1997 fcport->loop_id = FC_NO_LOOP_ID; 2016 fcport->loop_id = FC_NO_LOOP_ID;
1998 } 2017 }
@@ -2238,7 +2257,7 @@ qla2x00_find_all_fabric_devs(scsi_qla_host_t *ha, struct list_head *new_fcports)
2238 (fcport->flags & FCF_TAPE_PRESENT) == 0 && 2257 (fcport->flags & FCF_TAPE_PRESENT) == 0 &&
2239 fcport->port_type != FCT_INITIATOR && 2258 fcport->port_type != FCT_INITIATOR &&
2240 fcport->port_type != FCT_BROADCAST) { 2259 fcport->port_type != FCT_BROADCAST) {
2241 qla2x00_fabric_logout(ha, fcport->loop_id); 2260 ha->isp_ops.fabric_logout(ha, fcport->loop_id);
2242 fcport->loop_id = FC_NO_LOOP_ID; 2261 fcport->loop_id = FC_NO_LOOP_ID;
2243 } 2262 }
2244 2263
@@ -2497,7 +2516,7 @@ qla2x00_fabric_dev_login(scsi_qla_host_t *ha, fc_port_t *fcport,
2497 if (rval == QLA_SUCCESS) { 2516 if (rval == QLA_SUCCESS) {
2498 rval = qla2x00_get_port_database(ha, fcport, 0); 2517 rval = qla2x00_get_port_database(ha, fcport, 0);
2499 if (rval != QLA_SUCCESS) { 2518 if (rval != QLA_SUCCESS) {
2500 qla2x00_fabric_logout(ha, fcport->loop_id); 2519 ha->isp_ops.fabric_logout(ha, fcport->loop_id);
2501 } else { 2520 } else {
2502 qla2x00_update_fcport(ha, fcport); 2521 qla2x00_update_fcport(ha, fcport);
2503 } 2522 }
@@ -2539,7 +2558,7 @@ qla2x00_fabric_login(scsi_qla_host_t *ha, fc_port_t *fcport,
2539 fcport->d_id.b.area, fcport->d_id.b.al_pa)); 2558 fcport->d_id.b.area, fcport->d_id.b.al_pa));
2540 2559
2541 /* Login fcport on switch. */ 2560 /* Login fcport on switch. */
2542 qla2x00_login_fabric(ha, fcport->loop_id, 2561 ha->isp_ops.fabric_login(ha, fcport->loop_id,
2543 fcport->d_id.b.domain, fcport->d_id.b.area, 2562 fcport->d_id.b.domain, fcport->d_id.b.area,
2544 fcport->d_id.b.al_pa, mb, BIT_0); 2563 fcport->d_id.b.al_pa, mb, BIT_0);
2545 if (mb[0] == MBS_PORT_ID_USED) { 2564 if (mb[0] == MBS_PORT_ID_USED) {
@@ -2602,7 +2621,7 @@ qla2x00_fabric_login(scsi_qla_host_t *ha, fc_port_t *fcport,
2602 * dead. 2621 * dead.
2603 */ 2622 */
2604 *next_loopid = fcport->loop_id; 2623 *next_loopid = fcport->loop_id;
2605 qla2x00_fabric_logout(ha, fcport->loop_id); 2624 ha->isp_ops.fabric_logout(ha, fcport->loop_id);
2606 qla2x00_mark_device_lost(ha, fcport, 1); 2625 qla2x00_mark_device_lost(ha, fcport, 1);
2607 2626
2608 rval = 1; 2627 rval = 1;
@@ -2618,7 +2637,7 @@ qla2x00_fabric_login(scsi_qla_host_t *ha, fc_port_t *fcport,
2618 fcport->d_id.b.al_pa, fcport->loop_id, jiffies)); 2637 fcport->d_id.b.al_pa, fcport->loop_id, jiffies));
2619 2638
2620 *next_loopid = fcport->loop_id; 2639 *next_loopid = fcport->loop_id;
2621 qla2x00_fabric_logout(ha, fcport->loop_id); 2640 ha->isp_ops.fabric_logout(ha, fcport->loop_id);
2622 fcport->loop_id = FC_NO_LOOP_ID; 2641 fcport->loop_id = FC_NO_LOOP_ID;
2623 atomic_set(&fcport->state, FCS_DEVICE_DEAD); 2642 atomic_set(&fcport->state, FCS_DEVICE_DEAD);
2624 2643
@@ -2763,7 +2782,7 @@ qla2x00_abort_isp(scsi_qla_host_t *ha)
2763 2782
2764 qla_printk(KERN_INFO, ha, 2783 qla_printk(KERN_INFO, ha,
2765 "Performing ISP error recovery - ha= %p.\n", ha); 2784 "Performing ISP error recovery - ha= %p.\n", ha);
2766 qla2x00_reset_chip(ha); 2785 ha->isp_ops.reset_chip(ha);
2767 2786
2768 atomic_set(&ha->loop_down_timer, LOOP_DOWN_TIME); 2787 atomic_set(&ha->loop_down_timer, LOOP_DOWN_TIME);
2769 if (atomic_read(&ha->loop_state) != LOOP_DOWN) { 2788 if (atomic_read(&ha->loop_state) != LOOP_DOWN) {
@@ -2789,7 +2808,7 @@ qla2x00_abort_isp(scsi_qla_host_t *ha)
2789 } 2808 }
2790 spin_unlock_irqrestore(&ha->hardware_lock, flags); 2809 spin_unlock_irqrestore(&ha->hardware_lock, flags);
2791 2810
2792 qla2x00_nvram_config(ha); 2811 ha->isp_ops.nvram_config(ha);
2793 2812
2794 if (!qla2x00_restart_isp(ha)) { 2813 if (!qla2x00_restart_isp(ha)) {
2795 clear_bit(RESET_MARKER_NEEDED, &ha->dpc_flags); 2814 clear_bit(RESET_MARKER_NEEDED, &ha->dpc_flags);
@@ -2804,8 +2823,7 @@ qla2x00_abort_isp(scsi_qla_host_t *ha)
2804 2823
2805 ha->flags.online = 1; 2824 ha->flags.online = 1;
2806 2825
2807 /* Enable ISP interrupts. */ 2826 ha->isp_ops.enable_intrs(ha);
2808 qla2x00_enable_intrs(ha);
2809 2827
2810 ha->isp_abort_cnt = 0; 2828 ha->isp_abort_cnt = 0;
2811 clear_bit(ISP_ABORT_RETRY, &ha->dpc_flags); 2829 clear_bit(ISP_ABORT_RETRY, &ha->dpc_flags);
@@ -2820,7 +2838,7 @@ qla2x00_abort_isp(scsi_qla_host_t *ha)
2820 * The next call disables the board 2838 * The next call disables the board
2821 * completely. 2839 * completely.
2822 */ 2840 */
2823 qla2x00_reset_adapter(ha); 2841 ha->isp_ops.reset_adapter(ha);
2824 ha->flags.online = 0; 2842 ha->flags.online = 0;
2825 clear_bit(ISP_ABORT_RETRY, 2843 clear_bit(ISP_ABORT_RETRY,
2826 &ha->dpc_flags); 2844 &ha->dpc_flags);
@@ -2877,7 +2895,7 @@ qla2x00_restart_isp(scsi_qla_host_t *ha)
2877 /* If firmware needs to be loaded */ 2895 /* If firmware needs to be loaded */
2878 if (qla2x00_isp_firmware(ha)) { 2896 if (qla2x00_isp_firmware(ha)) {
2879 ha->flags.online = 0; 2897 ha->flags.online = 0;
2880 if (!(status = qla2x00_chip_diag(ha))) { 2898 if (!(status = ha->isp_ops.chip_diag(ha))) {
2881 if (IS_QLA2100(ha) || IS_QLA2200(ha)) { 2899 if (IS_QLA2100(ha) || IS_QLA2200(ha)) {
2882 status = qla2x00_setup_chip(ha); 2900 status = qla2x00_setup_chip(ha);
2883 goto done; 2901 goto done;
@@ -2951,14 +2969,14 @@ qla2x00_restart_isp(scsi_qla_host_t *ha)
2951* Input: 2969* Input:
2952* ha = adapter block pointer. 2970* ha = adapter block pointer.
2953*/ 2971*/
2954static void 2972void
2955qla2x00_reset_adapter(scsi_qla_host_t *ha) 2973qla2x00_reset_adapter(scsi_qla_host_t *ha)
2956{ 2974{
2957 unsigned long flags = 0; 2975 unsigned long flags = 0;
2958 device_reg_t __iomem *reg = ha->iobase; 2976 device_reg_t __iomem *reg = ha->iobase;
2959 2977
2960 ha->flags.online = 0; 2978 ha->flags.online = 0;
2961 qla2x00_disable_intrs(ha); 2979 ha->isp_ops.disable_intrs(ha);
2962 2980
2963 /* Reset RISC processor. */ 2981 /* Reset RISC processor. */
2964 spin_lock_irqsave(&ha->hardware_lock, flags); 2982 spin_lock_irqsave(&ha->hardware_lock, flags);