Skip to content

Commit 5e6e942

Browse files
mjruhldledford
authored andcommitted
IB/hfi1: Add a patch value to the firmware version string
The HFI firmware now includes a patch level in its version. Updating the necessary code to include the patch version in the firmware string. Reviewed-by: Easwar Hariharan <[email protected]> Signed-off-by: Michael J. Ruhl <[email protected]> Signed-off-by: Dennis Dalessandro <[email protected]> Signed-off-by: Doug Ledford <[email protected]>
1 parent fb897ad commit 5e6e942

File tree

5 files changed

+47
-31
lines changed

5 files changed

+47
-31
lines changed

drivers/infiniband/hw/hfi1/chip.c

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright(c) 2015, 2016 Intel Corporation.
2+
* Copyright(c) 2015 - 2017 Intel Corporation.
33
*
44
* This file is provided under a dual BSD/GPLv2 license. When using or
55
* redistributing this file, you may do so under either license.
@@ -7166,7 +7166,7 @@ static void get_link_widths(struct hfi1_devdata *dd, u16 *tx_width,
71667166
* set the max_rate field in handle_verify_cap until v0.19.
71677167
*/
71687168
if ((dd->icode == ICODE_RTL_SILICON) &&
7169-
(dd->dc8051_ver < dc8051_ver(0, 19))) {
7169+
(dd->dc8051_ver < dc8051_ver(0, 19, 0))) {
71707170
/* max_rate: 0 = 12.5G, 1 = 25G */
71717171
switch (max_rate) {
71727172
case 0:
@@ -7351,7 +7351,7 @@ void handle_verify_cap(struct work_struct *work)
73517351
}
73527352

73537353
ppd->link_speed_active = 0; /* invalid value */
7354-
if (dd->dc8051_ver < dc8051_ver(0, 20)) {
7354+
if (dd->dc8051_ver < dc8051_ver(0, 20, 0)) {
73557355
/* remote_tx_rate: 0 = 12.5G, 1 = 25G */
73567356
switch (remote_tx_rate) {
73577357
case 0:
@@ -8422,7 +8422,7 @@ static int write_lcb_via_8051(struct hfi1_devdata *dd, u32 addr, u64 data)
84228422
int ret;
84238423

84248424
if (dd->icode == ICODE_FUNCTIONAL_SIMULATOR ||
8425-
(dd->dc8051_ver < dc8051_ver(0, 20))) {
8425+
(dd->dc8051_ver < dc8051_ver(0, 20, 0))) {
84268426
if (acquire_lcb_access(dd, 0) == 0) {
84278427
write_csr(dd, addr, data);
84288428
release_lcb_access(dd, 0);
@@ -8728,13 +8728,20 @@ static void read_remote_device_id(struct hfi1_devdata *dd, u16 *device_id,
87288728
& REMOTE_DEVICE_REV_MASK;
87298729
}
87308730

8731-
void read_misc_status(struct hfi1_devdata *dd, u8 *ver_a, u8 *ver_b)
8731+
void read_misc_status(struct hfi1_devdata *dd, u8 *ver_major, u8 *ver_minor,
8732+
u8 *ver_patch)
87328733
{
87338734
u32 frame;
87348735

87358736
read_8051_config(dd, MISC_STATUS, GENERAL_CONFIG, &frame);
8736-
*ver_a = (frame >> STS_FM_VERSION_A_SHIFT) & STS_FM_VERSION_A_MASK;
8737-
*ver_b = (frame >> STS_FM_VERSION_B_SHIFT) & STS_FM_VERSION_B_MASK;
8737+
*ver_major = (frame >> STS_FM_VERSION_MAJOR_SHIFT) &
8738+
STS_FM_VERSION_MAJOR_MASK;
8739+
*ver_minor = (frame >> STS_FM_VERSION_MINOR_SHIFT) &
8740+
STS_FM_VERSION_MINOR_MASK;
8741+
8742+
read_8051_config(dd, VERSION_PATCH, GENERAL_CONFIG, &frame);
8743+
*ver_patch = (frame >> STS_FM_VERSION_PATCH_SHIFT) &
8744+
STS_FM_VERSION_PATCH_MASK;
87388745
}
87398746

87408747
static void read_vc_remote_phy(struct hfi1_devdata *dd, u8 *power_management,
@@ -9130,7 +9137,7 @@ static int set_local_link_attributes(struct hfi1_pportdata *ppd)
91309137
if (ret)
91319138
goto set_local_link_attributes_fail;
91329139

9133-
if (dd->dc8051_ver < dc8051_ver(0, 20)) {
9140+
if (dd->dc8051_ver < dc8051_ver(0, 20, 0)) {
91349141
/* set the tx rate to the fastest enabled */
91359142
if (ppd->link_speed_enabled & OPA_LINK_SPEED_25G)
91369143
ppd->local_tx_rate = 1;

drivers/infiniband/hw/hfi1/chip.h

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#ifndef _CHIP_H
22
#define _CHIP_H
33
/*
4-
* Copyright(c) 2015, 2016 Intel Corporation.
4+
* Copyright(c) 2015 - 2017 Intel Corporation.
55
*
66
* This file is provided under a dual BSD/GPLv2 license. When using or
77
* redistributing this file, you may do so under either license.
@@ -394,7 +394,8 @@
394394
#define LAST_REMOTE_STATE_COMPLETE 0x13
395395
#define LINK_QUALITY_INFO 0x14
396396
#define REMOTE_DEVICE_ID 0x15
397-
#define LINK_DOWN_REASON 0x16
397+
#define LINK_DOWN_REASON 0x16 /* first byte of offset 0x16 */
398+
#define VERSION_PATCH 0x16 /* last byte of offset 0x16 */
398399

399400
/* 8051 lane specific register field IDs */
400401
#define TX_EQ_SETTINGS 0x00
@@ -524,10 +525,12 @@ enum {
524525
#define SUPPORTED_CRCS (CAP_CRC_14B | CAP_CRC_48B)
525526

526527
/* misc status version fields */
527-
#define STS_FM_VERSION_A_SHIFT 16
528-
#define STS_FM_VERSION_A_MASK 0xff
529-
#define STS_FM_VERSION_B_SHIFT 24
530-
#define STS_FM_VERSION_B_MASK 0xff
528+
#define STS_FM_VERSION_MINOR_SHIFT 16
529+
#define STS_FM_VERSION_MINOR_MASK 0xff
530+
#define STS_FM_VERSION_MAJOR_SHIFT 24
531+
#define STS_FM_VERSION_MAJOR_MASK 0xff
532+
#define STS_FM_VERSION_PATCH_SHIFT 24
533+
#define STS_FM_VERSION_PATCH_MASK 0xff
531534

532535
/* LCB_CFG_CRC_MODE TX_VAL and RX_VAL CRC mode values */
533536
#define LCB_CRC_16B 0x0 /* 16b CRC */
@@ -698,7 +701,8 @@ void fabric_serdes_reset(struct hfi1_devdata *dd);
698701
int read_8051_data(struct hfi1_devdata *dd, u32 addr, u32 len, u64 *result);
699702

700703
/* chip.c */
701-
void read_misc_status(struct hfi1_devdata *dd, u8 *ver_a, u8 *ver_b);
704+
void read_misc_status(struct hfi1_devdata *dd, u8 *ver_major, u8 *ver_minor,
705+
u8 *ver_patch);
702706
void read_guid(struct hfi1_devdata *dd);
703707
int wait_fm_ready(struct hfi1_devdata *dd, u32 mstimeout);
704708
void set_link_down_reason(struct hfi1_pportdata *ppd, u8 lcl_reason,

drivers/infiniband/hw/hfi1/firmware.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright(c) 2015, 2016 Intel Corporation.
2+
* Copyright(c) 2015 - 2017 Intel Corporation.
33
*
44
* This file is provided under a dual BSD/GPLv2 license. When using or
55
* redistributing this file, you may do so under either license.
@@ -1004,7 +1004,9 @@ static int load_8051_firmware(struct hfi1_devdata *dd,
10041004
{
10051005
u64 reg;
10061006
int ret;
1007-
u8 ver_a, ver_b;
1007+
u8 ver_major;
1008+
u8 ver_minor;
1009+
u8 ver_patch;
10081010

10091011
/*
10101012
* DC Reset sequence
@@ -1073,10 +1075,10 @@ static int load_8051_firmware(struct hfi1_devdata *dd,
10731075
return -ETIMEDOUT;
10741076
}
10751077

1076-
read_misc_status(dd, &ver_a, &ver_b);
1077-
dd_dev_info(dd, "8051 firmware version %d.%d\n",
1078-
(int)ver_b, (int)ver_a);
1079-
dd->dc8051_ver = dc8051_ver(ver_b, ver_a);
1078+
read_misc_status(dd, &ver_major, &ver_minor, &ver_patch);
1079+
dd_dev_info(dd, "8051 firmware version %d.%d.%d\n",
1080+
(int)ver_major, (int)ver_minor, (int)ver_patch);
1081+
dd->dc8051_ver = dc8051_ver(ver_major, ver_minor, ver_patch);
10801082

10811083
return 0;
10821084
}

drivers/infiniband/hw/hfi1/hfi.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,7 +1020,7 @@ struct hfi1_devdata {
10201020
u8 qos_shift;
10211021

10221022
u16 irev; /* implementation revision */
1023-
u16 dc8051_ver; /* 8051 firmware version */
1023+
u32 dc8051_ver; /* 8051 firmware version */
10241024

10251025
spinlock_t hfi1_diag_trans_lock; /* protect diag observer ops */
10261026
struct platform_config platform_config;
@@ -1173,9 +1173,10 @@ struct hfi1_devdata {
11731173
};
11741174

11751175
/* 8051 firmware version helper */
1176-
#define dc8051_ver(a, b) ((a) << 8 | (b))
1177-
#define dc8051_ver_maj(a) ((a & 0xff00) >> 8)
1178-
#define dc8051_ver_min(a) (a & 0x00ff)
1176+
#define dc8051_ver(a, b, c) ((a) << 16 | (b) << 8 | (c))
1177+
#define dc8051_ver_maj(a) (((a) & 0xff0000) >> 16)
1178+
#define dc8051_ver_min(a) (((a) & 0x00ff00) >> 8)
1179+
#define dc8051_ver_patch(a) ((a) & 0x0000ff)
11791180

11801181
/* f_put_tid types */
11811182
#define PT_EXPECTED 0

drivers/infiniband/hw/hfi1/verbs.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1236,12 +1236,14 @@ int hfi1_verbs_send(struct rvt_qp *qp, struct hfi1_pkt_state *ps)
12361236
static void hfi1_fill_device_attr(struct hfi1_devdata *dd)
12371237
{
12381238
struct rvt_dev_info *rdi = &dd->verbs_dev.rdi;
1239-
u16 ver = dd->dc8051_ver;
1239+
u32 ver = dd->dc8051_ver;
12401240

12411241
memset(&rdi->dparms.props, 0, sizeof(rdi->dparms.props));
12421242

1243-
rdi->dparms.props.fw_ver = ((u64)(dc8051_ver_maj(ver)) << 16) |
1244-
(u64)dc8051_ver_min(ver);
1243+
rdi->dparms.props.fw_ver = ((u64)(dc8051_ver_maj(ver)) << 32) |
1244+
((u64)(dc8051_ver_min(ver)) << 16) |
1245+
(u64)dc8051_ver_patch(ver);
1246+
12451247
rdi->dparms.props.device_cap_flags = IB_DEVICE_BAD_PKEY_CNTR |
12461248
IB_DEVICE_BAD_QKEY_CNTR | IB_DEVICE_SHUTDOWN_PORT |
12471249
IB_DEVICE_SYS_IMAGE_GUID | IB_DEVICE_RC_RNR_NAK_GEN |
@@ -1520,10 +1522,10 @@ static void hfi1_get_dev_fw_str(struct ib_device *ibdev, char *str,
15201522
{
15211523
struct rvt_dev_info *rdi = ib_to_rvt(ibdev);
15221524
struct hfi1_ibdev *dev = dev_from_rdi(rdi);
1523-
u16 ver = dd_from_dev(dev)->dc8051_ver;
1525+
u32 ver = dd_from_dev(dev)->dc8051_ver;
15241526

1525-
snprintf(str, str_len, "%u.%u", dc8051_ver_maj(ver),
1526-
dc8051_ver_min(ver));
1527+
snprintf(str, str_len, "%u.%u.%u", dc8051_ver_maj(ver),
1528+
dc8051_ver_min(ver), dc8051_ver_patch(ver));
15271529
}
15281530

15291531
static const char * const driver_cntr_names[] = {

0 commit comments

Comments
 (0)