Skip to content

Commit 9562713

Browse files
ikegami-tigaw
authored andcommitted
types: add SMART / health information CW shift and mask values
Also changed to use the definitions for AENCFG SHCW. Signed-off-by: Tokunori Ikegami <[email protected]>
1 parent 7e26cf9 commit 9562713

1 file changed

Lines changed: 68 additions & 13 deletions

File tree

src/nvme/types.h

Lines changed: 68 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3729,6 +3729,42 @@ struct nvme_smart_log {
37293729

37303730
/**
37313731
* enum nvme_smart_crit - Critical Warning
3732+
* @NVME_SMART_CW_ASCBT_SHIFT: Shift amount to get the available spare capacity has fallen
3733+
* below the threshold.
3734+
* @NVME_SMART_CW_TTC_SHIFT: Shift amount to get the temperature is either greater
3735+
* than or equal to an over temperature threshold; or
3736+
* less than or equal to an under temperature threshold.
3737+
* @NVME_SMART_CW_NDR_SHIFT: Shift amount to get the NVM subsystem reliability has
3738+
* been degraded due to significant media related errors
3739+
* or any internal error that degrades NVM subsystem
3740+
* reliability.
3741+
* @NVME_SMART_CW_AMRO_SHIFT: Shift amount to get the all of the media has been placed in read
3742+
* only mode. The controller shall not set this bit if
3743+
* the read-only condition on the media is a result of
3744+
* a change in the write protection state of a namespace.
3745+
* @NVME_SMART_CW_VMBF_SHIFT: Shift amount to get the volatile memory backup
3746+
* device has failed. This field is only valid if the
3747+
* controller has a volatile memory backup solution.
3748+
* @NVME_SMART_CW_PMRRO_SHIFT: Shift amount to get the Persistent Memory Region has become
3749+
* read-only or unreliable.
3750+
* @NVME_SMART_CW_ASCBT_MASK: If set, then the available spare capacity has fallen
3751+
* below the threshold.
3752+
* @NVME_SMART_CW_TTC_MASK: Mask to get the temperature is either greater
3753+
* than or equal to an over temperature threshold; or
3754+
* less than or equal to an under temperature threshold.
3755+
* @NVME_SMART_CW_NDR_MASK: Mask to get the NVM subsystem reliability has
3756+
* been degraded due to significant media related errors
3757+
* or any internal error that degrades NVM subsystem
3758+
* reliability.
3759+
* @NVME_SMART_CW_AMRO_MASK: Mask to get the all of the media has been placed in read
3760+
* only mode. The controller shall not set this bit if
3761+
* the read-only condition on the media is a result of
3762+
* a change in the write protection state of a namespace.
3763+
* @NVME_SMART_CW_VMBF_MASK: Mask to get the volatile memory backup
3764+
* device has failed. This field is only valid if the
3765+
* controller has a volatile memory backup solution.
3766+
* @NVME_SMART_CW_PMRRO_MASK: Mask to get the Persistent Memory Region has become
3767+
* read-only or unreliable.
37323768
* @NVME_SMART_CRIT_SPARE: If set, then the available spare capacity has fallen
37333769
* below the threshold.
37343770
* @NVME_SMART_CRIT_TEMPERATURE: If set, then a temperature is either greater
@@ -3749,13 +3785,32 @@ struct nvme_smart_log {
37493785
* read-only or unreliable.
37503786
*/
37513787
enum nvme_smart_crit {
3752-
NVME_SMART_CRIT_SPARE = 1 << 0,
3753-
NVME_SMART_CRIT_TEMPERATURE = 1 << 1,
3754-
NVME_SMART_CRIT_DEGRADED = 1 << 2,
3755-
NVME_SMART_CRIT_MEDIA = 1 << 3,
3756-
NVME_SMART_CRIT_VOLATILE_MEMORY = 1 << 4,
3757-
NVME_SMART_CRIT_PMR_RO = 1 << 5,
3758-
};
3788+
NVME_SMART_CW_ASCBT_SHIFT = 0,
3789+
NVME_SMART_CW_TTC_SHIFT = 1,
3790+
NVME_SMART_CW_NDR_SHIFT = 2,
3791+
NVME_SMART_CW_AMRO_SHIFT = 3,
3792+
NVME_SMART_CW_VMBF_SHIFT = 4,
3793+
NVME_SMART_CW_PMRRO_SHIFT = 5,
3794+
NVME_SMART_CW_ASCBT_MASK = 0x1,
3795+
NVME_SMART_CW_TTC_MASK = 0x1,
3796+
NVME_SMART_CW_NDR_MASK = 0x1,
3797+
NVME_SMART_CW_AMRO_MASK = 0x1,
3798+
NVME_SMART_CW_VMBF_MASK = 0x1,
3799+
NVME_SMART_CW_PMRRO_MASK = 0x1,
3800+
NVME_SMART_CRIT_SPARE = NVME_VAL(SMART_CW_ASCBT),
3801+
NVME_SMART_CRIT_TEMPERATURE = NVME_VAL(SMART_CW_TTC),
3802+
NVME_SMART_CRIT_DEGRADED = NVME_VAL(SMART_CW_NDR),
3803+
NVME_SMART_CRIT_MEDIA = NVME_VAL(SMART_CW_AMRO),
3804+
NVME_SMART_CRIT_VOLATILE_MEMORY = NVME_VAL(SMART_CW_VMBF),
3805+
NVME_SMART_CRIT_PMR_RO = NVME_VAL(SMART_CW_PMRRO),
3806+
};
3807+
3808+
#define NVME_SMART_CW_ASCBT(cw) NVME_GET(cw, SMART_CW_ASCBT),
3809+
#define NVME_SMART_CW_TTC(cw) NVME_GET(cw, SMART_CW_TTC),
3810+
#define NVME_SMART_CW_NDR(cw) NVME_GET(cw, SMART_CW_NDR),
3811+
#define NVME_SMART_CW_AMRO(cw) NVME_GET(cw, SMART_CW_AMRO),
3812+
#define NVME_SMART_CW_VMBF(cw) NVME_GET(cw, SMART_CW_VMBF),
3813+
#define NVME_SMART_CW_PMRRO(cw) NVME_GET(cw, SMART_CW_PMRRO),
37593814

37603815
/**
37613816
* enum nvme_smart_egcw - Endurance Group Critical Warning Summary
@@ -9387,12 +9442,12 @@ enum nvme_feat_tmpthresh_thsel {
93879442
* @NVME_FEATURE_AENCFG_NOTICE_DISCOVERY_CHANGE:
93889443
*/
93899444
enum nvme_features_async_event_config_flags {
9390-
NVME_FEATURE_AENCFG_SMART_CRIT_SPARE = 1 << 0,
9391-
NVME_FEATURE_AENCFG_SMART_CRIT_TEMPERATURE = 1 << 1,
9392-
NVME_FEATURE_AENCFG_SMART_CRIT_DEGRADED = 1 << 2,
9393-
NVME_FEATURE_AENCFG_SMART_CRIT_READ_ONLY = 1 << 3,
9394-
NVME_FEATURE_AENCFG_SMART_CRIT_VOLATILE_BACKUP = 1 << 4,
9395-
NVME_FEATURE_AENCFG_SMART_CRIT_READ_ONLY_PMR = 1 << 5,
9445+
NVME_FEATURE_AENCFG_SMART_CRIT_SPARE = NVME_SMART_CRIT_SPARE,
9446+
NVME_FEATURE_AENCFG_SMART_CRIT_TEMPERATURE = NVME_SMART_CRIT_TEMPERATURE,
9447+
NVME_FEATURE_AENCFG_SMART_CRIT_DEGRADED = NVME_SMART_CRIT_DEGRADED,
9448+
NVME_FEATURE_AENCFG_SMART_CRIT_READ_ONLY = NVME_SMART_CRIT_MEDIA,
9449+
NVME_FEATURE_AENCFG_SMART_CRIT_VOLATILE_BACKUP = NVME_SMART_CRIT_VOLATILE_MEMORY,
9450+
NVME_FEATURE_AENCFG_SMART_CRIT_READ_ONLY_PMR = NVME_SMART_CRIT_PMR_RO,
93969451
NVME_FEATURE_AENCFG_NOTICE_NAMESPACE_ATTRIBUTES = 1 << 8,
93979452
NVME_FEATURE_AENCFG_NOTICE_FIRMWARE_ACTIVATION = 1 << 9,
93989453
NVME_FEATURE_AENCFG_NOTICE_TELEMETRY_LOG = 1 << 10,

0 commit comments

Comments
 (0)