aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/bfa/bfad.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/bfa/bfad.c')
-rw-r--r--drivers/scsi/bfa/bfad.c39
1 files changed, 29 insertions, 10 deletions
diff --git a/drivers/scsi/bfa/bfad.c b/drivers/scsi/bfa/bfad.c
index 0fd510a01561..d9360bf18d33 100644
--- a/drivers/scsi/bfa/bfad.c
+++ b/drivers/scsi/bfa/bfad.c
@@ -57,9 +57,19 @@ int pcie_max_read_reqsz;
57int bfa_debugfs_enable = 1; 57int 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 */
60u32 bfi_image_ct_fc_size, bfi_image_ct_cna_size, bfi_image_cb_fc_size; 61u32 bfi_image_ct_fc_size, bfi_image_ct_cna_size, bfi_image_cb_fc_size;
61u32 *bfi_image_ct_fc, *bfi_image_ct_cna, *bfi_image_cb_fc; 62u32 *bfi_image_ct_fc, *bfi_image_ct_cna, *bfi_image_cb_fc;
62 63
64#define BFAD_FW_FILE_CT_FC "ctfw_fc.bin"
65#define BFAD_FW_FILE_CT_CNA "ctfw_cna.bin"
66#define BFAD_FW_FILE_CB_FC "cbfw_fc.bin"
67
68static u32 *bfad_load_fwimg(struct pci_dev *pdev);
69static void bfad_free_fwimg(void);
70static void bfad_read_firmware(struct pci_dev *pdev, u32 **bfi_image,
71 u32 *bfi_image_size, char *fw_name);
72
63static const char *msix_name_ct[] = { 73static const char *msix_name_ct[] = {
64 "cpe0", "cpe1", "cpe2", "cpe3", 74 "cpe0", "cpe1", "cpe2", "cpe3",
65 "rme0", "rme1", "rme2", "rme3", 75 "rme0", "rme1", "rme2", "rme3",
@@ -1550,7 +1560,7 @@ bfad_exit(void)
1550} 1560}
1551 1561
1552/* Firmware handling */ 1562/* Firmware handling */
1553u32 * 1563static void
1554bfad_read_firmware(struct pci_dev *pdev, u32 **bfi_image, 1564bfad_read_firmware(struct pci_dev *pdev, u32 **bfi_image,
1555 u32 *bfi_image_size, char *fw_name) 1565 u32 *bfi_image_size, char *fw_name)
1556{ 1566{
@@ -1558,27 +1568,25 @@ bfad_read_firmware(struct pci_dev *pdev, u32 **bfi_image,
1558 1568
1559 if (request_firmware(&fw, fw_name, &pdev->dev)) { 1569 if (request_firmware(&fw, fw_name, &pdev->dev)) {
1560 printk(KERN_ALERT "Can't locate firmware %s\n", fw_name); 1570 printk(KERN_ALERT "Can't locate firmware %s\n", fw_name);
1561 goto error; 1571 *bfi_image = NULL;
1572 goto out;
1562 } 1573 }
1563 1574
1564 *bfi_image = vmalloc(fw->size); 1575 *bfi_image = vmalloc(fw->size);
1565 if (NULL == *bfi_image) { 1576 if (NULL == *bfi_image) {
1566 printk(KERN_ALERT "Fail to allocate buffer for fw image " 1577 printk(KERN_ALERT "Fail to allocate buffer for fw image "
1567 "size=%x!\n", (u32) fw->size); 1578 "size=%x!\n", (u32) fw->size);
1568 goto error; 1579 goto out;
1569 } 1580 }
1570 1581
1571 memcpy(*bfi_image, fw->data, fw->size); 1582 memcpy(*bfi_image, fw->data, fw->size);
1572 *bfi_image_size = fw->size/sizeof(u32); 1583 *bfi_image_size = fw->size/sizeof(u32);
1573 1584out:
1574 return *bfi_image; 1585 release_firmware(fw);
1575
1576error:
1577 return NULL;
1578} 1586}
1579 1587
1580u32 * 1588static u32 *
1581bfad_get_firmware_buf(struct pci_dev *pdev) 1589bfad_load_fwimg(struct pci_dev *pdev)
1582{ 1590{
1583 if (pdev->device == BFA_PCI_DEVICE_ID_CT_FC) { 1591 if (pdev->device == BFA_PCI_DEVICE_ID_CT_FC) {
1584 if (bfi_image_ct_fc_size == 0) 1592 if (bfi_image_ct_fc_size == 0)
@@ -1598,6 +1606,17 @@ bfad_get_firmware_buf(struct pci_dev *pdev)
1598 } 1606 }
1599} 1607}
1600 1608
1609static void
1610bfad_free_fwimg(void)
1611{
1612 if (bfi_image_ct_fc_size && bfi_image_ct_fc)
1613 vfree(bfi_image_ct_fc);
1614 if (bfi_image_ct_cna_size && bfi_image_ct_cna)
1615 vfree(bfi_image_ct_cna);
1616 if (bfi_image_cb_fc_size && bfi_image_cb_fc)
1617 vfree(bfi_image_cb_fc);
1618}
1619
1601module_init(bfad_init); 1620module_init(bfad_init);
1602module_exit(bfad_exit); 1621module_exit(bfad_exit);
1603MODULE_LICENSE("GPL"); 1622MODULE_LICENSE("GPL");