nvmecontrol: Add nvme 2.0 fields to read_logpage

Add the lpo, ot, csi and uuid_index fields to read_logpage. The logpage
command has not been updated to allow these to be specified.

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D44683
This commit is contained in:
Warner Losh 2024-04-16 16:37:20 -06:00
parent 383a44fc0b
commit 98ab7d0a30
4 changed files with 16 additions and 8 deletions

View file

@ -102,7 +102,8 @@ slot_has_valid_firmware(int fd, int slot)
int has_fw = false;
read_logpage(fd, NVME_LOG_FIRMWARE_SLOT,
NVME_GLOBAL_NAMESPACE_TAG, 0, 0, 0, &fw, sizeof(fw));
NVME_GLOBAL_NAMESPACE_TAG, 0, 0, 0, 0, 0, 0, 0,
&fw, sizeof(fw));
if (fw.revision[slot-1][0] != '\0')
has_fw = true;

View file

@ -190,7 +190,8 @@ get_log_buffer(uint32_t size)
void
read_logpage(int fd, uint8_t log_page, uint32_t nsid, uint8_t lsp,
uint16_t lsi, uint8_t rae, void *payload, uint32_t payload_size)
uint16_t lsi, uint8_t rae, uint64_t lpo, uint8_t csi, uint8_t ot,
uint16_t uuid_index, void *payload, uint32_t payload_size)
{
struct nvme_pt_command pt;
u_int numd;
@ -207,9 +208,12 @@ read_logpage(int fd, uint8_t log_page, uint32_t nsid, uint8_t lsp,
pt.cmd.cdw11 = htole32(
((uint32_t)lsi << 16) | /* LSI */
(numd >> 16)); /* NUMDU */
pt.cmd.cdw12 = 0; /* LPOL */
pt.cmd.cdw13 = 0; /* LPOU */
pt.cmd.cdw14 = 0; /* UUID Index */
pt.cmd.cdw12 = htole32(lpo & 0xffffffff); /* LPOL */
pt.cmd.cdw13 = htole32(lpo >> 32); /* LPOU */
pt.cmd.cdw14 = htole32(
(csi << 24) | /* CSI */
(ot << 23) | /* OT */
uuid_index); /* UUID Index */
pt.buf = payload;
pt.len = payload_size;
pt.is_read = 1;
@ -794,7 +798,8 @@ logpage(const struct cmd *f, int argc, char *argv[])
/* Read the log page */
buf = get_log_buffer(size);
read_logpage(fd, opt.page, nsid, opt.lsp, opt.lsi, opt.rae, buf, size);
read_logpage(fd, opt.page, nsid, opt.lsp, opt.lsi, opt.rae,
0, 0, 0, 0, buf, size);
print_fn(&cdata, buf, size);
close(fd);

View file

@ -84,7 +84,8 @@ int read_namespace_data(int fd, uint32_t nsid, struct nvme_namespace_data *nsdat
void print_hex(void *data, uint32_t length);
void print_namespace(struct nvme_namespace_data *nsdata);
void read_logpage(int fd, uint8_t log_page, uint32_t nsid, uint8_t lsp,
uint16_t lsi, uint8_t rae, void *payload, uint32_t payload_size);
uint16_t lsi, uint8_t rae, uint64_t lpo, uint8_t csi, uint8_t ot,
uint16_t uuid_index, void *payload, uint32_t payload_size);
void print_temp_C(uint16_t t);
void print_temp_K(uint16_t t);
void print_intel_add_smart(const struct nvme_controller_data *cdata __unused, void *buf, uint32_t size __unused);

View file

@ -182,7 +182,8 @@ sanitize(const struct cmd *f, int argc, char *argv[])
wait:
read_logpage(fd, NVME_LOG_SANITIZE_STATUS,
NVME_GLOBAL_NAMESPACE_TAG, 0, 0, 0, &ss, sizeof(ss));
NVME_GLOBAL_NAMESPACE_TAG, 0, 0, 0,
0, 0, 0, 0, &ss, sizeof(ss));
switch (NVMEV(NVME_SS_PAGE_SSTAT_STATUS, ss.sstat)) {
case NVME_SS_PAGE_SSTAT_STATUS_NEVER:
printf("Never sanitized");