From: Tokunori Ikegami Date: Mon, 11 Mar 2024 14:28:57 +0000 (+0900) Subject: nvme-print-stdout: Use NVME_PMRSTS register definitions to print X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=2647b311acdb91ce19a926f33604f24d82d2a2f3;p=users%2Fsagi%2Fnvme-cli.git nvme-print-stdout: Use NVME_PMRSTS register definitions to print Change it instead of hardcoded register mask and shift values. Signed-off-by: Tokunori Ikegami --- diff --git a/nvme-print-stdout.c b/nvme-print-stdout.c index 14c248cd..eb674625 100644 --- a/nvme-print-stdout.c +++ b/nvme-print-stdout.c @@ -1379,16 +1379,14 @@ static void stdout_registers_pmrctl(__u32 pmrctl) static void stdout_registers_pmrsts(__u32 pmrsts, __u32 pmrctl) { - printf("\tController Base Address Invalid (CBAI): %x\n", - (pmrsts & 0x00001000) >> 12); + printf("\tController Base Address Invalid (CBAI): %x\n", NVME_PMRSTS_CBAI(pmrsts)); printf("\tHealth Status (HSTS): %s\n", - nvme_register_pmr_hsts_to_string((pmrsts & 0x00000e00) >> 9)); - printf("\tNot Ready (NRDY): "\ - "The Persistent Memory Region is %s to process "\ - "PCI Express memory read and write requests\n", - (pmrsts & 0x00000100) == 0 && (pmrctl & 0x00000001) ? - "READY" : "Not Ready"); - printf("\tError (ERR): %x\n", (pmrsts & 0x000000ff)); + nvme_register_pmr_hsts_to_string(NVME_PMRSTS_HSTS(pmrsts))); + printf("\tNot Ready (NRDY): "); + printf("The Persistent Memory Region is %s to process ", + !NVME_PMRSTS_NRDY(pmrsts) && NVME_PMRCTL_EN(pmrctl) ? "READY" : "Not Ready"); + printf("PCI Express memory read and write requests\n"); + printf("\tError (ERR): %x\n", NVME_PMRSTS_ERR(pmrsts)); } static void stdout_registers_pmrebs(__u32 pmrebs)