1 /*******************************************************************
2 * This file is part of the Emulex Linux Device Driver for *
3 * Fibre Channel Host Bus Adapters. *
4 * Copyright (C) 2004-2007 Emulex. All rights reserved. *
5 * EMULEX and SLI are trademarks of Emulex. *
7 * Portions Copyright (C) 2004-2005 Christoph Hellwig *
9 * This program is free software; you can redistribute it and/or *
10 * modify it under the terms of version 2 of the GNU General *
11 * Public License as published by the Free Software Foundation. *
12 * This program is distributed in the hope that it will be useful. *
13 * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND *
14 * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, *
15 * FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT, ARE *
16 * DISCLAIMED, EXCEPT TO THE EXTENT THAT SUCH DISCLAIMERS ARE HELD *
17 * TO BE LEGALLY INVALID. See the GNU General Public License for *
18 * more details, a copy of which can be found in the file COPYING *
19 * included with this package. *
20 *******************************************************************/
22 #include <linux/blkdev.h>
23 #include <linux/delay.h>
24 #include <linux/dma-mapping.h>
25 #include <linux/idr.h>
26 #include <linux/interrupt.h>
27 #include <linux/kthread.h>
28 #include <linux/pci.h>
29 #include <linux/spinlock.h>
31 #include <scsi/scsi.h>
32 #include <scsi/scsi_device.h>
33 #include <scsi/scsi_host.h>
34 #include <scsi/scsi_transport_fc.h>
38 #include "lpfc_disc.h"
39 #include "lpfc_scsi.h"
41 #include "lpfc_logmsg.h"
42 #include "lpfc_crtn.h"
43 #include "lpfc_version.h"
45 static int lpfc_parse_vpd(struct lpfc_hba
*, uint8_t *, int);
46 static void lpfc_get_hba_model_desc(struct lpfc_hba
*, uint8_t *, uint8_t *);
47 static int lpfc_post_rcv_buf(struct lpfc_hba
*);
49 static struct scsi_transport_template
*lpfc_transport_template
= NULL
;
50 static DEFINE_IDR(lpfc_hba_index
);
52 /************************************************************************/
54 /* lpfc_config_port_prep */
55 /* This routine will do LPFC initialization prior to the */
56 /* CONFIG_PORT mailbox command. This will be initialized */
57 /* as a SLI layer callback routine. */
58 /* This routine returns 0 on success or -ERESTART if it wants */
59 /* the SLI layer to reset the HBA and try again. Any */
60 /* other return value indicates an error. */
62 /************************************************************************/
64 lpfc_config_port_prep(struct lpfc_hba
* phba
)
66 lpfc_vpd_t
*vp
= &phba
->vpd
;
70 char *lpfc_vpd_data
= NULL
;
72 static char licensed
[56] =
73 "key unlock for use with gnu public licensed code only\0";
74 static int init_key
= 1;
76 pmb
= mempool_alloc(phba
->mbox_mem_pool
, GFP_KERNEL
);
78 phba
->hba_state
= LPFC_HBA_ERROR
;
83 phba
->hba_state
= LPFC_INIT_MBX_CMDS
;
85 if (lpfc_is_LC_HBA(phba
->pcidev
->device
)) {
87 uint32_t *ptext
= (uint32_t *) licensed
;
89 for (i
= 0; i
< 56; i
+= sizeof (uint32_t), ptext
++)
90 *ptext
= cpu_to_be32(*ptext
);
94 lpfc_read_nv(phba
, pmb
);
95 memset((char*)mb
->un
.varRDnvp
.rsvd3
, 0,
96 sizeof (mb
->un
.varRDnvp
.rsvd3
));
97 memcpy((char*)mb
->un
.varRDnvp
.rsvd3
, licensed
,
100 rc
= lpfc_sli_issue_mbox(phba
, pmb
, MBX_POLL
);
102 if (rc
!= MBX_SUCCESS
) {
103 lpfc_printf_log(phba
,
106 "%d:0324 Config Port initialization "
107 "error, mbxCmd x%x READ_NVPARM, "
110 mb
->mbxCommand
, mb
->mbxStatus
);
111 mempool_free(pmb
, phba
->mbox_mem_pool
);
114 memcpy(phba
->wwnn
, (char *)mb
->un
.varRDnvp
.nodename
,
115 sizeof (mb
->un
.varRDnvp
.nodename
));
118 /* Setup and issue mailbox READ REV command */
119 lpfc_read_rev(phba
, pmb
);
120 rc
= lpfc_sli_issue_mbox(phba
, pmb
, MBX_POLL
);
121 if (rc
!= MBX_SUCCESS
) {
122 lpfc_printf_log(phba
,
125 "%d:0439 Adapter failed to init, mbxCmd x%x "
126 "READ_REV, mbxStatus x%x\n",
128 mb
->mbxCommand
, mb
->mbxStatus
);
129 mempool_free( pmb
, phba
->mbox_mem_pool
);
134 * The value of rr must be 1 since the driver set the cv field to 1.
135 * This setting requires the FW to set all revision fields.
137 if (mb
->un
.varRdRev
.rr
== 0) {
139 lpfc_printf_log(phba
, KERN_ERR
, LOG_INIT
,
140 "%d:0440 Adapter failed to init, READ_REV has "
141 "missing revision information.\n",
143 mempool_free(pmb
, phba
->mbox_mem_pool
);
147 /* Save information as VPD data */
149 vp
->rev
.sli1FwRev
= mb
->un
.varRdRev
.sli1FwRev
;
150 memcpy(vp
->rev
.sli1FwName
, (char*) mb
->un
.varRdRev
.sli1FwName
, 16);
151 vp
->rev
.sli2FwRev
= mb
->un
.varRdRev
.sli2FwRev
;
152 memcpy(vp
->rev
.sli2FwName
, (char *) mb
->un
.varRdRev
.sli2FwName
, 16);
153 vp
->rev
.biuRev
= mb
->un
.varRdRev
.biuRev
;
154 vp
->rev
.smRev
= mb
->un
.varRdRev
.smRev
;
155 vp
->rev
.smFwRev
= mb
->un
.varRdRev
.un
.smFwRev
;
156 vp
->rev
.endecRev
= mb
->un
.varRdRev
.endecRev
;
157 vp
->rev
.fcphHigh
= mb
->un
.varRdRev
.fcphHigh
;
158 vp
->rev
.fcphLow
= mb
->un
.varRdRev
.fcphLow
;
159 vp
->rev
.feaLevelHigh
= mb
->un
.varRdRev
.feaLevelHigh
;
160 vp
->rev
.feaLevelLow
= mb
->un
.varRdRev
.feaLevelLow
;
161 vp
->rev
.postKernRev
= mb
->un
.varRdRev
.postKernRev
;
162 vp
->rev
.opFwRev
= mb
->un
.varRdRev
.opFwRev
;
164 if (lpfc_is_LC_HBA(phba
->pcidev
->device
))
165 memcpy(phba
->RandomData
, (char *)&mb
->un
.varWords
[24],
166 sizeof (phba
->RandomData
));
168 /* Get adapter VPD information */
169 pmb
->context2
= kmalloc(DMP_RSP_SIZE
, GFP_KERNEL
);
172 lpfc_vpd_data
= kmalloc(DMP_VPD_SIZE
, GFP_KERNEL
);
174 goto out_free_context2
;
177 lpfc_dump_mem(phba
, pmb
, offset
);
178 rc
= lpfc_sli_issue_mbox(phba
, pmb
, MBX_POLL
);
180 if (rc
!= MBX_SUCCESS
) {
181 lpfc_printf_log(phba
, KERN_INFO
, LOG_INIT
,
182 "%d:0441 VPD not present on adapter, "
183 "mbxCmd x%x DUMP VPD, mbxStatus x%x\n",
185 mb
->mbxCommand
, mb
->mbxStatus
);
186 mb
->un
.varDmp
.word_cnt
= 0;
188 if (mb
->un
.varDmp
.word_cnt
> DMP_VPD_SIZE
- offset
)
189 mb
->un
.varDmp
.word_cnt
= DMP_VPD_SIZE
- offset
;
190 lpfc_sli_pcimem_bcopy(pmb
->context2
, lpfc_vpd_data
+ offset
,
191 mb
->un
.varDmp
.word_cnt
);
192 offset
+= mb
->un
.varDmp
.word_cnt
;
193 } while (mb
->un
.varDmp
.word_cnt
&& offset
< DMP_VPD_SIZE
);
194 lpfc_parse_vpd(phba
, lpfc_vpd_data
, offset
);
196 kfree(lpfc_vpd_data
);
198 kfree(pmb
->context2
);
200 mempool_free(pmb
, phba
->mbox_mem_pool
);
204 /************************************************************************/
206 /* lpfc_config_port_post */
207 /* This routine will do LPFC initialization after the */
208 /* CONFIG_PORT mailbox command. This will be initialized */
209 /* as a SLI layer callback routine. */
210 /* This routine returns 0 on success. Any other return value */
211 /* indicates an error. */
213 /************************************************************************/
215 lpfc_config_port_post(struct lpfc_hba
* phba
)
219 struct lpfc_dmabuf
*mp
;
220 struct lpfc_sli
*psli
= &phba
->sli
;
221 uint32_t status
, timeout
;
224 pmb
= mempool_alloc(phba
->mbox_mem_pool
, GFP_KERNEL
);
226 phba
->hba_state
= LPFC_HBA_ERROR
;
231 lpfc_config_link(phba
, pmb
);
232 rc
= lpfc_sli_issue_mbox(phba
, pmb
, MBX_POLL
);
233 if (rc
!= MBX_SUCCESS
) {
234 lpfc_printf_log(phba
,
237 "%d:0447 Adapter failed init, mbxCmd x%x "
238 "CONFIG_LINK mbxStatus x%x\n",
240 mb
->mbxCommand
, mb
->mbxStatus
);
241 phba
->hba_state
= LPFC_HBA_ERROR
;
242 mempool_free( pmb
, phba
->mbox_mem_pool
);
246 /* Get login parameters for NID. */
247 lpfc_read_sparam(phba
, pmb
);
248 if (lpfc_sli_issue_mbox(phba
, pmb
, MBX_POLL
) != MBX_SUCCESS
) {
249 lpfc_printf_log(phba
,
252 "%d:0448 Adapter failed init, mbxCmd x%x "
253 "READ_SPARM mbxStatus x%x\n",
255 mb
->mbxCommand
, mb
->mbxStatus
);
256 phba
->hba_state
= LPFC_HBA_ERROR
;
257 mp
= (struct lpfc_dmabuf
*) pmb
->context1
;
258 mempool_free( pmb
, phba
->mbox_mem_pool
);
259 lpfc_mbuf_free(phba
, mp
->virt
, mp
->phys
);
264 mp
= (struct lpfc_dmabuf
*) pmb
->context1
;
266 memcpy(&phba
->fc_sparam
, mp
->virt
, sizeof (struct serv_parm
));
267 lpfc_mbuf_free(phba
, mp
->virt
, mp
->phys
);
269 pmb
->context1
= NULL
;
271 if (phba
->cfg_soft_wwnn
)
272 u64_to_wwn(phba
->cfg_soft_wwnn
, phba
->fc_sparam
.nodeName
.u
.wwn
);
273 if (phba
->cfg_soft_wwpn
)
274 u64_to_wwn(phba
->cfg_soft_wwpn
, phba
->fc_sparam
.portName
.u
.wwn
);
275 memcpy(&phba
->fc_nodename
, &phba
->fc_sparam
.nodeName
,
276 sizeof (struct lpfc_name
));
277 memcpy(&phba
->fc_portname
, &phba
->fc_sparam
.portName
,
278 sizeof (struct lpfc_name
));
279 /* If no serial number in VPD data, use low 6 bytes of WWNN */
280 /* This should be consolidated into parse_vpd ? - mr */
281 if (phba
->SerialNumber
[0] == 0) {
284 outptr
= &phba
->fc_nodename
.u
.s
.IEEE
[0];
285 for (i
= 0; i
< 12; i
++) {
287 j
= ((status
& 0xf0) >> 4);
289 phba
->SerialNumber
[i
] =
290 (char)((uint8_t) 0x30 + (uint8_t) j
);
292 phba
->SerialNumber
[i
] =
293 (char)((uint8_t) 0x61 + (uint8_t) (j
- 10));
297 phba
->SerialNumber
[i
] =
298 (char)((uint8_t) 0x30 + (uint8_t) j
);
300 phba
->SerialNumber
[i
] =
301 (char)((uint8_t) 0x61 + (uint8_t) (j
- 10));
305 lpfc_read_config(phba
, pmb
);
306 if (lpfc_sli_issue_mbox(phba
, pmb
, MBX_POLL
) != MBX_SUCCESS
) {
307 lpfc_printf_log(phba
,
310 "%d:0453 Adapter failed to init, mbxCmd x%x "
311 "READ_CONFIG, mbxStatus x%x\n",
313 mb
->mbxCommand
, mb
->mbxStatus
);
314 phba
->hba_state
= LPFC_HBA_ERROR
;
315 mempool_free( pmb
, phba
->mbox_mem_pool
);
319 /* Reset the DFT_HBA_Q_DEPTH to the max xri */
320 if (phba
->cfg_hba_queue_depth
> (mb
->un
.varRdConfig
.max_xri
+1))
321 phba
->cfg_hba_queue_depth
=
322 mb
->un
.varRdConfig
.max_xri
+ 1;
324 phba
->lmt
= mb
->un
.varRdConfig
.lmt
;
326 /* Get the default values for Model Name and Description */
327 lpfc_get_hba_model_desc(phba
, phba
->ModelName
, phba
->ModelDesc
);
329 if ((phba
->cfg_link_speed
> LINK_SPEED_10G
)
330 || ((phba
->cfg_link_speed
== LINK_SPEED_1G
)
331 && !(phba
->lmt
& LMT_1Gb
))
332 || ((phba
->cfg_link_speed
== LINK_SPEED_2G
)
333 && !(phba
->lmt
& LMT_2Gb
))
334 || ((phba
->cfg_link_speed
== LINK_SPEED_4G
)
335 && !(phba
->lmt
& LMT_4Gb
))
336 || ((phba
->cfg_link_speed
== LINK_SPEED_8G
)
337 && !(phba
->lmt
& LMT_8Gb
))
338 || ((phba
->cfg_link_speed
== LINK_SPEED_10G
)
339 && !(phba
->lmt
& LMT_10Gb
))) {
340 /* Reset link speed to auto */
341 lpfc_printf_log(phba
,
344 "%d:1302 Invalid speed for this board: "
345 "Reset link speed to auto: x%x\n",
347 phba
->cfg_link_speed
);
348 phba
->cfg_link_speed
= LINK_SPEED_AUTO
;
351 phba
->hba_state
= LPFC_LINK_DOWN
;
353 /* Only process IOCBs on ring 0 till hba_state is READY */
354 if (psli
->ring
[psli
->extra_ring
].cmdringaddr
)
355 psli
->ring
[psli
->extra_ring
].flag
|= LPFC_STOP_IOCB_EVENT
;
356 if (psli
->ring
[psli
->fcp_ring
].cmdringaddr
)
357 psli
->ring
[psli
->fcp_ring
].flag
|= LPFC_STOP_IOCB_EVENT
;
358 if (psli
->ring
[psli
->next_ring
].cmdringaddr
)
359 psli
->ring
[psli
->next_ring
].flag
|= LPFC_STOP_IOCB_EVENT
;
361 /* Post receive buffers for desired rings */
362 lpfc_post_rcv_buf(phba
);
364 /* Enable appropriate host interrupts */
365 spin_lock_irq(phba
->host
->host_lock
);
366 status
= readl(phba
->HCregaddr
);
367 status
|= HC_MBINT_ENA
| HC_ERINT_ENA
| HC_LAINT_ENA
;
368 if (psli
->num_rings
> 0)
369 status
|= HC_R0INT_ENA
;
370 if (psli
->num_rings
> 1)
371 status
|= HC_R1INT_ENA
;
372 if (psli
->num_rings
> 2)
373 status
|= HC_R2INT_ENA
;
374 if (psli
->num_rings
> 3)
375 status
|= HC_R3INT_ENA
;
377 if ((phba
->cfg_poll
& ENABLE_FCP_RING_POLLING
) &&
378 (phba
->cfg_poll
& DISABLE_FCP_RING_INT
))
379 status
&= ~(HC_R0INT_ENA
<< LPFC_FCP_RING
);
381 writel(status
, phba
->HCregaddr
);
382 readl(phba
->HCregaddr
); /* flush */
383 spin_unlock_irq(phba
->host
->host_lock
);
386 * Setup the ring 0 (els) timeout handler
388 timeout
= phba
->fc_ratov
<< 1;
389 mod_timer(&phba
->els_tmofunc
, jiffies
+ HZ
* timeout
);
391 lpfc_init_link(phba
, pmb
, phba
->cfg_topology
, phba
->cfg_link_speed
);
392 pmb
->mbox_cmpl
= lpfc_sli_def_mbox_cmpl
;
393 rc
= lpfc_sli_issue_mbox(phba
, pmb
, MBX_NOWAIT
);
394 lpfc_set_loopback_flag(phba
);
395 if (rc
!= MBX_SUCCESS
) {
396 lpfc_printf_log(phba
,
399 "%d:0454 Adapter failed to init, mbxCmd x%x "
400 "INIT_LINK, mbxStatus x%x\n",
402 mb
->mbxCommand
, mb
->mbxStatus
);
404 /* Clear all interrupt enable conditions */
405 writel(0, phba
->HCregaddr
);
406 readl(phba
->HCregaddr
); /* flush */
407 /* Clear all pending interrupts */
408 writel(0xffffffff, phba
->HAregaddr
);
409 readl(phba
->HAregaddr
); /* flush */
411 phba
->hba_state
= LPFC_HBA_ERROR
;
413 mempool_free(pmb
, phba
->mbox_mem_pool
);
416 /* MBOX buffer will be freed in mbox compl */
421 /************************************************************************/
423 /* lpfc_hba_down_prep */
424 /* This routine will do LPFC uninitialization before the */
425 /* HBA is reset when bringing down the SLI Layer. This will be */
426 /* initialized as a SLI layer callback routine. */
427 /* This routine returns 0 on success. Any other return value */
428 /* indicates an error. */
430 /************************************************************************/
432 lpfc_hba_down_prep(struct lpfc_hba
* phba
)
434 /* Disable interrupts */
435 writel(0, phba
->HCregaddr
);
436 readl(phba
->HCregaddr
); /* flush */
438 /* Cleanup potential discovery resources */
439 lpfc_els_flush_rscn(phba
);
440 lpfc_els_flush_cmd(phba
);
441 lpfc_disc_flush_list(phba
);
446 /************************************************************************/
448 /* lpfc_hba_down_post */
449 /* This routine will do uninitialization after the HBA is reset */
450 /* when bringing down the SLI Layer. */
451 /* This routine returns 0 on success. Any other return value */
452 /* indicates an error. */
454 /************************************************************************/
456 lpfc_hba_down_post(struct lpfc_hba
* phba
)
458 struct lpfc_sli
*psli
= &phba
->sli
;
459 struct lpfc_sli_ring
*pring
;
460 struct lpfc_dmabuf
*mp
, *next_mp
;
463 /* Cleanup preposted buffers on the ELS ring */
464 pring
= &psli
->ring
[LPFC_ELS_RING
];
465 list_for_each_entry_safe(mp
, next_mp
, &pring
->postbufq
, list
) {
467 pring
->postbufq_cnt
--;
468 lpfc_mbuf_free(phba
, mp
->virt
, mp
->phys
);
472 for (i
= 0; i
< psli
->num_rings
; i
++) {
473 pring
= &psli
->ring
[i
];
474 lpfc_sli_abort_iocb_ring(phba
, pring
);
480 /************************************************************************/
482 /* lpfc_handle_eratt */
483 /* This routine will handle processing a Host Attention */
484 /* Error Status event. This will be initialized */
485 /* as a SLI layer callback routine. */
487 /************************************************************************/
489 lpfc_handle_eratt(struct lpfc_hba
* phba
)
491 struct lpfc_sli
*psli
= &phba
->sli
;
492 struct lpfc_sli_ring
*pring
;
494 /* If the pci channel is offline, ignore possible errors,
495 * since we cannot communicate with the pci card anyway. */
496 if (pci_channel_offline(phba
->pcidev
))
499 if (phba
->work_hs
& HS_FFER6
||
500 phba
->work_hs
& HS_FFER5
) {
501 /* Re-establishing Link */
502 lpfc_printf_log(phba
, KERN_INFO
, LOG_LINK_EVENT
,
503 "%d:1301 Re-establishing Link "
504 "Data: x%x x%x x%x\n",
505 phba
->brd_no
, phba
->work_hs
,
506 phba
->work_status
[0], phba
->work_status
[1]);
507 spin_lock_irq(phba
->host
->host_lock
);
508 phba
->fc_flag
|= FC_ESTABLISH_LINK
;
509 psli
->sli_flag
&= ~LPFC_SLI2_ACTIVE
;
510 spin_unlock_irq(phba
->host
->host_lock
);
513 * Firmware stops when it triggled erratt with HS_FFER6.
514 * That could cause the I/Os dropped by the firmware.
515 * Error iocb (I/O) on txcmplq and let the SCSI layer
516 * retry it after re-establishing link.
518 pring
= &psli
->ring
[psli
->fcp_ring
];
519 lpfc_sli_abort_iocb_ring(phba
, pring
);
523 * There was a firmware error. Take the hba offline and then
524 * attempt to restart it.
526 lpfc_offline_prep(phba
);
528 lpfc_sli_brdrestart(phba
);
529 if (lpfc_online(phba
) == 0) { /* Initialize the HBA */
530 mod_timer(&phba
->fc_estabtmo
, jiffies
+ HZ
* 60);
531 lpfc_unblock_mgmt_io(phba
);
534 lpfc_unblock_mgmt_io(phba
);
536 /* The if clause above forces this code path when the status
537 * failure is a value other than FFER6. Do not call the offline
538 * twice. This is the adapter hardware error path.
540 lpfc_printf_log(phba
, KERN_ERR
, LOG_INIT
,
541 "%d:0457 Adapter Hardware Error "
542 "Data: x%x x%x x%x\n",
543 phba
->brd_no
, phba
->work_hs
,
544 phba
->work_status
[0], phba
->work_status
[1]);
546 event_data
= FC_REG_DUMP_EVENT
;
547 fc_host_post_vendor_event(phba
->host
, fc_get_event_number(),
548 sizeof(event_data
), (char *) &event_data
,
549 SCSI_NL_VID_TYPE_PCI
| PCI_VENDOR_ID_EMULEX
);
551 psli
->sli_flag
&= ~LPFC_SLI2_ACTIVE
;
552 lpfc_offline_prep(phba
);
554 lpfc_unblock_mgmt_io(phba
);
555 phba
->hba_state
= LPFC_HBA_ERROR
;
556 lpfc_hba_down_post(phba
);
560 /************************************************************************/
562 /* lpfc_handle_latt */
563 /* This routine will handle processing a Host Attention */
564 /* Link Status event. This will be initialized */
565 /* as a SLI layer callback routine. */
567 /************************************************************************/
569 lpfc_handle_latt(struct lpfc_hba
* phba
)
571 struct lpfc_sli
*psli
= &phba
->sli
;
573 volatile uint32_t control
;
574 struct lpfc_dmabuf
*mp
;
577 pmb
= (LPFC_MBOXQ_t
*)mempool_alloc(phba
->mbox_mem_pool
, GFP_KERNEL
);
579 goto lpfc_handle_latt_err_exit
;
581 mp
= kmalloc(sizeof(struct lpfc_dmabuf
), GFP_KERNEL
);
583 goto lpfc_handle_latt_free_pmb
;
585 mp
->virt
= lpfc_mbuf_alloc(phba
, 0, &mp
->phys
);
587 goto lpfc_handle_latt_free_mp
;
591 /* Cleanup any outstanding ELS commands */
592 lpfc_els_flush_cmd(phba
);
594 psli
->slistat
.link_event
++;
595 lpfc_read_la(phba
, pmb
, mp
);
596 pmb
->mbox_cmpl
= lpfc_mbx_cmpl_read_la
;
597 rc
= lpfc_sli_issue_mbox (phba
, pmb
, (MBX_NOWAIT
| MBX_STOP_IOCB
));
598 if (rc
== MBX_NOT_FINISHED
)
599 goto lpfc_handle_latt_free_mbuf
;
601 /* Clear Link Attention in HA REG */
602 spin_lock_irq(phba
->host
->host_lock
);
603 writel(HA_LATT
, phba
->HAregaddr
);
604 readl(phba
->HAregaddr
); /* flush */
605 spin_unlock_irq(phba
->host
->host_lock
);
609 lpfc_handle_latt_free_mbuf
:
610 lpfc_mbuf_free(phba
, mp
->virt
, mp
->phys
);
611 lpfc_handle_latt_free_mp
:
613 lpfc_handle_latt_free_pmb
:
614 mempool_free(pmb
, phba
->mbox_mem_pool
);
615 lpfc_handle_latt_err_exit
:
616 /* Enable Link attention interrupts */
617 spin_lock_irq(phba
->host
->host_lock
);
618 psli
->sli_flag
|= LPFC_PROCESS_LA
;
619 control
= readl(phba
->HCregaddr
);
620 control
|= HC_LAINT_ENA
;
621 writel(control
, phba
->HCregaddr
);
622 readl(phba
->HCregaddr
); /* flush */
624 /* Clear Link Attention in HA REG */
625 writel(HA_LATT
, phba
->HAregaddr
);
626 readl(phba
->HAregaddr
); /* flush */
627 spin_unlock_irq(phba
->host
->host_lock
);
629 phba
->hba_state
= LPFC_HBA_ERROR
;
631 /* The other case is an error from issue_mbox */
633 lpfc_printf_log(phba
,
636 "%d:0300 READ_LA: no buffers\n",
642 /************************************************************************/
645 /* This routine will parse the VPD data */
647 /************************************************************************/
649 lpfc_parse_vpd(struct lpfc_hba
* phba
, uint8_t * vpd
, int len
)
651 uint8_t lenlo
, lenhi
;
661 lpfc_printf_log(phba
,
664 "%d:0455 Vital Product Data: x%x x%x x%x x%x\n",
666 (uint32_t) vpd
[0], (uint32_t) vpd
[1], (uint32_t) vpd
[2],
668 while (!finished
&& (index
< (len
- 4))) {
669 switch (vpd
[index
]) {
677 i
= ((((unsigned short)lenhi
) << 8) + lenlo
);
686 Length
= ((((unsigned short)lenhi
) << 8) + lenlo
);
687 if (Length
> len
- index
)
688 Length
= len
- index
;
690 /* Look for Serial Number */
691 if ((vpd
[index
] == 'S') && (vpd
[index
+1] == 'N')) {
698 phba
->SerialNumber
[j
++] = vpd
[index
++];
702 phba
->SerialNumber
[j
] = 0;
705 else if ((vpd
[index
] == 'V') && (vpd
[index
+1] == '1')) {
706 phba
->vpd_flag
|= VPD_MODEL_DESC
;
713 phba
->ModelDesc
[j
++] = vpd
[index
++];
717 phba
->ModelDesc
[j
] = 0;
720 else if ((vpd
[index
] == 'V') && (vpd
[index
+1] == '2')) {
721 phba
->vpd_flag
|= VPD_MODEL_NAME
;
728 phba
->ModelName
[j
++] = vpd
[index
++];
732 phba
->ModelName
[j
] = 0;
735 else if ((vpd
[index
] == 'V') && (vpd
[index
+1] == '3')) {
736 phba
->vpd_flag
|= VPD_PROGRAM_TYPE
;
743 phba
->ProgramType
[j
++] = vpd
[index
++];
747 phba
->ProgramType
[j
] = 0;
750 else if ((vpd
[index
] == 'V') && (vpd
[index
+1] == '4')) {
751 phba
->vpd_flag
|= VPD_PORT
;
758 phba
->Port
[j
++] = vpd
[index
++];
788 lpfc_get_hba_model_desc(struct lpfc_hba
* phba
, uint8_t * mdp
, uint8_t * descp
)
791 uint16_t dev_id
= phba
->pcidev
->device
;
797 } m
= {"<Unknown>", 0, ""};
799 if (mdp
&& mdp
[0] != '\0'
800 && descp
&& descp
[0] != '\0')
803 if (phba
->lmt
& LMT_10Gb
)
805 else if (phba
->lmt
& LMT_8Gb
)
807 else if (phba
->lmt
& LMT_4Gb
)
809 else if (phba
->lmt
& LMT_2Gb
)
817 case PCI_DEVICE_ID_FIREFLY
:
818 m
= (typeof(m
)){"LP6000", max_speed
, "PCI"};
820 case PCI_DEVICE_ID_SUPERFLY
:
821 if (vp
->rev
.biuRev
>= 1 && vp
->rev
.biuRev
<= 3)
822 m
= (typeof(m
)){"LP7000", max_speed
, "PCI"};
824 m
= (typeof(m
)){"LP7000E", max_speed
, "PCI"};
826 case PCI_DEVICE_ID_DRAGONFLY
:
827 m
= (typeof(m
)){"LP8000", max_speed
, "PCI"};
829 case PCI_DEVICE_ID_CENTAUR
:
830 if (FC_JEDEC_ID(vp
->rev
.biuRev
) == CENTAUR_2G_JEDEC_ID
)
831 m
= (typeof(m
)){"LP9002", max_speed
, "PCI"};
833 m
= (typeof(m
)){"LP9000", max_speed
, "PCI"};
835 case PCI_DEVICE_ID_RFLY
:
836 m
= (typeof(m
)){"LP952", max_speed
, "PCI"};
838 case PCI_DEVICE_ID_PEGASUS
:
839 m
= (typeof(m
)){"LP9802", max_speed
, "PCI-X"};
841 case PCI_DEVICE_ID_THOR
:
842 m
= (typeof(m
)){"LP10000", max_speed
, "PCI-X"};
844 case PCI_DEVICE_ID_VIPER
:
845 m
= (typeof(m
)){"LPX1000", max_speed
, "PCI-X"};
847 case PCI_DEVICE_ID_PFLY
:
848 m
= (typeof(m
)){"LP982", max_speed
, "PCI-X"};
850 case PCI_DEVICE_ID_TFLY
:
851 m
= (typeof(m
)){"LP1050", max_speed
, "PCI-X"};
853 case PCI_DEVICE_ID_HELIOS
:
854 m
= (typeof(m
)){"LP11000", max_speed
, "PCI-X2"};
856 case PCI_DEVICE_ID_HELIOS_SCSP
:
857 m
= (typeof(m
)){"LP11000-SP", max_speed
, "PCI-X2"};
859 case PCI_DEVICE_ID_HELIOS_DCSP
:
860 m
= (typeof(m
)){"LP11002-SP", max_speed
, "PCI-X2"};
862 case PCI_DEVICE_ID_NEPTUNE
:
863 m
= (typeof(m
)){"LPe1000", max_speed
, "PCIe"};
865 case PCI_DEVICE_ID_NEPTUNE_SCSP
:
866 m
= (typeof(m
)){"LPe1000-SP", max_speed
, "PCIe"};
868 case PCI_DEVICE_ID_NEPTUNE_DCSP
:
869 m
= (typeof(m
)){"LPe1002-SP", max_speed
, "PCIe"};
871 case PCI_DEVICE_ID_BMID
:
872 m
= (typeof(m
)){"LP1150", max_speed
, "PCI-X2"};
874 case PCI_DEVICE_ID_BSMB
:
875 m
= (typeof(m
)){"LP111", max_speed
, "PCI-X2"};
877 case PCI_DEVICE_ID_ZEPHYR
:
878 m
= (typeof(m
)){"LPe11000", max_speed
, "PCIe"};
880 case PCI_DEVICE_ID_ZEPHYR_SCSP
:
881 m
= (typeof(m
)){"LPe11000", max_speed
, "PCIe"};
883 case PCI_DEVICE_ID_ZEPHYR_DCSP
:
884 m
= (typeof(m
)){"LPe11002-SP", max_speed
, "PCIe"};
886 case PCI_DEVICE_ID_ZMID
:
887 m
= (typeof(m
)){"LPe1150", max_speed
, "PCIe"};
889 case PCI_DEVICE_ID_ZSMB
:
890 m
= (typeof(m
)){"LPe111", max_speed
, "PCIe"};
892 case PCI_DEVICE_ID_LP101
:
893 m
= (typeof(m
)){"LP101", max_speed
, "PCI-X"};
895 case PCI_DEVICE_ID_LP10000S
:
896 m
= (typeof(m
)){"LP10000-S", max_speed
, "PCI"};
898 case PCI_DEVICE_ID_LP11000S
:
899 m
= (typeof(m
)){"LP11000-S", max_speed
,
902 case PCI_DEVICE_ID_LPE11000S
:
903 m
= (typeof(m
)){"LPe11000-S", max_speed
,
906 case PCI_DEVICE_ID_SAT
:
907 m
= (typeof(m
)){"LPe12000", max_speed
, "PCIe"};
909 case PCI_DEVICE_ID_SAT_MID
:
910 m
= (typeof(m
)){"LPe1250", max_speed
, "PCIe"};
912 case PCI_DEVICE_ID_SAT_SMB
:
913 m
= (typeof(m
)){"LPe121", max_speed
, "PCIe"};
915 case PCI_DEVICE_ID_SAT_DCSP
:
916 m
= (typeof(m
)){"LPe12002-SP", max_speed
, "PCIe"};
918 case PCI_DEVICE_ID_SAT_SCSP
:
919 m
= (typeof(m
)){"LPe12000-SP", max_speed
, "PCIe"};
921 case PCI_DEVICE_ID_SAT_S
:
922 m
= (typeof(m
)){"LPe12000-S", max_speed
, "PCIe"};
925 m
= (typeof(m
)){ NULL
};
929 if (mdp
&& mdp
[0] == '\0')
930 snprintf(mdp
, 79,"%s", m
.name
);
931 if (descp
&& descp
[0] == '\0')
933 "Emulex %s %dGb %s Fibre Channel Adapter",
934 m
.name
, m
.max_speed
, m
.bus
);
937 /**************************************************/
938 /* lpfc_post_buffer */
940 /* This routine will post count buffers to the */
941 /* ring with the QUE_RING_BUF_CN command. This */
942 /* allows 3 buffers / command to be posted. */
943 /* Returns the number of buffers NOT posted. */
944 /**************************************************/
946 lpfc_post_buffer(struct lpfc_hba
* phba
, struct lpfc_sli_ring
* pring
, int cnt
,
950 struct lpfc_iocbq
*iocb
;
951 struct lpfc_dmabuf
*mp1
, *mp2
;
953 cnt
+= pring
->missbufcnt
;
955 /* While there are buffers to post */
957 /* Allocate buffer for command iocb */
958 spin_lock_irq(phba
->host
->host_lock
);
959 iocb
= lpfc_sli_get_iocbq(phba
);
960 spin_unlock_irq(phba
->host
->host_lock
);
962 pring
->missbufcnt
= cnt
;
967 /* 2 buffers can be posted per command */
968 /* Allocate buffer to post */
969 mp1
= kmalloc(sizeof (struct lpfc_dmabuf
), GFP_KERNEL
);
971 mp1
->virt
= lpfc_mbuf_alloc(phba
, MEM_PRI
,
973 if (mp1
== 0 || mp1
->virt
== 0) {
975 spin_lock_irq(phba
->host
->host_lock
);
976 lpfc_sli_release_iocbq(phba
, iocb
);
977 spin_unlock_irq(phba
->host
->host_lock
);
978 pring
->missbufcnt
= cnt
;
982 INIT_LIST_HEAD(&mp1
->list
);
983 /* Allocate buffer to post */
985 mp2
= kmalloc(sizeof (struct lpfc_dmabuf
), GFP_KERNEL
);
987 mp2
->virt
= lpfc_mbuf_alloc(phba
, MEM_PRI
,
989 if (mp2
== 0 || mp2
->virt
== 0) {
991 lpfc_mbuf_free(phba
, mp1
->virt
, mp1
->phys
);
993 spin_lock_irq(phba
->host
->host_lock
);
994 lpfc_sli_release_iocbq(phba
, iocb
);
995 spin_unlock_irq(phba
->host
->host_lock
);
996 pring
->missbufcnt
= cnt
;
1000 INIT_LIST_HEAD(&mp2
->list
);
1005 icmd
->un
.cont64
[0].addrHigh
= putPaddrHigh(mp1
->phys
);
1006 icmd
->un
.cont64
[0].addrLow
= putPaddrLow(mp1
->phys
);
1007 icmd
->un
.cont64
[0].tus
.f
.bdeSize
= FCELSSIZE
;
1008 icmd
->ulpBdeCount
= 1;
1011 icmd
->un
.cont64
[1].addrHigh
= putPaddrHigh(mp2
->phys
);
1012 icmd
->un
.cont64
[1].addrLow
= putPaddrLow(mp2
->phys
);
1013 icmd
->un
.cont64
[1].tus
.f
.bdeSize
= FCELSSIZE
;
1015 icmd
->ulpBdeCount
= 2;
1018 icmd
->ulpCommand
= CMD_QUE_RING_BUF64_CN
;
1021 spin_lock_irq(phba
->host
->host_lock
);
1022 if (lpfc_sli_issue_iocb(phba
, pring
, iocb
, 0) == IOCB_ERROR
) {
1023 lpfc_mbuf_free(phba
, mp1
->virt
, mp1
->phys
);
1027 lpfc_mbuf_free(phba
, mp2
->virt
, mp2
->phys
);
1031 lpfc_sli_release_iocbq(phba
, iocb
);
1032 pring
->missbufcnt
= cnt
;
1033 spin_unlock_irq(phba
->host
->host_lock
);
1036 spin_unlock_irq(phba
->host
->host_lock
);
1037 lpfc_sli_ringpostbuf_put(phba
, pring
, mp1
);
1039 lpfc_sli_ringpostbuf_put(phba
, pring
, mp2
);
1042 pring
->missbufcnt
= 0;
1046 /************************************************************************/
1048 /* lpfc_post_rcv_buf */
1049 /* This routine post initial rcv buffers to the configured rings */
1051 /************************************************************************/
1053 lpfc_post_rcv_buf(struct lpfc_hba
* phba
)
1055 struct lpfc_sli
*psli
= &phba
->sli
;
1057 /* Ring 0, ELS / CT buffers */
1058 lpfc_post_buffer(phba
, &psli
->ring
[LPFC_ELS_RING
], LPFC_BUF_RING0
, 1);
1059 /* Ring 2 - FCP no buffers needed */
1064 #define S(N,V) (((V)<<(N))|((V)>>(32-(N))))
1066 /************************************************************************/
1070 /************************************************************************/
1072 lpfc_sha_init(uint32_t * HashResultPointer
)
1074 HashResultPointer
[0] = 0x67452301;
1075 HashResultPointer
[1] = 0xEFCDAB89;
1076 HashResultPointer
[2] = 0x98BADCFE;
1077 HashResultPointer
[3] = 0x10325476;
1078 HashResultPointer
[4] = 0xC3D2E1F0;
1081 /************************************************************************/
1083 /* lpfc_sha_iterate */
1085 /************************************************************************/
1087 lpfc_sha_iterate(uint32_t * HashResultPointer
, uint32_t * HashWorkingPointer
)
1091 uint32_t A
, B
, C
, D
, E
;
1094 HashWorkingPointer
[t
] =
1096 HashWorkingPointer
[t
- 3] ^ HashWorkingPointer
[t
-
1098 HashWorkingPointer
[t
- 14] ^ HashWorkingPointer
[t
- 16]);
1099 } while (++t
<= 79);
1101 A
= HashResultPointer
[0];
1102 B
= HashResultPointer
[1];
1103 C
= HashResultPointer
[2];
1104 D
= HashResultPointer
[3];
1105 E
= HashResultPointer
[4];
1109 TEMP
= ((B
& C
) | ((~B
) & D
)) + 0x5A827999;
1110 } else if (t
< 40) {
1111 TEMP
= (B
^ C
^ D
) + 0x6ED9EBA1;
1112 } else if (t
< 60) {
1113 TEMP
= ((B
& C
) | (B
& D
) | (C
& D
)) + 0x8F1BBCDC;
1115 TEMP
= (B
^ C
^ D
) + 0xCA62C1D6;
1117 TEMP
+= S(5, A
) + E
+ HashWorkingPointer
[t
];
1123 } while (++t
<= 79);
1125 HashResultPointer
[0] += A
;
1126 HashResultPointer
[1] += B
;
1127 HashResultPointer
[2] += C
;
1128 HashResultPointer
[3] += D
;
1129 HashResultPointer
[4] += E
;
1133 /************************************************************************/
1135 /* lpfc_challenge_key */
1137 /************************************************************************/
1139 lpfc_challenge_key(uint32_t * RandomChallenge
, uint32_t * HashWorking
)
1141 *HashWorking
= (*RandomChallenge
^ *HashWorking
);
1144 /************************************************************************/
1148 /************************************************************************/
1150 lpfc_hba_init(struct lpfc_hba
*phba
, uint32_t *hbainit
)
1153 uint32_t *HashWorking
;
1154 uint32_t *pwwnn
= phba
->wwnn
;
1156 HashWorking
= kmalloc(80 * sizeof(uint32_t), GFP_KERNEL
);
1160 memset(HashWorking
, 0, (80 * sizeof(uint32_t)));
1161 HashWorking
[0] = HashWorking
[78] = *pwwnn
++;
1162 HashWorking
[1] = HashWorking
[79] = *pwwnn
;
1164 for (t
= 0; t
< 7; t
++)
1165 lpfc_challenge_key(phba
->RandomData
+ t
, HashWorking
+ t
);
1167 lpfc_sha_init(hbainit
);
1168 lpfc_sha_iterate(hbainit
, HashWorking
);
1173 lpfc_cleanup(struct lpfc_hba
* phba
)
1175 struct lpfc_nodelist
*ndlp
, *next_ndlp
;
1177 /* clean up phba - lpfc specific */
1178 lpfc_can_disctmo(phba
);
1179 list_for_each_entry_safe(ndlp
, next_ndlp
, &phba
->fc_nodes
, nlp_listp
)
1182 INIT_LIST_HEAD(&phba
->fc_nodes
);
1188 lpfc_establish_link_tmo(unsigned long ptr
)
1190 struct lpfc_hba
*phba
= (struct lpfc_hba
*)ptr
;
1191 unsigned long iflag
;
1194 /* Re-establishing Link, timer expired */
1195 lpfc_printf_log(phba
, KERN_ERR
, LOG_LINK_EVENT
,
1196 "%d:1300 Re-establishing Link, timer expired "
1198 phba
->brd_no
, phba
->fc_flag
, phba
->hba_state
);
1199 spin_lock_irqsave(phba
->host
->host_lock
, iflag
);
1200 phba
->fc_flag
&= ~FC_ESTABLISH_LINK
;
1201 spin_unlock_irqrestore(phba
->host
->host_lock
, iflag
);
1205 lpfc_stop_timer(struct lpfc_hba
* phba
)
1207 struct lpfc_sli
*psli
= &phba
->sli
;
1209 del_timer_sync(&phba
->fcp_poll_timer
);
1210 del_timer_sync(&phba
->fc_estabtmo
);
1211 del_timer_sync(&phba
->fc_disctmo
);
1212 del_timer_sync(&phba
->fc_fdmitmo
);
1213 del_timer_sync(&phba
->els_tmofunc
);
1215 del_timer_sync(&psli
->mbox_tmo
);
1220 lpfc_online(struct lpfc_hba
* phba
)
1225 if (!(phba
->fc_flag
& FC_OFFLINE_MODE
))
1228 lpfc_printf_log(phba
,
1231 "%d:0458 Bring Adapter online\n",
1234 lpfc_block_mgmt_io(phba
);
1236 if (!lpfc_sli_queue_setup(phba
)) {
1237 lpfc_unblock_mgmt_io(phba
);
1241 if (lpfc_sli_hba_setup(phba
)) { /* Initialize the HBA */
1242 lpfc_unblock_mgmt_io(phba
);
1246 spin_lock_irq(phba
->host
->host_lock
);
1247 phba
->fc_flag
&= ~FC_OFFLINE_MODE
;
1248 spin_unlock_irq(phba
->host
->host_lock
);
1250 lpfc_unblock_mgmt_io(phba
);
1255 lpfc_block_mgmt_io(struct lpfc_hba
* phba
)
1257 unsigned long iflag
;
1259 spin_lock_irqsave(phba
->host
->host_lock
, iflag
);
1260 phba
->fc_flag
|= FC_BLOCK_MGMT_IO
;
1261 spin_unlock_irqrestore(phba
->host
->host_lock
, iflag
);
1265 lpfc_unblock_mgmt_io(struct lpfc_hba
* phba
)
1267 unsigned long iflag
;
1269 spin_lock_irqsave(phba
->host
->host_lock
, iflag
);
1270 phba
->fc_flag
&= ~FC_BLOCK_MGMT_IO
;
1271 spin_unlock_irqrestore(phba
->host
->host_lock
, iflag
);
1275 lpfc_offline_prep(struct lpfc_hba
* phba
)
1277 struct lpfc_nodelist
*ndlp
, *next_ndlp
;
1279 if (phba
->fc_flag
& FC_OFFLINE_MODE
)
1282 lpfc_block_mgmt_io(phba
);
1284 lpfc_linkdown(phba
);
1286 /* Issue an unreg_login to all nodes */
1287 list_for_each_entry_safe(ndlp
, next_ndlp
, &phba
->fc_nodes
, nlp_listp
)
1288 if (ndlp
->nlp_state
!= NLP_STE_UNUSED_NODE
)
1289 lpfc_unreg_rpi(phba
, ndlp
);
1291 lpfc_sli_flush_mbox_queue(phba
);
1295 lpfc_offline(struct lpfc_hba
* phba
)
1297 unsigned long iflag
;
1299 if (phba
->fc_flag
& FC_OFFLINE_MODE
)
1302 /* stop all timers associated with this hba */
1303 lpfc_stop_timer(phba
);
1305 lpfc_printf_log(phba
,
1308 "%d:0460 Bring Adapter offline\n",
1311 /* Bring down the SLI Layer and cleanup. The HBA is offline
1313 lpfc_sli_hba_down(phba
);
1315 spin_lock_irqsave(phba
->host
->host_lock
, iflag
);
1316 phba
->work_hba_events
= 0;
1318 phba
->fc_flag
|= FC_OFFLINE_MODE
;
1319 spin_unlock_irqrestore(phba
->host
->host_lock
, iflag
);
1322 /******************************************************************************
1323 * Function name: lpfc_scsi_free
1325 * Description: Called from lpfc_pci_remove_one free internal driver resources
1327 ******************************************************************************/
1329 lpfc_scsi_free(struct lpfc_hba
* phba
)
1331 struct lpfc_scsi_buf
*sb
, *sb_next
;
1332 struct lpfc_iocbq
*io
, *io_next
;
1334 spin_lock_irq(phba
->host
->host_lock
);
1335 /* Release all the lpfc_scsi_bufs maintained by this host. */
1336 list_for_each_entry_safe(sb
, sb_next
, &phba
->lpfc_scsi_buf_list
, list
) {
1337 list_del(&sb
->list
);
1338 pci_pool_free(phba
->lpfc_scsi_dma_buf_pool
, sb
->data
,
1341 phba
->total_scsi_bufs
--;
1344 /* Release all the lpfc_iocbq entries maintained by this host. */
1345 list_for_each_entry_safe(io
, io_next
, &phba
->lpfc_iocb_list
, list
) {
1346 list_del(&io
->list
);
1348 phba
->total_iocbq_bufs
--;
1351 spin_unlock_irq(phba
->host
->host_lock
);
1356 void lpfc_remove_device(struct lpfc_hba
*phba
)
1358 unsigned long iflag
;
1360 lpfc_free_sysfs_attr(phba
);
1362 spin_lock_irqsave(phba
->host
->host_lock
, iflag
);
1363 phba
->fc_flag
|= FC_UNLOADING
;
1365 spin_unlock_irqrestore(phba
->host
->host_lock
, iflag
);
1367 fc_remove_host(phba
->host
);
1368 scsi_remove_host(phba
->host
);
1370 kthread_stop(phba
->worker_thread
);
1373 * Bring down the SLI Layer. This step disable all interrupts,
1374 * clears the rings, discards all mailbox commands, and resets
1377 lpfc_sli_hba_down(phba
);
1378 lpfc_sli_brdrestart(phba
);
1380 /* Release the irq reservation */
1381 free_irq(phba
->pcidev
->irq
, phba
);
1382 pci_disable_msi(phba
->pcidev
);
1385 lpfc_stop_timer(phba
);
1386 phba
->work_hba_events
= 0;
1389 * Call scsi_free before mem_free since scsi bufs are released to their
1390 * corresponding pools here.
1392 lpfc_scsi_free(phba
);
1393 lpfc_mem_free(phba
);
1395 /* Free resources associated with SLI2 interface */
1396 dma_free_coherent(&phba
->pcidev
->dev
, SLI2_SLIM_SIZE
,
1397 phba
->slim2p
, phba
->slim2p_mapping
);
1399 /* unmap adapter SLIM and Control Registers */
1400 iounmap(phba
->ctrl_regs_memmap_p
);
1401 iounmap(phba
->slim_memmap_p
);
1403 pci_release_regions(phba
->pcidev
);
1404 pci_disable_device(phba
->pcidev
);
1406 idr_remove(&lpfc_hba_index
, phba
->brd_no
);
1407 scsi_host_put(phba
->host
);
1410 void lpfc_scan_start(struct Scsi_Host
*host
)
1412 struct lpfc_hba
*phba
= (struct lpfc_hba
*)host
->hostdata
;
1414 if (lpfc_alloc_sysfs_attr(phba
))
1417 phba
->MBslimaddr
= phba
->slim_memmap_p
;
1418 phba
->HAregaddr
= phba
->ctrl_regs_memmap_p
+ HA_REG_OFFSET
;
1419 phba
->CAregaddr
= phba
->ctrl_regs_memmap_p
+ CA_REG_OFFSET
;
1420 phba
->HSregaddr
= phba
->ctrl_regs_memmap_p
+ HS_REG_OFFSET
;
1421 phba
->HCregaddr
= phba
->ctrl_regs_memmap_p
+ HC_REG_OFFSET
;
1423 if (lpfc_sli_hba_setup(phba
))
1427 * hba setup may have changed the hba_queue_depth so we need to adjust
1428 * the value of can_queue.
1430 host
->can_queue
= phba
->cfg_hba_queue_depth
- 10;
1434 lpfc_remove_device(phba
);
1437 int lpfc_scan_finished(struct Scsi_Host
*shost
, unsigned long time
)
1439 struct lpfc_hba
*phba
= (struct lpfc_hba
*)shost
->hostdata
;
1443 if (time
>= 30 * HZ
)
1446 if (phba
->hba_state
!= LPFC_HBA_READY
)
1448 if (phba
->num_disc_nodes
|| phba
->fc_prli_sent
)
1450 if ((phba
->fc_map_cnt
== 0) && (time
< 2 * HZ
))
1452 if (phba
->sli
.sli_flag
& LPFC_SLI_MBOX_ACTIVE
)
1454 if ((phba
->hba_state
> LPFC_LINK_DOWN
) || (time
< 15 * HZ
))
1458 if (phba
->cfg_poll
& DISABLE_FCP_RING_INT
) {
1459 spin_lock_irq(shost
->host_lock
);
1460 lpfc_poll_start_timer(phba
);
1461 spin_unlock_irq(shost
->host_lock
);
1465 * set fixed host attributes
1466 * Must done after lpfc_sli_hba_setup()
1469 fc_host_node_name(shost
) = wwn_to_u64(phba
->fc_nodename
.u
.wwn
);
1470 fc_host_port_name(shost
) = wwn_to_u64(phba
->fc_portname
.u
.wwn
);
1471 fc_host_supported_classes(shost
) = FC_COS_CLASS3
;
1473 memset(fc_host_supported_fc4s(shost
), 0,
1474 sizeof(fc_host_supported_fc4s(shost
)));
1475 fc_host_supported_fc4s(shost
)[2] = 1;
1476 fc_host_supported_fc4s(shost
)[7] = 1;
1478 lpfc_get_hba_sym_node_name(phba
, fc_host_symbolic_name(shost
));
1480 fc_host_supported_speeds(shost
) = 0;
1481 if (phba
->lmt
& LMT_10Gb
)
1482 fc_host_supported_speeds(shost
) |= FC_PORTSPEED_10GBIT
;
1483 if (phba
->lmt
& LMT_4Gb
)
1484 fc_host_supported_speeds(shost
) |= FC_PORTSPEED_4GBIT
;
1485 if (phba
->lmt
& LMT_2Gb
)
1486 fc_host_supported_speeds(shost
) |= FC_PORTSPEED_2GBIT
;
1487 if (phba
->lmt
& LMT_1Gb
)
1488 fc_host_supported_speeds(shost
) |= FC_PORTSPEED_1GBIT
;
1490 fc_host_maxframe_size(shost
) =
1491 ((((uint32_t) phba
->fc_sparam
.cmn
.bbRcvSizeMsb
& 0x0F) << 8) |
1492 (uint32_t) phba
->fc_sparam
.cmn
.bbRcvSizeLsb
);
1494 /* This value is also unchanging */
1495 memset(fc_host_active_fc4s(shost
), 0,
1496 sizeof(fc_host_active_fc4s(shost
)));
1497 fc_host_active_fc4s(shost
)[2] = 1;
1498 fc_host_active_fc4s(shost
)[7] = 1;
1500 spin_lock_irq(shost
->host_lock
);
1501 phba
->fc_flag
&= ~FC_LOADING
;
1502 spin_unlock_irq(shost
->host_lock
);
1507 static int __devinit
1508 lpfc_pci_probe_one(struct pci_dev
*pdev
, const struct pci_device_id
*pid
)
1510 struct Scsi_Host
*host
;
1511 struct lpfc_hba
*phba
;
1512 struct lpfc_sli
*psli
;
1513 struct lpfc_iocbq
*iocbq_entry
= NULL
, *iocbq_next
= NULL
;
1514 unsigned long bar0map_len
, bar2map_len
;
1515 int error
= -ENODEV
, retval
;
1519 if (pci_enable_device(pdev
))
1521 if (pci_request_regions(pdev
, LPFC_DRIVER_NAME
))
1522 goto out_disable_device
;
1524 host
= scsi_host_alloc(&lpfc_template
, sizeof (struct lpfc_hba
));
1526 goto out_release_regions
;
1528 phba
= (struct lpfc_hba
*)host
->hostdata
;
1529 memset(phba
, 0, sizeof (struct lpfc_hba
));
1532 phba
->fc_flag
|= FC_LOADING
;
1533 phba
->pcidev
= pdev
;
1535 /* Assign an unused board number */
1536 if (!idr_pre_get(&lpfc_hba_index
, GFP_KERNEL
))
1539 error
= idr_get_new(&lpfc_hba_index
, NULL
, &phba
->brd_no
);
1543 host
->unique_id
= phba
->brd_no
;
1545 /* Initialize timers used by driver */
1546 init_timer(&phba
->fc_estabtmo
);
1547 phba
->fc_estabtmo
.function
= lpfc_establish_link_tmo
;
1548 phba
->fc_estabtmo
.data
= (unsigned long)phba
;
1549 init_timer(&phba
->fc_disctmo
);
1550 phba
->fc_disctmo
.function
= lpfc_disc_timeout
;
1551 phba
->fc_disctmo
.data
= (unsigned long)phba
;
1553 init_timer(&phba
->fc_fdmitmo
);
1554 phba
->fc_fdmitmo
.function
= lpfc_fdmi_tmo
;
1555 phba
->fc_fdmitmo
.data
= (unsigned long)phba
;
1556 init_timer(&phba
->els_tmofunc
);
1557 phba
->els_tmofunc
.function
= lpfc_els_timeout
;
1558 phba
->els_tmofunc
.data
= (unsigned long)phba
;
1560 init_timer(&psli
->mbox_tmo
);
1561 psli
->mbox_tmo
.function
= lpfc_mbox_timeout
;
1562 psli
->mbox_tmo
.data
= (unsigned long)phba
;
1564 init_timer(&phba
->fcp_poll_timer
);
1565 phba
->fcp_poll_timer
.function
= lpfc_poll_timeout
;
1566 phba
->fcp_poll_timer
.data
= (unsigned long)phba
;
1569 * Get all the module params for configuring this host and then
1570 * establish the host parameters.
1572 lpfc_get_cfgparam(phba
);
1574 host
->max_id
= LPFC_MAX_TARGET
;
1575 host
->max_lun
= phba
->cfg_max_luns
;
1578 INIT_LIST_HEAD(&phba
->fc_nodes
);
1580 pci_set_master(pdev
);
1581 retval
= pci_set_mwi(pdev
);
1583 dev_printk(KERN_WARNING
, &pdev
->dev
,
1584 "Warning: pci_set_mwi returned %d\n", retval
);
1586 if (pci_set_dma_mask(phba
->pcidev
, DMA_64BIT_MASK
) != 0)
1587 if (pci_set_dma_mask(phba
->pcidev
, DMA_32BIT_MASK
) != 0)
1588 goto out_idr_remove
;
1591 * Get the bus address of Bar0 and Bar2 and the number of bytes
1592 * required by each mapping.
1594 phba
->pci_bar0_map
= pci_resource_start(phba
->pcidev
, 0);
1595 bar0map_len
= pci_resource_len(phba
->pcidev
, 0);
1597 phba
->pci_bar2_map
= pci_resource_start(phba
->pcidev
, 2);
1598 bar2map_len
= pci_resource_len(phba
->pcidev
, 2);
1600 /* Map HBA SLIM to a kernel virtual address. */
1601 phba
->slim_memmap_p
= ioremap(phba
->pci_bar0_map
, bar0map_len
);
1602 if (!phba
->slim_memmap_p
) {
1604 dev_printk(KERN_ERR
, &pdev
->dev
,
1605 "ioremap failed for SLIM memory.\n");
1606 goto out_idr_remove
;
1609 /* Map HBA Control Registers to a kernel virtual address. */
1610 phba
->ctrl_regs_memmap_p
= ioremap(phba
->pci_bar2_map
, bar2map_len
);
1611 if (!phba
->ctrl_regs_memmap_p
) {
1613 dev_printk(KERN_ERR
, &pdev
->dev
,
1614 "ioremap failed for HBA control registers.\n");
1615 goto out_iounmap_slim
;
1618 /* Allocate memory for SLI-2 structures */
1619 phba
->slim2p
= dma_alloc_coherent(&phba
->pcidev
->dev
, SLI2_SLIM_SIZE
,
1620 &phba
->slim2p_mapping
, GFP_KERNEL
);
1624 memset(phba
->slim2p
, 0, SLI2_SLIM_SIZE
);
1626 /* Initialize the SLI Layer to run with lpfc HBAs. */
1627 lpfc_sli_setup(phba
);
1628 lpfc_sli_queue_setup(phba
);
1630 error
= lpfc_mem_alloc(phba
);
1634 /* Initialize and populate the iocb list per host. */
1635 INIT_LIST_HEAD(&phba
->lpfc_iocb_list
);
1636 for (i
= 0; i
< LPFC_IOCB_LIST_CNT
; i
++) {
1637 iocbq_entry
= kzalloc(sizeof(struct lpfc_iocbq
), GFP_KERNEL
);
1638 if (iocbq_entry
== NULL
) {
1639 printk(KERN_ERR
"%s: only allocated %d iocbs of "
1640 "expected %d count. Unloading driver.\n",
1641 __FUNCTION__
, i
, LPFC_IOCB_LIST_CNT
);
1643 goto out_free_iocbq
;
1646 iotag
= lpfc_sli_next_iotag(phba
, iocbq_entry
);
1648 kfree (iocbq_entry
);
1649 printk(KERN_ERR
"%s: failed to allocate IOTAG. "
1650 "Unloading driver.\n",
1653 goto out_free_iocbq
;
1655 spin_lock_irq(phba
->host
->host_lock
);
1656 list_add(&iocbq_entry
->list
, &phba
->lpfc_iocb_list
);
1657 phba
->total_iocbq_bufs
++;
1658 spin_unlock_irq(phba
->host
->host_lock
);
1661 /* Initialize HBA structure */
1662 phba
->fc_edtov
= FF_DEF_EDTOV
;
1663 phba
->fc_ratov
= FF_DEF_RATOV
;
1664 phba
->fc_altov
= FF_DEF_ALTOV
;
1665 phba
->fc_arbtov
= FF_DEF_ARBTOV
;
1667 INIT_LIST_HEAD(&phba
->work_list
);
1668 phba
->work_ha_mask
= (HA_ERATT
|HA_MBATT
|HA_LATT
);
1669 phba
->work_ha_mask
|= (HA_RXMASK
<< (LPFC_ELS_RING
* 4));
1671 /* Startup the kernel thread for this host adapter. */
1672 phba
->worker_thread
= kthread_run(lpfc_do_work
, phba
,
1673 "lpfc_worker_%d", phba
->brd_no
);
1674 if (IS_ERR(phba
->worker_thread
)) {
1675 error
= PTR_ERR(phba
->worker_thread
);
1676 goto out_free_iocbq
;
1680 * Set initial can_queue value since 0 is no longer supported and
1681 * scsi_add_host will fail. This will be adjusted later based on the
1682 * max xri value determined in hba setup.
1684 host
->can_queue
= phba
->cfg_hba_queue_depth
- 10;
1686 /* Tell the midlayer we support 16 byte commands */
1687 host
->max_cmd_len
= 16;
1689 /* Initialize the list of scsi buffers used by driver for scsi IO. */
1690 spin_lock_init(&phba
->scsi_buf_list_lock
);
1691 INIT_LIST_HEAD(&phba
->lpfc_scsi_buf_list
);
1693 host
->transportt
= lpfc_transport_template
;
1694 pci_set_drvdata(pdev
, host
);
1696 if (phba
->cfg_use_msi
) {
1697 error
= pci_enable_msi(phba
->pcidev
);
1699 lpfc_printf_log(phba
, KERN_INFO
, LOG_INIT
, "%d:0452 "
1700 "Enable MSI failed, continuing with "
1701 "IRQ\n", phba
->brd_no
);
1704 error
= request_irq(phba
->pcidev
->irq
, lpfc_intr_handler
, IRQF_SHARED
,
1705 LPFC_DRIVER_NAME
, phba
);
1707 lpfc_printf_log(phba
, KERN_ERR
, LOG_INIT
,
1708 "%d:0451 Enable interrupt handler failed\n",
1710 goto out_kthread_stop
;
1713 error
= scsi_add_host(host
, &pdev
->dev
);
1717 scsi_scan_host(host
);
1722 lpfc_stop_timer(phba
);
1723 phba
->work_hba_events
= 0;
1724 free_irq(phba
->pcidev
->irq
, phba
);
1725 pci_disable_msi(phba
->pcidev
);
1727 kthread_stop(phba
->worker_thread
);
1729 list_for_each_entry_safe(iocbq_entry
, iocbq_next
,
1730 &phba
->lpfc_iocb_list
, list
) {
1731 spin_lock_irq(phba
->host
->host_lock
);
1733 phba
->total_iocbq_bufs
--;
1734 spin_unlock_irq(phba
->host
->host_lock
);
1736 lpfc_mem_free(phba
);
1738 dma_free_coherent(&pdev
->dev
, SLI2_SLIM_SIZE
, phba
->slim2p
,
1739 phba
->slim2p_mapping
);
1741 iounmap(phba
->ctrl_regs_memmap_p
);
1743 iounmap(phba
->slim_memmap_p
);
1745 idr_remove(&lpfc_hba_index
, phba
->brd_no
);
1748 scsi_host_put(host
);
1749 out_release_regions
:
1750 pci_release_regions(pdev
);
1752 pci_disable_device(pdev
);
1754 pci_set_drvdata(pdev
, NULL
);
1758 static void __devexit
1759 lpfc_pci_remove_one(struct pci_dev
*pdev
)
1761 struct Scsi_Host
*host
= pci_get_drvdata(pdev
);
1762 struct lpfc_hba
*phba
= (struct lpfc_hba
*)host
->hostdata
;
1764 lpfc_remove_device(phba
);
1766 pci_set_drvdata(pdev
, NULL
);
1770 * lpfc_io_error_detected - called when PCI error is detected
1771 * @pdev: Pointer to PCI device
1772 * @state: The current pci conneection state
1774 * This function is called after a PCI bus error affecting
1775 * this device has been detected.
1777 static pci_ers_result_t
lpfc_io_error_detected(struct pci_dev
*pdev
,
1778 pci_channel_state_t state
)
1780 struct Scsi_Host
*host
= pci_get_drvdata(pdev
);
1781 struct lpfc_hba
*phba
= (struct lpfc_hba
*)host
->hostdata
;
1782 struct lpfc_sli
*psli
= &phba
->sli
;
1783 struct lpfc_sli_ring
*pring
;
1785 if (state
== pci_channel_io_perm_failure
)
1786 return PCI_ERS_RESULT_DISCONNECT
;
1788 pci_disable_device(pdev
);
1790 * There may be I/Os dropped by the firmware.
1791 * Error iocb (I/O) on txcmplq and let the SCSI layer
1792 * retry it after re-establishing link.
1794 pring
= &psli
->ring
[psli
->fcp_ring
];
1795 lpfc_sli_abort_iocb_ring(phba
, pring
);
1797 /* Request a slot reset. */
1798 return PCI_ERS_RESULT_NEED_RESET
;
1802 * lpfc_io_slot_reset - called after the pci bus has been reset.
1803 * @pdev: Pointer to PCI device
1805 * Restart the card from scratch, as if from a cold-boot.
1807 static pci_ers_result_t
lpfc_io_slot_reset(struct pci_dev
*pdev
)
1809 struct Scsi_Host
*host
= pci_get_drvdata(pdev
);
1810 struct lpfc_hba
*phba
= (struct lpfc_hba
*)host
->hostdata
;
1811 struct lpfc_sli
*psli
= &phba
->sli
;
1812 int bars
= pci_select_bars(pdev
, IORESOURCE_MEM
);
1814 dev_printk(KERN_INFO
, &pdev
->dev
, "recovering from a slot reset.\n");
1815 if (pci_enable_device_bars(pdev
, bars
)) {
1816 printk(KERN_ERR
"lpfc: Cannot re-enable "
1817 "PCI device after reset.\n");
1818 return PCI_ERS_RESULT_DISCONNECT
;
1821 pci_set_master(pdev
);
1823 /* Re-establishing Link */
1824 spin_lock_irq(phba
->host
->host_lock
);
1825 phba
->fc_flag
|= FC_ESTABLISH_LINK
;
1826 psli
->sli_flag
&= ~LPFC_SLI2_ACTIVE
;
1827 spin_unlock_irq(phba
->host
->host_lock
);
1830 /* Take device offline; this will perform cleanup */
1832 lpfc_sli_brdrestart(phba
);
1834 return PCI_ERS_RESULT_RECOVERED
;
1838 * lpfc_io_resume - called when traffic can start flowing again.
1839 * @pdev: Pointer to PCI device
1841 * This callback is called when the error recovery driver tells us that
1842 * its OK to resume normal operation.
1844 static void lpfc_io_resume(struct pci_dev
*pdev
)
1846 struct Scsi_Host
*host
= pci_get_drvdata(pdev
);
1847 struct lpfc_hba
*phba
= (struct lpfc_hba
*)host
->hostdata
;
1849 if (lpfc_online(phba
) == 0) {
1850 mod_timer(&phba
->fc_estabtmo
, jiffies
+ HZ
* 60);
1854 static struct pci_device_id lpfc_id_table
[] = {
1855 {PCI_VENDOR_ID_EMULEX
, PCI_DEVICE_ID_VIPER
,
1856 PCI_ANY_ID
, PCI_ANY_ID
, },
1857 {PCI_VENDOR_ID_EMULEX
, PCI_DEVICE_ID_FIREFLY
,
1858 PCI_ANY_ID
, PCI_ANY_ID
, },
1859 {PCI_VENDOR_ID_EMULEX
, PCI_DEVICE_ID_THOR
,
1860 PCI_ANY_ID
, PCI_ANY_ID
, },
1861 {PCI_VENDOR_ID_EMULEX
, PCI_DEVICE_ID_PEGASUS
,
1862 PCI_ANY_ID
, PCI_ANY_ID
, },
1863 {PCI_VENDOR_ID_EMULEX
, PCI_DEVICE_ID_CENTAUR
,
1864 PCI_ANY_ID
, PCI_ANY_ID
, },
1865 {PCI_VENDOR_ID_EMULEX
, PCI_DEVICE_ID_DRAGONFLY
,
1866 PCI_ANY_ID
, PCI_ANY_ID
, },
1867 {PCI_VENDOR_ID_EMULEX
, PCI_DEVICE_ID_SUPERFLY
,
1868 PCI_ANY_ID
, PCI_ANY_ID
, },
1869 {PCI_VENDOR_ID_EMULEX
, PCI_DEVICE_ID_RFLY
,
1870 PCI_ANY_ID
, PCI_ANY_ID
, },
1871 {PCI_VENDOR_ID_EMULEX
, PCI_DEVICE_ID_PFLY
,
1872 PCI_ANY_ID
, PCI_ANY_ID
, },
1873 {PCI_VENDOR_ID_EMULEX
, PCI_DEVICE_ID_NEPTUNE
,
1874 PCI_ANY_ID
, PCI_ANY_ID
, },
1875 {PCI_VENDOR_ID_EMULEX
, PCI_DEVICE_ID_NEPTUNE_SCSP
,
1876 PCI_ANY_ID
, PCI_ANY_ID
, },
1877 {PCI_VENDOR_ID_EMULEX
, PCI_DEVICE_ID_NEPTUNE_DCSP
,
1878 PCI_ANY_ID
, PCI_ANY_ID
, },
1879 {PCI_VENDOR_ID_EMULEX
, PCI_DEVICE_ID_HELIOS
,
1880 PCI_ANY_ID
, PCI_ANY_ID
, },
1881 {PCI_VENDOR_ID_EMULEX
, PCI_DEVICE_ID_HELIOS_SCSP
,
1882 PCI_ANY_ID
, PCI_ANY_ID
, },
1883 {PCI_VENDOR_ID_EMULEX
, PCI_DEVICE_ID_HELIOS_DCSP
,
1884 PCI_ANY_ID
, PCI_ANY_ID
, },
1885 {PCI_VENDOR_ID_EMULEX
, PCI_DEVICE_ID_BMID
,
1886 PCI_ANY_ID
, PCI_ANY_ID
, },
1887 {PCI_VENDOR_ID_EMULEX
, PCI_DEVICE_ID_BSMB
,
1888 PCI_ANY_ID
, PCI_ANY_ID
, },
1889 {PCI_VENDOR_ID_EMULEX
, PCI_DEVICE_ID_ZEPHYR
,
1890 PCI_ANY_ID
, PCI_ANY_ID
, },
1891 {PCI_VENDOR_ID_EMULEX
, PCI_DEVICE_ID_ZEPHYR_SCSP
,
1892 PCI_ANY_ID
, PCI_ANY_ID
, },
1893 {PCI_VENDOR_ID_EMULEX
, PCI_DEVICE_ID_ZEPHYR_DCSP
,
1894 PCI_ANY_ID
, PCI_ANY_ID
, },
1895 {PCI_VENDOR_ID_EMULEX
, PCI_DEVICE_ID_ZMID
,
1896 PCI_ANY_ID
, PCI_ANY_ID
, },
1897 {PCI_VENDOR_ID_EMULEX
, PCI_DEVICE_ID_ZSMB
,
1898 PCI_ANY_ID
, PCI_ANY_ID
, },
1899 {PCI_VENDOR_ID_EMULEX
, PCI_DEVICE_ID_TFLY
,
1900 PCI_ANY_ID
, PCI_ANY_ID
, },
1901 {PCI_VENDOR_ID_EMULEX
, PCI_DEVICE_ID_LP101
,
1902 PCI_ANY_ID
, PCI_ANY_ID
, },
1903 {PCI_VENDOR_ID_EMULEX
, PCI_DEVICE_ID_LP10000S
,
1904 PCI_ANY_ID
, PCI_ANY_ID
, },
1905 {PCI_VENDOR_ID_EMULEX
, PCI_DEVICE_ID_LP11000S
,
1906 PCI_ANY_ID
, PCI_ANY_ID
, },
1907 {PCI_VENDOR_ID_EMULEX
, PCI_DEVICE_ID_LPE11000S
,
1908 PCI_ANY_ID
, PCI_ANY_ID
, },
1909 {PCI_VENDOR_ID_EMULEX
, PCI_DEVICE_ID_SAT
,
1910 PCI_ANY_ID
, PCI_ANY_ID
, },
1911 {PCI_VENDOR_ID_EMULEX
, PCI_DEVICE_ID_SAT_MID
,
1912 PCI_ANY_ID
, PCI_ANY_ID
, },
1913 {PCI_VENDOR_ID_EMULEX
, PCI_DEVICE_ID_SAT_SMB
,
1914 PCI_ANY_ID
, PCI_ANY_ID
, },
1915 {PCI_VENDOR_ID_EMULEX
, PCI_DEVICE_ID_SAT_DCSP
,
1916 PCI_ANY_ID
, PCI_ANY_ID
, },
1917 {PCI_VENDOR_ID_EMULEX
, PCI_DEVICE_ID_SAT_SCSP
,
1918 PCI_ANY_ID
, PCI_ANY_ID
, },
1919 {PCI_VENDOR_ID_EMULEX
, PCI_DEVICE_ID_SAT_S
,
1920 PCI_ANY_ID
, PCI_ANY_ID
, },
1924 MODULE_DEVICE_TABLE(pci
, lpfc_id_table
);
1926 static struct pci_error_handlers lpfc_err_handler
= {
1927 .error_detected
= lpfc_io_error_detected
,
1928 .slot_reset
= lpfc_io_slot_reset
,
1929 .resume
= lpfc_io_resume
,
1932 static struct pci_driver lpfc_driver
= {
1933 .name
= LPFC_DRIVER_NAME
,
1934 .id_table
= lpfc_id_table
,
1935 .probe
= lpfc_pci_probe_one
,
1936 .remove
= __devexit_p(lpfc_pci_remove_one
),
1937 .err_handler
= &lpfc_err_handler
,
1945 printk(LPFC_MODULE_DESC
"\n");
1946 printk(LPFC_COPYRIGHT
"\n");
1948 lpfc_transport_template
=
1949 fc_attach_transport(&lpfc_transport_functions
);
1950 if (!lpfc_transport_template
)
1952 error
= pci_register_driver(&lpfc_driver
);
1954 fc_release_transport(lpfc_transport_template
);
1962 pci_unregister_driver(&lpfc_driver
);
1963 fc_release_transport(lpfc_transport_template
);
1966 module_init(lpfc_init
);
1967 module_exit(lpfc_exit
);
1968 MODULE_LICENSE("GPL");
1969 MODULE_DESCRIPTION(LPFC_MODULE_DESC
);
1970 MODULE_AUTHOR("Emulex Corporation - tech.support@emulex.com");
1971 MODULE_VERSION("0:" LPFC_DRIVER_VERSION
);