Skip to content

Commit 7ad9d9a

Browse files
francispravin5igaw
authored andcommitted
nvme-print: print the new fields added in TP4142
Print the new fields added in Identify Controller Data Structure. Also, print the field added in Temperature Threshold feature. Signed-off-by: Francis Pravin <francis.p@samsung.com> Reviewed-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
1 parent 9e7f171 commit 7ad9d9a

File tree

2 files changed

+36
-6
lines changed

2 files changed

+36
-6
lines changed

nvme-print-json.c

+10-1
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,7 @@ void json_nvme_id_ctrl(struct nvme_id_ctrl *ctrl,
400400
obj_add_uint(r, "pels", le32_to_cpu(ctrl->pels));
401401
obj_add_int(r, "domainid", le16_to_cpu(ctrl->domainid));
402402
obj_add_uint128(r, "megcap", megcap);
403+
obj_add_int(r, "tmpthha", ctrl->tmpthha);
403404
obj_add_int(r, "sqes", ctrl->sqes);
404405
obj_add_int(r, "cqes", ctrl->cqes);
405406
obj_add_int(r, "maxcmd", le16_to_cpu(ctrl->maxcmd));
@@ -3298,9 +3299,17 @@ static void json_feature_show_fields_lba_range(struct json_object *r, __u8 field
32983299

32993300
static void json_feature_show_fields_temp_thresh(struct json_object *r, unsigned int result)
33003301
{
3301-
__u8 field = (result & 0x300000) >> 20;
33023302
char json_str[STR_LEN];
3303+
__u8 field;
33033304

3305+
field = (result & 0x1c00000) >> 22;
3306+
sprintf(json_str, "%s", nvme_degrees_string(field));
3307+
obj_add_str(r, "Temperature Threshold Hysteresis (TMPTHH)", json_str);
3308+
3309+
sprintf(json_str, "%u K", field);
3310+
obj_add_str(r, "TMPTHH kelvin", json_str);
3311+
3312+
field = (result & 0x300000) >> 20;
33043313
obj_add_uint(r, "Threshold Type Select (THSEL)", field);
33053314
obj_add_str(r, "THSEL description", nvme_feature_temp_type_to_string(field));
33063315

nvme-print-stdout.c

+26-5
Original file line numberDiff line numberDiff line change
@@ -1684,7 +1684,8 @@ static void stdout_id_ctrl_oaes(__le32 ctrl_oaes)
16841684
__u32 disc = (oaes >> 31) & 0x1;
16851685
__u32 rsvd0 = (oaes & 0x70000000) >> 28;
16861686
__u32 zicn = (oaes & 0x08000000) >> 27;
1687-
__u32 rsvd1 = (oaes & 0x07FF0000) >> 16;
1687+
__u32 rsvd1 = (oaes & 0x7fe0000) >> 17;
1688+
__u32 tthr = (oaes & 0x10000) >> 16;
16881689
__u32 normal_shn = (oaes >> 15) & 0x1;
16891690
__u32 egealpcn = (oaes & 0x4000) >> 14;
16901691
__u32 lbasin = (oaes & 0x2000) >> 13;
@@ -1702,7 +1703,9 @@ static void stdout_id_ctrl_oaes(__le32 ctrl_oaes)
17021703
printf(" [27:27] : %#x\tZone Descriptor Changed Notices %sSupported\n",
17031704
zicn, zicn ? "" : "Not ");
17041705
if (rsvd1)
1705-
printf(" [26:16] : %#x\tReserved\n", rsvd1);
1706+
printf(" [26:17] : %#x\tReserved\n", rsvd1);
1707+
printf(" [16:16] : %#x\tTemperature Threshold Hysteresis Recovery %sSupported\n",
1708+
tthr, tthr ? "" : "Not ");
17061709
printf(" [15:15] : %#x\tNormal NSS Shutdown Event %sSupported\n",
17071710
normal_shn, normal_shn ? "" : "Not ");
17081711
printf(" [14:14] : %#x\tEndurance Group Event Aggregate Log Page"\
@@ -2118,6 +2121,18 @@ static void stdout_id_ctrl_anacap(__u8 anacap)
21182121
printf("\n");
21192122
}
21202123

2124+
static void stdout_id_ctrl_tmpthha(__u8 tmpthha)
2125+
{
2126+
__u8 rsvd3 = (tmpthha & 0xf8) >> 3;
2127+
__u8 tmpthmh = tmpthha & 0x7;
2128+
2129+
if (rsvd3)
2130+
printf(" [7:3] : %#x\tReserved\n", rsvd3);
2131+
printf(" [2:0] : %#x\tTemperature Threshold Maximum Hysteresis\n",
2132+
tmpthmh);
2133+
printf("\n");
2134+
}
2135+
21212136
static void stdout_id_ctrl_sqes(__u8 sqes)
21222137
{
21232138
__u8 msqes = (sqes & 0xF0) >> 4;
@@ -2992,6 +3007,9 @@ static void stdout_id_ctrl(struct nvme_id_ctrl *ctrl,
29923007
printf("domainid : %d\n", le16_to_cpu(ctrl->domainid));
29933008
printf("megcap : %s\n",
29943009
uint128_t_to_l10n_string(le128_to_cpu(ctrl->megcap)));
3010+
printf("tmpthha : %#x\n", ctrl->tmpthha);
3011+
if (human)
3012+
stdout_id_ctrl_tmpthha(ctrl->tmpthha);
29953013
printf("sqes : %#x\n", ctrl->sqes);
29963014
if (human)
29973015
stdout_id_ctrl_sqes(ctrl->sqes);
@@ -4495,13 +4513,16 @@ static void stdout_feature_show_fields(enum nvme_features_id fid,
44954513
stdout_lba_range((struct nvme_lba_range_type *)buf, field);
44964514
break;
44974515
case NVME_FEAT_FID_TEMP_THRESH:
4516+
field = (result & 0x1c00000) >> 22;
4517+
printf("\tTemperature Threshold Hysteresis(TMPTHH): %s (%u K)\n",
4518+
nvme_degrees_string(field), field);
44984519
field = (result & 0x00300000) >> 20;
4499-
printf("\tThreshold Type Select (THSEL): %u - %s\n", field,
4520+
printf("\tThreshold Type Select (THSEL): %u - %s\n", field,
45004521
nvme_feature_temp_type_to_string(field));
45014522
field = (result & 0x000f0000) >> 16;
4502-
printf("\tThreshold Temperature Select (TMPSEL): %u - %s\n",
4523+
printf("\tThreshold Temperature Select (TMPSEL): %u - %s\n",
45034524
field, nvme_feature_temp_sel_to_string(field));
4504-
printf("\tTemperature Threshold (TMPTH): %s (%u K)\n",
4525+
printf("\tTemperature Threshold (TMPTH): %s (%u K)\n",
45054526
nvme_degrees_string(result & 0x0000ffff), result & 0x0000ffff);
45064527
break;
45074528
case NVME_FEAT_FID_ERR_RECOVERY:

0 commit comments

Comments
 (0)