diff options
Diffstat (limited to 'nvme-ioctl.c')
-rw-r--r-- | nvme-ioctl.c | 47 |
1 files changed, 46 insertions, 1 deletions
diff --git a/nvme-ioctl.c b/nvme-ioctl.c index c511808..5a57a25 100644 --- a/nvme-ioctl.c +++ b/nvme-ioctl.c @@ -126,7 +126,8 @@ int nvme_passthru(int fd, unsigned long ioctl_cmd, __u8 opcode, int nvme_io(int fd, __u8 opcode, __u32 nsid, __u64 slba, __u16 nblocks, __u16 control, __u32 dsmgmt, __u32 reftag, __u16 apptag, - __u16 appmask, __u64 storage_tag, void *data, void *metadata) + __u16 appmask, __u64 storage_tag, void *data, __u32 buffer_size, + void *metadata, __u32 mbuffer_size) { struct nvme_passthru_cmd cmd = { .opcode = opcode, @@ -141,6 +142,8 @@ int nvme_io(int fd, __u8 opcode, __u32 nsid, __u64 slba, __u16 nblocks, .cdw13 = dsmgmt, .cdw14 = reftag, .cdw15 = apptag | (appmask << 16), + .data_len = buffer_size, + .metadata_len = mbuffer_size, }; return nvme_submit_io_passthru(fd, &cmd); @@ -408,6 +411,11 @@ int nvme_identify_ns_list_csi(int fd, __u32 nsid, __u8 csi, bool all, void *data return nvme_identify13(fd, nsid, cns, csi << 24, data); } +int nvme_cmd_set_independent_identify_ns(int fd, __u32 nsid, void *data) +{ + return nvme_identify(fd, nsid, NVME_ID_CNS_CS_INDEPENDENT_ID_NS, data); +} + int nvme_identify_ctrl_list(int fd, __u32 nsid, __u16 cntid, void *data) { int cns = nsid ? NVME_ID_CNS_CTRL_NS_LIST : NVME_ID_CNS_CTRL_LIST; @@ -471,6 +479,11 @@ int nvme_identify_domain_list(int fd, __u16 dom_id, void *data) return nvme_identify13(fd, 0, NVME_ID_CNS_DOMAIN_LIST, dom_id, data); } +int nvme_identify_endurance_group_list(int fd, __u16 endgrp_id, void *data) +{ + return nvme_identify13(fd, 0, NVME_ID_CNS_ENDURANCE_GROUP_ID, endgrp_id, data); +} + int nvme_get_log14(int fd, __u32 nsid, __u8 log_id, __u8 lsp, __u64 lpo, __u16 lsi, bool rae, __u8 uuid_ix, __u8 csi, bool ot, __u32 data_len, void *data) @@ -598,6 +611,12 @@ int nvme_effects_log(int fd, struct nvme_effects_log_page *effects_log) NVME_NO_LOG_LSP, sizeof(*effects_log), effects_log); } +int nvme_supported_log(int fd, struct nvme_support_log_pages *supports) +{ + return nvme_get_log(fd, NVME_NSID_ALL, NVME_LOG_SUPPORTED_PAGES, false, + NVME_NO_LOG_LSP, sizeof(*supports), supports); +} + int nvme_discovery_log(int fd, struct nvmf_disc_rsp_page_hdr *log, __u32 size) { return nvme_get_log(fd, 0, NVME_LOG_DISC, false, NVME_NO_LOG_LSP, size, log); @@ -654,6 +673,18 @@ int nvme_resv_notif_log(int fd, struct nvme_resv_notif_log *resv) NVME_NO_LOG_LSP, sizeof(*resv), resv); } +int nvme_boot_part_log(int fd, __u8 lsp, void *data, __u32 size) +{ + return nvme_get_log(fd, NVME_NSID_ALL, NVME_LOG_BOOT_PARTITION, + false, lsp, size, data); +} + +int nvme_fid_support_effects_log(int fd, struct nvme_fid_support_effects *fid_log) +{ + return nvme_get_log(fd, 0, NVME_LOG_FID_SUPPORT_EFFECTS, false, + NVME_NO_LOG_LSP, sizeof(*fid_log), fid_log); +} + int nvme_feature(int fd, __u8 opcode, __u32 nsid, __u32 cdw10, __u32 cdw11, __u32 cdw12, __u32 cdw14, __u32 data_len, void *data, __u32 *result) { @@ -900,6 +931,20 @@ int nvme_sec_recv(int fd, __u32 nsid, __u8 nssf, __u16 spsp, return nvme_submit_admin_passthru(fd, &cmd); } +int nvme_lockdown(int fd, __u8 scp, __u8 prhbt, __u8 ifc, __u8 ofi, + __u8 uuid) +{ + __u32 cdw10 = ofi << 8 | (ifc & 0x3) << 5 | (prhbt & 0x1) << 4 | (scp & 0xF); + + struct nvme_admin_cmd cmd = { + .opcode = nvme_admin_lockdown_cmd, + .cdw10 = cdw10, + .cdw14 = uuid & 0x3F, + }; + + return nvme_submit_admin_passthru(fd, &cmd); +} + int nvme_get_lba_status(int fd, __u32 namespace_id, __u64 slba, __u32 mndw, __u8 atype, __u16 rl, void *data, __u32 timeout_ms) { |