From 60214ccff11f63b4c748844ef486171591d0256d Mon Sep 17 00:00:00 2001 From: Tokunori Ikegami Date: Sun, 24 Nov 2024 14:21:55 +0900 Subject: [PATCH] ocp: set UUID index to get hwcomp log The index is required by the OCP specification. Signed-off-by: Tokunori Ikegami --- plugins/ocp/ocp-hardware-component-log.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/plugins/ocp/ocp-hardware-component-log.c b/plugins/ocp/ocp-hardware-component-log.c index 5e039dd853..230d3d92bd 100644 --- a/plugins/ocp/ocp-hardware-component-log.c +++ b/plugins/ocp/ocp-hardware-component-log.c @@ -11,6 +11,7 @@ #include "nvme-print.h" #include "ocp-hardware-component-log.h" #include "ocp-print.h" +#include "ocp-utils.h" //#define HWCOMP_DUMMY @@ -171,21 +172,23 @@ static int get_hwcomp_log_data(struct nvme_dev *dev, struct hwcomp_log *log) int ret = 0; size_t desc_offset = offsetof(struct hwcomp_log, desc); struct nvme_get_log_args args = { - .lpo = desc_offset, .args_size = sizeof(args), .fd = dev_fd(dev), .timeout = NVME_DEFAULT_IOCTL_TIMEOUT, .lid = LID_HWCOMP, .nsid = NVME_NSID_ALL, + .log = log, + .len = desc_offset, }; + ocp_get_uuid_index(dev, &args.uuidx); + #ifdef HWCOMP_DUMMY memcpy(log, hwcomp_dummy, desc_offset); #else /* HWCOMP_DUMMY */ - ret = nvme_get_log_simple(dev_fd(dev), LID_HWCOMP, desc_offset, log); + ret = nvme_get_log_page(dev_fd(dev), NVME_LOG_PAGE_PDU_SIZE, &args); if (ret) { - print_info_error("error: ocp: failed to get log simple (hwcomp: %02X, ret: %d)\n", - LID_HWCOMP, ret); + print_info_error("error: ocp: failed to get hwcomp log size (ret: %d)\n", ret); return ret; } #endif /* HWCOMP_DUMMY */ @@ -208,6 +211,7 @@ static int get_hwcomp_log_data(struct nvme_dev *dev, struct hwcomp_log *log) } args.log = log->desc, + args.lpo = desc_offset, #ifdef HWCOMP_DUMMY memcpy(log->desc, &hwcomp_dummy[desc_offset], args.len);