]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
nvme-print-stdout: Use NVME_PMREBS register definitions to print
authorTokunori Ikegami <ikegami.t@gmail.com>
Mon, 11 Mar 2024 14:36:06 +0000 (23:36 +0900)
committerDaniel Wagner <wagi@monom.org>
Tue, 12 Mar 2024 17:16:15 +0000 (18:16 +0100)
Change it instead of hardcoded register mask and shift values.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
nvme-print-stdout.c

index eb674625d938d3709dacee92ece4dede17a542a4..25bc0311cd820e946d25d586078a0c4d3b51f013 100644 (file)
@@ -1391,12 +1391,13 @@ static void stdout_registers_pmrsts(__u32 pmrsts, __u32 pmrctl)
 
 static void stdout_registers_pmrebs(__u32 pmrebs)
 {
-       printf("\tPMR Elasticity Buffer Size Base  (PMRWBZ): %x\n", (pmrebs & 0xffffff00) >> 8);
-       printf("\tRead Bypass Behavior                     : memory reads not conflicting with memory writes "\
-              "in the PMR Elasticity Buffer %s bypass those memory writes\n",
-              (pmrebs & 0x00000010) ? "SHALL" : "MAY");
+       printf("\tPMR Elasticity Buffer Size Base  (PMRWBZ): %x\n", NVME_PMREBS_PMRWBZ(pmrebs));
+       printf("\tRead Bypass Behavior                     : ");
+       printf("memory reads not conflicting with memory writes ");
+       printf("in the PMR Elasticity Buffer %s bypass those memory writes\n",
+              NVME_PMREBS_RBB(pmrebs) ? "SHALL" : "MAY");
        printf("\tPMR Elasticity Buffer Size Units (PMRSZU): %s\n",
-               nvme_register_pmr_pmrszu_to_string(pmrebs & 0x0000000f));
+              nvme_register_pmr_pmrszu_to_string(NVME_PMREBS_PMRSZU(pmrebs)));
 }
 
 static void stdout_registers_pmrswtp(__u32 pmrswtp)