Skip to content

Commit

Permalink
types: add boot partition log support
Browse files Browse the repository at this point in the history
Signed-off-by: Gollu Appalanaidu <[email protected]>
[dwagner: ported from nvme-cli-monolithic]
Signed-off-by: Daniel Wagner <[email protected]>
  • Loading branch information
Gollu Appalanaidu authored and igaw committed Nov 16, 2021
1 parent 4948dd9 commit 21acd63
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/libnvme.map
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@
nvme_get_log;
nvme_get_log_ana;
nvme_get_log_ana_groups;
nvme_get_log_boot_partition;
nvme_get_log_changed_ns_list;
nvme_get_log_cmd_effects;
nvme_get_log_create_telemetry_host;
Expand Down
11 changes: 11 additions & 0 deletions src/nvme/ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -747,6 +747,17 @@ int nvme_get_log_endurance_grp_evt(int fd, bool rae, __u32 offset, __u32 len,
NVME_CSI_NVM, len, log);
}

int nvme_get_log_boot_partition(int fd, bool rae, __u8 lsp, __u32 len,
struct nvme_boot_partition *part)
{
BUILD_ASSERT(sizeof(struct nvme_boot_partition) == 16);
return nvme_get_log(fd, NVME_LOG_LID_BOOT_PARTITION,
NVME_NSID_NONE, 0, NVME_LOG_LSP_NONE,
NVME_LOG_LSI_NONE, rae, NVME_UUID_NONE,
NVME_CSI_NVM, len, part);

}

int nvme_get_log_discovery(int fd, bool rae, __u32 offset, __u32 len, void *log)
{
return nvme_get_log(fd, NVME_LOG_LID_DISCOVER, NVME_NSID_NONE, offset,
Expand Down
14 changes: 14 additions & 0 deletions src/nvme/ioctl.h
Original file line number Diff line number Diff line change
Expand Up @@ -1004,6 +1004,20 @@ int nvme_get_log_lba_status(int fd, bool rae, __u64 offset, __u32 len,
int nvme_get_log_endurance_grp_evt(int fd, bool rae, __u32 offset, __u32 len,
void *log);

/**
* nvme_get_log_boot_partition() -
* @fd: File descriptor of nvme device
* @rae: Retain asynchronous events
* @lsp: The log specified field of LID
* @len: The allocated size, minimum
* struct nvme_boot_partition
*
* Return: The nvme command status if a response was received (see
* &enum nvme_status_field) or -1 with errno set otherwise
*/
int nvme_get_log_boot_partition(int fd, bool rae, __u8 lsp, __u32 len,
struct nvme_boot_partition *part);

/**
* nvme_get_log_discovery() -
* @fd: File descriptor of nvme device
Expand Down
16 changes: 16 additions & 0 deletions src/nvme/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -3154,6 +3154,20 @@ struct nvme_eg_event_aggregate_log {
__le16 egids[];
};

/**
* struct nvme_boot_paritition -
* @lid:
* @bpinfo:
* @boot_partitiion_data:
*/
struct nvme_boot_partition {
__u8 lid;
__u8 rsvd1[3];
__le32 bpinfo;
__u8 rsvd8[8];
__u8 boot_partition_data[];
};

/**
* struct nvme_resv_notification_log -
* @lpc:
Expand Down Expand Up @@ -5021,6 +5035,7 @@ enum nvme_identify_cns {
* @NVME_LOG_LID_PERSISTENT_EVENT:
* @NVME_LOG_LID_LBA_STATUS:
* @NVME_LOG_LID_ENDURANCE_GRP_EVT:
* @NVME_LOG_LID_BOOT_PARTITION:
* @NVME_LOG_LID_DISCOVER:
* @NVME_LOG_LID_RESERVATION:
* @NVME_LOG_LID_SANITIZE:
Expand All @@ -5042,6 +5057,7 @@ enum nvme_cmd_get_log_lid {
NVME_LOG_LID_PERSISTENT_EVENT = 0x0d,
NVME_LOG_LID_LBA_STATUS = 0x0e,
NVME_LOG_LID_ENDURANCE_GRP_EVT = 0x0f,
NVME_LOG_LID_BOOT_PARTITION = 0x15,
NVME_LOG_LID_DISCOVER = 0x70,
NVME_LOG_LID_RESERVATION = 0x80,
NVME_LOG_LID_SANITIZE = 0x81,
Expand Down

0 comments on commit 21acd63

Please sign in to comment.