Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nvme: Add show-regs and get-property commands NSSD print outputs #2227

Merged
merged 1 commit into from
Mar 5, 2024
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
19 changes: 19 additions & 0 deletions nvme-print-json.c
Original file line number Diff line number Diff line change
Expand Up @@ -1011,6 +1011,11 @@ static void json_registers_nssr(__u32 nssr, struct json_object *r)
obj_add_uint(r, "NVM Subsystem Reset Control (NSSRC)", nssr);
}

static void json_registers_nssd(__u32 nssd, struct json_object *r)
{
obj_add_uint_nx(r, "NVM Subsystem Shutdown Control (NSSC)", nssd);
}

static void json_registers_crto(__u32 crto, struct json_object *r)
{
obj_add_uint_x(r, "crto", crto);
Expand Down Expand Up @@ -1248,6 +1253,9 @@ static void json_single_property_human(int offset, uint64_t value64, struct json
case NVME_REG_NSSR:
json_registers_nssr(value32, r);
break;
case NVME_REG_NSSD:
json_registers_nssd(value32, r);
break;
case NVME_REG_CRTO:
json_registers_crto(value32, r);
break;
Expand Down Expand Up @@ -2476,6 +2484,16 @@ static void json_ctrl_registers_nssr(void *bar, struct json_object *r)
obj_add_int(r, "nssr", nssr);
}

static void json_ctrl_registers_nssd(void *bar, struct json_object *r)
{
uint32_t nssd = mmio_read32(bar + NVME_REG_NSSD);

if (human())
json_registers_nssd(nssd, obj_create_array_obj(r, "nssd"));
else
obj_add_int(r, "nssd", nssd);
}

static void json_ctrl_registers_crto(void *bar, struct json_object *r)
{
uint32_t crto = mmio_read32(bar + NVME_REG_CRTO);
Expand Down Expand Up @@ -2667,6 +2685,7 @@ static void json_ctrl_registers(void *bar, bool fabrics)
json_ctrl_registers_cc(bar, r);
json_ctrl_registers_csts(bar, r);
json_ctrl_registers_nssr(bar, r);
json_ctrl_registers_nssd(bar, r);
json_ctrl_registers_crto(bar, r);
json_ctrl_registers_aqa(bar, r);
json_ctrl_registers_asq(bar, r);
Expand Down
9 changes: 9 additions & 0 deletions nvme-print-stdout.c
Original file line number Diff line number Diff line change
Expand Up @@ -1223,6 +1223,11 @@ static void stdout_registers_csts(__u32 csts)

}

static void stdout_registers_nssd(__u32 nssd)
{
printf("\tNVM Subsystem Shutdown Control (NSSC): %#x\n\n", nssd);
}

static void stdout_registers_crto(__u32 crto)
{
printf("\tCRIMT : %d secs\n", NVME_CRTO_CRIMT(crto) / 2);
Expand Down Expand Up @@ -1621,6 +1626,10 @@ static void stdout_single_property(int offset, uint64_t value64)
printf("nssr : %x\n", value32);
printf("\tNVM Subsystem Reset Control (NSSRC): %u\n\n", value32);
break;
case NVME_REG_NSSD:
printf("nssd : %x\n", value32);
stdout_registers_nssd(value32);
break;
case NVME_REG_CRTO:
printf("crto : %x\n", value32);
stdout_registers_crto(value32);
Expand Down
2 changes: 1 addition & 1 deletion nvme.c
Original file line number Diff line number Diff line change
Expand Up @@ -5377,7 +5377,7 @@ static int get_property(int argc, char **argv, struct command *cmd, struct plugi
{
const char *desc = "Reads and shows the defined NVMe controller property\n"
"for NVMe over Fabric. Property offset must be one of:\n"
"CAP=0x0, VS=0x8, CC=0x14, CSTS=0x1c, NSSR=0x20";
"CAP=0x0, VS=0x8, CC=0x14, CSTS=0x1c, NSSR=0x20, NSSD=0x64, CRTO=0x68";
const char *offset = "offset of the requested property";
const char *human_readable = "show property in readable format";

Expand Down