Skip to content

Commit 40a3bbd

Browse files
jimmunnigaw
authored andcommitted
nvme-print: Decode 2 new bits in ctratt.
Add decoding of Power Measurement Support (PMS) and Power Limit Support (PLS) bits in Controller Attributes (CTRATT) field of Identify Controller Data Structure. Signed-off-by: Jim Munn <[email protected]>
1 parent 4efa117 commit 40a3bbd

2 files changed

Lines changed: 13 additions & 3 deletions

File tree

libnvme/src/nvme/types.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1821,6 +1821,8 @@ enum nvme_id_ctrl_oaes {
18211821
* @NVME_CTRL_CTRATT_HMBR: HMB Restrict Non-Operational Power State Access
18221822
* @NVME_CTRL_CTRATT_RHII: Reservations and Host Identifier Interaction
18231823
* @NVME_CTRL_CTRATT_FDPS: Flexible Data Placement supported
1824+
* @NVME_CTRL_CTRATT_PLS: Power Limit Support
1825+
* @NVME_CTRL_CTRATT_PMS: Power Measurement Support
18241826
*/
18251827
enum nvme_id_ctrl_ctratt {
18261828
NVME_CTRL_CTRATT_128_ID = 1 << 0,
@@ -1843,6 +1845,8 @@ enum nvme_id_ctrl_ctratt {
18431845
NVME_CTRL_CTRATT_HMBR = 1 << 17,
18441846
NVME_CTRL_CTRATT_RHII = 1 << 18,
18451847
NVME_CTRL_CTRATT_FDPS = 1 << 19,
1848+
NVME_CTRL_CTRATT_PLS = 1 << 20,
1849+
NVME_CTRL_CTRATT_PMS = 1 << 21,
18461850
};
18471851

18481852
/**

nvme-print-stdout.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1925,7 +1925,9 @@ static void stdout_id_ctrl_oaes(__le32 ctrl_oaes)
19251925
static void stdout_id_ctrl_ctratt(__le32 ctrl_ctratt)
19261926
{
19271927
__u32 ctratt = le32_to_cpu(ctrl_ctratt);
1928-
__u32 rsvd20 = (ctratt >> 20);
1928+
__u32 rsvd22 = (ctratt >> 22);
1929+
__u32 pms = (ctratt & NVME_CTRL_CTRATT_PMS) >> 21;
1930+
__u32 pls = (ctratt & NVME_CTRL_CTRATT_PLS) >> 20;
19291931
__u32 fdps = (ctratt & NVME_CTRL_CTRATT_FDPS) >> 19;
19301932
__u32 rhii = (ctratt & NVME_CTRL_CTRATT_RHII) >> 18;
19311933
__u32 hmbr = (ctratt & NVME_CTRL_CTRATT_HMBR) >> 17;
@@ -1947,8 +1949,12 @@ static void stdout_id_ctrl_ctratt(__le32 ctrl_ctratt)
19471949
__u32 nopspm = (ctratt & NVME_CTRL_CTRATT_NON_OP_PSP) >> 1;
19481950
__u32 hids = (ctratt & NVME_CTRL_CTRATT_128_ID) >> 0;
19491951

1950-
if (rsvd20)
1951-
printf(" [31:20] : %#x\tReserved\n", rsvd20);
1952+
if (rsvd22)
1953+
printf(" [31:22] : %#x\tReserved\n", rsvd22);
1954+
printf(" [21:21] : %#x\tPower Measurement %sSupported\n",
1955+
pms, pms ? "" : "Not ");
1956+
printf(" [20:20] : %#x\tPower Limit %sSupported\n",
1957+
pls, pls ? "" : "Not ");
19521958
printf(" [19:19] : %#x\tFlexible Data Placement %sSupported\n",
19531959
fdps, fdps ? "" : "Not ");
19541960
printf(" [18:18] : %#x\tReservations and Host Identifier Interaction %sSupported\n",

0 commit comments

Comments
 (0)