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

Types ctrl fna #886

Merged
merged 2 commits into from
Sep 16, 2024
Merged
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
39 changes: 34 additions & 5 deletions src/nvme/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,14 @@
*/
#define NVME_CHECK(value, name, check) ((value) == NVME_##name##_##check)

/**
* NVME_VAL() - get mask value shifted
* @name: The name of the sub-field within an nvme value
*
* Returns: The mask value shifted
*/
#define NVME_VAL(name) (NVME_##name##_MASK << NVME_##name##_SHIFT)

/**
* enum nvme_constants - A place to stash various constant nvme values
* @NVME_NSID_ALL: A broadcast value that is used to specify all
Expand Down Expand Up @@ -1984,6 +1992,14 @@ enum nvme_id_ctrl_fuses {
/**
* enum nvme_id_ctrl_fna - This field indicates attributes for the Format NVM
* command.
* @NVME_CTRL_FNA_FMT_ALL_NS_SHIFT: Shift amount to get the format applied to all namespaces
* @NVME_CTRL_FNA_SEC_ALL_NS_SHIFT: Shift amount to get the secure erase applied to all namespaces
* @NVME_CTRL_FNA_CES_SHIFT: Shift amount to get the cryptographic erase supported
* @NVME_CTRL_FNA_NSID_ALL_F_SHIFT: Shift amount to get the format supported an NSID FFFFFFFFh
* @NVME_CTRL_FNA_FMT_ALL_NS_MASK: Mask to get the format applied to all namespaces
* @NVME_CTRL_FNA_SEC_ALL_NS_MASK: Mask to get the secure erase applied to all namespaces
* @NVME_CTRL_FNA_CES_MASK: Mask to get the cryptographic erase supported
* @NVME_CTRL_FNA_NSID_ALL_F_MASK: Mask to get the format supported an NSID FFFFFFFFh
* @NVME_CTRL_FNA_FMT_ALL_NAMESPACES: If set, then all namespaces in an NVM
* subsystem shall be configured with the
* same attributes and a format (excluding
Expand All @@ -2008,11 +2024,24 @@ enum nvme_id_ctrl_fuses {
* FFFFFFFFh.
*/
enum nvme_id_ctrl_fna {
NVME_CTRL_FNA_FMT_ALL_NAMESPACES = 1 << 0,
NVME_CTRL_FNA_SEC_ALL_NAMESPACES = 1 << 1,
NVME_CTRL_FNA_CRYPTO_ERASE = 1 << 2,
NVME_CTRL_FNA_NSID_FFFFFFFF = 1 << 3,
};
NVME_CTRL_FNA_FMT_ALL_NS_SHIFT = 0,
NVME_CTRL_FNA_SEC_ALL_NS_SHIFT = 1,
NVME_CTRL_FNA_CES_SHIFT = 2,
NVME_CTRL_FNA_NSID_ALL_F_SHIFT = 3,
NVME_CTRL_FNA_FMT_ALL_NS_MASK = 0x1,
NVME_CTRL_FNA_SEC_ALL_NS_MASK = 0x1,
NVME_CTRL_FNA_CES_MASK = 0x1,
NVME_CTRL_FNA_NSID_ALL_F_MASK = 0x1,
NVME_CTRL_FNA_FMT_ALL_NAMESPACES = NVME_VAL(CTRL_FNA_FMT_ALL_NS),
NVME_CTRL_FNA_SEC_ALL_NAMESPACES = NVME_VAL(CTRL_FNA_SEC_ALL_NS),
NVME_CTRL_FNA_CRYPTO_ERASE = NVME_VAL(CTRL_FNA_CES),
NVME_CTRL_FNA_NSID_FFFFFFFF = NVME_VAL(CTRL_FNA_NSID_ALL_F),
};

#define NVME_CTRL_FNA_FMT_ALL_NS(fna) NVME_GET(fna, CTRL_FNA_FMT_ALL_NS)
#define NVME_CTRL_FNA_SEC_ALL_NS(fna) NVME_GET(fna, CTRL_FNA_SEC_ALL_NS)
#define NVME_CTRL_FNA_CES(fna) NVME_GET(fna, CTRL_FNA_CES)
#define NVME_CTRL_FNA_NSID_ALL_F(fna) NVME_GET(fna, CTRL_FNA_NSID_ALL_F)

/**
* enum nvme_id_ctrl_vwc - Volatile write cache
Expand Down