aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/lpfc/lpfc_init.c
diff options
context:
space:
mode:
authorJames Smart <James.Smart@Emulex.Com>2007-06-17 20:56:37 -0400
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>2007-06-17 23:06:27 -0400
commited957684294618602b48f1950b0c9bbcb036583f (patch)
tree4e88dbb2e55013f973ad94099e2963dd507ea719 /drivers/scsi/lpfc/lpfc_init.c
parent2e0fef85e098f6794956b8b80b111179fbb4cbb7 (diff)
[SCSI] lpfc: NPIV: add SLI-3 interface
NPIV support is only available via new adapter interface extensions, termed SLI-3. This interface changes some of the basic behaviors such as command and response ring element sizes and data structures, as well as a change in buffer posting. Note: the new firmware extensions are found only on our mid-range and enterprise 4Gig adapters - so NPIV support is available only on these newer adapters. The latest firmware can be downloaded from the Emulex support page. Signed-off-by: James Smart <James.Smart@emulex.com> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_init.c')
-rw-r--r--drivers/scsi/lpfc/lpfc_init.c68
1 files changed, 39 insertions, 29 deletions
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index e11c4cda0f3f..e50c5ad252f9 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -49,6 +49,12 @@ static int lpfc_post_rcv_buf(struct lpfc_hba *);
49static struct scsi_transport_template *lpfc_transport_template = NULL; 49static struct scsi_transport_template *lpfc_transport_template = NULL;
50static DEFINE_IDR(lpfc_hba_index); 50static DEFINE_IDR(lpfc_hba_index);
51 51
52int lpfc_sli_mode = 0;
53module_param(lpfc_sli_mode, int, 0);
54MODULE_PARM_DESC(lpfc_sli_mode, "SLI mode selector:"
55 " 0 - auto (SLI-3 if supported),"
56 " 2 - select SLI-2 even on SLI-3 capable HBAs,"
57 " 3 - select SLI-3");
52 58
53 59
54/************************************************************************/ 60/************************************************************************/
@@ -102,9 +108,7 @@ lpfc_config_port_prep(struct lpfc_hba *phba)
102 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); 108 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL);
103 109
104 if (rc != MBX_SUCCESS) { 110 if (rc != MBX_SUCCESS) {
105 lpfc_printf_log(phba, 111 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX,
106 KERN_ERR,
107 LOG_MBOX,
108 "%d:0324 Config Port initialization " 112 "%d:0324 Config Port initialization "
109 "error, mbxCmd x%x READ_NVPARM, " 113 "error, mbxCmd x%x READ_NVPARM, "
110 "mbxStatus x%x\n", 114 "mbxStatus x%x\n",
@@ -123,9 +127,7 @@ lpfc_config_port_prep(struct lpfc_hba *phba)
123 lpfc_read_rev(phba, pmb); 127 lpfc_read_rev(phba, pmb);
124 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); 128 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL);
125 if (rc != MBX_SUCCESS) { 129 if (rc != MBX_SUCCESS) {
126 lpfc_printf_log(phba, 130 lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
127 KERN_ERR,
128 LOG_INIT,
129 "%d:0439 Adapter failed to init, mbxCmd x%x " 131 "%d:0439 Adapter failed to init, mbxCmd x%x "
130 "READ_REV, mbxStatus x%x\n", 132 "READ_REV, mbxStatus x%x\n",
131 phba->brd_no, 133 phba->brd_no,
@@ -148,6 +150,9 @@ lpfc_config_port_prep(struct lpfc_hba *phba)
148 return -ERESTART; 150 return -ERESTART;
149 } 151 }
150 152
153 if (phba->sli_rev == 3 && !mb->un.varRdRev.v3rsp)
154 return -EINVAL;
155
151 /* Save information as VPD data */ 156 /* Save information as VPD data */
152 vp->rev.rBit = 1; 157 vp->rev.rBit = 1;
153 vp->rev.sli1FwRev = mb->un.varRdRev.sli1FwRev; 158 vp->rev.sli1FwRev = mb->un.varRdRev.sli1FwRev;
@@ -236,10 +241,9 @@ lpfc_config_port_post(struct lpfc_hba *phba)
236 241
237 /* Get login parameters for NID. */ 242 /* Get login parameters for NID. */
238 lpfc_read_sparam(phba, pmb); 243 lpfc_read_sparam(phba, pmb);
244 pmb->vport = vport;
239 if (lpfc_sli_issue_mbox(phba, pmb, MBX_POLL) != MBX_SUCCESS) { 245 if (lpfc_sli_issue_mbox(phba, pmb, MBX_POLL) != MBX_SUCCESS) {
240 lpfc_printf_log(phba, 246 lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
241 KERN_ERR,
242 LOG_INIT,
243 "%d:0448 Adapter failed init, mbxCmd x%x " 247 "%d:0448 Adapter failed init, mbxCmd x%x "
244 "READ_SPARM mbxStatus x%x\n", 248 "READ_SPARM mbxStatus x%x\n",
245 phba->brd_no, 249 phba->brd_no,
@@ -296,10 +300,9 @@ lpfc_config_port_post(struct lpfc_hba *phba)
296 } 300 }
297 301
298 lpfc_read_config(phba, pmb); 302 lpfc_read_config(phba, pmb);
303 pmb->vport = vport;
299 if (lpfc_sli_issue_mbox(phba, pmb, MBX_POLL) != MBX_SUCCESS) { 304 if (lpfc_sli_issue_mbox(phba, pmb, MBX_POLL) != MBX_SUCCESS) {
300 lpfc_printf_log(phba, 305 lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
301 KERN_ERR,
302 LOG_INIT,
303 "%d:0453 Adapter failed to init, mbxCmd x%x " 306 "%d:0453 Adapter failed to init, mbxCmd x%x "
304 "READ_CONFIG, mbxStatus x%x\n", 307 "READ_CONFIG, mbxStatus x%x\n",
305 phba->brd_no, 308 phba->brd_no,
@@ -331,9 +334,7 @@ lpfc_config_port_post(struct lpfc_hba *phba)
331 || ((phba->cfg_link_speed == LINK_SPEED_10G) 334 || ((phba->cfg_link_speed == LINK_SPEED_10G)
332 && !(phba->lmt & LMT_10Gb))) { 335 && !(phba->lmt & LMT_10Gb))) {
333 /* Reset link speed to auto */ 336 /* Reset link speed to auto */
334 lpfc_printf_log(phba, 337 lpfc_printf_log(phba, KERN_WARNING, LOG_LINK_EVENT,
335 KERN_WARNING,
336 LOG_LINK_EVENT,
337 "%d:1302 Invalid speed for this board: " 338 "%d:1302 Invalid speed for this board: "
338 "Reset link speed to auto: x%x\n", 339 "Reset link speed to auto: x%x\n",
339 phba->brd_no, 340 phba->brd_no,
@@ -352,7 +353,8 @@ lpfc_config_port_post(struct lpfc_hba *phba)
352 psli->ring[psli->next_ring].flag |= LPFC_STOP_IOCB_EVENT; 353 psli->ring[psli->next_ring].flag |= LPFC_STOP_IOCB_EVENT;
353 354
354 /* Post receive buffers for desired rings */ 355 /* Post receive buffers for desired rings */
355 lpfc_post_rcv_buf(phba); 356 if (phba->sli_rev != 3)
357 lpfc_post_rcv_buf(phba);
356 358
357 /* Enable appropriate host interrupts */ 359 /* Enable appropriate host interrupts */
358 spin_lock_irq(&phba->hbalock); 360 spin_lock_irq(&phba->hbalock);
@@ -383,12 +385,11 @@ lpfc_config_port_post(struct lpfc_hba *phba)
383 385
384 lpfc_init_link(phba, pmb, phba->cfg_topology, phba->cfg_link_speed); 386 lpfc_init_link(phba, pmb, phba->cfg_topology, phba->cfg_link_speed);
385 pmb->mbox_cmpl = lpfc_sli_def_mbox_cmpl; 387 pmb->mbox_cmpl = lpfc_sli_def_mbox_cmpl;
388 pmb->vport = vport;
386 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT); 389 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT);
387 lpfc_set_loopback_flag(phba); 390 lpfc_set_loopback_flag(phba);
388 if (rc != MBX_SUCCESS) { 391 if (rc != MBX_SUCCESS) {
389 lpfc_printf_log(phba, 392 lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
390 KERN_ERR,
391 LOG_INIT,
392 "%d:0454 Adapter failed to init, mbxCmd x%x " 393 "%d:0454 Adapter failed to init, mbxCmd x%x "
393 "INIT_LINK, mbxStatus x%x\n", 394 "INIT_LINK, mbxStatus x%x\n",
394 phba->brd_no, 395 phba->brd_no,
@@ -630,9 +631,7 @@ lpfc_handle_latt_err_exit:
630 631
631 /* The other case is an error from issue_mbox */ 632 /* The other case is an error from issue_mbox */
632 if (rc == -ENOMEM) 633 if (rc == -ENOMEM)
633 lpfc_printf_log(phba, 634 lpfc_printf_log(phba, KERN_WARNING, LOG_MBOX,
634 KERN_WARNING,
635 LOG_MBOX,
636 "%d:0300 READ_LA: no buffers\n", 635 "%d:0300 READ_LA: no buffers\n",
637 phba->brd_no); 636 phba->brd_no);
638 637
@@ -658,9 +657,7 @@ lpfc_parse_vpd(struct lpfc_hba *phba, uint8_t *vpd, int len)
658 return 0; 657 return 0;
659 658
660 /* Vital Product */ 659 /* Vital Product */
661 lpfc_printf_log(phba, 660 lpfc_printf_log(phba, KERN_INFO, LOG_INIT,
662 KERN_INFO,
663 LOG_INIT,
664 "%d:0455 Vital Product Data: x%x x%x x%x x%x\n", 661 "%d:0455 Vital Product Data: x%x x%x x%x x%x\n",
665 phba->brd_no, 662 phba->brd_no,
666 (uint32_t) vpd[0], (uint32_t) vpd[1], (uint32_t) vpd[2], 663 (uint32_t) vpd[0], (uint32_t) vpd[1], (uint32_t) vpd[2],
@@ -1221,9 +1218,7 @@ lpfc_online(struct lpfc_hba *phba)
1221 if (!(vport->fc_flag & FC_OFFLINE_MODE)) 1218 if (!(vport->fc_flag & FC_OFFLINE_MODE))
1222 return 0; 1219 return 0;
1223 1220
1224 lpfc_printf_log(phba, 1221 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT,
1225 KERN_WARNING,
1226 LOG_INIT,
1227 "%d:0458 Bring Adapter online\n", 1222 "%d:0458 Bring Adapter online\n",
1228 phba->brd_no); 1223 phba->brd_no);
1229 1224
@@ -1633,13 +1628,22 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid)
1633 1628
1634 memset(phba->slim2p, 0, SLI2_SLIM_SIZE); 1629 memset(phba->slim2p, 0, SLI2_SLIM_SIZE);
1635 1630
1631 phba->hbqslimp.virt = dma_alloc_coherent(&phba->pcidev->dev,
1632 lpfc_sli_hbq_size(),
1633 &phba->hbqslimp.phys,
1634 GFP_KERNEL);
1635 if (!phba->hbqslimp.virt)
1636 goto out_free_slim;
1637
1638 memset(phba->hbqslimp.virt, 0, lpfc_sli_hbq_size());
1639
1636 /* Initialize the SLI Layer to run with lpfc HBAs. */ 1640 /* Initialize the SLI Layer to run with lpfc HBAs. */
1637 lpfc_sli_setup(phba); 1641 lpfc_sli_setup(phba);
1638 lpfc_sli_queue_setup(phba); 1642 lpfc_sli_queue_setup(phba);
1639 1643
1640 error = lpfc_mem_alloc(phba); 1644 error = lpfc_mem_alloc(phba);
1641 if (error) 1645 if (error)
1642 goto out_free_slim; 1646 goto out_free_hbqslimp;
1643 1647
1644 /* Initialize and populate the iocb list per host. */ 1648 /* Initialize and populate the iocb list per host. */
1645 INIT_LIST_HEAD(&phba->lpfc_iocb_list); 1649 INIT_LIST_HEAD(&phba->lpfc_iocb_list);
@@ -1753,6 +1757,9 @@ out_free_iocbq:
1753 phba->total_iocbq_bufs--; 1757 phba->total_iocbq_bufs--;
1754 } 1758 }
1755 lpfc_mem_free(phba); 1759 lpfc_mem_free(phba);
1760out_free_hbqslimp:
1761 dma_free_coherent(&pdev->dev, lpfc_sli_hbq_size(), phba->hbqslimp.virt,
1762 phba->hbqslimp.phys);
1756out_free_slim: 1763out_free_slim:
1757 dma_free_coherent(&pdev->dev, SLI2_SLIM_SIZE, phba->slim2p, 1764 dma_free_coherent(&pdev->dev, SLI2_SLIM_SIZE, phba->slim2p,
1758 phba->slim2p_mapping); 1765 phba->slim2p_mapping);
@@ -1811,6 +1818,9 @@ lpfc_pci_remove_one(struct pci_dev *pdev)
1811 lpfc_scsi_free(phba); 1818 lpfc_scsi_free(phba);
1812 lpfc_mem_free(phba); 1819 lpfc_mem_free(phba);
1813 1820
1821 dma_free_coherent(&pdev->dev, lpfc_sli_hbq_size(), phba->hbqslimp.virt,
1822 phba->hbqslimp.phys);
1823
1814 /* Free resources associated with SLI2 interface */ 1824 /* Free resources associated with SLI2 interface */
1815 dma_free_coherent(&pdev->dev, SLI2_SLIM_SIZE, 1825 dma_free_coherent(&pdev->dev, SLI2_SLIM_SIZE,
1816 phba->slim2p, phba->slim2p_mapping); 1826 phba->slim2p, phba->slim2p_mapping);