Commit 939b6ca8 authored by Ira Weiny's avatar Ira Weiny Committed by Doug Ledford

IB/hfi1: Add device FW version string

Export the firmware version through the core.
Acked-by: default avatarDennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: default avatarIra Weiny <ira.weiny@intel.com>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent 41a6ae1e
...@@ -1174,6 +1174,8 @@ struct hfi1_devdata { ...@@ -1174,6 +1174,8 @@ struct hfi1_devdata {
/* 8051 firmware version helper */ /* 8051 firmware version helper */
#define dc8051_ver(a, b) ((a) << 8 | (b)) #define dc8051_ver(a, b) ((a) << 8 | (b))
#define dc8051_ver_maj(a) ((a & 0xff00) >> 8)
#define dc8051_ver_min(a) (a & 0x00ff)
/* f_put_tid types */ /* f_put_tid types */
#define PT_EXPECTED 0 #define PT_EXPECTED 0
......
...@@ -1291,9 +1291,12 @@ int hfi1_verbs_send(struct rvt_qp *qp, struct hfi1_pkt_state *ps) ...@@ -1291,9 +1291,12 @@ int hfi1_verbs_send(struct rvt_qp *qp, struct hfi1_pkt_state *ps)
static void hfi1_fill_device_attr(struct hfi1_devdata *dd) static void hfi1_fill_device_attr(struct hfi1_devdata *dd)
{ {
struct rvt_dev_info *rdi = &dd->verbs_dev.rdi; struct rvt_dev_info *rdi = &dd->verbs_dev.rdi;
u16 ver = dd->dc8051_ver;
memset(&rdi->dparms.props, 0, sizeof(rdi->dparms.props)); memset(&rdi->dparms.props, 0, sizeof(rdi->dparms.props));
rdi->dparms.props.fw_ver = ((u64)(dc8051_ver_maj(ver)) << 16) |
(u64)dc8051_ver_min(ver);
rdi->dparms.props.device_cap_flags = IB_DEVICE_BAD_PKEY_CNTR | rdi->dparms.props.device_cap_flags = IB_DEVICE_BAD_PKEY_CNTR |
IB_DEVICE_BAD_QKEY_CNTR | IB_DEVICE_SHUTDOWN_PORT | IB_DEVICE_BAD_QKEY_CNTR | IB_DEVICE_SHUTDOWN_PORT |
IB_DEVICE_SYS_IMAGE_GUID | IB_DEVICE_RC_RNR_NAK_GEN | IB_DEVICE_SYS_IMAGE_GUID | IB_DEVICE_RC_RNR_NAK_GEN |
...@@ -1567,6 +1570,17 @@ static void init_ibport(struct hfi1_pportdata *ppd) ...@@ -1567,6 +1570,17 @@ static void init_ibport(struct hfi1_pportdata *ppd)
RCU_INIT_POINTER(ibp->rvp.qp[1], NULL); RCU_INIT_POINTER(ibp->rvp.qp[1], NULL);
} }
static void hfi1_get_dev_fw_str(struct ib_device *ibdev, char *str,
size_t str_len)
{
struct rvt_dev_info *rdi = ib_to_rvt(ibdev);
struct hfi1_ibdev *dev = dev_from_rdi(rdi);
u16 ver = dd_from_dev(dev)->dc8051_ver;
snprintf(str, str_len, "%u.%u", dc8051_ver_maj(ver),
dc8051_ver_min(ver));
}
/** /**
* hfi1_register_ib_device - register our device with the infiniband core * hfi1_register_ib_device - register our device with the infiniband core
* @dd: the device data structure * @dd: the device data structure
...@@ -1613,6 +1627,7 @@ int hfi1_register_ib_device(struct hfi1_devdata *dd) ...@@ -1613,6 +1627,7 @@ int hfi1_register_ib_device(struct hfi1_devdata *dd)
/* keep process mad in the driver */ /* keep process mad in the driver */
ibdev->process_mad = hfi1_process_mad; ibdev->process_mad = hfi1_process_mad;
ibdev->get_dev_fw_str = hfi1_get_dev_fw_str;
strncpy(ibdev->node_desc, init_utsname()->nodename, strncpy(ibdev->node_desc, init_utsname()->nodename,
sizeof(ibdev->node_desc)); sizeof(ibdev->node_desc));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment