Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions nvme-print-json.c
Original file line number Diff line number Diff line change
Expand Up @@ -3886,6 +3886,16 @@ static void json_feature_show_fields_fdp_events(struct json_object *r, unsigned
}
}

static void json_feature_show_fields_bpwp(struct json_object *r, unsigned int result)
{
__u8 field;

field = NVME_FEAT_BPWPC_BP0WPS(result);
obj_add_str(r, "Boot Partition 0 Write Protection State", nvme_bpwps_to_string(field));
field = NVME_FEAT_BPWPC_BP1WPS(result);
obj_add_str(r, "Boot Partition 1 Write Protection State", nvme_bpwps_to_string(field));
}

static void json_feature_show(enum nvme_features_id fid, int sel, unsigned int result)
{
struct json_object *r;
Expand Down Expand Up @@ -4022,6 +4032,9 @@ static void json_feature_show_fields(enum nvme_features_id fid, unsigned int res
case NVME_FEAT_FID_FDP_EVENTS:
json_feature_show_fields_fdp_events(r, result, buf);
break;
case NVME_FEAT_FID_BP_WRITE_PROTECT:
json_feature_show_fields_bpwp(r, result);
break;
default:
break;
}
Expand Down
8 changes: 8 additions & 0 deletions nvme-print-stdout.c
Original file line number Diff line number Diff line change
Expand Up @@ -5224,6 +5224,14 @@ static void stdout_feature_show_fields(enum nvme_features_id fid,
d->evta & 0x1 ? "" : "Not ");
}
break;
case NVME_FEAT_FID_BP_WRITE_PROTECT:
field = NVME_FEAT_BPWPC_BP1WPS(result);
printf("\tBoot Partition 1 Write Protection State (BP1WPS): %s\n",
nvme_bpwps_to_string(field));
field = NVME_FEAT_BPWPC_BP0WPS(result);
printf("\tBoot Partition 0 Write Protection State (BP0WPS): %s\n",
nvme_bpwps_to_string(field));
break;
default:
break;
}
Expand Down
18 changes: 18 additions & 0 deletions nvme-print.c
Original file line number Diff line number Diff line change
Expand Up @@ -1202,6 +1202,24 @@ const char *nvme_ns_wp_cfg_to_string(enum nvme_ns_write_protect_cfg state)
}
}

const char *nvme_bpwps_to_string(__u8 bpwps)
{
switch (bpwps) {
case NVME_FEAT_BPWPS_CHANGE_NOT_REQUESTED:
return "Change in state not requested";
case NVME_FEAT_BPWPS_WRITE_UNLOCKED:
return "Write Unlocked";
case NVME_FEAT_BPWPS_WRITE_LOCKED:
return "Write Locked";
case NVME_FEAT_BPWPS_WRITE_LOCKED_PWR_CYCLE:
return "Write Locked Until Power Cycle";
case NVME_FEAT_BPWPS_WRITE_PROTECTION_RPMB:
return "Write Protection controlled by RPMB";
default:
return "Reserved";
}
}

void nvme_directive_show(__u8 type, __u8 oper, __u16 spec, __u32 nsid, __u32 result,
void *buf, __u32 len, nvme_print_flags_t flags)
{
Expand Down
1 change: 1 addition & 0 deletions nvme-print.h
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@ const char *nvme_pel_ehai_pit_to_string(enum nvme_pel_ehai_pit pit);
const char *nvme_ssi_state_to_string(__u8 state);
const char *nvme_time_scale_to_string(__u8 ts);
const char *nvme_pls_mode_to_string(__u8 mode);
const char *nvme_bpwps_to_string(__u8 bpwps);

void nvme_dev_full_path(nvme_ns_t n, char *path, size_t len);
void nvme_generic_full_path(nvme_ns_t n, char *path, size_t len);
Expand Down