diff options
| -rw-r--r-- | drivers/infiniband/hw/mlx4/main.c | 45 | ||||
| -rw-r--r-- | drivers/net/mlx4/main.c | 4 | ||||
| -rw-r--r-- | drivers/net/mlx4/mlx4.h | 7 | ||||
| -rw-r--r-- | include/linux/mlx4/device.h | 6 |
4 files changed, 53 insertions, 9 deletions
diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c index dde8fe9af47e..d9fc822a1468 100644 --- a/drivers/infiniband/hw/mlx4/main.c +++ b/drivers/infiniband/hw/mlx4/main.c | |||
| @@ -476,9 +476,48 @@ out: | |||
| 476 | return err; | 476 | return err; |
| 477 | } | 477 | } |
| 478 | 478 | ||
| 479 | static ssize_t show_hca(struct class_device *cdev, char *buf) | ||
| 480 | { | ||
| 481 | struct mlx4_ib_dev *dev = container_of(cdev, struct mlx4_ib_dev, ib_dev.class_dev); | ||
| 482 | return sprintf(buf, "MT%d\n", dev->dev->pdev->device); | ||
| 483 | } | ||
| 484 | |||
| 485 | static ssize_t show_fw_ver(struct class_device *cdev, char *buf) | ||
| 486 | { | ||
| 487 | struct mlx4_ib_dev *dev = container_of(cdev, struct mlx4_ib_dev, ib_dev.class_dev); | ||
| 488 | return sprintf(buf, "%d.%d.%d\n", (int) (dev->dev->caps.fw_ver >> 32), | ||
| 489 | (int) (dev->dev->caps.fw_ver >> 16) & 0xffff, | ||
| 490 | (int) dev->dev->caps.fw_ver & 0xffff); | ||
| 491 | } | ||
| 492 | |||
| 493 | static ssize_t show_rev(struct class_device *cdev, char *buf) | ||
| 494 | { | ||
| 495 | struct mlx4_ib_dev *dev = container_of(cdev, struct mlx4_ib_dev, ib_dev.class_dev); | ||
| 496 | return sprintf(buf, "%x\n", dev->dev->rev_id); | ||
| 497 | } | ||
| 498 | |||
| 499 | static ssize_t show_board(struct class_device *cdev, char *buf) | ||
| 500 | { | ||
| 501 | struct mlx4_ib_dev *dev = container_of(cdev, struct mlx4_ib_dev, ib_dev.class_dev); | ||
| 502 | return sprintf(buf, "%.*s\n", MLX4_BOARD_ID_LEN, dev->dev->board_id); | ||
| 503 | } | ||
| 504 | |||
| 505 | static CLASS_DEVICE_ATTR(hw_rev, S_IRUGO, show_rev, NULL); | ||
| 506 | static CLASS_DEVICE_ATTR(fw_ver, S_IRUGO, show_fw_ver, NULL); | ||
| 507 | static CLASS_DEVICE_ATTR(hca_type, S_IRUGO, show_hca, NULL); | ||
| 508 | static CLASS_DEVICE_ATTR(board_id, S_IRUGO, show_board, NULL); | ||
| 509 | |||
| 510 | static struct class_device_attribute *mlx4_class_attributes[] = { | ||
| 511 | &class_device_attr_hw_rev, | ||
| 512 | &class_device_attr_fw_ver, | ||
| 513 | &class_device_attr_hca_type, | ||
| 514 | &class_device_attr_board_id | ||
| 515 | }; | ||
| 516 | |||
| 479 | static void *mlx4_ib_add(struct mlx4_dev *dev) | 517 | static void *mlx4_ib_add(struct mlx4_dev *dev) |
| 480 | { | 518 | { |
| 481 | struct mlx4_ib_dev *ibdev; | 519 | struct mlx4_ib_dev *ibdev; |
| 520 | int i; | ||
| 482 | 521 | ||
| 483 | ibdev = (struct mlx4_ib_dev *) ib_alloc_device(sizeof *ibdev); | 522 | ibdev = (struct mlx4_ib_dev *) ib_alloc_device(sizeof *ibdev); |
| 484 | if (!ibdev) { | 523 | if (!ibdev) { |
| @@ -580,6 +619,12 @@ static void *mlx4_ib_add(struct mlx4_dev *dev) | |||
| 580 | if (mlx4_ib_mad_init(ibdev)) | 619 | if (mlx4_ib_mad_init(ibdev)) |
| 581 | goto err_reg; | 620 | goto err_reg; |
| 582 | 621 | ||
| 622 | for (i = 0; i < ARRAY_SIZE(mlx4_class_attributes); ++i) { | ||
| 623 | if (class_device_create_file(&ibdev->ib_dev.class_dev, | ||
| 624 | mlx4_class_attributes[i])) | ||
| 625 | goto err_reg; | ||
| 626 | } | ||
| 627 | |||
| 583 | return ibdev; | 628 | return ibdev; |
| 584 | 629 | ||
| 585 | err_reg: | 630 | err_reg: |
diff --git a/drivers/net/mlx4/main.c b/drivers/net/mlx4/main.c index 4b1269435586..9e590e11c1cf 100644 --- a/drivers/net/mlx4/main.c +++ b/drivers/net/mlx4/main.c | |||
| @@ -524,8 +524,8 @@ static int __devinit mlx4_init_hca(struct mlx4_dev *dev) | |||
| 524 | } | 524 | } |
| 525 | 525 | ||
| 526 | priv->eq_table.inta_pin = adapter.inta_pin; | 526 | priv->eq_table.inta_pin = adapter.inta_pin; |
| 527 | priv->rev_id = adapter.revision_id; | 527 | dev->rev_id = adapter.revision_id; |
| 528 | memcpy(priv->board_id, adapter.board_id, sizeof priv->board_id); | 528 | memcpy(dev->board_id, adapter.board_id, sizeof dev->board_id); |
| 529 | 529 | ||
| 530 | return 0; | 530 | return 0; |
| 531 | 531 | ||
diff --git a/drivers/net/mlx4/mlx4.h b/drivers/net/mlx4/mlx4.h index be304a7c2c91..b9f839761919 100644 --- a/drivers/net/mlx4/mlx4.h +++ b/drivers/net/mlx4/mlx4.h | |||
| @@ -56,10 +56,6 @@ enum { | |||
| 56 | }; | 56 | }; |
| 57 | 57 | ||
| 58 | enum { | 58 | enum { |
| 59 | MLX4_BOARD_ID_LEN = 64 | ||
| 60 | }; | ||
| 61 | |||
| 62 | enum { | ||
| 63 | MLX4_MGM_ENTRY_SIZE = 0x40, | 59 | MLX4_MGM_ENTRY_SIZE = 0x40, |
| 64 | MLX4_QP_PER_MGM = 4 * (MLX4_MGM_ENTRY_SIZE / 16 - 2), | 60 | MLX4_QP_PER_MGM = 4 * (MLX4_MGM_ENTRY_SIZE / 16 - 2), |
| 65 | MLX4_MTT_ENTRY_PER_SEG = 8 | 61 | MLX4_MTT_ENTRY_PER_SEG = 8 |
| @@ -277,9 +273,6 @@ struct mlx4_priv { | |||
| 277 | 273 | ||
| 278 | struct mlx4_uar driver_uar; | 274 | struct mlx4_uar driver_uar; |
| 279 | void __iomem *kar; | 275 | void __iomem *kar; |
| 280 | |||
| 281 | u32 rev_id; | ||
| 282 | char board_id[MLX4_BOARD_ID_LEN]; | ||
| 283 | }; | 276 | }; |
| 284 | 277 | ||
| 285 | static inline struct mlx4_priv *mlx4_priv(struct mlx4_dev *dev) | 278 | static inline struct mlx4_priv *mlx4_priv(struct mlx4_dev *dev) |
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h index cfb78fb2c046..a93520c76fde 100644 --- a/include/linux/mlx4/device.h +++ b/include/linux/mlx4/device.h | |||
| @@ -49,6 +49,10 @@ enum { | |||
| 49 | }; | 49 | }; |
| 50 | 50 | ||
| 51 | enum { | 51 | enum { |
| 52 | MLX4_BOARD_ID_LEN = 64 | ||
| 53 | }; | ||
| 54 | |||
| 55 | enum { | ||
| 52 | MLX4_DEV_CAP_FLAG_RC = 1 << 0, | 56 | MLX4_DEV_CAP_FLAG_RC = 1 << 0, |
| 53 | MLX4_DEV_CAP_FLAG_UC = 1 << 1, | 57 | MLX4_DEV_CAP_FLAG_UC = 1 << 1, |
| 54 | MLX4_DEV_CAP_FLAG_UD = 1 << 2, | 58 | MLX4_DEV_CAP_FLAG_UD = 1 << 2, |
| @@ -272,6 +276,8 @@ struct mlx4_dev { | |||
| 272 | unsigned long flags; | 276 | unsigned long flags; |
| 273 | struct mlx4_caps caps; | 277 | struct mlx4_caps caps; |
| 274 | struct radix_tree_root qp_table_tree; | 278 | struct radix_tree_root qp_table_tree; |
| 279 | u32 rev_id; | ||
| 280 | char board_id[MLX4_BOARD_ID_LEN]; | ||
| 275 | }; | 281 | }; |
| 276 | 282 | ||
| 277 | struct mlx4_init_port_param { | 283 | struct mlx4_init_port_param { |
