aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEddie Wai <eddie.wai@broadcom.com>2012-10-15 20:31:37 -0400
committerJames Bottomley <JBottomley@Parallels.com>2012-11-26 23:59:43 -0500
commitb83908ce845311061eaabf2d8dc9b182907dbc5f (patch)
tree2aa1b2242fb37c64a5891be1149aa4c62e82376c
parent9a07da9f1f40a6e569794d074ca71b7c1cf77d17 (diff)
[SCSI] bnx2i: removed the individual PCI DEVICE ID checking
Removed the individual PCI DEVICE ID checking inside bnx2i. The device type can easily be read from the corresponding cnic->flags. This will free bnx2i from having to get updated for every new device ID that gets added. Signed-off-by: Eddie Wai <eddie.wai@broadcom.com> Acked-by: Michael Chan <mchan@broadcom.com> Reviewed-by: Mike Christie <michaelc@cs.wisc.edu> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
-rw-r--r--drivers/scsi/bnx2i/bnx2i.h2
-rw-r--r--drivers/scsi/bnx2i/bnx2i_init.c43
-rw-r--r--drivers/scsi/bnx2i/bnx2i_iscsi.c2
3 files changed, 19 insertions, 28 deletions
diff --git a/drivers/scsi/bnx2i/bnx2i.h b/drivers/scsi/bnx2i/bnx2i.h
index 3f9e7061258e..b44d04e41b0d 100644
--- a/drivers/scsi/bnx2i/bnx2i.h
+++ b/drivers/scsi/bnx2i/bnx2i.h
@@ -800,7 +800,7 @@ extern struct device_attribute *bnx2i_dev_attributes[];
800/* 800/*
801 * Function Prototypes 801 * Function Prototypes
802 */ 802 */
803extern void bnx2i_identify_device(struct bnx2i_hba *hba); 803extern void bnx2i_identify_device(struct bnx2i_hba *hba, struct cnic_dev *dev);
804 804
805extern void bnx2i_ulp_init(struct cnic_dev *dev); 805extern void bnx2i_ulp_init(struct cnic_dev *dev);
806extern void bnx2i_ulp_exit(struct cnic_dev *dev); 806extern void bnx2i_ulp_exit(struct cnic_dev *dev);
diff --git a/drivers/scsi/bnx2i/bnx2i_init.c b/drivers/scsi/bnx2i/bnx2i_init.c
index b17637aab9a7..ee009e4ad097 100644
--- a/drivers/scsi/bnx2i/bnx2i_init.c
+++ b/drivers/scsi/bnx2i/bnx2i_init.c
@@ -79,42 +79,33 @@ static struct notifier_block bnx2i_cpu_notifier = {
79/** 79/**
80 * bnx2i_identify_device - identifies NetXtreme II device type 80 * bnx2i_identify_device - identifies NetXtreme II device type
81 * @hba: Adapter structure pointer 81 * @hba: Adapter structure pointer
82 * @cnic: Corresponding cnic device
82 * 83 *
83 * This function identifies the NX2 device type and sets appropriate 84 * This function identifies the NX2 device type and sets appropriate
84 * queue mailbox register access method, 5709 requires driver to 85 * queue mailbox register access method, 5709 requires driver to
85 * access MBOX regs using *bin* mode 86 * access MBOX regs using *bin* mode
86 */ 87 */
87void bnx2i_identify_device(struct bnx2i_hba *hba) 88void bnx2i_identify_device(struct bnx2i_hba *hba, struct cnic_dev *dev)
88{ 89{
89 hba->cnic_dev_type = 0; 90 hba->cnic_dev_type = 0;
90 if ((hba->pci_did == PCI_DEVICE_ID_NX2_5706) || 91 if (test_bit(CNIC_F_BNX2_CLASS, &dev->flags)) {
91 (hba->pci_did == PCI_DEVICE_ID_NX2_5706S)) 92 if (hba->pci_did == PCI_DEVICE_ID_NX2_5706 ||
92 set_bit(BNX2I_NX2_DEV_5706, &hba->cnic_dev_type); 93 hba->pci_did == PCI_DEVICE_ID_NX2_5706S) {
93 else if ((hba->pci_did == PCI_DEVICE_ID_NX2_5708) || 94 set_bit(BNX2I_NX2_DEV_5706, &hba->cnic_dev_type);
94 (hba->pci_did == PCI_DEVICE_ID_NX2_5708S)) 95 } else if (hba->pci_did == PCI_DEVICE_ID_NX2_5708 ||
95 set_bit(BNX2I_NX2_DEV_5708, &hba->cnic_dev_type); 96 hba->pci_did == PCI_DEVICE_ID_NX2_5708S) {
96 else if ((hba->pci_did == PCI_DEVICE_ID_NX2_5709) || 97 set_bit(BNX2I_NX2_DEV_5708, &hba->cnic_dev_type);
97 (hba->pci_did == PCI_DEVICE_ID_NX2_5709S)) { 98 } else if (hba->pci_did == PCI_DEVICE_ID_NX2_5709 ||
98 set_bit(BNX2I_NX2_DEV_5709, &hba->cnic_dev_type); 99 hba->pci_did == PCI_DEVICE_ID_NX2_5709S) {
99 hba->mail_queue_access = BNX2I_MQ_BIN_MODE; 100 set_bit(BNX2I_NX2_DEV_5709, &hba->cnic_dev_type);
100 } else if (hba->pci_did == PCI_DEVICE_ID_NX2_57710 || 101 hba->mail_queue_access = BNX2I_MQ_BIN_MODE;
101 hba->pci_did == PCI_DEVICE_ID_NX2_57711 || 102 }
102 hba->pci_did == PCI_DEVICE_ID_NX2_57711E || 103 } else if (test_bit(CNIC_F_BNX2X_CLASS, &dev->flags)) {
103 hba->pci_did == PCI_DEVICE_ID_NX2_57712 ||
104 hba->pci_did == PCI_DEVICE_ID_NX2_57712E ||
105 hba->pci_did == PCI_DEVICE_ID_NX2_57800 ||
106 hba->pci_did == PCI_DEVICE_ID_NX2_57800_MF ||
107 hba->pci_did == PCI_DEVICE_ID_NX2_57800_VF ||
108 hba->pci_did == PCI_DEVICE_ID_NX2_57810 ||
109 hba->pci_did == PCI_DEVICE_ID_NX2_57810_MF ||
110 hba->pci_did == PCI_DEVICE_ID_NX2_57810_VF ||
111 hba->pci_did == PCI_DEVICE_ID_NX2_57840 ||
112 hba->pci_did == PCI_DEVICE_ID_NX2_57840_MF ||
113 hba->pci_did == PCI_DEVICE_ID_NX2_57840_VF)
114 set_bit(BNX2I_NX2_DEV_57710, &hba->cnic_dev_type); 104 set_bit(BNX2I_NX2_DEV_57710, &hba->cnic_dev_type);
115 else 105 } else {
116 printk(KERN_ALERT "bnx2i: unknown device, 0x%x\n", 106 printk(KERN_ALERT "bnx2i: unknown device, 0x%x\n",
117 hba->pci_did); 107 hba->pci_did);
108 }
118} 109}
119 110
120 111
diff --git a/drivers/scsi/bnx2i/bnx2i_iscsi.c b/drivers/scsi/bnx2i/bnx2i_iscsi.c
index 3b34c13e2f02..0056e47bd56e 100644
--- a/drivers/scsi/bnx2i/bnx2i_iscsi.c
+++ b/drivers/scsi/bnx2i/bnx2i_iscsi.c
@@ -808,7 +808,7 @@ struct bnx2i_hba *bnx2i_alloc_hba(struct cnic_dev *cnic)
808 hba->pci_func = PCI_FUNC(hba->pcidev->devfn); 808 hba->pci_func = PCI_FUNC(hba->pcidev->devfn);
809 hba->pci_devno = PCI_SLOT(hba->pcidev->devfn); 809 hba->pci_devno = PCI_SLOT(hba->pcidev->devfn);
810 810
811 bnx2i_identify_device(hba); 811 bnx2i_identify_device(hba, cnic);
812 bnx2i_setup_host_queue_size(hba, shost); 812 bnx2i_setup_host_queue_size(hba, shost);
813 813
814 hba->reg_base = pci_resource_start(hba->pcidev, 0); 814 hba->reg_base = pci_resource_start(hba->pcidev, 0);