aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/bfa/bfad.c
diff options
context:
space:
mode:
authorKrishna Gudipati <kgudipat@brocade.com>2011-06-13 18:50:35 -0400
committerJames Bottomley <JBottomley@Parallels.com>2011-06-29 16:31:31 -0400
commit111892082ed7a3214bc7a7ec6b8b20e8f847501a (patch)
treefb4950f69aaf7c2bf07ce8987884bb52aa497ffa /drivers/scsi/bfa/bfad.c
parent43ffdf4dfb827babcdca5345a76031598a985dc8 (diff)
[SCSI] bfa: Brocade-1860 Fabric Adapter Hardware Enablement
- Added support for Brocade-1860 Fabric Adapter. - Made changes to support single firmware image per asic type. - Combined bfi_cbreg.h and bfi_ctreg.h defines into bfi_reg.h with only minimal defines used by host. - Added changes to setup CPE/RME Queue register offsets based on firmware response. - Removed queue register offset initializations and added register offsets to BFI config response message. - Added Brocade-1860 asic specific interrupt status definitions and mailbox interfaces. Signed-off-by: Krishna Gudipati <kgudipat@brocade.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/bfa/bfad.c')
-rw-r--r--drivers/scsi/bfa/bfad.c81
1 files changed, 46 insertions, 35 deletions
diff --git a/drivers/scsi/bfa/bfad.c b/drivers/scsi/bfa/bfad.c
index 59b5e9b61d71..8ddae0d85fa8 100644
--- a/drivers/scsi/bfa/bfad.c
+++ b/drivers/scsi/bfa/bfad.c
@@ -58,12 +58,12 @@ int bfa_debugfs_enable = 1;
58int msix_disable_cb = 0, msix_disable_ct = 0; 58int msix_disable_cb = 0, msix_disable_ct = 0;
59 59
60/* Firmware releated */ 60/* Firmware releated */
61u32 bfi_image_ct_fc_size, bfi_image_ct_cna_size, bfi_image_cb_fc_size; 61u32 bfi_image_cb_size, bfi_image_ct_size, bfi_image_ct2_size;
62u32 *bfi_image_ct_fc, *bfi_image_ct_cna, *bfi_image_cb_fc; 62u32 *bfi_image_cb, *bfi_image_ct, *bfi_image_ct2;
63 63
64#define BFAD_FW_FILE_CT_FC "ctfw_fc.bin" 64#define BFAD_FW_FILE_CB "cbfw.bin"
65#define BFAD_FW_FILE_CT_CNA "ctfw_cna.bin" 65#define BFAD_FW_FILE_CT "ctfw.bin"
66#define BFAD_FW_FILE_CB_FC "cbfw_fc.bin" 66#define BFAD_FW_FILE_CT2 "ct2fw.bin"
67 67
68static u32 *bfad_load_fwimg(struct pci_dev *pdev); 68static u32 *bfad_load_fwimg(struct pci_dev *pdev);
69static void bfad_free_fwimg(void); 69static void bfad_free_fwimg(void);
@@ -71,18 +71,18 @@ static void bfad_read_firmware(struct pci_dev *pdev, u32 **bfi_image,
71 u32 *bfi_image_size, char *fw_name); 71 u32 *bfi_image_size, char *fw_name);
72 72
73static const char *msix_name_ct[] = { 73static const char *msix_name_ct[] = {
74 "ctrl",
74 "cpe0", "cpe1", "cpe2", "cpe3", 75 "cpe0", "cpe1", "cpe2", "cpe3",
75 "rme0", "rme1", "rme2", "rme3", 76 "rme0", "rme1", "rme2", "rme3" };
76 "ctrl" };
77 77
78static const char *msix_name_cb[] = { 78static const char *msix_name_cb[] = {
79 "cpe0", "cpe1", "cpe2", "cpe3", 79 "cpe0", "cpe1", "cpe2", "cpe3",
80 "rme0", "rme1", "rme2", "rme3", 80 "rme0", "rme1", "rme2", "rme3",
81 "eemc", "elpu0", "elpu1", "epss", "mlpu" }; 81 "eemc", "elpu0", "elpu1", "epss", "mlpu" };
82 82
83MODULE_FIRMWARE(BFAD_FW_FILE_CT_FC); 83MODULE_FIRMWARE(BFAD_FW_FILE_CB);
84MODULE_FIRMWARE(BFAD_FW_FILE_CT_CNA); 84MODULE_FIRMWARE(BFAD_FW_FILE_CT);
85MODULE_FIRMWARE(BFAD_FW_FILE_CB_FC); 85MODULE_FIRMWARE(BFAD_FW_FILE_CT2);
86 86
87module_param(os_name, charp, S_IRUGO | S_IWUSR); 87module_param(os_name, charp, S_IRUGO | S_IWUSR);
88MODULE_PARM_DESC(os_name, "OS name of the hba host machine"); 88MODULE_PARM_DESC(os_name, "OS name of the hba host machine");
@@ -787,6 +787,7 @@ bfad_pci_init(struct pci_dev *pdev, struct bfad_s *bfad)
787 } 787 }
788 788
789 bfad->pci_bar0_kva = pci_iomap(pdev, 0, pci_resource_len(pdev, 0)); 789 bfad->pci_bar0_kva = pci_iomap(pdev, 0, pci_resource_len(pdev, 0));
790 bfad->pci_bar2_kva = pci_iomap(pdev, 2, pci_resource_len(pdev, 2));
790 791
791 if (bfad->pci_bar0_kva == NULL) { 792 if (bfad->pci_bar0_kva == NULL) {
792 printk(KERN_ERR "Fail to map bar0\n"); 793 printk(KERN_ERR "Fail to map bar0\n");
@@ -868,6 +869,7 @@ void
868bfad_pci_uninit(struct pci_dev *pdev, struct bfad_s *bfad) 869bfad_pci_uninit(struct pci_dev *pdev, struct bfad_s *bfad)
869{ 870{
870 pci_iounmap(pdev, bfad->pci_bar0_kva); 871 pci_iounmap(pdev, bfad->pci_bar0_kva);
872 pci_iounmap(pdev, bfad->pci_bar2_kva);
871 pci_release_regions(pdev); 873 pci_release_regions(pdev);
872 pci_disable_device(pdev); 874 pci_disable_device(pdev);
873 pci_set_drvdata(pdev, NULL); 875 pci_set_drvdata(pdev, NULL);
@@ -1233,8 +1235,8 @@ bfad_install_msix_handler(struct bfad_s *bfad)
1233 for (i = 0; i < bfad->nvec; i++) { 1235 for (i = 0; i < bfad->nvec; i++) {
1234 sprintf(bfad->msix_tab[i].name, "bfa-%s-%s", 1236 sprintf(bfad->msix_tab[i].name, "bfa-%s-%s",
1235 bfad->pci_name, 1237 bfad->pci_name,
1236 ((bfa_asic_id_ct(bfad->hal_pcidev.device_id)) ? 1238 ((bfa_asic_id_cb(bfad->hal_pcidev.device_id)) ?
1237 msix_name_ct[i] : msix_name_cb[i])); 1239 msix_name_cb[i] : msix_name_ct[i]));
1238 1240
1239 error = request_irq(bfad->msix_tab[i].msix.vector, 1241 error = request_irq(bfad->msix_tab[i].msix.vector,
1240 (irq_handler_t) bfad_msix, 0, 1242 (irq_handler_t) bfad_msix, 0,
@@ -1272,8 +1274,8 @@ bfad_setup_intr(struct bfad_s *bfad)
1272 /* Set up the msix entry table */ 1274 /* Set up the msix entry table */
1273 bfad_init_msix_entry(bfad, msix_entries, mask, max_bit); 1275 bfad_init_msix_entry(bfad, msix_entries, mask, max_bit);
1274 1276
1275 if ((bfa_asic_id_ct(pdev->device) && !msix_disable_ct) || 1277 if ((bfa_asic_id_ctc(pdev->device) && !msix_disable_ct) ||
1276 (!bfa_asic_id_ct(pdev->device) && !msix_disable_cb)) { 1278 (bfa_asic_id_cb(pdev->device) && !msix_disable_cb)) {
1277 1279
1278 error = pci_enable_msix(bfad->pcidev, msix_entries, bfad->nvec); 1280 error = pci_enable_msix(bfad->pcidev, msix_entries, bfad->nvec);
1279 if (error) { 1281 if (error) {
@@ -1346,7 +1348,8 @@ bfad_pci_probe(struct pci_dev *pdev, const struct pci_device_id *pid)
1346 int error = -ENODEV, retval; 1348 int error = -ENODEV, retval;
1347 1349
1348 /* For single port cards - only claim function 0 */ 1350 /* For single port cards - only claim function 0 */
1349 if ((pdev->device == BFA_PCI_DEVICE_ID_FC_8G1P) && 1351 if ((pdev->device == BFA_PCI_DEVICE_ID_FC_8G1P ||
1352 pdev->device == BFA_PCI_DEVICE_ID_CT2) &&
1350 (PCI_FUNC(pdev->devfn) != 0)) 1353 (PCI_FUNC(pdev->devfn) != 0))
1351 return -ENODEV; 1354 return -ENODEV;
1352 1355
@@ -1501,6 +1504,14 @@ struct pci_device_id bfad_id_table[] = {
1501 .class = (PCI_CLASS_SERIAL_FIBER << 8), 1504 .class = (PCI_CLASS_SERIAL_FIBER << 8),
1502 .class_mask = ~0, 1505 .class_mask = ~0,
1503 }, 1506 },
1507 {
1508 .vendor = BFA_PCI_VENDOR_ID_BROCADE,
1509 .device = BFA_PCI_DEVICE_ID_CT2,
1510 .subvendor = PCI_ANY_ID,
1511 .subdevice = PCI_ANY_ID,
1512 .class = (PCI_CLASS_SERIAL_FIBER << 8),
1513 .class_mask = ~0,
1514 },
1504 1515
1505 {0, 0}, 1516 {0, 0},
1506}; 1517};
@@ -1594,33 +1605,33 @@ out:
1594static u32 * 1605static u32 *
1595bfad_load_fwimg(struct pci_dev *pdev) 1606bfad_load_fwimg(struct pci_dev *pdev)
1596{ 1607{
1597 if (pdev->device == BFA_PCI_DEVICE_ID_CT_FC) { 1608 if (pdev->device == BFA_PCI_DEVICE_ID_CT2) {
1598 if (bfi_image_ct_fc_size == 0) 1609 if (bfi_image_ct2_size == 0)
1599 bfad_read_firmware(pdev, &bfi_image_ct_fc, 1610 bfad_read_firmware(pdev, &bfi_image_ct2,
1600 &bfi_image_ct_fc_size, BFAD_FW_FILE_CT_FC); 1611 &bfi_image_ct2_size, BFAD_FW_FILE_CT2);
1601 return bfi_image_ct_fc; 1612 return bfi_image_ct2;
1602 } else if (pdev->device == BFA_PCI_DEVICE_ID_CT) { 1613 } else if (bfa_asic_id_ct(pdev->device)) {
1603 if (bfi_image_ct_cna_size == 0) 1614 if (bfi_image_ct_size == 0)
1604 bfad_read_firmware(pdev, &bfi_image_ct_cna, 1615 bfad_read_firmware(pdev, &bfi_image_ct,
1605 &bfi_image_ct_cna_size, BFAD_FW_FILE_CT_CNA); 1616 &bfi_image_ct_size, BFAD_FW_FILE_CT);
1606 return bfi_image_ct_cna; 1617 return bfi_image_ct;
1607 } else { 1618 } else {
1608 if (bfi_image_cb_fc_size == 0) 1619 if (bfi_image_cb_size == 0)
1609 bfad_read_firmware(pdev, &bfi_image_cb_fc, 1620 bfad_read_firmware(pdev, &bfi_image_cb,
1610 &bfi_image_cb_fc_size, BFAD_FW_FILE_CB_FC); 1621 &bfi_image_cb_size, BFAD_FW_FILE_CB);
1611 return bfi_image_cb_fc; 1622 return bfi_image_cb;
1612 } 1623 }
1613} 1624}
1614 1625
1615static void 1626static void
1616bfad_free_fwimg(void) 1627bfad_free_fwimg(void)
1617{ 1628{
1618 if (bfi_image_ct_fc_size && bfi_image_ct_fc) 1629 if (bfi_image_ct2_size && bfi_image_ct2)
1619 vfree(bfi_image_ct_fc); 1630 vfree(bfi_image_ct2);
1620 if (bfi_image_ct_cna_size && bfi_image_ct_cna) 1631 if (bfi_image_ct_size && bfi_image_ct)
1621 vfree(bfi_image_ct_cna); 1632 vfree(bfi_image_ct);
1622 if (bfi_image_cb_fc_size && bfi_image_cb_fc) 1633 if (bfi_image_cb_size && bfi_image_cb)
1623 vfree(bfi_image_cb_fc); 1634 vfree(bfi_image_cb);
1624} 1635}
1625 1636
1626module_init(bfad_init); 1637module_init(bfad_init);