diff options
author | Ben Hutchings <bhutchings@solarflare.com> | 2012-03-05 10:35:39 -0500 |
---|---|---|
committer | Ben Hutchings <bhutchings@solarflare.com> | 2012-03-06 13:14:16 -0500 |
commit | 460eeaa03c5c0af32a388337a6e1f0f1acd043ce (patch) | |
tree | 6eac9198ba0b43470ac4d643195c7326ea7ac4b1 | |
parent | 58f7e57d11b99575ddb0a3ee9baf7551f10bc3dd (diff) |
sfc: Log the part number on probe
During probe of each port, read and log the part number from VPD.
Remove the Falcon-specific board name lookup.
Initial version by Stuart Hodgson <smhodgson@solarflare.com>.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
-rw-r--r-- | drivers/net/ethernet/sfc/efx.c | 53 | ||||
-rw-r--r-- | drivers/net/ethernet/sfc/falcon_boards.c | 13 | ||||
-rw-r--r-- | drivers/net/ethernet/sfc/nic.h | 4 |
3 files changed, 53 insertions, 17 deletions
diff --git a/drivers/net/ethernet/sfc/efx.c b/drivers/net/ethernet/sfc/efx.c index 7683e53fda1d..3cbfbffe3f00 100644 --- a/drivers/net/ethernet/sfc/efx.c +++ b/drivers/net/ethernet/sfc/efx.c | |||
@@ -2497,6 +2497,57 @@ static void efx_pci_remove(struct pci_dev *pci_dev) | |||
2497 | free_netdev(efx->net_dev); | 2497 | free_netdev(efx->net_dev); |
2498 | }; | 2498 | }; |
2499 | 2499 | ||
2500 | /* NIC VPD information | ||
2501 | * Called during probe to display the part number of the | ||
2502 | * installed NIC. VPD is potentially very large but this should | ||
2503 | * always appear within the first 512 bytes. | ||
2504 | */ | ||
2505 | #define SFC_VPD_LEN 512 | ||
2506 | static void efx_print_product_vpd(struct efx_nic *efx) | ||
2507 | { | ||
2508 | struct pci_dev *dev = efx->pci_dev; | ||
2509 | char vpd_data[SFC_VPD_LEN]; | ||
2510 | ssize_t vpd_size; | ||
2511 | int i, j; | ||
2512 | |||
2513 | /* Get the vpd data from the device */ | ||
2514 | vpd_size = pci_read_vpd(dev, 0, sizeof(vpd_data), vpd_data); | ||
2515 | if (vpd_size <= 0) { | ||
2516 | netif_err(efx, drv, efx->net_dev, "Unable to read VPD\n"); | ||
2517 | return; | ||
2518 | } | ||
2519 | |||
2520 | /* Get the Read only section */ | ||
2521 | i = pci_vpd_find_tag(vpd_data, 0, vpd_size, PCI_VPD_LRDT_RO_DATA); | ||
2522 | if (i < 0) { | ||
2523 | netif_err(efx, drv, efx->net_dev, "VPD Read-only not found\n"); | ||
2524 | return; | ||
2525 | } | ||
2526 | |||
2527 | j = pci_vpd_lrdt_size(&vpd_data[i]); | ||
2528 | i += PCI_VPD_LRDT_TAG_SIZE; | ||
2529 | if (i + j > vpd_size) | ||
2530 | j = vpd_size - i; | ||
2531 | |||
2532 | /* Get the Part number */ | ||
2533 | i = pci_vpd_find_info_keyword(vpd_data, i, j, "PN"); | ||
2534 | if (i < 0) { | ||
2535 | netif_err(efx, drv, efx->net_dev, "Part number not found\n"); | ||
2536 | return; | ||
2537 | } | ||
2538 | |||
2539 | j = pci_vpd_info_field_size(&vpd_data[i]); | ||
2540 | i += PCI_VPD_INFO_FLD_HDR_SIZE; | ||
2541 | if (i + j > vpd_size) { | ||
2542 | netif_err(efx, drv, efx->net_dev, "Incomplete part number\n"); | ||
2543 | return; | ||
2544 | } | ||
2545 | |||
2546 | netif_info(efx, drv, efx->net_dev, | ||
2547 | "Part Number : %.*s\n", j, &vpd_data[i]); | ||
2548 | } | ||
2549 | |||
2550 | |||
2500 | /* Main body of NIC initialisation | 2551 | /* Main body of NIC initialisation |
2501 | * This is called at module load (or hotplug insertion, theoretically). | 2552 | * This is called at module load (or hotplug insertion, theoretically). |
2502 | */ | 2553 | */ |
@@ -2586,6 +2637,8 @@ static int __devinit efx_pci_probe(struct pci_dev *pci_dev, | |||
2586 | netif_info(efx, probe, efx->net_dev, | 2637 | netif_info(efx, probe, efx->net_dev, |
2587 | "Solarflare NIC detected\n"); | 2638 | "Solarflare NIC detected\n"); |
2588 | 2639 | ||
2640 | efx_print_product_vpd(efx); | ||
2641 | |||
2589 | /* Set up basic I/O (BAR mappings etc) */ | 2642 | /* Set up basic I/O (BAR mappings etc) */ |
2590 | rc = efx_init_io(efx); | 2643 | rc = efx_init_io(efx); |
2591 | if (rc) | 2644 | if (rc) |
diff --git a/drivers/net/ethernet/sfc/falcon_boards.c b/drivers/net/ethernet/sfc/falcon_boards.c index 2084cc6ede52..8687a6c3db0d 100644 --- a/drivers/net/ethernet/sfc/falcon_boards.c +++ b/drivers/net/ethernet/sfc/falcon_boards.c | |||
@@ -709,8 +709,6 @@ static int sfe4003_init(struct efx_nic *efx) | |||
709 | static const struct falcon_board_type board_types[] = { | 709 | static const struct falcon_board_type board_types[] = { |
710 | { | 710 | { |
711 | .id = FALCON_BOARD_SFE4001, | 711 | .id = FALCON_BOARD_SFE4001, |
712 | .ref_model = "SFE4001", | ||
713 | .gen_type = "10GBASE-T adapter", | ||
714 | .init = sfe4001_init, | 712 | .init = sfe4001_init, |
715 | .init_phy = efx_port_dummy_op_void, | 713 | .init_phy = efx_port_dummy_op_void, |
716 | .fini = sfe4001_fini, | 714 | .fini = sfe4001_fini, |
@@ -719,8 +717,6 @@ static const struct falcon_board_type board_types[] = { | |||
719 | }, | 717 | }, |
720 | { | 718 | { |
721 | .id = FALCON_BOARD_SFE4002, | 719 | .id = FALCON_BOARD_SFE4002, |
722 | .ref_model = "SFE4002", | ||
723 | .gen_type = "XFP adapter", | ||
724 | .init = sfe4002_init, | 720 | .init = sfe4002_init, |
725 | .init_phy = sfe4002_init_phy, | 721 | .init_phy = sfe4002_init_phy, |
726 | .fini = efx_fini_lm87, | 722 | .fini = efx_fini_lm87, |
@@ -729,8 +725,6 @@ static const struct falcon_board_type board_types[] = { | |||
729 | }, | 725 | }, |
730 | { | 726 | { |
731 | .id = FALCON_BOARD_SFE4003, | 727 | .id = FALCON_BOARD_SFE4003, |
732 | .ref_model = "SFE4003", | ||
733 | .gen_type = "10GBASE-CX4 adapter", | ||
734 | .init = sfe4003_init, | 728 | .init = sfe4003_init, |
735 | .init_phy = sfe4003_init_phy, | 729 | .init_phy = sfe4003_init_phy, |
736 | .fini = efx_fini_lm87, | 730 | .fini = efx_fini_lm87, |
@@ -739,8 +733,6 @@ static const struct falcon_board_type board_types[] = { | |||
739 | }, | 733 | }, |
740 | { | 734 | { |
741 | .id = FALCON_BOARD_SFN4112F, | 735 | .id = FALCON_BOARD_SFN4112F, |
742 | .ref_model = "SFN4112F", | ||
743 | .gen_type = "SFP+ adapter", | ||
744 | .init = sfn4112f_init, | 736 | .init = sfn4112f_init, |
745 | .init_phy = sfn4112f_init_phy, | 737 | .init_phy = sfn4112f_init_phy, |
746 | .fini = efx_fini_lm87, | 738 | .fini = efx_fini_lm87, |
@@ -763,11 +755,6 @@ int falcon_probe_board(struct efx_nic *efx, u16 revision_info) | |||
763 | board->type = &board_types[i]; | 755 | board->type = &board_types[i]; |
764 | 756 | ||
765 | if (board->type) { | 757 | if (board->type) { |
766 | netif_info(efx, probe, efx->net_dev, "board is %s rev %c%d\n", | ||
767 | (efx->pci_dev->subsystem_vendor == | ||
768 | PCI_VENDOR_ID_SOLARFLARE) | ||
769 | ? board->type->ref_model : board->type->gen_type, | ||
770 | 'A' + board->major, board->minor); | ||
771 | return 0; | 758 | return 0; |
772 | } else { | 759 | } else { |
773 | netif_err(efx, probe, efx->net_dev, "unknown board type %d\n", | 760 | netif_err(efx, probe, efx->net_dev, "unknown board type %d\n", |
diff --git a/drivers/net/ethernet/sfc/nic.h b/drivers/net/ethernet/sfc/nic.h index f46e2cea8ca9..f48ccf6bb3b9 100644 --- a/drivers/net/ethernet/sfc/nic.h +++ b/drivers/net/ethernet/sfc/nic.h | |||
@@ -69,8 +69,6 @@ enum { | |||
69 | /** | 69 | /** |
70 | * struct falcon_board_type - board operations and type information | 70 | * struct falcon_board_type - board operations and type information |
71 | * @id: Board type id, as found in NVRAM | 71 | * @id: Board type id, as found in NVRAM |
72 | * @ref_model: Model number of Solarflare reference design | ||
73 | * @gen_type: Generic board type description | ||
74 | * @init: Allocate resources and initialise peripheral hardware | 72 | * @init: Allocate resources and initialise peripheral hardware |
75 | * @init_phy: Do board-specific PHY initialisation | 73 | * @init_phy: Do board-specific PHY initialisation |
76 | * @fini: Shut down hardware and free resources | 74 | * @fini: Shut down hardware and free resources |
@@ -79,8 +77,6 @@ enum { | |||
79 | */ | 77 | */ |
80 | struct falcon_board_type { | 78 | struct falcon_board_type { |
81 | u8 id; | 79 | u8 id; |
82 | const char *ref_model; | ||
83 | const char *gen_type; | ||
84 | int (*init) (struct efx_nic *nic); | 80 | int (*init) (struct efx_nic *nic); |
85 | void (*init_phy) (struct efx_nic *efx); | 81 | void (*init_phy) (struct efx_nic *efx); |
86 | void (*fini) (struct efx_nic *nic); | 82 | void (*fini) (struct efx_nic *nic); |