int nvme_format(int fd, __u32 nsid, __u8 lbaf, __u8 ses, __u8 pi,
__u8 pil, __u8 ms, __u32 timeout)
{
- __u32 cdw10 = lbaf | ms << 4 | pi << 5 | pil << 8 | ses << 9;
+ __u8 lbafl = lbaf & 0xf;
+ __u8 lbafu = (lbaf >> 4) & 0x3;
+ __u32 cdw10 = lbafl | ms << 4 | pi << 5 | pil << 8 | ses << 9 |
+ lbafu << 12;
+
struct nvme_admin_cmd cmd = {
.opcode = nvme_admin_format_nvm,
.nsid = nsid,
"data erase) or delete data encryption key if specified. "\
"Can also be used to change LBAF to change the namespaces reported physical block format.";
const char *namespace_id = "identifier of desired namespace";
- const char *lbaf = "LBA format to apply (required)";
+ const char *lbaf = "[0-63]: LBA format lower (LBAFL) and upper (LBAFU), "\
+ "mention directly LBAF format that needs be applied (required)";
const char *ses = "[0-2]: secure erase";
const char *pil = "[0-1]: protection info location last/first 8 bytes of metadata";
const char *pi = "[0-3]: protection info off/Type 1/Type 2/Type 3";
err = -EINVAL;
goto close_fd;
}
- if (cfg.lbaf > 15) {
+ if (cfg.lbaf > 63) {
fprintf(stderr, "invalid lbaf:%d\n", cfg.lbaf);
err = -EINVAL;
goto close_fd;