diff options
author | Michael S. Tsirkin <mst@mellanox.co.il> | 2005-08-14 00:19:38 -0400 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2005-08-26 23:37:35 -0400 |
commit | 2e8b981c5d5c6fe5479ad47c44e3e76ebb5408ef (patch) | |
tree | d01fc31cb120666633f92d0eaf48b82b6a22be46 /drivers/infiniband/hw/mthca/mthca_main.c | |
parent | 97f52eb438be7caebe026421545619d8a0c1398a (diff) |
[PATCH] IB/mthca: add HCA board ID to sysfs info
Add support for reporting HCA board ID returned from QUERY_ADAPTER
firmware command through sysfs.
Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband/hw/mthca/mthca_main.c')
-rw-r--r-- | drivers/infiniband/hw/mthca/mthca_main.c | 122 |
1 files changed, 58 insertions, 64 deletions
diff --git a/drivers/infiniband/hw/mthca/mthca_main.c b/drivers/infiniband/hw/mthca/mthca_main.c index 2d539403bdac..2f039680239c 100644 --- a/drivers/infiniband/hw/mthca/mthca_main.c +++ b/drivers/infiniband/hw/mthca/mthca_main.c | |||
@@ -213,7 +213,6 @@ static int __devinit mthca_init_tavor(struct mthca_dev *mdev) | |||
213 | struct mthca_dev_lim dev_lim; | 213 | struct mthca_dev_lim dev_lim; |
214 | struct mthca_profile profile; | 214 | struct mthca_profile profile; |
215 | struct mthca_init_hca_param init_hca; | 215 | struct mthca_init_hca_param init_hca; |
216 | struct mthca_adapter adapter; | ||
217 | 216 | ||
218 | err = mthca_SYS_EN(mdev, &status); | 217 | err = mthca_SYS_EN(mdev, &status); |
219 | if (err) { | 218 | if (err) { |
@@ -271,26 +270,8 @@ static int __devinit mthca_init_tavor(struct mthca_dev *mdev) | |||
271 | goto err_disable; | 270 | goto err_disable; |
272 | } | 271 | } |
273 | 272 | ||
274 | err = mthca_QUERY_ADAPTER(mdev, &adapter, &status); | ||
275 | if (err) { | ||
276 | mthca_err(mdev, "QUERY_ADAPTER command failed, aborting.\n"); | ||
277 | goto err_close; | ||
278 | } | ||
279 | if (status) { | ||
280 | mthca_err(mdev, "QUERY_ADAPTER returned status 0x%02x, " | ||
281 | "aborting.\n", status); | ||
282 | err = -EINVAL; | ||
283 | goto err_close; | ||
284 | } | ||
285 | |||
286 | mdev->eq_table.inta_pin = adapter.inta_pin; | ||
287 | mdev->rev_id = adapter.revision_id; | ||
288 | |||
289 | return 0; | 273 | return 0; |
290 | 274 | ||
291 | err_close: | ||
292 | mthca_CLOSE_HCA(mdev, 0, &status); | ||
293 | |||
294 | err_disable: | 275 | err_disable: |
295 | mthca_SYS_DIS(mdev, &status); | 276 | mthca_SYS_DIS(mdev, &status); |
296 | 277 | ||
@@ -507,7 +488,6 @@ static int __devinit mthca_init_arbel(struct mthca_dev *mdev) | |||
507 | struct mthca_dev_lim dev_lim; | 488 | struct mthca_dev_lim dev_lim; |
508 | struct mthca_profile profile; | 489 | struct mthca_profile profile; |
509 | struct mthca_init_hca_param init_hca; | 490 | struct mthca_init_hca_param init_hca; |
510 | struct mthca_adapter adapter; | ||
511 | u64 icm_size; | 491 | u64 icm_size; |
512 | u8 status; | 492 | u8 status; |
513 | int err; | 493 | int err; |
@@ -575,21 +555,6 @@ static int __devinit mthca_init_arbel(struct mthca_dev *mdev) | |||
575 | goto err_free_icm; | 555 | goto err_free_icm; |
576 | } | 556 | } |
577 | 557 | ||
578 | err = mthca_QUERY_ADAPTER(mdev, &adapter, &status); | ||
579 | if (err) { | ||
580 | mthca_err(mdev, "QUERY_ADAPTER command failed, aborting.\n"); | ||
581 | goto err_free_icm; | ||
582 | } | ||
583 | if (status) { | ||
584 | mthca_err(mdev, "QUERY_ADAPTER returned status 0x%02x, " | ||
585 | "aborting.\n", status); | ||
586 | err = -EINVAL; | ||
587 | goto err_free_icm; | ||
588 | } | ||
589 | |||
590 | mdev->eq_table.inta_pin = adapter.inta_pin; | ||
591 | mdev->rev_id = adapter.revision_id; | ||
592 | |||
593 | return 0; | 558 | return 0; |
594 | 559 | ||
595 | err_free_icm: | 560 | err_free_icm: |
@@ -615,12 +580,68 @@ err_disable: | |||
615 | return err; | 580 | return err; |
616 | } | 581 | } |
617 | 582 | ||
583 | static void mthca_close_hca(struct mthca_dev *mdev) | ||
584 | { | ||
585 | u8 status; | ||
586 | |||
587 | mthca_CLOSE_HCA(mdev, 0, &status); | ||
588 | |||
589 | if (mthca_is_memfree(mdev)) { | ||
590 | mthca_free_icm_table(mdev, mdev->cq_table.table); | ||
591 | mthca_free_icm_table(mdev, mdev->qp_table.rdb_table); | ||
592 | mthca_free_icm_table(mdev, mdev->qp_table.eqp_table); | ||
593 | mthca_free_icm_table(mdev, mdev->qp_table.qp_table); | ||
594 | mthca_free_icm_table(mdev, mdev->mr_table.mpt_table); | ||
595 | mthca_free_icm_table(mdev, mdev->mr_table.mtt_table); | ||
596 | mthca_unmap_eq_icm(mdev); | ||
597 | |||
598 | mthca_UNMAP_ICM_AUX(mdev, &status); | ||
599 | mthca_free_icm(mdev, mdev->fw.arbel.aux_icm); | ||
600 | |||
601 | mthca_UNMAP_FA(mdev, &status); | ||
602 | mthca_free_icm(mdev, mdev->fw.arbel.fw_icm); | ||
603 | |||
604 | if (!(mdev->mthca_flags & MTHCA_FLAG_NO_LAM)) | ||
605 | mthca_DISABLE_LAM(mdev, &status); | ||
606 | } else | ||
607 | mthca_SYS_DIS(mdev, &status); | ||
608 | } | ||
609 | |||
618 | static int __devinit mthca_init_hca(struct mthca_dev *mdev) | 610 | static int __devinit mthca_init_hca(struct mthca_dev *mdev) |
619 | { | 611 | { |
612 | u8 status; | ||
613 | int err; | ||
614 | struct mthca_adapter adapter; | ||
615 | |||
620 | if (mthca_is_memfree(mdev)) | 616 | if (mthca_is_memfree(mdev)) |
621 | return mthca_init_arbel(mdev); | 617 | err = mthca_init_arbel(mdev); |
622 | else | 618 | else |
623 | return mthca_init_tavor(mdev); | 619 | err = mthca_init_tavor(mdev); |
620 | |||
621 | if (err) | ||
622 | return err; | ||
623 | |||
624 | err = mthca_QUERY_ADAPTER(mdev, &adapter, &status); | ||
625 | if (err) { | ||
626 | mthca_err(mdev, "QUERY_ADAPTER command failed, aborting.\n"); | ||
627 | goto err_close; | ||
628 | } | ||
629 | if (status) { | ||
630 | mthca_err(mdev, "QUERY_ADAPTER returned status 0x%02x, " | ||
631 | "aborting.\n", status); | ||
632 | err = -EINVAL; | ||
633 | goto err_close; | ||
634 | } | ||
635 | |||
636 | mdev->eq_table.inta_pin = adapter.inta_pin; | ||
637 | mdev->rev_id = adapter.revision_id; | ||
638 | memcpy(mdev->board_id, adapter.board_id, sizeof mdev->board_id); | ||
639 | |||
640 | return 0; | ||
641 | |||
642 | err_close: | ||
643 | mthca_close_hca(mdev); | ||
644 | return err; | ||
624 | } | 645 | } |
625 | 646 | ||
626 | static int __devinit mthca_setup_hca(struct mthca_dev *dev) | 647 | static int __devinit mthca_setup_hca(struct mthca_dev *dev) |
@@ -845,33 +866,6 @@ static int __devinit mthca_enable_msi_x(struct mthca_dev *mdev) | |||
845 | return 0; | 866 | return 0; |
846 | } | 867 | } |
847 | 868 | ||
848 | static void mthca_close_hca(struct mthca_dev *mdev) | ||
849 | { | ||
850 | u8 status; | ||
851 | |||
852 | mthca_CLOSE_HCA(mdev, 0, &status); | ||
853 | |||
854 | if (mthca_is_memfree(mdev)) { | ||
855 | mthca_free_icm_table(mdev, mdev->cq_table.table); | ||
856 | mthca_free_icm_table(mdev, mdev->qp_table.rdb_table); | ||
857 | mthca_free_icm_table(mdev, mdev->qp_table.eqp_table); | ||
858 | mthca_free_icm_table(mdev, mdev->qp_table.qp_table); | ||
859 | mthca_free_icm_table(mdev, mdev->mr_table.mpt_table); | ||
860 | mthca_free_icm_table(mdev, mdev->mr_table.mtt_table); | ||
861 | mthca_unmap_eq_icm(mdev); | ||
862 | |||
863 | mthca_UNMAP_ICM_AUX(mdev, &status); | ||
864 | mthca_free_icm(mdev, mdev->fw.arbel.aux_icm); | ||
865 | |||
866 | mthca_UNMAP_FA(mdev, &status); | ||
867 | mthca_free_icm(mdev, mdev->fw.arbel.fw_icm); | ||
868 | |||
869 | if (!(mdev->mthca_flags & MTHCA_FLAG_NO_LAM)) | ||
870 | mthca_DISABLE_LAM(mdev, &status); | ||
871 | } else | ||
872 | mthca_SYS_DIS(mdev, &status); | ||
873 | } | ||
874 | |||
875 | /* Types of supported HCA */ | 869 | /* Types of supported HCA */ |
876 | enum { | 870 | enum { |
877 | TAVOR, /* MT23108 */ | 871 | TAVOR, /* MT23108 */ |