diff options
author | Sucheta Chakraborty <sucheta.chakraborty@qlogic.com> | 2010-05-12 23:07:48 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-05-14 06:08:01 -0400 |
commit | b3a2464941e32ca58059cba68012105e35ce84af (patch) | |
tree | 1cd60c8732140819958f9acde18960c80586a3cc /drivers/net/qlcnic | |
parent | 96f8118c25ea812335986d96a68441c2bcb01fe0 (diff) |
qlcnic: check device class
pci-func class can be other than ethernet in Qlogic CNA device.
Signed-off-by: Sucheta Chakraborty <sucheta.chakraborty@qlogic.com>
Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/qlcnic')
-rw-r--r-- | drivers/net/qlcnic/qlcnic.h | 2 | ||||
-rw-r--r-- | drivers/net/qlcnic/qlcnic_init.c | 16 | ||||
-rw-r--r-- | drivers/net/qlcnic/qlcnic_main.c | 8 |
3 files changed, 18 insertions, 8 deletions
diff --git a/drivers/net/qlcnic/qlcnic.h b/drivers/net/qlcnic/qlcnic.h index 8a9412fd2ff5..5c89f4e4635b 100644 --- a/drivers/net/qlcnic/qlcnic.h +++ b/drivers/net/qlcnic/qlcnic.h | |||
@@ -1037,7 +1037,7 @@ int qlcnic_need_fw_reset(struct qlcnic_adapter *adapter); | |||
1037 | void qlcnic_request_firmware(struct qlcnic_adapter *adapter); | 1037 | void qlcnic_request_firmware(struct qlcnic_adapter *adapter); |
1038 | void qlcnic_release_firmware(struct qlcnic_adapter *adapter); | 1038 | void qlcnic_release_firmware(struct qlcnic_adapter *adapter); |
1039 | int qlcnic_pinit_from_rom(struct qlcnic_adapter *adapter); | 1039 | int qlcnic_pinit_from_rom(struct qlcnic_adapter *adapter); |
1040 | void qlcnic_setup_idc_param(struct qlcnic_adapter *adapter); | 1040 | int qlcnic_setup_idc_param(struct qlcnic_adapter *adapter); |
1041 | 1041 | ||
1042 | int qlcnic_rom_fast_read(struct qlcnic_adapter *adapter, int addr, int *valp); | 1042 | int qlcnic_rom_fast_read(struct qlcnic_adapter *adapter, int addr, int *valp); |
1043 | int qlcnic_rom_fast_read_words(struct qlcnic_adapter *adapter, int addr, | 1043 | int qlcnic_rom_fast_read_words(struct qlcnic_adapter *adapter, int addr, |
diff --git a/drivers/net/qlcnic/qlcnic_init.c b/drivers/net/qlcnic/qlcnic_init.c index c4bef57b9cd0..77bfdaba83e8 100644 --- a/drivers/net/qlcnic/qlcnic_init.c +++ b/drivers/net/qlcnic/qlcnic_init.c | |||
@@ -514,10 +514,22 @@ int qlcnic_pinit_from_rom(struct qlcnic_adapter *adapter) | |||
514 | return 0; | 514 | return 0; |
515 | } | 515 | } |
516 | 516 | ||
517 | void | 517 | int |
518 | qlcnic_setup_idc_param(struct qlcnic_adapter *adapter) { | 518 | qlcnic_setup_idc_param(struct qlcnic_adapter *adapter) { |
519 | 519 | ||
520 | int timeo; | 520 | int timeo; |
521 | u32 val; | ||
522 | |||
523 | val = QLCRD32(adapter, QLCNIC_CRB_DEV_PARTITION_INFO); | ||
524 | val = (val >> (adapter->portnum * 4)) & 0xf; | ||
525 | |||
526 | if ((val & 0x3) != 1) { | ||
527 | dev_err(&adapter->pdev->dev, "Not an Ethernet NIC func=%u\n", | ||
528 | val); | ||
529 | return -EIO; | ||
530 | } | ||
531 | |||
532 | adapter->physical_port = (val >> 2); | ||
521 | 533 | ||
522 | if (qlcnic_rom_fast_read(adapter, QLCNIC_ROM_DEV_INIT_TIMEOUT, &timeo)) | 534 | if (qlcnic_rom_fast_read(adapter, QLCNIC_ROM_DEV_INIT_TIMEOUT, &timeo)) |
523 | timeo = 30; | 535 | timeo = 30; |
@@ -528,6 +540,8 @@ qlcnic_setup_idc_param(struct qlcnic_adapter *adapter) { | |||
528 | timeo = 10; | 540 | timeo = 10; |
529 | 541 | ||
530 | adapter->reset_ack_timeo = timeo; | 542 | adapter->reset_ack_timeo = timeo; |
543 | |||
544 | return 0; | ||
531 | } | 545 | } |
532 | 546 | ||
533 | static int | 547 | static int |
diff --git a/drivers/net/qlcnic/qlcnic_main.c b/drivers/net/qlcnic/qlcnic_main.c index 54a6bb20ec07..79c6e0517bad 100644 --- a/drivers/net/qlcnic/qlcnic_main.c +++ b/drivers/net/qlcnic/qlcnic_main.c | |||
@@ -1080,17 +1080,13 @@ qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1080 | goto err_out_iounmap; | 1080 | goto err_out_iounmap; |
1081 | } | 1081 | } |
1082 | 1082 | ||
1083 | qlcnic_setup_idc_param(adapter); | 1083 | if (qlcnic_setup_idc_param(adapter)) |
1084 | goto err_out_iounmap; | ||
1084 | 1085 | ||
1085 | err = qlcnic_start_firmware(adapter); | 1086 | err = qlcnic_start_firmware(adapter); |
1086 | if (err) | 1087 | if (err) |
1087 | goto err_out_decr_ref; | 1088 | goto err_out_decr_ref; |
1088 | 1089 | ||
1089 | /* | ||
1090 | * See if the firmware gave us a virtual-physical port mapping. | ||
1091 | */ | ||
1092 | adapter->physical_port = adapter->portnum; | ||
1093 | |||
1094 | qlcnic_clear_stats(adapter); | 1090 | qlcnic_clear_stats(adapter); |
1095 | 1091 | ||
1096 | qlcnic_setup_intr(adapter); | 1092 | qlcnic_setup_intr(adapter); |