diff options
author | David Woodhouse <dwmw2@shinybook.infradead.org> | 2005-07-27 09:14:13 -0400 |
---|---|---|
committer | David Woodhouse <dwmw2@shinybook.infradead.org> | 2005-07-27 09:14:13 -0400 |
commit | c5fbc3966f48279dbebfde10248c977014aa9988 (patch) | |
tree | 0a52f645d89f91952c26b215f460a4ba195ca42c /drivers/scsi/qla2xxx/qla_os.c | |
parent | 39299d9d15c41cbdd7c7009967cd35afaf34d8fa (diff) | |
parent | 9e566d8bd61f939b7f5d7d969f5b178571471cf9 (diff) |
Merge with master.kernel.org:/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 | 621 |
1 files changed, 455 insertions, 166 deletions
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index 0b12498b7672..9000659bfbcf 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * QLOGIC LINUX SOFTWARE | 2 | * QLOGIC LINUX SOFTWARE |
3 | * | 3 | * |
4 | * QLogic ISP2x00 device driver for Linux 2.6.x | 4 | * QLogic ISP2x00 device driver for Linux 2.6.x |
5 | * Copyright (C) 2003-2004 QLogic Corporation | 5 | * Copyright (C) 2003-2005 QLogic Corporation |
6 | * (www.qlogic.com) | 6 | * (www.qlogic.com) |
7 | * | 7 | * |
8 | * This program is free software; you can redistribute it and/or modify it | 8 | * This program is free software; you can redistribute it and/or modify it |
@@ -64,7 +64,7 @@ MODULE_PARM_DESC(ql2xplogiabsentdevice, | |||
64 | int ql2xenablezio = 0; | 64 | int ql2xenablezio = 0; |
65 | module_param(ql2xenablezio, int, S_IRUGO|S_IRUSR); | 65 | module_param(ql2xenablezio, int, S_IRUGO|S_IRUSR); |
66 | MODULE_PARM_DESC(ql2xenablezio, | 66 | MODULE_PARM_DESC(ql2xenablezio, |
67 | "Option to enable ZIO:If 1 then enable it otherwise" | 67 | "Option to enable ZIO:If 1 then enable it otherwise" |
68 | " use the default set in the NVRAM." | 68 | " use the default set in the NVRAM." |
69 | " Default is 0 : disabled"); | 69 | " Default is 0 : disabled"); |
70 | 70 | ||
@@ -79,18 +79,25 @@ module_param(ql2xloginretrycount, int, S_IRUGO|S_IRUSR); | |||
79 | MODULE_PARM_DESC(ql2xloginretrycount, | 79 | MODULE_PARM_DESC(ql2xloginretrycount, |
80 | "Specify an alternate value for the NVRAM login retry count."); | 80 | "Specify an alternate value for the NVRAM login retry count."); |
81 | 81 | ||
82 | int ql2xfwloadbin; | ||
83 | module_param(ql2xfwloadbin, int, S_IRUGO|S_IRUSR); | ||
84 | MODULE_PARM_DESC(ql2xfwloadbin, | ||
85 | "Load ISP2xxx firmware image via hotplug."); | ||
86 | |||
82 | static void qla2x00_free_device(scsi_qla_host_t *); | 87 | static void qla2x00_free_device(scsi_qla_host_t *); |
83 | 88 | ||
84 | static void qla2x00_config_dma_addressing(scsi_qla_host_t *ha); | 89 | static void qla2x00_config_dma_addressing(scsi_qla_host_t *ha); |
85 | 90 | ||
86 | /* | 91 | /* |
87 | * SCSI host template entry points | 92 | * SCSI host template entry points |
88 | */ | 93 | */ |
89 | static int qla2xxx_slave_configure(struct scsi_device * device); | 94 | static int qla2xxx_slave_configure(struct scsi_device * device); |
90 | static int qla2xxx_slave_alloc(struct scsi_device *); | 95 | static int qla2xxx_slave_alloc(struct scsi_device *); |
91 | static void qla2xxx_slave_destroy(struct scsi_device *); | 96 | static void qla2xxx_slave_destroy(struct scsi_device *); |
92 | static int qla2x00_queuecommand(struct scsi_cmnd *cmd, | 97 | static int qla2x00_queuecommand(struct scsi_cmnd *cmd, |
93 | void (*fn)(struct scsi_cmnd *)); | 98 | void (*fn)(struct scsi_cmnd *)); |
99 | static int qla24xx_queuecommand(struct scsi_cmnd *cmd, | ||
100 | void (*fn)(struct scsi_cmnd *)); | ||
94 | static int qla2xxx_eh_abort(struct scsi_cmnd *); | 101 | static int qla2xxx_eh_abort(struct scsi_cmnd *); |
95 | static int qla2xxx_eh_device_reset(struct scsi_cmnd *); | 102 | static int qla2xxx_eh_device_reset(struct scsi_cmnd *); |
96 | static int qla2xxx_eh_bus_reset(struct scsi_cmnd *); | 103 | static int qla2xxx_eh_bus_reset(struct scsi_cmnd *); |
@@ -124,6 +131,28 @@ static struct scsi_host_template qla2x00_driver_template = { | |||
124 | .max_sectors = 0xFFFF, | 131 | .max_sectors = 0xFFFF, |
125 | }; | 132 | }; |
126 | 133 | ||
134 | static struct scsi_host_template qla24xx_driver_template = { | ||
135 | .module = THIS_MODULE, | ||
136 | .name = "qla2xxx", | ||
137 | .queuecommand = qla24xx_queuecommand, | ||
138 | |||
139 | .eh_abort_handler = qla2xxx_eh_abort, | ||
140 | .eh_device_reset_handler = qla2xxx_eh_device_reset, | ||
141 | .eh_bus_reset_handler = qla2xxx_eh_bus_reset, | ||
142 | .eh_host_reset_handler = qla2xxx_eh_host_reset, | ||
143 | |||
144 | .slave_configure = qla2xxx_slave_configure, | ||
145 | |||
146 | .slave_alloc = qla2xxx_slave_alloc, | ||
147 | .slave_destroy = qla2xxx_slave_destroy, | ||
148 | .this_id = -1, | ||
149 | .cmd_per_lun = 3, | ||
150 | .use_clustering = ENABLE_CLUSTERING, | ||
151 | .sg_tablesize = SG_ALL, | ||
152 | |||
153 | .max_sectors = 0xFFFF, | ||
154 | }; | ||
155 | |||
127 | static struct scsi_transport_template *qla2xxx_transport_template = NULL; | 156 | static struct scsi_transport_template *qla2xxx_transport_template = NULL; |
128 | 157 | ||
129 | /* TODO Convert to inlines | 158 | /* TODO Convert to inlines |
@@ -171,14 +200,13 @@ static uint8_t qla2x00_mem_alloc(scsi_qla_host_t *); | |||
171 | static void qla2x00_mem_free(scsi_qla_host_t *ha); | 200 | static void qla2x00_mem_free(scsi_qla_host_t *ha); |
172 | static int qla2x00_allocate_sp_pool( scsi_qla_host_t *ha); | 201 | static int qla2x00_allocate_sp_pool( scsi_qla_host_t *ha); |
173 | static void qla2x00_free_sp_pool(scsi_qla_host_t *ha); | 202 | static void qla2x00_free_sp_pool(scsi_qla_host_t *ha); |
174 | static srb_t *qla2x00_get_new_sp(scsi_qla_host_t *); | ||
175 | static void qla2x00_sp_free_dma(scsi_qla_host_t *, srb_t *); | 203 | static void qla2x00_sp_free_dma(scsi_qla_host_t *, srb_t *); |
176 | void qla2x00_sp_compl(scsi_qla_host_t *ha, srb_t *); | 204 | void qla2x00_sp_compl(scsi_qla_host_t *ha, srb_t *); |
177 | 205 | ||
178 | /* -------------------------------------------------------------------------- */ | 206 | /* -------------------------------------------------------------------------- */ |
179 | 207 | ||
180 | static char * | 208 | static char * |
181 | qla2x00_get_pci_info_str(struct scsi_qla_host *ha, char *str) | 209 | qla2x00_pci_info_str(struct scsi_qla_host *ha, char *str) |
182 | { | 210 | { |
183 | static char *pci_bus_modes[] = { | 211 | static char *pci_bus_modes[] = { |
184 | "33", "66", "100", "133", | 212 | "33", "66", "100", "133", |
@@ -200,11 +228,59 @@ qla2x00_get_pci_info_str(struct scsi_qla_host *ha, char *str) | |||
200 | return (str); | 228 | return (str); |
201 | } | 229 | } |
202 | 230 | ||
231 | static char * | ||
232 | qla24xx_pci_info_str(struct scsi_qla_host *ha, char *str) | ||
233 | { | ||
234 | static char *pci_bus_modes[] = { "33", "66", "100", "133", }; | ||
235 | uint32_t pci_bus; | ||
236 | int pcie_reg; | ||
237 | |||
238 | pcie_reg = pci_find_capability(ha->pdev, PCI_CAP_ID_EXP); | ||
239 | if (pcie_reg) { | ||
240 | char lwstr[6]; | ||
241 | uint16_t pcie_lstat, lspeed, lwidth; | ||
242 | |||
243 | pcie_reg += 0x12; | ||
244 | pci_read_config_word(ha->pdev, pcie_reg, &pcie_lstat); | ||
245 | lspeed = pcie_lstat & (BIT_0 | BIT_1 | BIT_2 | BIT_3); | ||
246 | lwidth = (pcie_lstat & | ||
247 | (BIT_4 | BIT_5 | BIT_6 | BIT_7 | BIT_8 | BIT_9)) >> 4; | ||
248 | |||
249 | strcpy(str, "PCIe ("); | ||
250 | if (lspeed == 1) | ||
251 | strcat(str, "2.5Gb/s "); | ||
252 | else | ||
253 | strcat(str, "<unknown> "); | ||
254 | snprintf(lwstr, sizeof(lwstr), "x%d)", lwidth); | ||
255 | strcat(str, lwstr); | ||
256 | |||
257 | return str; | ||
258 | } | ||
259 | |||
260 | strcpy(str, "PCI"); | ||
261 | pci_bus = (ha->pci_attr & CSRX_PCIX_BUS_MODE_MASK) >> 8; | ||
262 | if (pci_bus == 0 || pci_bus == 8) { | ||
263 | strcat(str, " ("); | ||
264 | strcat(str, pci_bus_modes[pci_bus >> 3]); | ||
265 | } else { | ||
266 | strcat(str, "-X "); | ||
267 | if (pci_bus & BIT_2) | ||
268 | strcat(str, "Mode 2"); | ||
269 | else | ||
270 | strcat(str, "Mode 1"); | ||
271 | strcat(str, " ("); | ||
272 | strcat(str, pci_bus_modes[pci_bus & ~BIT_2]); | ||
273 | } | ||
274 | strcat(str, " MHz)"); | ||
275 | |||
276 | return str; | ||
277 | } | ||
278 | |||
203 | char * | 279 | char * |
204 | qla2x00_get_fw_version_str(struct scsi_qla_host *ha, char *str) | 280 | qla2x00_fw_version_str(struct scsi_qla_host *ha, char *str) |
205 | { | 281 | { |
206 | char un_str[10]; | 282 | char un_str[10]; |
207 | 283 | ||
208 | sprintf(str, "%d.%02d.%02d ", ha->fw_major_version, | 284 | sprintf(str, "%d.%02d.%02d ", ha->fw_major_version, |
209 | ha->fw_minor_version, | 285 | ha->fw_minor_version, |
210 | ha->fw_subminor_version); | 286 | ha->fw_subminor_version); |
@@ -238,25 +314,45 @@ qla2x00_get_fw_version_str(struct scsi_qla_host *ha, char *str) | |||
238 | return (str); | 314 | return (str); |
239 | } | 315 | } |
240 | 316 | ||
241 | /************************************************************************** | 317 | char * |
242 | * qla2x00_queuecommand | 318 | qla24xx_fw_version_str(struct scsi_qla_host *ha, char *str) |
243 | * | 319 | { |
244 | * Description: | 320 | sprintf(str, "%d.%02d.%02d ", ha->fw_major_version, |
245 | * Queue a command to the controller. | 321 | ha->fw_minor_version, |
246 | * | 322 | ha->fw_subminor_version); |
247 | * Input: | 323 | |
248 | * cmd - pointer to Scsi cmd structure | 324 | if (ha->fw_attributes & BIT_0) |
249 | * fn - pointer to Scsi done function | 325 | strcat(str, "[Class 2] "); |
250 | * | 326 | if (ha->fw_attributes & BIT_1) |
251 | * Returns: | 327 | strcat(str, "[IP] "); |
252 | * 0 - Always | 328 | if (ha->fw_attributes & BIT_2) |
253 | * | 329 | strcat(str, "[Multi-ID] "); |
254 | * Note: | 330 | if (ha->fw_attributes & BIT_13) |
255 | * The mid-level driver tries to ensures that queuecommand never gets invoked | 331 | strcat(str, "[Experimental]"); |
256 | * concurrently with itself or the interrupt handler (although the | 332 | return str; |
257 | * interrupt handler may call this routine as part of request-completion | 333 | } |
258 | * handling). | 334 | |
259 | **************************************************************************/ | 335 | static inline srb_t * |
336 | qla2x00_get_new_sp(scsi_qla_host_t *ha, fc_port_t *fcport, | ||
337 | struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) | ||
338 | { | ||
339 | srb_t *sp; | ||
340 | |||
341 | sp = mempool_alloc(ha->srb_mempool, GFP_ATOMIC); | ||
342 | if (!sp) | ||
343 | return sp; | ||
344 | |||
345 | atomic_set(&sp->ref_count, 1); | ||
346 | sp->ha = ha; | ||
347 | sp->fcport = fcport; | ||
348 | sp->cmd = cmd; | ||
349 | sp->flags = 0; | ||
350 | CMD_SP(cmd) = (void *)sp; | ||
351 | cmd->scsi_done = done; | ||
352 | |||
353 | return sp; | ||
354 | } | ||
355 | |||
260 | static int | 356 | static int |
261 | qla2x00_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) | 357 | qla2x00_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) |
262 | { | 358 | { |
@@ -281,18 +377,9 @@ qla2x00_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) | |||
281 | 377 | ||
282 | spin_unlock_irq(ha->host->host_lock); | 378 | spin_unlock_irq(ha->host->host_lock); |
283 | 379 | ||
284 | /* Allocate a command packet from the "sp" pool. */ | 380 | sp = qla2x00_get_new_sp(ha, fcport, cmd, done); |
285 | if ((sp = qla2x00_get_new_sp(ha)) == NULL) { | 381 | if (!sp) |
286 | goto qc_host_busy_lock; | 382 | goto qc_host_busy_lock; |
287 | } | ||
288 | |||
289 | sp->ha = ha; | ||
290 | sp->fcport = fcport; | ||
291 | sp->cmd = cmd; | ||
292 | sp->flags = 0; | ||
293 | |||
294 | CMD_SP(cmd) = (void *)sp; | ||
295 | cmd->scsi_done = done; | ||
296 | 383 | ||
297 | rval = qla2x00_start_scsi(sp); | 384 | rval = qla2x00_start_scsi(sp); |
298 | if (rval != QLA_SUCCESS) | 385 | if (rval != QLA_SUCCESS) |
@@ -314,7 +401,6 @@ qla2x00_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) | |||
314 | 401 | ||
315 | qc_host_busy_free_sp: | 402 | qc_host_busy_free_sp: |
316 | qla2x00_sp_free_dma(ha, sp); | 403 | qla2x00_sp_free_dma(ha, sp); |
317 | CMD_SP(cmd) = NULL; | ||
318 | mempool_free(sp, ha->srb_mempool); | 404 | mempool_free(sp, ha->srb_mempool); |
319 | 405 | ||
320 | qc_host_busy_lock: | 406 | qc_host_busy_lock: |
@@ -329,6 +415,60 @@ qc_fail_command: | |||
329 | return 0; | 415 | return 0; |
330 | } | 416 | } |
331 | 417 | ||
418 | |||
419 | static int | ||
420 | qla24xx_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) | ||
421 | { | ||
422 | scsi_qla_host_t *ha = to_qla_host(cmd->device->host); | ||
423 | fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata; | ||
424 | srb_t *sp; | ||
425 | int rval; | ||
426 | |||
427 | if (!fcport) { | ||
428 | cmd->result = DID_NO_CONNECT << 16; | ||
429 | goto qc24_fail_command; | ||
430 | } | ||
431 | |||
432 | if (atomic_read(&fcport->state) != FCS_ONLINE) { | ||
433 | if (atomic_read(&fcport->state) == FCS_DEVICE_DEAD || | ||
434 | atomic_read(&ha->loop_state) == LOOP_DEAD) { | ||
435 | cmd->result = DID_NO_CONNECT << 16; | ||
436 | goto qc24_fail_command; | ||
437 | } | ||
438 | goto qc24_host_busy; | ||
439 | } | ||
440 | |||
441 | spin_unlock_irq(ha->host->host_lock); | ||
442 | |||
443 | sp = qla2x00_get_new_sp(ha, fcport, cmd, done); | ||
444 | if (!sp) | ||
445 | goto qc24_host_busy_lock; | ||
446 | |||
447 | rval = qla24xx_start_scsi(sp); | ||
448 | if (rval != QLA_SUCCESS) | ||
449 | goto qc24_host_busy_free_sp; | ||
450 | |||
451 | spin_lock_irq(ha->host->host_lock); | ||
452 | |||
453 | return 0; | ||
454 | |||
455 | qc24_host_busy_free_sp: | ||
456 | qla2x00_sp_free_dma(ha, sp); | ||
457 | mempool_free(sp, ha->srb_mempool); | ||
458 | |||
459 | qc24_host_busy_lock: | ||
460 | spin_lock_irq(ha->host->host_lock); | ||
461 | |||
462 | qc24_host_busy: | ||
463 | return SCSI_MLQUEUE_HOST_BUSY; | ||
464 | |||
465 | qc24_fail_command: | ||
466 | done(cmd); | ||
467 | |||
468 | return 0; | ||
469 | } | ||
470 | |||
471 | |||
332 | /* | 472 | /* |
333 | * qla2x00_eh_wait_on_command | 473 | * qla2x00_eh_wait_on_command |
334 | * Waits for the command to be returned by the Firmware for some | 474 | * Waits for the command to be returned by the Firmware for some |
@@ -367,14 +507,14 @@ qla2x00_eh_wait_on_command(scsi_qla_host_t *ha, struct scsi_cmnd *cmd) | |||
367 | 507 | ||
368 | /* | 508 | /* |
369 | * qla2x00_wait_for_hba_online | 509 | * qla2x00_wait_for_hba_online |
370 | * Wait till the HBA is online after going through | 510 | * Wait till the HBA is online after going through |
371 | * <= MAX_RETRIES_OF_ISP_ABORT or | 511 | * <= MAX_RETRIES_OF_ISP_ABORT or |
372 | * finally HBA is disabled ie marked offline | 512 | * finally HBA is disabled ie marked offline |
373 | * | 513 | * |
374 | * Input: | 514 | * Input: |
375 | * ha - pointer to host adapter structure | 515 | * ha - pointer to host adapter structure |
376 | * | 516 | * |
377 | * Note: | 517 | * Note: |
378 | * Does context switching-Release SPIN_LOCK | 518 | * Does context switching-Release SPIN_LOCK |
379 | * (if any) before calling this routine. | 519 | * (if any) before calling this routine. |
380 | * | 520 | * |
@@ -382,13 +522,13 @@ qla2x00_eh_wait_on_command(scsi_qla_host_t *ha, struct scsi_cmnd *cmd) | |||
382 | * Success (Adapter is online) : 0 | 522 | * Success (Adapter is online) : 0 |
383 | * Failed (Adapter is offline/disabled) : 1 | 523 | * Failed (Adapter is offline/disabled) : 1 |
384 | */ | 524 | */ |
385 | static int | 525 | static int |
386 | qla2x00_wait_for_hba_online(scsi_qla_host_t *ha) | 526 | qla2x00_wait_for_hba_online(scsi_qla_host_t *ha) |
387 | { | 527 | { |
388 | int return_status; | 528 | int return_status; |
389 | unsigned long wait_online; | 529 | unsigned long wait_online; |
390 | 530 | ||
391 | wait_online = jiffies + (MAX_LOOP_TIMEOUT * HZ); | 531 | wait_online = jiffies + (MAX_LOOP_TIMEOUT * HZ); |
392 | while (((test_bit(ISP_ABORT_NEEDED, &ha->dpc_flags)) || | 532 | while (((test_bit(ISP_ABORT_NEEDED, &ha->dpc_flags)) || |
393 | test_bit(ABORT_ISP_ACTIVE, &ha->dpc_flags) || | 533 | test_bit(ABORT_ISP_ACTIVE, &ha->dpc_flags) || |
394 | test_bit(ISP_ABORT_RETRY, &ha->dpc_flags) || | 534 | test_bit(ISP_ABORT_RETRY, &ha->dpc_flags) || |
@@ -396,8 +536,8 @@ qla2x00_wait_for_hba_online(scsi_qla_host_t *ha) | |||
396 | 536 | ||
397 | msleep(1000); | 537 | msleep(1000); |
398 | } | 538 | } |
399 | if (ha->flags.online) | 539 | if (ha->flags.online) |
400 | return_status = QLA_SUCCESS; | 540 | return_status = QLA_SUCCESS; |
401 | else | 541 | else |
402 | return_status = QLA_FUNCTION_FAILED; | 542 | return_status = QLA_FUNCTION_FAILED; |
403 | 543 | ||
@@ -409,27 +549,27 @@ qla2x00_wait_for_hba_online(scsi_qla_host_t *ha) | |||
409 | /* | 549 | /* |
410 | * qla2x00_wait_for_loop_ready | 550 | * qla2x00_wait_for_loop_ready |
411 | * Wait for MAX_LOOP_TIMEOUT(5 min) value for loop | 551 | * Wait for MAX_LOOP_TIMEOUT(5 min) value for loop |
412 | * to be in LOOP_READY state. | 552 | * to be in LOOP_READY state. |
413 | * Input: | 553 | * Input: |
414 | * ha - pointer to host adapter structure | 554 | * ha - pointer to host adapter structure |
415 | * | 555 | * |
416 | * Note: | 556 | * Note: |
417 | * Does context switching-Release SPIN_LOCK | 557 | * Does context switching-Release SPIN_LOCK |
418 | * (if any) before calling this routine. | 558 | * (if any) before calling this routine. |
419 | * | 559 | * |
420 | * | 560 | * |
421 | * Return: | 561 | * Return: |
422 | * Success (LOOP_READY) : 0 | 562 | * Success (LOOP_READY) : 0 |
423 | * Failed (LOOP_NOT_READY) : 1 | 563 | * Failed (LOOP_NOT_READY) : 1 |
424 | */ | 564 | */ |
425 | static inline int | 565 | static inline int |
426 | qla2x00_wait_for_loop_ready(scsi_qla_host_t *ha) | 566 | qla2x00_wait_for_loop_ready(scsi_qla_host_t *ha) |
427 | { | 567 | { |
428 | int return_status = QLA_SUCCESS; | 568 | int return_status = QLA_SUCCESS; |
429 | unsigned long loop_timeout ; | 569 | unsigned long loop_timeout ; |
430 | 570 | ||
431 | /* wait for 5 min at the max for loop to be ready */ | 571 | /* wait for 5 min at the max for loop to be ready */ |
432 | loop_timeout = jiffies + (MAX_LOOP_TIMEOUT * HZ); | 572 | loop_timeout = jiffies + (MAX_LOOP_TIMEOUT * HZ); |
433 | 573 | ||
434 | while ((!atomic_read(&ha->loop_down_timer) && | 574 | while ((!atomic_read(&ha->loop_down_timer) && |
435 | atomic_read(&ha->loop_state) == LOOP_DOWN) || | 575 | atomic_read(&ha->loop_state) == LOOP_DOWN) || |
@@ -440,7 +580,7 @@ qla2x00_wait_for_loop_ready(scsi_qla_host_t *ha) | |||
440 | break; | 580 | break; |
441 | } | 581 | } |
442 | } | 582 | } |
443 | return (return_status); | 583 | return (return_status); |
444 | } | 584 | } |
445 | 585 | ||
446 | /************************************************************************** | 586 | /************************************************************************** |
@@ -493,7 +633,7 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd) | |||
493 | DEBUG3(qla2x00_print_scsi_cmd(cmd);) | 633 | DEBUG3(qla2x00_print_scsi_cmd(cmd);) |
494 | 634 | ||
495 | spin_unlock_irqrestore(&ha->hardware_lock, flags); | 635 | spin_unlock_irqrestore(&ha->hardware_lock, flags); |
496 | if (qla2x00_abort_command(ha, sp)) { | 636 | if (ha->isp_ops.abort_command(ha, sp)) { |
497 | DEBUG2(printk("%s(%ld): abort_command " | 637 | DEBUG2(printk("%s(%ld): abort_command " |
498 | "mbx failed.\n", __func__, ha->host_no)); | 638 | "mbx failed.\n", __func__, ha->host_no)); |
499 | } else { | 639 | } else { |
@@ -510,13 +650,13 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd) | |||
510 | /* Wait for the command to be returned. */ | 650 | /* Wait for the command to be returned. */ |
511 | if (ret == SUCCESS) { | 651 | if (ret == SUCCESS) { |
512 | if (qla2x00_eh_wait_on_command(ha, cmd) != QLA_SUCCESS) { | 652 | if (qla2x00_eh_wait_on_command(ha, cmd) != QLA_SUCCESS) { |
513 | qla_printk(KERN_ERR, ha, | 653 | qla_printk(KERN_ERR, ha, |
514 | "scsi(%ld:%d:%d): Abort handler timed out -- %lx " | 654 | "scsi(%ld:%d:%d): Abort handler timed out -- %lx " |
515 | "%x.\n", ha->host_no, id, lun, serial, ret); | 655 | "%x.\n", ha->host_no, id, lun, serial, ret); |
516 | } | 656 | } |
517 | } | 657 | } |
518 | 658 | ||
519 | qla_printk(KERN_INFO, ha, | 659 | qla_printk(KERN_INFO, ha, |
520 | "scsi(%ld:%d:%d): Abort command issued -- %lx %x.\n", ha->host_no, | 660 | "scsi(%ld:%d:%d): Abort command issued -- %lx %x.\n", ha->host_no, |
521 | id, lun, serial, ret); | 661 | id, lun, serial, ret); |
522 | 662 | ||
@@ -531,7 +671,7 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd) | |||
531 | * | 671 | * |
532 | * Input: | 672 | * Input: |
533 | * ha - pointer to scsi_qla_host structure. | 673 | * ha - pointer to scsi_qla_host structure. |
534 | * t - target | 674 | * t - target |
535 | * Returns: | 675 | * Returns: |
536 | * Either SUCCESS or FAILED. | 676 | * Either SUCCESS or FAILED. |
537 | * | 677 | * |
@@ -580,7 +720,7 @@ qla2x00_eh_wait_for_pending_target_commands(scsi_qla_host_t *ha, unsigned int t) | |||
580 | * executing commands. | 720 | * executing commands. |
581 | * | 721 | * |
582 | * NOTE: The use of SP is undefined within this context. Do *NOT* | 722 | * NOTE: The use of SP is undefined within this context. Do *NOT* |
583 | * attempt to use this value, even if you determine it is | 723 | * attempt to use this value, even if you determine it is |
584 | * non-null. | 724 | * non-null. |
585 | * | 725 | * |
586 | * Input: | 726 | * Input: |
@@ -624,7 +764,7 @@ qla2xxx_eh_device_reset(struct scsi_cmnd *cmd) | |||
624 | #if defined(LOGOUT_AFTER_DEVICE_RESET) | 764 | #if defined(LOGOUT_AFTER_DEVICE_RESET) |
625 | if (ret == SUCCESS) { | 765 | if (ret == SUCCESS) { |
626 | if (fcport->flags & FC_FABRIC_DEVICE) { | 766 | if (fcport->flags & FC_FABRIC_DEVICE) { |
627 | qla2x00_fabric_logout(ha, fcport->loop_id); | 767 | ha->isp_ops.fabric_logout(ha, fcport->loop_id); |
628 | qla2x00_mark_device_lost(ha, fcport); | 768 | qla2x00_mark_device_lost(ha, fcport); |
629 | } | 769 | } |
630 | } | 770 | } |
@@ -656,7 +796,7 @@ qla2xxx_eh_device_reset(struct scsi_cmnd *cmd) | |||
656 | "commands\n", __func__, ha->host_no)); | 796 | "commands\n", __func__, ha->host_no)); |
657 | qla_printk(KERN_INFO, ha, | 797 | qla_printk(KERN_INFO, ha, |
658 | "%s: failed while waiting for commands\n", | 798 | "%s: failed while waiting for commands\n", |
659 | __func__); | 799 | __func__); |
660 | 800 | ||
661 | goto eh_dev_reset_done; | 801 | goto eh_dev_reset_done; |
662 | } | 802 | } |
@@ -822,7 +962,7 @@ qla2xxx_eh_host_reset(struct scsi_cmnd *cmd) | |||
822 | 962 | ||
823 | /* | 963 | /* |
824 | * Fixme-may be dpc thread is active and processing | 964 | * Fixme-may be dpc thread is active and processing |
825 | * loop_resync,so wait a while for it to | 965 | * loop_resync,so wait a while for it to |
826 | * be completed and then issue big hammer.Otherwise | 966 | * be completed and then issue big hammer.Otherwise |
827 | * it may cause I/O failure as big hammer marks the | 967 | * it may cause I/O failure as big hammer marks the |
828 | * devices as lost kicking of the port_down_timer | 968 | * devices as lost kicking of the port_down_timer |
@@ -837,7 +977,7 @@ qla2xxx_eh_host_reset(struct scsi_cmnd *cmd) | |||
837 | 977 | ||
838 | if (qla2x00_wait_for_hba_online(ha) != QLA_SUCCESS) | 978 | if (qla2x00_wait_for_hba_online(ha) != QLA_SUCCESS) |
839 | goto eh_host_reset_lock; | 979 | goto eh_host_reset_lock; |
840 | } | 980 | } |
841 | clear_bit(ABORT_ISP_ACTIVE, &ha->dpc_flags); | 981 | clear_bit(ABORT_ISP_ACTIVE, &ha->dpc_flags); |
842 | 982 | ||
843 | /* Waiting for our command in done_queue to be returned to OS.*/ | 983 | /* Waiting for our command in done_queue to be returned to OS.*/ |
@@ -883,7 +1023,7 @@ qla2x00_loop_reset(scsi_qla_host_t *ha) | |||
883 | } | 1023 | } |
884 | 1024 | ||
885 | if (status == QLA_SUCCESS && | 1025 | if (status == QLA_SUCCESS && |
886 | ((!ha->flags.enable_target_reset && | 1026 | ((!ha->flags.enable_target_reset && |
887 | !ha->flags.enable_lip_reset) || | 1027 | !ha->flags.enable_lip_reset) || |
888 | ha->flags.enable_lip_full_login)) { | 1028 | ha->flags.enable_lip_full_login)) { |
889 | 1029 | ||
@@ -925,32 +1065,18 @@ static int | |||
925 | qla2x00_device_reset(scsi_qla_host_t *ha, fc_port_t *reset_fcport) | 1065 | qla2x00_device_reset(scsi_qla_host_t *ha, fc_port_t *reset_fcport) |
926 | { | 1066 | { |
927 | /* Abort Target command will clear Reservation */ | 1067 | /* Abort Target command will clear Reservation */ |
928 | return qla2x00_abort_target(reset_fcport); | 1068 | return ha->isp_ops.abort_target(reset_fcport); |
929 | } | 1069 | } |
930 | 1070 | ||
931 | static int | 1071 | static int |
932 | qla2xxx_slave_alloc(struct scsi_device *sdev) | 1072 | qla2xxx_slave_alloc(struct scsi_device *sdev) |
933 | { | 1073 | { |
934 | scsi_qla_host_t *ha = to_qla_host(sdev->host); | ||
935 | struct fc_rport *rport = starget_to_rport(scsi_target(sdev)); | 1074 | struct fc_rport *rport = starget_to_rport(scsi_target(sdev)); |
936 | fc_port_t *fcport; | ||
937 | int found; | ||
938 | 1075 | ||
939 | if (!rport) | 1076 | if (!rport) |
940 | return -ENXIO; | 1077 | return -ENXIO; |
941 | 1078 | ||
942 | found = 0; | 1079 | sdev->hostdata = rport->dd_data; |
943 | list_for_each_entry(fcport, &ha->fcports, list) { | ||
944 | if (rport->port_name == | ||
945 | be64_to_cpu(*(uint64_t *)fcport->port_name)) { | ||
946 | found++; | ||
947 | break; | ||
948 | } | ||
949 | } | ||
950 | if (!found) | ||
951 | return -ENXIO; | ||
952 | |||
953 | sdev->hostdata = fcport; | ||
954 | 1080 | ||
955 | return 0; | 1081 | return 0; |
956 | } | 1082 | } |
@@ -989,8 +1115,6 @@ qla2x00_config_dma_addressing(scsi_qla_host_t *ha) | |||
989 | { | 1115 | { |
990 | /* Assume 32bit DMA address */ | 1116 | /* Assume 32bit DMA address */ |
991 | ha->flags.enable_64bit_addressing = 0; | 1117 | ha->flags.enable_64bit_addressing = 0; |
992 | ha->calc_request_entries = qla2x00_calc_iocbs_32; | ||
993 | ha->build_scsi_iocbs = qla2x00_build_scsi_iocbs_32; | ||
994 | 1118 | ||
995 | /* | 1119 | /* |
996 | * Given the two variants pci_set_dma_mask(), allow the compiler to | 1120 | * Given the two variants pci_set_dma_mask(), allow the compiler to |
@@ -999,12 +1123,12 @@ qla2x00_config_dma_addressing(scsi_qla_host_t *ha) | |||
999 | if (sizeof(dma_addr_t) > 4) { | 1123 | if (sizeof(dma_addr_t) > 4) { |
1000 | if (pci_set_dma_mask(ha->pdev, DMA_64BIT_MASK) == 0) { | 1124 | if (pci_set_dma_mask(ha->pdev, DMA_64BIT_MASK) == 0) { |
1001 | ha->flags.enable_64bit_addressing = 1; | 1125 | ha->flags.enable_64bit_addressing = 1; |
1002 | ha->calc_request_entries = qla2x00_calc_iocbs_64; | 1126 | ha->isp_ops.calc_req_entries = qla2x00_calc_iocbs_64; |
1003 | ha->build_scsi_iocbs = qla2x00_build_scsi_iocbs_64; | 1127 | ha->isp_ops.build_iocbs = qla2x00_build_scsi_iocbs_64; |
1004 | 1128 | ||
1005 | if (pci_set_consistent_dma_mask(ha->pdev, | 1129 | if (pci_set_consistent_dma_mask(ha->pdev, |
1006 | DMA_64BIT_MASK)) { | 1130 | DMA_64BIT_MASK)) { |
1007 | qla_printk(KERN_DEBUG, ha, | 1131 | qla_printk(KERN_DEBUG, ha, |
1008 | "Failed to set 64 bit PCI consistent mask; " | 1132 | "Failed to set 64 bit PCI consistent mask; " |
1009 | "using 32 bit.\n"); | 1133 | "using 32 bit.\n"); |
1010 | pci_set_consistent_dma_mask(ha->pdev, | 1134 | pci_set_consistent_dma_mask(ha->pdev, |
@@ -1087,6 +1211,61 @@ iospace_error_exit: | |||
1087 | return (-ENOMEM); | 1211 | return (-ENOMEM); |
1088 | } | 1212 | } |
1089 | 1213 | ||
1214 | static void | ||
1215 | qla2x00_enable_intrs(scsi_qla_host_t *ha) | ||
1216 | { | ||
1217 | unsigned long flags = 0; | ||
1218 | struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; | ||
1219 | |||
1220 | spin_lock_irqsave(&ha->hardware_lock, flags); | ||
1221 | ha->interrupts_on = 1; | ||
1222 | /* enable risc and host interrupts */ | ||
1223 | WRT_REG_WORD(®->ictrl, ICR_EN_INT | ICR_EN_RISC); | ||
1224 | RD_REG_WORD(®->ictrl); | ||
1225 | spin_unlock_irqrestore(&ha->hardware_lock, flags); | ||
1226 | |||
1227 | } | ||
1228 | |||
1229 | static void | ||
1230 | qla2x00_disable_intrs(scsi_qla_host_t *ha) | ||
1231 | { | ||
1232 | unsigned long flags = 0; | ||
1233 | struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; | ||
1234 | |||
1235 | spin_lock_irqsave(&ha->hardware_lock, flags); | ||
1236 | ha->interrupts_on = 0; | ||
1237 | /* disable risc and host interrupts */ | ||
1238 | WRT_REG_WORD(®->ictrl, 0); | ||
1239 | RD_REG_WORD(®->ictrl); | ||
1240 | spin_unlock_irqrestore(&ha->hardware_lock, flags); | ||
1241 | } | ||
1242 | |||
1243 | static void | ||
1244 | qla24xx_enable_intrs(scsi_qla_host_t *ha) | ||
1245 | { | ||
1246 | unsigned long flags = 0; | ||
1247 | struct device_reg_24xx __iomem *reg = &ha->iobase->isp24; | ||
1248 | |||
1249 | spin_lock_irqsave(&ha->hardware_lock, flags); | ||
1250 | ha->interrupts_on = 1; | ||
1251 | WRT_REG_DWORD(®->ictrl, ICRX_EN_RISC_INT); | ||
1252 | RD_REG_DWORD(®->ictrl); | ||
1253 | spin_unlock_irqrestore(&ha->hardware_lock, flags); | ||
1254 | } | ||
1255 | |||
1256 | static void | ||
1257 | qla24xx_disable_intrs(scsi_qla_host_t *ha) | ||
1258 | { | ||
1259 | unsigned long flags = 0; | ||
1260 | struct device_reg_24xx __iomem *reg = &ha->iobase->isp24; | ||
1261 | |||
1262 | spin_lock_irqsave(&ha->hardware_lock, flags); | ||
1263 | ha->interrupts_on = 0; | ||
1264 | WRT_REG_DWORD(®->ictrl, 0); | ||
1265 | RD_REG_DWORD(®->ictrl); | ||
1266 | spin_unlock_irqrestore(&ha->hardware_lock, flags); | ||
1267 | } | ||
1268 | |||
1090 | /* | 1269 | /* |
1091 | * PCI driver interface | 1270 | * PCI driver interface |
1092 | */ | 1271 | */ |
@@ -1105,8 +1284,8 @@ int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info) | |||
1105 | if (pci_enable_device(pdev)) | 1284 | if (pci_enable_device(pdev)) |
1106 | goto probe_out; | 1285 | goto probe_out; |
1107 | 1286 | ||
1108 | host = scsi_host_alloc(&qla2x00_driver_template, | 1287 | host = scsi_host_alloc(brd_info->sht ? brd_info->sht: |
1109 | sizeof(scsi_qla_host_t)); | 1288 | &qla2x00_driver_template, sizeof(scsi_qla_host_t)); |
1110 | if (host == NULL) { | 1289 | if (host == NULL) { |
1111 | printk(KERN_WARNING | 1290 | printk(KERN_WARNING |
1112 | "qla2xxx: Couldn't allocate host from scsi layer!\n"); | 1291 | "qla2xxx: Couldn't allocate host from scsi layer!\n"); |
@@ -1128,18 +1307,41 @@ int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info) | |||
1128 | if (ret) | 1307 | if (ret) |
1129 | goto probe_failed; | 1308 | goto probe_failed; |
1130 | 1309 | ||
1131 | /* Sanitize the information from PCI BIOS. */ | ||
1132 | host->irq = pdev->irq; | ||
1133 | |||
1134 | qla_printk(KERN_INFO, ha, | 1310 | qla_printk(KERN_INFO, ha, |
1135 | "Found an %s, irq %d, iobase 0x%p\n", ha->brd_info->isp_name, | 1311 | "Found an %s, irq %d, iobase 0x%p\n", ha->brd_info->isp_name, |
1136 | host->irq, ha->iobase); | 1312 | pdev->irq, ha->iobase); |
1137 | 1313 | ||
1138 | spin_lock_init(&ha->hardware_lock); | 1314 | spin_lock_init(&ha->hardware_lock); |
1139 | 1315 | ||
1140 | ha->prev_topology = 0; | 1316 | ha->prev_topology = 0; |
1141 | ha->ports = MAX_BUSES; | 1317 | ha->ports = MAX_BUSES; |
1142 | 1318 | ha->init_cb_size = sizeof(init_cb_t); | |
1319 | |||
1320 | /* Assign ISP specific operations. */ | ||
1321 | ha->isp_ops.pci_config = qla2100_pci_config; | ||
1322 | ha->isp_ops.reset_chip = qla2x00_reset_chip; | ||
1323 | ha->isp_ops.chip_diag = qla2x00_chip_diag; | ||
1324 | ha->isp_ops.config_rings = qla2x00_config_rings; | ||
1325 | ha->isp_ops.reset_adapter = qla2x00_reset_adapter; | ||
1326 | ha->isp_ops.nvram_config = qla2x00_nvram_config; | ||
1327 | ha->isp_ops.update_fw_options = qla2x00_update_fw_options; | ||
1328 | ha->isp_ops.load_risc = qla2x00_load_risc; | ||
1329 | ha->isp_ops.pci_info_str = qla2x00_pci_info_str; | ||
1330 | ha->isp_ops.fw_version_str = qla2x00_fw_version_str; | ||
1331 | ha->isp_ops.intr_handler = qla2100_intr_handler; | ||
1332 | ha->isp_ops.enable_intrs = qla2x00_enable_intrs; | ||
1333 | ha->isp_ops.disable_intrs = qla2x00_disable_intrs; | ||
1334 | ha->isp_ops.abort_command = qla2x00_abort_command; | ||
1335 | ha->isp_ops.abort_target = qla2x00_abort_target; | ||
1336 | ha->isp_ops.fabric_login = qla2x00_login_fabric; | ||
1337 | ha->isp_ops.fabric_logout = qla2x00_fabric_logout; | ||
1338 | ha->isp_ops.calc_req_entries = qla2x00_calc_iocbs_32; | ||
1339 | ha->isp_ops.build_iocbs = qla2x00_build_scsi_iocbs_32; | ||
1340 | ha->isp_ops.prep_ms_iocb = qla2x00_prep_ms_iocb; | ||
1341 | ha->isp_ops.read_nvram = qla2x00_read_nvram_data; | ||
1342 | ha->isp_ops.write_nvram = qla2x00_write_nvram_data; | ||
1343 | ha->isp_ops.fw_dump = qla2100_fw_dump; | ||
1344 | ha->isp_ops.ascii_fw_dump = qla2100_ascii_fw_dump; | ||
1143 | if (IS_QLA2100(ha)) { | 1345 | if (IS_QLA2100(ha)) { |
1144 | host->max_id = MAX_TARGETS_2100; | 1346 | host->max_id = MAX_TARGETS_2100; |
1145 | ha->mbx_count = MAILBOX_REGISTER_COUNT_2100; | 1347 | ha->mbx_count = MAILBOX_REGISTER_COUNT_2100; |
@@ -1147,18 +1349,57 @@ int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info) | |||
1147 | ha->response_q_length = RESPONSE_ENTRY_CNT_2100; | 1349 | ha->response_q_length = RESPONSE_ENTRY_CNT_2100; |
1148 | ha->last_loop_id = SNS_LAST_LOOP_ID_2100; | 1350 | ha->last_loop_id = SNS_LAST_LOOP_ID_2100; |
1149 | host->sg_tablesize = 32; | 1351 | host->sg_tablesize = 32; |
1352 | ha->gid_list_info_size = 4; | ||
1150 | } else if (IS_QLA2200(ha)) { | 1353 | } else if (IS_QLA2200(ha)) { |
1151 | host->max_id = MAX_TARGETS_2200; | 1354 | host->max_id = MAX_TARGETS_2200; |
1152 | ha->mbx_count = MAILBOX_REGISTER_COUNT; | 1355 | ha->mbx_count = MAILBOX_REGISTER_COUNT; |
1153 | ha->request_q_length = REQUEST_ENTRY_CNT_2200; | 1356 | ha->request_q_length = REQUEST_ENTRY_CNT_2200; |
1154 | ha->response_q_length = RESPONSE_ENTRY_CNT_2100; | 1357 | ha->response_q_length = RESPONSE_ENTRY_CNT_2100; |
1155 | ha->last_loop_id = SNS_LAST_LOOP_ID_2100; | 1358 | ha->last_loop_id = SNS_LAST_LOOP_ID_2100; |
1156 | } else /*if (IS_QLA2300(ha))*/ { | 1359 | ha->gid_list_info_size = 4; |
1360 | } else if (IS_QLA23XX(ha)) { | ||
1157 | host->max_id = MAX_TARGETS_2200; | 1361 | host->max_id = MAX_TARGETS_2200; |
1158 | ha->mbx_count = MAILBOX_REGISTER_COUNT; | 1362 | ha->mbx_count = MAILBOX_REGISTER_COUNT; |
1159 | ha->request_q_length = REQUEST_ENTRY_CNT_2200; | 1363 | ha->request_q_length = REQUEST_ENTRY_CNT_2200; |
1160 | ha->response_q_length = RESPONSE_ENTRY_CNT_2300; | 1364 | ha->response_q_length = RESPONSE_ENTRY_CNT_2300; |
1161 | ha->last_loop_id = SNS_LAST_LOOP_ID_2300; | 1365 | ha->last_loop_id = SNS_LAST_LOOP_ID_2300; |
1366 | ha->isp_ops.pci_config = qla2300_pci_config; | ||
1367 | ha->isp_ops.intr_handler = qla2300_intr_handler; | ||
1368 | ha->isp_ops.fw_dump = qla2300_fw_dump; | ||
1369 | ha->isp_ops.ascii_fw_dump = qla2300_ascii_fw_dump; | ||
1370 | ha->gid_list_info_size = 6; | ||
1371 | } else if (IS_QLA24XX(ha) || IS_QLA25XX(ha)) { | ||
1372 | host->max_id = MAX_TARGETS_2200; | ||
1373 | ha->mbx_count = MAILBOX_REGISTER_COUNT; | ||
1374 | ha->request_q_length = REQUEST_ENTRY_CNT_24XX; | ||
1375 | ha->response_q_length = RESPONSE_ENTRY_CNT_2300; | ||
1376 | ha->last_loop_id = SNS_LAST_LOOP_ID_2300; | ||
1377 | ha->init_cb_size = sizeof(struct init_cb_24xx); | ||
1378 | ha->isp_ops.pci_config = qla24xx_pci_config; | ||
1379 | ha->isp_ops.reset_chip = qla24xx_reset_chip; | ||
1380 | ha->isp_ops.chip_diag = qla24xx_chip_diag; | ||
1381 | ha->isp_ops.config_rings = qla24xx_config_rings; | ||
1382 | ha->isp_ops.reset_adapter = qla24xx_reset_adapter; | ||
1383 | ha->isp_ops.nvram_config = qla24xx_nvram_config; | ||
1384 | ha->isp_ops.update_fw_options = qla24xx_update_fw_options; | ||
1385 | ha->isp_ops.load_risc = qla24xx_load_risc_flash; | ||
1386 | if (ql2xfwloadbin) | ||
1387 | ha->isp_ops.load_risc = qla24xx_load_risc_hotplug; | ||
1388 | ha->isp_ops.pci_info_str = qla24xx_pci_info_str; | ||
1389 | ha->isp_ops.fw_version_str = qla24xx_fw_version_str; | ||
1390 | ha->isp_ops.intr_handler = qla24xx_intr_handler; | ||
1391 | ha->isp_ops.enable_intrs = qla24xx_enable_intrs; | ||
1392 | ha->isp_ops.disable_intrs = qla24xx_disable_intrs; | ||
1393 | ha->isp_ops.abort_command = qla24xx_abort_command; | ||
1394 | ha->isp_ops.abort_target = qla24xx_abort_target; | ||
1395 | ha->isp_ops.fabric_login = qla24xx_login_fabric; | ||
1396 | ha->isp_ops.fabric_logout = qla24xx_fabric_logout; | ||
1397 | ha->isp_ops.prep_ms_iocb = qla24xx_prep_ms_iocb; | ||
1398 | ha->isp_ops.read_nvram = qla24xx_read_nvram_data; | ||
1399 | ha->isp_ops.write_nvram = qla24xx_write_nvram_data; | ||
1400 | ha->isp_ops.fw_dump = qla24xx_fw_dump; | ||
1401 | ha->isp_ops.ascii_fw_dump = qla24xx_ascii_fw_dump; | ||
1402 | ha->gid_list_info_size = 8; | ||
1162 | } | 1403 | } |
1163 | host->can_queue = ha->request_q_length + 128; | 1404 | host->can_queue = ha->request_q_length + 128; |
1164 | 1405 | ||
@@ -1229,18 +1470,15 @@ int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info) | |||
1229 | host->max_lun = MAX_LUNS; | 1470 | host->max_lun = MAX_LUNS; |
1230 | host->transportt = qla2xxx_transport_template; | 1471 | host->transportt = qla2xxx_transport_template; |
1231 | 1472 | ||
1232 | if (IS_QLA2100(ha) || IS_QLA2200(ha)) | 1473 | ret = request_irq(pdev->irq, ha->isp_ops.intr_handler, |
1233 | ret = request_irq(host->irq, qla2100_intr_handler, | 1474 | SA_INTERRUPT|SA_SHIRQ, ha->brd_info->drv_name, ha); |
1234 | SA_INTERRUPT|SA_SHIRQ, ha->brd_info->drv_name, ha); | ||
1235 | else | ||
1236 | ret = request_irq(host->irq, qla2300_intr_handler, | ||
1237 | SA_INTERRUPT|SA_SHIRQ, ha->brd_info->drv_name, ha); | ||
1238 | if (ret) { | 1475 | if (ret) { |
1239 | qla_printk(KERN_WARNING, ha, | 1476 | qla_printk(KERN_WARNING, ha, |
1240 | "Failed to reserve interrupt %d already in use.\n", | 1477 | "Failed to reserve interrupt %d already in use.\n", |
1241 | host->irq); | 1478 | pdev->irq); |
1242 | goto probe_failed; | 1479 | goto probe_failed; |
1243 | } | 1480 | } |
1481 | host->irq = pdev->irq; | ||
1244 | 1482 | ||
1245 | /* Initialized the timer */ | 1483 | /* Initialized the timer */ |
1246 | qla2x00_start_timer(ha, qla2x00_timer, WATCH_INTERVAL); | 1484 | qla2x00_start_timer(ha, qla2x00_timer, WATCH_INTERVAL); |
@@ -1248,30 +1486,33 @@ int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info) | |||
1248 | DEBUG2(printk("DEBUG: detect hba %ld at address = %p\n", | 1486 | DEBUG2(printk("DEBUG: detect hba %ld at address = %p\n", |
1249 | ha->host_no, ha)); | 1487 | ha->host_no, ha)); |
1250 | 1488 | ||
1251 | reg = ha->iobase; | 1489 | ha->isp_ops.disable_intrs(ha); |
1252 | 1490 | ||
1253 | /* Disable ISP interrupts. */ | ||
1254 | qla2x00_disable_intrs(ha); | ||
1255 | |||
1256 | /* Ensure mailbox registers are free. */ | ||
1257 | spin_lock_irqsave(&ha->hardware_lock, flags); | 1491 | spin_lock_irqsave(&ha->hardware_lock, flags); |
1258 | WRT_REG_WORD(®->semaphore, 0); | 1492 | reg = ha->iobase; |
1259 | WRT_REG_WORD(®->hccr, HCCR_CLR_RISC_INT); | 1493 | if (IS_QLA24XX(ha) || IS_QLA25XX(ha)) { |
1260 | WRT_REG_WORD(®->hccr, HCCR_CLR_HOST_INT); | 1494 | WRT_REG_DWORD(®->isp24.hccr, HCCRX_CLR_HOST_INT); |
1261 | 1495 | WRT_REG_DWORD(®->isp24.hccr, HCCRX_CLR_RISC_INT); | |
1262 | /* Enable proper parity */ | 1496 | } else { |
1263 | if (!IS_QLA2100(ha) && !IS_QLA2200(ha)) { | 1497 | WRT_REG_WORD(®->isp.semaphore, 0); |
1264 | if (IS_QLA2300(ha)) | 1498 | WRT_REG_WORD(®->isp.hccr, HCCR_CLR_RISC_INT); |
1265 | /* SRAM parity */ | 1499 | WRT_REG_WORD(®->isp.hccr, HCCR_CLR_HOST_INT); |
1266 | WRT_REG_WORD(®->hccr, (HCCR_ENABLE_PARITY + 0x1)); | 1500 | |
1267 | else | 1501 | /* Enable proper parity */ |
1268 | /* SRAM, Instruction RAM and GP RAM parity */ | 1502 | if (!IS_QLA2100(ha) && !IS_QLA2200(ha)) { |
1269 | WRT_REG_WORD(®->hccr, (HCCR_ENABLE_PARITY + 0x7)); | 1503 | if (IS_QLA2300(ha)) |
1504 | /* SRAM parity */ | ||
1505 | WRT_REG_WORD(®->isp.hccr, | ||
1506 | (HCCR_ENABLE_PARITY + 0x1)); | ||
1507 | else | ||
1508 | /* SRAM, Instruction RAM and GP RAM parity */ | ||
1509 | WRT_REG_WORD(®->isp.hccr, | ||
1510 | (HCCR_ENABLE_PARITY + 0x7)); | ||
1511 | } | ||
1270 | } | 1512 | } |
1271 | spin_unlock_irqrestore(&ha->hardware_lock, flags); | 1513 | spin_unlock_irqrestore(&ha->hardware_lock, flags); |
1272 | 1514 | ||
1273 | /* Enable chip interrupts. */ | 1515 | ha->isp_ops.enable_intrs(ha); |
1274 | qla2x00_enable_intrs(ha); | ||
1275 | 1516 | ||
1276 | /* v2.19.5b6 */ | 1517 | /* v2.19.5b6 */ |
1277 | /* | 1518 | /* |
@@ -1306,9 +1547,9 @@ int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info) | |||
1306 | " QLogic %s - %s\n" | 1547 | " QLogic %s - %s\n" |
1307 | " %s: %s @ %s hdma%c, host#=%ld, fw=%s\n", qla2x00_version_str, | 1548 | " %s: %s @ %s hdma%c, host#=%ld, fw=%s\n", qla2x00_version_str, |
1308 | ha->model_number, ha->model_desc ? ha->model_desc: "", | 1549 | ha->model_number, ha->model_desc ? ha->model_desc: "", |
1309 | ha->brd_info->isp_name, qla2x00_get_pci_info_str(ha, pci_info), | 1550 | ha->brd_info->isp_name, ha->isp_ops.pci_info_str(ha, pci_info), |
1310 | pci_name(ha->pdev), ha->flags.enable_64bit_addressing ? '+': '-', | 1551 | pci_name(pdev), ha->flags.enable_64bit_addressing ? '+': '-', |
1311 | ha->host_no, qla2x00_get_fw_version_str(ha, fw_str)); | 1552 | ha->host_no, ha->isp_ops.fw_version_str(ha, fw_str)); |
1312 | 1553 | ||
1313 | /* Go with fc_rport registration. */ | 1554 | /* Go with fc_rport registration. */ |
1314 | list_for_each_entry(fcport, &ha->fcports, list) | 1555 | list_for_each_entry(fcport, &ha->fcports, list) |
@@ -1362,7 +1603,7 @@ qla2x00_free_device(scsi_qla_host_t *ha) | |||
1362 | 1603 | ||
1363 | /* turn-off interrupts on the card */ | 1604 | /* turn-off interrupts on the card */ |
1364 | if (ha->interrupts_on) | 1605 | if (ha->interrupts_on) |
1365 | qla2x00_disable_intrs(ha); | 1606 | ha->isp_ops.disable_intrs(ha); |
1366 | 1607 | ||
1367 | /* Disable timer */ | 1608 | /* Disable timer */ |
1368 | if (ha->timer_active) | 1609 | if (ha->timer_active) |
@@ -1414,7 +1655,7 @@ void qla2x00_mark_device_lost(scsi_qla_host_t *ha, fc_port_t *fcport, | |||
1414 | { | 1655 | { |
1415 | if (atomic_read(&fcport->state) == FCS_ONLINE && fcport->rport) | 1656 | if (atomic_read(&fcport->state) == FCS_ONLINE && fcport->rport) |
1416 | fc_remote_port_block(fcport->rport); | 1657 | fc_remote_port_block(fcport->rport); |
1417 | /* | 1658 | /* |
1418 | * We may need to retry the login, so don't change the state of the | 1659 | * We may need to retry the login, so don't change the state of the |
1419 | * port but do the retries. | 1660 | * port but do the retries. |
1420 | */ | 1661 | */ |
@@ -1459,7 +1700,7 @@ void qla2x00_mark_device_lost(scsi_qla_host_t *ha, fc_port_t *fcport, | |||
1459 | * Context: | 1700 | * Context: |
1460 | */ | 1701 | */ |
1461 | void | 1702 | void |
1462 | qla2x00_mark_all_devices_lost(scsi_qla_host_t *ha) | 1703 | qla2x00_mark_all_devices_lost(scsi_qla_host_t *ha) |
1463 | { | 1704 | { |
1464 | fc_port_t *fcport; | 1705 | fc_port_t *fcport; |
1465 | 1706 | ||
@@ -1576,7 +1817,7 @@ qla2x00_mem_alloc(scsi_qla_host_t *ha) | |||
1576 | 1817 | ||
1577 | continue; | 1818 | continue; |
1578 | } | 1819 | } |
1579 | memset(ha->init_cb, 0, sizeof(init_cb_t)); | 1820 | memset(ha->init_cb, 0, ha->init_cb_size); |
1580 | 1821 | ||
1581 | /* Get consistent memory allocated for Get Port Database cmd */ | 1822 | /* Get consistent memory allocated for Get Port Database cmd */ |
1582 | ha->iodesc_pd = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, | 1823 | ha->iodesc_pd = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, |
@@ -1788,10 +2029,13 @@ qla2x00_mem_free(scsi_qla_host_t *ha) | |||
1788 | if (ha->fw_dump) | 2029 | if (ha->fw_dump) |
1789 | free_pages((unsigned long)ha->fw_dump, ha->fw_dump_order); | 2030 | free_pages((unsigned long)ha->fw_dump, ha->fw_dump_order); |
1790 | 2031 | ||
1791 | if (ha->fw_dump_buffer) | 2032 | vfree(ha->fw_dump24); |
1792 | vfree(ha->fw_dump_buffer); | 2033 | |
2034 | vfree(ha->fw_dump_buffer); | ||
1793 | 2035 | ||
1794 | ha->fw_dump = NULL; | 2036 | ha->fw_dump = NULL; |
2037 | ha->fw_dump24 = NULL; | ||
2038 | ha->fw_dumped = 0; | ||
1795 | ha->fw_dump_reading = 0; | 2039 | ha->fw_dump_reading = 0; |
1796 | ha->fw_dump_buffer = NULL; | 2040 | ha->fw_dump_buffer = NULL; |
1797 | } | 2041 | } |
@@ -1806,11 +2050,11 @@ qla2x00_mem_free(scsi_qla_host_t *ha) | |||
1806 | * | 2050 | * |
1807 | * Context: | 2051 | * Context: |
1808 | * Kernel context. | 2052 | * Kernel context. |
1809 | * | 2053 | * |
1810 | * Note: Sets the ref_count for non Null sp to one. | 2054 | * Note: Sets the ref_count for non Null sp to one. |
1811 | */ | 2055 | */ |
1812 | static int | 2056 | static int |
1813 | qla2x00_allocate_sp_pool(scsi_qla_host_t *ha) | 2057 | qla2x00_allocate_sp_pool(scsi_qla_host_t *ha) |
1814 | { | 2058 | { |
1815 | int rval; | 2059 | int rval; |
1816 | 2060 | ||
@@ -1826,10 +2070,10 @@ qla2x00_allocate_sp_pool(scsi_qla_host_t *ha) | |||
1826 | 2070 | ||
1827 | /* | 2071 | /* |
1828 | * This routine frees all adapter allocated memory. | 2072 | * This routine frees all adapter allocated memory. |
1829 | * | 2073 | * |
1830 | */ | 2074 | */ |
1831 | static void | 2075 | static void |
1832 | qla2x00_free_sp_pool( scsi_qla_host_t *ha) | 2076 | qla2x00_free_sp_pool( scsi_qla_host_t *ha) |
1833 | { | 2077 | { |
1834 | if (ha->srb_mempool) { | 2078 | if (ha->srb_mempool) { |
1835 | mempool_destroy(ha->srb_mempool); | 2079 | mempool_destroy(ha->srb_mempool); |
@@ -1951,9 +2195,11 @@ qla2x00_do_dpc(void *data) | |||
1951 | if (fcport->flags & FCF_FABRIC_DEVICE) { | 2195 | if (fcport->flags & FCF_FABRIC_DEVICE) { |
1952 | if (fcport->flags & | 2196 | if (fcport->flags & |
1953 | FCF_TAPE_PRESENT) | 2197 | FCF_TAPE_PRESENT) |
1954 | qla2x00_fabric_logout( | 2198 | ha->isp_ops.fabric_logout( |
1955 | ha, | 2199 | ha, fcport->loop_id, |
1956 | fcport->loop_id); | 2200 | fcport->d_id.b.domain, |
2201 | fcport->d_id.b.area, | ||
2202 | fcport->d_id.b.al_pa); | ||
1957 | status = qla2x00_fabric_login( | 2203 | status = qla2x00_fabric_login( |
1958 | ha, fcport, &next_loopid); | 2204 | ha, fcport, &next_loopid); |
1959 | } else | 2205 | } else |
@@ -1966,7 +2212,7 @@ qla2x00_do_dpc(void *data) | |||
1966 | 2212 | ||
1967 | DEBUG(printk("scsi(%ld): port login OK: logged in ID 0x%x\n", | 2213 | DEBUG(printk("scsi(%ld): port login OK: logged in ID 0x%x\n", |
1968 | ha->host_no, fcport->loop_id)); | 2214 | ha->host_no, fcport->loop_id)); |
1969 | 2215 | ||
1970 | fcport->port_login_retry_count = | 2216 | fcport->port_login_retry_count = |
1971 | ha->port_down_retry_count * PORT_RETRY_TIME; | 2217 | ha->port_down_retry_count * PORT_RETRY_TIME; |
1972 | atomic_set(&fcport->state, FCS_ONLINE); | 2218 | atomic_set(&fcport->state, FCS_ONLINE); |
@@ -1997,7 +2243,7 @@ qla2x00_do_dpc(void *data) | |||
1997 | clear_bit(LOGIN_RETRY_NEEDED, &ha->dpc_flags); | 2243 | clear_bit(LOGIN_RETRY_NEEDED, &ha->dpc_flags); |
1998 | DEBUG(printk("scsi(%ld): qla2x00_login_retry()\n", | 2244 | DEBUG(printk("scsi(%ld): qla2x00_login_retry()\n", |
1999 | ha->host_no)); | 2245 | ha->host_no)); |
2000 | 2246 | ||
2001 | set_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags); | 2247 | set_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags); |
2002 | 2248 | ||
2003 | DEBUG(printk("scsi(%ld): qla2x00_login_retry - end\n", | 2249 | DEBUG(printk("scsi(%ld): qla2x00_login_retry - end\n", |
@@ -2034,7 +2280,7 @@ qla2x00_do_dpc(void *data) | |||
2034 | } | 2280 | } |
2035 | 2281 | ||
2036 | if (!ha->interrupts_on) | 2282 | if (!ha->interrupts_on) |
2037 | qla2x00_enable_intrs(ha); | 2283 | ha->isp_ops.enable_intrs(ha); |
2038 | 2284 | ||
2039 | ha->dpc_active = 0; | 2285 | ha->dpc_active = 0; |
2040 | } /* End of while(1) */ | 2286 | } /* End of while(1) */ |
@@ -2058,7 +2304,7 @@ qla2x00_do_dpc(void *data) | |||
2058 | * ha = adapter block pointer. | 2304 | * ha = adapter block pointer. |
2059 | */ | 2305 | */ |
2060 | static void | 2306 | static void |
2061 | qla2x00_rst_aen(scsi_qla_host_t *ha) | 2307 | qla2x00_rst_aen(scsi_qla_host_t *ha) |
2062 | { | 2308 | { |
2063 | if (ha->flags.online && !ha->flags.reset_active && | 2309 | if (ha->flags.online && !ha->flags.reset_active && |
2064 | !atomic_read(&ha->loop_down_timer) && | 2310 | !atomic_read(&ha->loop_down_timer) && |
@@ -2076,25 +2322,6 @@ qla2x00_rst_aen(scsi_qla_host_t *ha) | |||
2076 | } | 2322 | } |
2077 | } | 2323 | } |
2078 | 2324 | ||
2079 | |||
2080 | /* | ||
2081 | * This routine will allocate SP from the free queue | ||
2082 | * input: | ||
2083 | * scsi_qla_host_t * | ||
2084 | * output: | ||
2085 | * srb_t * or NULL | ||
2086 | */ | ||
2087 | static srb_t * | ||
2088 | qla2x00_get_new_sp(scsi_qla_host_t *ha) | ||
2089 | { | ||
2090 | srb_t *sp; | ||
2091 | |||
2092 | sp = mempool_alloc(ha->srb_mempool, GFP_ATOMIC); | ||
2093 | if (sp) | ||
2094 | atomic_set(&sp->ref_count, 1); | ||
2095 | return (sp); | ||
2096 | } | ||
2097 | |||
2098 | static void | 2325 | static void |
2099 | qla2x00_sp_free_dma(scsi_qla_host_t *ha, srb_t *sp) | 2326 | qla2x00_sp_free_dma(scsi_qla_host_t *ha, srb_t *sp) |
2100 | { | 2327 | { |
@@ -2110,6 +2337,7 @@ qla2x00_sp_free_dma(scsi_qla_host_t *ha, srb_t *sp) | |||
2110 | } | 2337 | } |
2111 | sp->flags &= ~SRB_DMA_VALID; | 2338 | sp->flags &= ~SRB_DMA_VALID; |
2112 | } | 2339 | } |
2340 | CMD_SP(cmd) = NULL; | ||
2113 | } | 2341 | } |
2114 | 2342 | ||
2115 | void | 2343 | void |
@@ -2119,7 +2347,6 @@ qla2x00_sp_compl(scsi_qla_host_t *ha, srb_t *sp) | |||
2119 | 2347 | ||
2120 | qla2x00_sp_free_dma(ha, sp); | 2348 | qla2x00_sp_free_dma(ha, sp); |
2121 | 2349 | ||
2122 | CMD_SP(cmd) = NULL; | ||
2123 | mempool_free(sp, ha->srb_mempool); | 2350 | mempool_free(sp, ha->srb_mempool); |
2124 | 2351 | ||
2125 | cmd->scsi_done(cmd); | 2352 | cmd->scsi_done(cmd); |
@@ -2148,7 +2375,7 @@ qla2x00_timer(scsi_qla_host_t *ha) | |||
2148 | * | 2375 | * |
2149 | * Whenever, a port is in the LOST state we start decrementing its port | 2376 | * Whenever, a port is in the LOST state we start decrementing its port |
2150 | * down timer every second until it reaches zero. Once it reaches zero | 2377 | * down timer every second until it reaches zero. Once it reaches zero |
2151 | * the port it marked DEAD. | 2378 | * the port it marked DEAD. |
2152 | */ | 2379 | */ |
2153 | t = 0; | 2380 | t = 0; |
2154 | list_for_each_entry(fcport, &ha->fcports, list) { | 2381 | list_for_each_entry(fcport, &ha->fcports, list) { |
@@ -2160,11 +2387,11 @@ qla2x00_timer(scsi_qla_host_t *ha) | |||
2160 | if (atomic_read(&fcport->port_down_timer) == 0) | 2387 | if (atomic_read(&fcport->port_down_timer) == 0) |
2161 | continue; | 2388 | continue; |
2162 | 2389 | ||
2163 | if (atomic_dec_and_test(&fcport->port_down_timer) != 0) | 2390 | if (atomic_dec_and_test(&fcport->port_down_timer) != 0) |
2164 | atomic_set(&fcport->state, FCS_DEVICE_DEAD); | 2391 | atomic_set(&fcport->state, FCS_DEVICE_DEAD); |
2165 | 2392 | ||
2166 | DEBUG(printk("scsi(%ld): fcport-%d - port retry count: " | 2393 | DEBUG(printk("scsi(%ld): fcport-%d - port retry count: " |
2167 | "%d remainning\n", | 2394 | "%d remaining\n", |
2168 | ha->host_no, | 2395 | ha->host_no, |
2169 | t, atomic_read(&fcport->port_down_timer))); | 2396 | t, atomic_read(&fcport->port_down_timer))); |
2170 | } | 2397 | } |
@@ -2184,7 +2411,7 @@ qla2x00_timer(scsi_qla_host_t *ha) | |||
2184 | ha->host_no)); | 2411 | ha->host_no)); |
2185 | 2412 | ||
2186 | if (!IS_QLA2100(ha) && ha->link_down_timeout) | 2413 | if (!IS_QLA2100(ha) && ha->link_down_timeout) |
2187 | atomic_set(&ha->loop_state, LOOP_DEAD); | 2414 | atomic_set(&ha->loop_state, LOOP_DEAD); |
2188 | 2415 | ||
2189 | /* Schedule an ISP abort to return any tape commands. */ | 2416 | /* Schedule an ISP abort to return any tape commands. */ |
2190 | spin_lock_irqsave(&ha->hardware_lock, cpu_flags); | 2417 | spin_lock_irqsave(&ha->hardware_lock, cpu_flags); |
@@ -2227,7 +2454,7 @@ qla2x00_timer(scsi_qla_host_t *ha) | |||
2227 | set_bit(ISP_ABORT_NEEDED, &ha->dpc_flags); | 2454 | set_bit(ISP_ABORT_NEEDED, &ha->dpc_flags); |
2228 | } | 2455 | } |
2229 | } | 2456 | } |
2230 | DEBUG3(printk("scsi(%ld): Loop Down - seconds remainning %d\n", | 2457 | DEBUG3(printk("scsi(%ld): Loop Down - seconds remaining %d\n", |
2231 | ha->host_no, | 2458 | ha->host_no, |
2232 | atomic_read(&ha->loop_down_timer))); | 2459 | atomic_read(&ha->loop_down_timer))); |
2233 | } | 2460 | } |
@@ -2264,12 +2491,68 @@ qla2x00_down_timeout(struct semaphore *sema, unsigned long timeout) | |||
2264 | return -ETIMEDOUT; | 2491 | return -ETIMEDOUT; |
2265 | } | 2492 | } |
2266 | 2493 | ||
2494 | static struct qla_board_info qla_board_tbl[] = { | ||
2495 | { | ||
2496 | .drv_name = "qla2400", | ||
2497 | .isp_name = "ISP2422", | ||
2498 | .fw_fname = "ql2400_fw.bin", | ||
2499 | .sht = &qla24xx_driver_template, | ||
2500 | }, | ||
2501 | { | ||
2502 | .drv_name = "qla2400", | ||
2503 | .isp_name = "ISP2432", | ||
2504 | .fw_fname = "ql2400_fw.bin", | ||
2505 | .sht = &qla24xx_driver_template, | ||
2506 | }, | ||
2507 | }; | ||
2508 | |||
2509 | static struct pci_device_id qla2xxx_pci_tbl[] = { | ||
2510 | { | ||
2511 | .vendor = PCI_VENDOR_ID_QLOGIC, | ||
2512 | .device = PCI_DEVICE_ID_QLOGIC_ISP2422, | ||
2513 | .subvendor = PCI_ANY_ID, | ||
2514 | .subdevice = PCI_ANY_ID, | ||
2515 | .driver_data = (unsigned long)&qla_board_tbl[0], | ||
2516 | }, | ||
2517 | { | ||
2518 | .vendor = PCI_VENDOR_ID_QLOGIC, | ||
2519 | .device = PCI_DEVICE_ID_QLOGIC_ISP2432, | ||
2520 | .subvendor = PCI_ANY_ID, | ||
2521 | .subdevice = PCI_ANY_ID, | ||
2522 | .driver_data = (unsigned long)&qla_board_tbl[1], | ||
2523 | }, | ||
2524 | {0, 0}, | ||
2525 | }; | ||
2526 | MODULE_DEVICE_TABLE(pci, qla2xxx_pci_tbl); | ||
2527 | |||
2528 | static int __devinit | ||
2529 | qla2xxx_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) | ||
2530 | { | ||
2531 | return qla2x00_probe_one(pdev, | ||
2532 | (struct qla_board_info *)id->driver_data); | ||
2533 | } | ||
2534 | |||
2535 | static void __devexit | ||
2536 | qla2xxx_remove_one(struct pci_dev *pdev) | ||
2537 | { | ||
2538 | qla2x00_remove_one(pdev); | ||
2539 | } | ||
2540 | |||
2541 | static struct pci_driver qla2xxx_pci_driver = { | ||
2542 | .name = "qla2xxx", | ||
2543 | .id_table = qla2xxx_pci_tbl, | ||
2544 | .probe = qla2xxx_probe_one, | ||
2545 | .remove = __devexit_p(qla2xxx_remove_one), | ||
2546 | }; | ||
2547 | |||
2267 | /** | 2548 | /** |
2268 | * qla2x00_module_init - Module initialization. | 2549 | * qla2x00_module_init - Module initialization. |
2269 | **/ | 2550 | **/ |
2270 | static int __init | 2551 | static int __init |
2271 | qla2x00_module_init(void) | 2552 | qla2x00_module_init(void) |
2272 | { | 2553 | { |
2554 | int ret = 0; | ||
2555 | |||
2273 | /* Allocate cache for SRBs. */ | 2556 | /* Allocate cache for SRBs. */ |
2274 | srb_cachep = kmem_cache_create("qla2xxx_srbs", sizeof(srb_t), 0, | 2557 | srb_cachep = kmem_cache_create("qla2xxx_srbs", sizeof(srb_t), 0, |
2275 | SLAB_HWCACHE_ALIGN, NULL, NULL); | 2558 | SLAB_HWCACHE_ALIGN, NULL, NULL); |
@@ -2290,7 +2573,12 @@ qla2x00_module_init(void) | |||
2290 | return -ENODEV; | 2573 | return -ENODEV; |
2291 | 2574 | ||
2292 | printk(KERN_INFO "QLogic Fibre Channel HBA Driver\n"); | 2575 | printk(KERN_INFO "QLogic Fibre Channel HBA Driver\n"); |
2293 | return 0; | 2576 | ret = pci_module_init(&qla2xxx_pci_driver); |
2577 | if (ret) { | ||
2578 | kmem_cache_destroy(srb_cachep); | ||
2579 | fc_release_transport(qla2xxx_transport_template); | ||
2580 | } | ||
2581 | return ret; | ||
2294 | } | 2582 | } |
2295 | 2583 | ||
2296 | /** | 2584 | /** |
@@ -2299,6 +2587,7 @@ qla2x00_module_init(void) | |||
2299 | static void __exit | 2587 | static void __exit |
2300 | qla2x00_module_exit(void) | 2588 | qla2x00_module_exit(void) |
2301 | { | 2589 | { |
2590 | pci_unregister_driver(&qla2xxx_pci_driver); | ||
2302 | kmem_cache_destroy(srb_cachep); | 2591 | kmem_cache_destroy(srb_cachep); |
2303 | fc_release_transport(qla2xxx_transport_template); | 2592 | fc_release_transport(qla2xxx_transport_template); |
2304 | } | 2593 | } |