Merging upstream version 2.12.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
078c0dbcc0
commit
635faa7346
571 changed files with 10718 additions and 2738 deletions
|
@ -39,6 +39,7 @@ void print_stats_desc(struct telemetry_stats_desc *stat_desc)
|
|||
printf("Statistics info : 0x%x\n", stat_desc->info);
|
||||
printf("NS info : 0x%x\n", stat_desc->ns_info);
|
||||
printf("Statistic Data Size : 0x%x\n", le16_to_cpu(stat_data_sz));
|
||||
printf("Namespace ID[15:0] : 0x%x\n", stat_desc->nsid);
|
||||
|
||||
if (stat_data_sz > 0) {
|
||||
printf("%s : 0x",
|
||||
|
@ -109,13 +110,18 @@ void print_telemetry_fifo_event(__u8 class_type,
|
|||
if ((id == ADMIN_QUEUE_NONZERO_STATUS) ||
|
||||
(id == IO_QUEUE_NONZERO_STATUS)) {
|
||||
printf(" Cmd Op Code : 0x%02x\n", data[0]);
|
||||
__u16 status = *(__u16 *)&data[1];
|
||||
__u16 cmd_id = *(__u16 *)&data[3];
|
||||
__u16 sq_id = *(__u16 *)&data[5];
|
||||
__u16 status;
|
||||
__u16 cmd_id;
|
||||
__u16 sq_id;
|
||||
|
||||
memcpy(&status, &data[1], sizeof(status));
|
||||
memcpy(&cmd_id, &data[3], sizeof(cmd_id));
|
||||
memcpy(&sq_id, &data[5], sizeof(sq_id));
|
||||
|
||||
printf(" Status Code : 0x%04x\n", le16_to_cpu(status));
|
||||
printf(" Cmd ID : 0x%04x\n", le16_to_cpu(cmd_id));
|
||||
printf(" SQ ID : 0x%04x\n", le16_to_cpu(sq_id));
|
||||
printf(" LID,FID,Other Cmd Reserved : 0x%02x\n", data[7]);
|
||||
} else if (id == CC_REGISTER_CHANGED) {
|
||||
__u32 cc_reg_data = *(__u32 *)data;
|
||||
|
||||
|
@ -126,6 +132,20 @@ void print_telemetry_fifo_event(__u8 class_type,
|
|||
|
||||
printf(" CSTS Reg Data : 0x%08x\n",
|
||||
le32_to_cpu(csts_reg_data));
|
||||
} else if (id == OOB_COMMAND) {
|
||||
printf(" Cmd Op Code : 0x%02x\n", data[0]);
|
||||
__u16 status;
|
||||
memcpy(&status, &data[1], sizeof(status));
|
||||
|
||||
printf(" Admin Cmd Status : 0x%04x\n", le16_to_cpu(status));
|
||||
printf(" NVMe MI SC : 0x%02x\n", data[3]);
|
||||
printf(" Byte1 Req Msg : 0x%02x\n", data[4]);
|
||||
printf(" Byte2 Req Msg : 0x%02x\n", data[5]);
|
||||
} else if (id == OOB_AER_EVENT_MSG_TRANS) {
|
||||
__u64 aem = *(__u64 *)data;
|
||||
|
||||
printf(" AEM : 0x%016"PRIx64"\n",
|
||||
le64_to_cpu(aem));
|
||||
}
|
||||
if (size > 8)
|
||||
print_vu_event_data((size-8), (__u8 *)&data[8]);
|
||||
|
@ -168,7 +188,7 @@ void print_telemetry_fifo_event(__u8 class_type,
|
|||
|
||||
case TELEMETRY_MEDIA_WEAR_CLASS:
|
||||
printf(" Event ID : 0x%04x %s\n",
|
||||
id, telemetry_media_debug_event_id_to_string(id));
|
||||
id, telemetry_media_wear_event_id_to_string(id));
|
||||
__u32 host_tb_written = *(__u32 *)&data[0];
|
||||
__u32 media_tb_written = *(__u32 *)&data[4];
|
||||
__u32 media_tb_erased = *(__u32 *)&data[8];
|
||||
|
@ -190,6 +210,16 @@ void print_telemetry_fifo_event(__u8 class_type,
|
|||
print_stats_desc((struct telemetry_stats_desc *)data);
|
||||
break;
|
||||
|
||||
case TELEMETRY_VIRTUAL_FIFO_EVENT_CLASS:
|
||||
printf(" Event ID : 0x%04x %s\n",
|
||||
id, telemetry_virtual_fifo_event_id_to_string(id));
|
||||
|
||||
__u16 vu_event_id = *(__u16 *)data;
|
||||
|
||||
printf(" VU Virtual FIFO Event ID : 0x%02x\n", le16_to_cpu(vu_event_id));
|
||||
printf("\n");
|
||||
break;
|
||||
|
||||
default:
|
||||
/*
|
||||
* printf("Unknown Event Class Type\n");
|
||||
|
@ -489,9 +519,9 @@ int get_telemetry_das_offset_and_size(
|
|||
return 0;
|
||||
}
|
||||
|
||||
int get_static_id_ascii_string(int identifier, char *description)
|
||||
int get_statistic_id_ascii_string(int identifier, char *description)
|
||||
{
|
||||
if (pstring_buffer == NULL)
|
||||
if (!pstring_buffer || !description)
|
||||
return -1;
|
||||
|
||||
struct nvme_ocp_telemetry_string_header *pocp_ts_header =
|
||||
|
@ -522,16 +552,17 @@ int get_static_id_ascii_string(int identifier, char *description)
|
|||
memcpy(description, pdescription,
|
||||
peach_statistic_entry->ascii_id_length + 1);
|
||||
|
||||
// If ASCII string isn't found, see in our internal Map
|
||||
// for 2.5 Spec defined strings (id < 0x1D).
|
||||
if ((description == NULL) && (identifier < 0x1D))
|
||||
memcpy(description,
|
||||
statistic_identifiers_map[identifier].description,
|
||||
peach_statistic_entry->ascii_id_length + 1);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
// If ASCII string isn't found, see in our internal Map
|
||||
// for 2.5 Spec defined strings
|
||||
if (identifier <= 0x1D) {
|
||||
strcpy(description, statistic_identifiers_map[identifier].description);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -629,10 +660,10 @@ int parse_ocp_telemetry_string_log(int event_fifo_num, int identifier, int debug
|
|||
}
|
||||
|
||||
if (string_table == STATISTICS_IDENTIFIER_STRING)
|
||||
get_static_id_ascii_string(identifier, description);
|
||||
else if (string_table == EVENT_STRING)
|
||||
get_statistic_id_ascii_string(identifier, description);
|
||||
else if (string_table == EVENT_STRING && debug_event_class < 0x80)
|
||||
get_event_id_ascii_string(identifier, debug_event_class, description);
|
||||
else if (string_table == VU_EVENT_STRING)
|
||||
else if (string_table == VU_EVENT_STRING || debug_event_class >= 0x80)
|
||||
get_vu_event_id_ascii_string(identifier, debug_event_class, description);
|
||||
|
||||
return 0;
|
||||
|
@ -1204,10 +1235,15 @@ int parse_statistic(struct nvme_ocp_telemetry_statistic_descriptor *pstatistic_e
|
|||
struct json_object *pstats_array, FILE *fp)
|
||||
{
|
||||
if (pstatistic_entry == NULL) {
|
||||
nvme_show_error("Input buffer was NULL");
|
||||
nvme_show_error("Statistics Input buffer was NULL");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (pstatistic_entry->statistic_id == STATISTICS_RESERVED_ID)
|
||||
/* End of statistics entries, return -1 to stop processing the buffer */
|
||||
return -1;
|
||||
|
||||
|
||||
unsigned int data_size = pstatistic_entry->statistic_data_size * SIZE_OF_DWORD;
|
||||
__u8 *pdata = (__u8 *)pstatistic_entry +
|
||||
sizeof(struct nvme_ocp_telemetry_statistic_descriptor);
|
||||
|
@ -1236,8 +1272,33 @@ int parse_statistic(struct nvme_ocp_telemetry_statistic_descriptor *pstatistic_e
|
|||
pstatistic_entry->statistic_data_size);
|
||||
json_add_formatted_u32_str(pstatistics_object, STR_RESERVED,
|
||||
pstatistic_entry->reserved);
|
||||
json_add_formatted_var_size_str(pstatistics_object, STR_STATISTICS_SPECIFIC_DATA,
|
||||
pdata, data_size);
|
||||
if (pstatistic_entry->statistic_id == MAX_DIE_BAD_BLOCK_ID) {
|
||||
json_add_formatted_u32_str(pstatistics_object,
|
||||
STR_STATISTICS_WORST_DIE_PERCENT,
|
||||
pdata[0]);
|
||||
json_add_formatted_u32_str(pstatistics_object,
|
||||
STR_STATISTICS_WORST_DIE_RAW,
|
||||
*(__u16 *)&pdata[2]);
|
||||
} else if (pstatistic_entry->statistic_id == MAX_NAND_CHANNEL_BAD_BLOCK_ID) {
|
||||
json_add_formatted_u32_str(pstatistics_object,
|
||||
STR_STATISTICS_WORST_NAND_CHANNEL_PERCENT,
|
||||
pdata[0]);
|
||||
json_add_formatted_u32_str(pstatistics_object,
|
||||
STR_STATISTICS_WORST_NAND_CHANNEL_RAW,
|
||||
*(__u16 *)&pdata[2]);
|
||||
} else if (pstatistic_entry->statistic_id == MIN_NAND_CHANNEL_BAD_BLOCK_ID) {
|
||||
json_add_formatted_u32_str(pstatistics_object,
|
||||
STR_STATISTICS_BEST_NAND_CHANNEL_PERCENT,
|
||||
pdata[0]);
|
||||
json_add_formatted_u32_str(pstatistics_object,
|
||||
STR_STATISTICS_BEST_NAND_CHANNEL_RAW,
|
||||
*(__u16 *)&pdata[2]);
|
||||
} else {
|
||||
json_add_formatted_var_size_str(pstatistics_object,
|
||||
STR_STATISTICS_SPECIFIC_DATA,
|
||||
pdata,
|
||||
data_size);
|
||||
}
|
||||
|
||||
if (pstatistics_object != NULL)
|
||||
json_array_add_value_object(pstats_array, pstatistics_object);
|
||||
|
@ -1257,8 +1318,33 @@ int parse_statistic(struct nvme_ocp_telemetry_statistic_descriptor *pstatistic_e
|
|||
fprintf(fp, "%s: 0x%x\n", STR_STATISTICS_DATA_SIZE,
|
||||
pstatistic_entry->statistic_data_size);
|
||||
fprintf(fp, "%s: 0x%x\n", STR_RESERVED, pstatistic_entry->reserved);
|
||||
print_formatted_var_size_str(STR_STATISTICS_SPECIFIC_DATA, pdata,
|
||||
data_size, fp);
|
||||
if (pstatistic_entry->statistic_id == MAX_DIE_BAD_BLOCK_ID) {
|
||||
fprintf(fp, "%s: 0x%02x\n", STR_STATISTICS_WORST_DIE_PERCENT,
|
||||
pdata[0]);
|
||||
fprintf(fp, "%s: 0x%04x\n", STR_STATISTICS_WORST_DIE_RAW,
|
||||
*(__u16 *)&pdata[2]);
|
||||
} else if (pstatistic_entry->statistic_id ==
|
||||
MAX_NAND_CHANNEL_BAD_BLOCK_ID) {
|
||||
fprintf(fp, "%s: 0x%02x\n",
|
||||
STR_STATISTICS_WORST_NAND_CHANNEL_PERCENT,
|
||||
pdata[0]);
|
||||
fprintf(fp, "%s: 0x%04x\n",
|
||||
STR_STATISTICS_WORST_NAND_CHANNEL_RAW,
|
||||
*(__u16 *)&pdata[2]);
|
||||
} else if (pstatistic_entry->statistic_id ==
|
||||
MIN_NAND_CHANNEL_BAD_BLOCK_ID) {
|
||||
fprintf(fp, "%s: 0x%02x\n",
|
||||
STR_STATISTICS_BEST_NAND_CHANNEL_PERCENT,
|
||||
pdata[0]);
|
||||
fprintf(fp, "%s: 0x%04x\n",
|
||||
STR_STATISTICS_BEST_NAND_CHANNEL_RAW,
|
||||
*(__u16 *)&pdata[2]);
|
||||
} else {
|
||||
print_formatted_var_size_str(STR_STATISTICS_SPECIFIC_DATA,
|
||||
pdata,
|
||||
data_size,
|
||||
fp);
|
||||
}
|
||||
fprintf(fp, STR_LINE2);
|
||||
} else {
|
||||
printf("%s: 0x%x\n", STR_STATISTICS_IDENTIFIER,
|
||||
|
@ -1275,8 +1361,33 @@ int parse_statistic(struct nvme_ocp_telemetry_statistic_descriptor *pstatistic_e
|
|||
printf("%s: 0x%x\n", STR_STATISTICS_DATA_SIZE,
|
||||
pstatistic_entry->statistic_data_size);
|
||||
printf("%s: 0x%x\n", STR_RESERVED, pstatistic_entry->reserved);
|
||||
print_formatted_var_size_str(STR_STATISTICS_SPECIFIC_DATA, pdata,
|
||||
data_size, fp);
|
||||
if (pstatistic_entry->statistic_id == MAX_DIE_BAD_BLOCK_ID) {
|
||||
printf("%s: 0x%02x\n", STR_STATISTICS_WORST_DIE_PERCENT,
|
||||
pdata[0]);
|
||||
printf("%s: 0x%04x\n", STR_STATISTICS_WORST_DIE_RAW,
|
||||
*(__u16 *)&pdata[2]);
|
||||
} else if (pstatistic_entry->statistic_id ==
|
||||
MAX_NAND_CHANNEL_BAD_BLOCK_ID) {
|
||||
printf("%s: 0x%02x\n",
|
||||
STR_STATISTICS_WORST_NAND_CHANNEL_PERCENT,
|
||||
pdata[0]);
|
||||
printf("%s: 0x%04x\n",
|
||||
STR_STATISTICS_WORST_NAND_CHANNEL_RAW,
|
||||
*(__u16 *)&pdata[2]);
|
||||
} else if (pstatistic_entry->statistic_id ==
|
||||
MIN_NAND_CHANNEL_BAD_BLOCK_ID) {
|
||||
printf("%s: 0x%02x\n",
|
||||
STR_STATISTICS_BEST_NAND_CHANNEL_PERCENT,
|
||||
pdata[0]);
|
||||
printf("%s: 0x%04x\n",
|
||||
STR_STATISTICS_BEST_NAND_CHANNEL_RAW,
|
||||
*(__u16 *)&pdata[2]);
|
||||
} else {
|
||||
print_formatted_var_size_str(STR_STATISTICS_SPECIFIC_DATA,
|
||||
pdata,
|
||||
data_size,
|
||||
fp);
|
||||
}
|
||||
printf(STR_LINE2);
|
||||
}
|
||||
}
|
||||
|
@ -1297,6 +1408,7 @@ int parse_statistics(struct json_object *root, struct nvme_ocp_telemetry_offsets
|
|||
__u32 stats_da_1_start_dw = 0, stats_da_1_size_dw = 0;
|
||||
__u32 stats_da_2_start_dw = 0, stats_da_2_size_dw = 0;
|
||||
__u8 *pstats_offset = NULL;
|
||||
int parse_rc = 0;
|
||||
|
||||
if (poffsets->data_area == 1) {
|
||||
__u32 stats_da_1_start = *(__u32 *)(pda1_ocp_header_offset +
|
||||
|
@ -1336,7 +1448,11 @@ int parse_statistics(struct json_object *root, struct nvme_ocp_telemetry_offsets
|
|||
(struct nvme_ocp_telemetry_statistic_descriptor *)
|
||||
(pstats_offset + offset_to_move);
|
||||
|
||||
parse_statistic(pstatistic_entry, pstats_array, fp);
|
||||
parse_rc = parse_statistic(pstatistic_entry, pstats_array, fp);
|
||||
if (parse_rc < 0)
|
||||
/* end of stats entries or null pointer, so break */
|
||||
break;
|
||||
|
||||
offset_to_move += (pstatistic_entry->statistic_data_size * SIZE_OF_DWORD +
|
||||
stat_des_size);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue