1
0
Fork 0

Merging upstream version 2.9.1.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-16 12:26:52 +01:00
parent bb95f41000
commit 698d985f9d
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
451 changed files with 5896 additions and 2734 deletions

View file

@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) 2023 Solidigm.
* Copyright (c) 2023-2024 Solidigm.
*
* Author: leonardo.da.cunha@solidigm.com
*/
@ -11,7 +11,8 @@
#include "nvme-print.h"
#include "solidigm-util.h"
#define SLDGM_TEMP_STATS_LID 0xC5
#define SLDGM_LEGACY_TEMP_STATS_LID 0xC5
#define SLDGM_TEMP_STATS_LID 0xD5
struct temp_stats {
__le64 curr;
@ -40,7 +41,7 @@ static void show_temp_stats(struct temp_stats *stats)
int sldgm_get_temp_stats_log(int argc, char **argv, struct command *cmd, struct plugin *plugin)
{
unsigned char buffer[4096] = {0};
struct nvme_dev *dev;
_cleanup_nvme_dev_ struct nvme_dev *dev = NULL;
__u8 uuid_idx;
int err;
@ -63,7 +64,7 @@ int sldgm_get_temp_stats_log(int argc, char **argv, struct command *cmd, struct
if (err)
return err;
uuid_idx = solidigm_get_vu_uuid_index(dev);
sldgm_get_uuid_index(dev, &uuid_idx);
struct nvme_get_log_args args = {
.lpo = 0,
@ -84,25 +85,26 @@ int sldgm_get_temp_stats_log(int argc, char **argv, struct command *cmd, struct
};
err = nvme_get_log(&args);
if (!err) {
uint64_t *guid = (uint64_t *)&buffer[4080];
if (err > 0) {
args.lid = SLDGM_LEGACY_TEMP_STATS_LID;
err = nvme_get_log(&args);
if (!err) {
uint64_t *guid = (uint64_t *)&buffer[4080];
if (guid[1] == 0xC7BB98B7D0324863 && guid[0] == 0xBB2C23990E9C722F) {
fprintf(stderr, "Error: Log page has 'OCP unsupported Requirements' GUID\n");
err = -EBADMSG;
goto closefd;
if (guid[1] == 0xC7BB98B7D0324863 && guid[0] == 0xBB2C23990E9C722F) {
fprintf(stderr,
"Error: Log page has OCP unsupported Requirements GUID\n");
return -EBADMSG;
}
}
}
if (!err) {
if (!cfg.raw_binary)
show_temp_stats((struct temp_stats *) buffer);
else
d_raw(buffer, sizeof(struct temp_stats));
} else if (err > 0) {
} else if (err > 0)
nvme_show_status(err);
}
closefd:
/* Redundant close() to make static code analysis happy */
close(dev->direct.fd);
dev_close(dev);
return err;
}