]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
ocp: split telemetry string log print codes
authorTokunori Ikegami <ikegami.t@gmail.com>
Sun, 6 Oct 2024 12:11:54 +0000 (21:11 +0900)
committerDaniel Wagner <wagi@monom.org>
Wed, 23 Oct 2024 12:24:49 +0000 (14:24 +0200)
Move into ocp-print-stdout.c and ocp-print-json.c.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
plugins/ocp/ocp-nvme.c
plugins/ocp/ocp-print-binary.c
plugins/ocp/ocp-print-json.c
plugins/ocp/ocp-print-stdout.c
plugins/ocp/ocp-print.c
plugins/ocp/ocp-print.h

index 48046edea27170bd68f640a150e15ed298a60191..f9ddec9c98b3c43ad97676ee609cc177b55b1cd0 100644 (file)
@@ -2470,452 +2470,6 @@ static int get_dssd_async_event_config(int argc, char **argv, struct command *cm
 static int ocp_telemetry_str_log_format(int argc, char **argv, struct command *cmd,
                                        struct plugin *plugin);
 
-
-static int ocp_print_c9_log_normal(struct telemetry_str_log_format *log_data, __u8 *log_data_buf)
-{
-       //calculating the index value for array
-       __le64 stat_id_index = (log_data->sitsz * 4) / 16;
-       __le64 eve_id_index = (log_data->estsz * 4) / 16;
-       __le64 vu_eve_index = (log_data->vu_eve_st_sz * 4) / 16;
-       __le64 ascii_table_index = (log_data->asctsz * 4);
-       //Calculating the offset for dynamic fields.
-       __le64 stat_id_str_table_ofst = log_data->sits * 4;
-       __le64 event_str_table_ofst = log_data->ests * 4;
-       __le64 vu_event_str_table_ofst = log_data->vu_eve_sts * 4;
-       __le64 ascii_table_ofst = log_data->ascts * 4;
-       struct statistics_id_str_table_entry stat_id_str_table_arr[stat_id_index];
-       struct event_id_str_table_entry event_id_str_table_arr[eve_id_index];
-       struct vu_event_id_str_table_entry vu_event_id_str_table_arr[vu_eve_index];
-       int j;
-
-       printf("  Log Page Version                                : 0x%x\n", log_data->log_page_version);
-
-       printf("  Reserved                                        : ");
-       for (j = 0; j < 15; j++)
-               printf("%d", log_data->reserved1[j]);
-       printf("\n");
-
-       printf("  Log page GUID                                   : 0x");
-       for (j = C9_GUID_LENGTH - 1; j >= 0; j--)
-               printf("%02x", log_data->log_page_guid[j]);
-       printf("\n");
-
-       printf("  Telemetry String Log Size                       : 0x%lx\n", le64_to_cpu(log_data->sls));
-
-       printf("  Reserved                                        : ");
-       for (j = 0; j < 24; j++)
-               printf("%d", log_data->reserved2[j]);
-       printf("\n");
-
-       printf("  Statistics Identifier String Table Start        : 0x%lx\n", le64_to_cpu(log_data->sits));
-       printf("  Statistics Identifier String Table Size         : 0x%lx\n", le64_to_cpu(log_data->sitsz));
-       printf("  Event String Table Start                        : 0x%lx\n", le64_to_cpu(log_data->ests));
-       printf("  Event String Table Size                         : 0x%lx\n", le64_to_cpu(log_data->estsz));
-       printf("  VU Event String Table Start                     : 0x%lx\n", le64_to_cpu(log_data->vu_eve_sts));
-       printf("  VU Event String Table Size                      : 0x%lx\n", le64_to_cpu(log_data->vu_eve_st_sz));
-       printf("  ASCII Table Start                               : 0x%lx\n", le64_to_cpu(log_data->ascts));
-       printf("  ASCII Table Size                                : 0x%lx\n", le64_to_cpu(log_data->asctsz));
-
-       printf("  FIFO 1 ASCII String\n");
-       printf("   index    value    ascii_val\n");
-       for (j = 0; j < 16; j++)
-               printf("  %d       %d        %c    \n", j, log_data->fifo1[j], log_data->fifo1[j]);
-
-       printf("  FIFO 2 ASCII String\n");
-       printf("   index    value    ascii_val\n");
-       for (j = 0; j < 16; j++)
-               printf("  %d       %d        %c    \n", j, log_data->fifo2[j], log_data->fifo2[j]);
-
-       printf("  FIFO 3 ASCII String\n");
-       printf("   index    value    ascii_val\n");
-       for (j = 0; j < 16; j++)
-               printf("  %d       %d        %c    \n", j, log_data->fifo3[j], log_data->fifo3[j]);
-
-       printf("  FIFO 4 ASCII String\n");
-       printf("   index    value    ascii_val\n");
-       for (j = 0; j < 16; j++)
-               printf("  %d       %d        %c    \n", j, log_data->fifo4[j], log_data->fifo4[j]);
-
-       printf("  FIFO 5 ASCII String\n");
-       printf("   index    value    ascii_val\n");
-       for (j = 0; j < 16; j++)
-               printf("  %d       %d        %c    \n", j, log_data->fifo5[j], log_data->fifo5[j]);
-
-       printf("  FIFO 6 ASCII String\n");
-       printf("   index    value    ascii_val\n");
-       for (j = 0; j < 16; j++)
-               printf("  %d       %d        %c    \n", j, log_data->fifo6[j], log_data->fifo6[j]);
-
-       printf("  FIFO 7 ASCII String\n");
-       printf("   index    value    ascii_val\n");
-       for (j = 0; j < 16; j++)
-               printf("  %d       %d        %c    \n", j, log_data->fifo7[j], log_data->fifo7[j]);
-
-       printf("  FIFO 8 ASCII String\n");
-       printf("   index    value    ascii_val\n");
-       for (j = 0; j < 16; j++)
-               printf("  %d       %d        %c    \n", j, log_data->fifo8[j], log_data->fifo8[j]);
-
-       printf("  FIFO 9 ASCII String\n");
-       printf("   index    value    ascii_val\n");
-       for (j = 0; j < 16; j++)
-               printf("  %d       %d        %c    \n", j, log_data->fifo9[j], log_data->fifo9[j]);
-
-       printf("  FIFO 10 ASCII String\n");
-       printf("   index    value    ascii_val\n");
-       for (j = 0; j < 16; j++)
-               printf("  %d       %d        %c    \n", j, log_data->fifo10[j], log_data->fifo10[j]);
-
-       printf("  FIFO 11 ASCII String\n");
-       printf("   index    value    ascii_val\n");
-       for (j = 0; j < 16; j++)
-               printf("  %d       %d        %c    \n", j, log_data->fifo11[j], log_data->fifo11[j]);
-
-       printf("  FIFO 12 ASCII String\n");
-       printf("   index    value    ascii_val\n");
-       for (j = 0; j < 16; j++)
-               printf("  %d       %d        %c    \n", j, log_data->fifo12[j], log_data->fifo12[j]);
-
-       printf("  FIFO 13 ASCII String\n");
-       printf("   index    value    ascii_val\n");
-       for (j = 0; j < 16; j++)
-               printf("  %d       %d        %c    \n", j, log_data->fifo13[j], log_data->fifo13[j]);
-
-       printf("  FIFO 14 ASCII String\n");
-       printf("   index    value    ascii_val\n");
-       for (j = 0; j < 16; j++)
-               printf("  %d       %d        %c    \n", j, log_data->fifo14[j], log_data->fifo14[j]);
-
-       printf("  FIFO 15 ASCII String\n");
-       printf("   index    value    ascii_val\n");
-       for (j = 0; j < 16; j++)
-               printf("  %d       %d        %c    \n", j, log_data->fifo15[j], log_data->fifo16[j]);
-
-       printf("  FIFO 16 ASCII String\n");
-       printf("   index    value    ascii_val\n");
-       for (j = 0; j < 16; j++)
-               printf("  %d       %d        %c    \n", j, log_data->fifo16[j], log_data->fifo16[j]);
-
-       printf("  Reserved                                        : ");
-       for (j = 0; j < 48; j++)
-               printf("%d", log_data->reserved3[j]);
-       printf("\n");
-
-
-       if (log_data->sitsz != 0) {
-               memcpy(stat_id_str_table_arr,
-               (__u8 *)log_data_buf + stat_id_str_table_ofst,
-               (log_data->sitsz * 4));
-               printf("  Statistics Identifier String Table\n");
-               for (j = 0; j < stat_id_index; j++) {
-                       printf("   Vendor Specific Statistic Identifier : 0x%x\n",
-                       le16_to_cpu(stat_id_str_table_arr[j].vs_si));
-                       printf("   Reserved                             : 0x%x\n",
-                       stat_id_str_table_arr[j].reserved1);
-                       printf("   ASCII ID Length                      : 0x%x\n",
-                       stat_id_str_table_arr[j].ascii_id_len);
-                       printf("   ASCII ID offset                      : 0x%lx\n",
-                       le64_to_cpu(stat_id_str_table_arr[j].ascii_id_ofst));
-                       printf("   Reserved                             : 0x%x\n",
-                       stat_id_str_table_arr[j].reserved2);
-               }
-       }
-
-
-       if (log_data->estsz != 0) {
-               memcpy(event_id_str_table_arr, (__u8 *)log_data_buf +
-               event_str_table_ofst, (log_data->estsz * 4));
-               printf("  Event Identifier String Table Entry\n");
-               for (j = 0; j < eve_id_index; j++) {
-                       printf("   Debug Event Class        : 0x%x\n",
-                       event_id_str_table_arr[j].deb_eve_class);
-                       printf("   Event Identifier         : 0x%x\n",
-                       le16_to_cpu(event_id_str_table_arr[j].ei));
-                       printf("   ASCII ID Length          : 0x%x\n",
-                       event_id_str_table_arr[j].ascii_id_len);
-                       printf("   ASCII ID offset          : 0x%lx\n",
-                       le64_to_cpu(event_id_str_table_arr[j].ascii_id_ofst));
-                       printf("   Reserved                 : 0x%x\n",
-                       event_id_str_table_arr[j].reserved2);
-
-               }
-       }
-
-       if (log_data->vu_eve_st_sz != 0) {
-               memcpy(vu_event_id_str_table_arr, (__u8 *)log_data_buf +
-               vu_event_str_table_ofst, (log_data->vu_eve_st_sz * 4));
-               printf("  VU Event Identifier String Table Entry\n");
-               for (j = 0; j < vu_eve_index; j++) {
-                       printf("   Debug Event Class        : 0x%x\n",
-                       vu_event_id_str_table_arr[j].deb_eve_class);
-                       printf("   VU Event Identifier      : 0x%x\n",
-                       le16_to_cpu(vu_event_id_str_table_arr[j].vu_ei));
-                       printf("   ASCII ID Length          : 0x%x\n",
-                       vu_event_id_str_table_arr[j].ascii_id_len);
-                       printf("   ASCII ID offset          : 0x%lx\n",
-                       le64_to_cpu(vu_event_id_str_table_arr[j].ascii_id_ofst));
-                       printf("   Reserved                 : 0x%x\n",
-                       vu_event_id_str_table_arr[j].reserved);
-
-               }
-       }
-
-       if (log_data->asctsz != 0) {
-               printf("  ASCII Table\n");
-               printf("   Byte    Data_Byte    ASCII_Character\n");
-               for (j = 0; j < ascii_table_index; j++)
-                       printf("    %lld        %d             %c\n",
-                       ascii_table_ofst+j, log_data_buf[ascii_table_ofst + j],
-                       (char)log_data_buf[ascii_table_ofst + j]);
-       }
-
-       return 0;
-}
-
-static int ocp_print_c9_log_json(struct telemetry_str_log_format *log_data, __u8 *log_data_buf)
-{
-       struct json_object *root = json_create_object();
-       char res_arr[48];
-       char *res = res_arr;
-       char guid_buf[C9_GUID_LENGTH];
-       char *guid = guid_buf;
-       char fifo_arr[16];
-       char *fifo = fifo_arr;
-       char buf[128];
-       //calculating the index value for array
-       __le64 stat_id_index = (log_data->sitsz * 4) / 16;
-       __le64 eve_id_index = (log_data->estsz * 4) / 16;
-       __le64 vu_eve_index = (log_data->vu_eve_st_sz * 4) / 16;
-       __le64 ascii_table_index = (log_data->asctsz * 4);
-       //Calculating the offset for dynamic fields.
-       __le64 stat_id_str_table_ofst = log_data->sits * 4;
-       __le64 event_str_table_ofst = log_data->ests * 4;
-       __le64 vu_event_str_table_ofst = log_data->vu_eve_sts * 4;
-       __le64 ascii_table_ofst = log_data->ascts * 4;
-       struct statistics_id_str_table_entry stat_id_str_table_arr[stat_id_index];
-       struct event_id_str_table_entry event_id_str_table_arr[eve_id_index];
-       struct vu_event_id_str_table_entry vu_event_id_str_table_arr[vu_eve_index];
-       __u8 ascii_table_info_arr[ascii_table_index];
-       char ascii_buf[ascii_table_index];
-       char *ascii = ascii_buf;
-       int j;
-
-       json_object_add_value_int(root, "Log Page Version", le16_to_cpu(log_data->log_page_version));
-
-       memset((__u8 *)res, 0, 15);
-       for (j = 0; j < 15; j++)
-               res += sprintf(res, "%d", log_data->reserved1[j]);
-       json_object_add_value_string(root, "Reserved", res_arr);
-
-       memset((void *)guid, 0, C9_GUID_LENGTH);
-       for (j = C9_GUID_LENGTH - 1; j >= 0; j--)
-               guid += sprintf(guid, "%02x", log_data->log_page_guid[j]);
-       json_object_add_value_string(root, "Log page GUID", guid_buf);
-
-       json_object_add_value_int(root, "Telemetry String Log Size", le64_to_cpu(log_data->sls));
-
-       memset((__u8 *)res, 0, 24);
-       for (j = 0; j < 24; j++)
-               res += sprintf(res, "%d", log_data->reserved2[j]);
-       json_object_add_value_string(root, "Reserved", res_arr);
-
-       json_object_add_value_int(root, "Statistics Identifier String Table Start", le64_to_cpu(log_data->sits));
-       json_object_add_value_int(root, "Event String Table Start", le64_to_cpu(log_data->ests));
-       json_object_add_value_int(root, "Event String Table Size", le64_to_cpu(log_data->estsz));
-       json_object_add_value_int(root, "VU Event String Table Start", le64_to_cpu(log_data->vu_eve_sts));
-       json_object_add_value_int(root, "VU Event String Table Size", le64_to_cpu(log_data->vu_eve_st_sz));
-       json_object_add_value_int(root, "ASCII Table Start", le64_to_cpu(log_data->ascts));
-       json_object_add_value_int(root, "ASCII Table Size", le64_to_cpu(log_data->asctsz));
-
-       memset((void *)fifo, 0, 16);
-       for (j = 0; j < 16; j++)
-               fifo += sprintf(fifo, "%c", log_data->fifo1[j]);
-       json_object_add_value_string(root, "FIFO 1 ASCII String", fifo_arr);
-
-       memset((void *)fifo, 0, 16);
-       for (j = 0; j < 16; j++)
-               fifo += sprintf(fifo, "%c", log_data->fifo2[j]);
-       json_object_add_value_string(root, "FIFO 2 ASCII String", fifo_arr);
-
-       memset((void *)fifo, 0, 16);
-       for (j = 0; j < 16; j++)
-               fifo += sprintf(fifo, "%c", log_data->fifo3[j]);
-       json_object_add_value_string(root, "FIFO 3 ASCII String", fifo_arr);
-
-       memset((void *)fifo, 0, 16);
-       for (j = 0; j < 16; j++)
-               fifo += sprintf(fifo, "%c", log_data->fifo4[j]);
-       json_object_add_value_string(root, "FIFO 4 ASCII String", fifo_arr);
-
-       memset((void *)fifo, 0, 16);
-       for (j = 0; j < 16; j++)
-               fifo += sprintf(fifo, "%c", log_data->fifo5[j]);
-       json_object_add_value_string(root, "FIFO 5 ASCII String", fifo_arr);
-
-       memset((void *)fifo, 0, 16);
-       for (j = 0; j < 16; j++)
-               fifo += sprintf(fifo, "%c", log_data->fifo6[j]);
-       json_object_add_value_string(root, "FIFO 6 ASCII String", fifo_arr);
-
-       memset((void *)fifo, 0, 16);
-       for (j = 0; j < 16; j++)
-               fifo += sprintf(fifo, "%c", log_data->fifo7[j]);
-       json_object_add_value_string(root, "FIFO 7 ASCII String", fifo_arr);
-
-       memset((void *)fifo, 0, 16);
-       for (j = 0; j < 16; j++)
-               fifo += sprintf(fifo, "%c", log_data->fifo8[j]);
-       json_object_add_value_string(root, "FIFO 8 ASCII String", fifo_arr);
-
-       memset((void *)fifo, 0, 16);
-       for (j = 0; j < 16; j++)
-               fifo += sprintf(fifo, "%c", log_data->fifo9[j]);
-       json_object_add_value_string(root, "FIFO 9 ASCII String", fifo_arr);
-
-       memset((void *)fifo, 0, 16);
-       for (j = 0; j < 16; j++)
-               fifo += sprintf(fifo, "%c", log_data->fifo10[j]);
-       json_object_add_value_string(root, "FIFO 10 ASCII String", fifo_arr);
-
-       memset((void *)fifo, 0, 16);
-       for (j = 0; j < 16; j++)
-               fifo += sprintf(fifo, "%c", log_data->fifo11[j]);
-       json_object_add_value_string(root, "FIFO 11 ASCII String", fifo_arr);
-
-       memset((void *)fifo, 0, 16);
-       for (j = 0; j < 16; j++)
-               fifo += sprintf(fifo, "%c", log_data->fifo12[j]);
-       json_object_add_value_string(root, "FIFO 12 ASCII String", fifo_arr);
-
-       memset((void *)fifo, 0, 16);
-       for (j = 0; j < 16; j++)
-               fifo += sprintf(fifo, "%c", log_data->fifo13[j]);
-       json_object_add_value_string(root, "FIFO 13 ASCII String", fifo_arr);
-
-       memset((void *)fifo, 0, 16);
-       for (j = 0; j < 16; j++)
-               fifo += sprintf(fifo, "%c", log_data->fifo14[j]);
-       json_object_add_value_string(root, "FIFO 14 ASCII String", fifo_arr);
-
-       memset((void *)fifo, 0, 16);
-       for (j = 0; j < 16; j++)
-               fifo += sprintf(fifo, "%c", log_data->fifo15[j]);
-       json_object_add_value_string(root, "FIFO 15 ASCII String", fifo_arr);
-
-       memset((void *)fifo, 0, 16);
-       for (j = 0; j < 16; j++)
-               fifo += sprintf(fifo, "%c", log_data->fifo16[j]);
-       json_object_add_value_string(root, "FIFO 16 ASCII String", fifo_arr);
-
-       memset((__u8 *)res, 0, 48);
-       for (j = 0; j < 48; j++)
-               res += sprintf(res, "%d", log_data->reserved3[j]);
-       json_object_add_value_string(root, "Reserved", res_arr);
-
-       if (log_data->sitsz != 0) {
-
-               memcpy(stat_id_str_table_arr,
-               (__u8 *)log_data_buf + stat_id_str_table_ofst,
-               (log_data->sitsz * 4));
-               struct json_object *stat_table = json_create_object();
-
-               for (j = 0; j < stat_id_index; j++) {
-                       struct json_object *entry = json_create_object();
-
-                       json_object_add_value_uint(entry, "Vendor Specific Statistic Identifier",
-                       le16_to_cpu(stat_id_str_table_arr[j].vs_si));
-                       json_object_add_value_uint(entry, "Reserved",
-                       le64_to_cpu(stat_id_str_table_arr[j].reserved1));
-                       json_object_add_value_uint(entry, "ASCII ID Length",
-                       le64_to_cpu(stat_id_str_table_arr[j].ascii_id_len));
-                       json_object_add_value_uint(entry, "ASCII ID offset",
-                       le64_to_cpu(stat_id_str_table_arr[j].ascii_id_ofst));
-                       json_object_add_value_uint(entry, "Reserved2",
-                       le64_to_cpu(stat_id_str_table_arr[j].reserved2));
-                       sprintf(buf, "Statistics Identifier String Table %d", j);
-                       json_object_add_value_object(stat_table, buf, entry);
-               }
-
-               json_object_add_value_object(root,
-               "Statistics Identifier String Table", stat_table);
-       }
-
-       if (log_data->estsz != 0) {
-               struct json_object *eve_table = json_create_object();
-
-               memcpy(event_id_str_table_arr,
-               (__u8 *)log_data_buf + event_str_table_ofst,
-               (log_data->estsz * 4));
-               for (j = 0; j < eve_id_index; j++) {
-                       struct json_object *entry = json_create_object();
-
-                       json_object_add_value_int(entry, "Debug Event Class",
-                       le16_to_cpu(event_id_str_table_arr[j].deb_eve_class));
-                       json_object_add_value_int(entry, "Event Identifier",
-                       le16_to_cpu(event_id_str_table_arr[j].ei));
-                       json_object_add_value_int(entry, "ASCII ID Length",
-                       le64_to_cpu(event_id_str_table_arr[j].ascii_id_len));
-                       json_object_add_value_int(entry, "ASCII ID offset",
-                       le64_to_cpu(event_id_str_table_arr[j].ascii_id_ofst));
-                       json_object_add_value_int(entry, "Reserved",
-                       le64_to_cpu(event_id_str_table_arr[j].reserved2));
-                       sprintf(buf, "Event Identifier String Table Entry %d", j);
-                       json_object_add_value_object(eve_table, buf, entry);
-               }
-               json_object_add_value_object(root,
-               "Event Identifier String Table Entry",
-               eve_table);
-       }
-
-       if (log_data->vu_eve_st_sz != 0) {
-               struct json_object *vu_eve_table = json_create_object();
-
-               memcpy(vu_event_id_str_table_arr,
-               (__u8 *)log_data_buf + vu_event_str_table_ofst,
-               (log_data->vu_eve_st_sz * 4));
-               for (j = 0; j < vu_eve_index; j++) {
-                       struct json_object *entry = json_create_object();
-
-                       json_object_add_value_int(entry, "Debug Event Class",
-                       le16_to_cpu(vu_event_id_str_table_arr[j].deb_eve_class));
-                       json_object_add_value_int(entry, "VU Event Identifier",
-                       le16_to_cpu(vu_event_id_str_table_arr[j].vu_ei));
-                       json_object_add_value_int(entry, "ASCII ID Length",
-                       le64_to_cpu(vu_event_id_str_table_arr[j].ascii_id_len));
-                       json_object_add_value_int(entry, "ASCII ID offset",
-                       le64_to_cpu(vu_event_id_str_table_arr[j].ascii_id_ofst));
-                       json_object_add_value_int(entry, "Reserved",
-                       le64_to_cpu(vu_event_id_str_table_arr[j].reserved));
-                       sprintf(buf, "VU Event Identifier String Table Entry %d", j);
-                       json_object_add_value_object(vu_eve_table, buf, entry);
-               }
-               json_object_add_value_object(root,
-               "VU Event Identifier String Table Entry",
-               vu_eve_table);
-       }
-
-       if (log_data->asctsz != 0) {
-               memcpy(ascii_table_info_arr,
-               (__u8 *)log_data_buf + ascii_table_ofst,
-               (log_data->asctsz * 4));
-               memset((void *)ascii, 0, ascii_table_index);
-               for (j = 0; j < ascii_table_index; j++)
-                       ascii += sprintf(ascii, "%c", ascii_table_info_arr[j]);
-               json_object_add_value_string(root, "ASCII Table", ascii_buf);
-       }
-
-       json_print_object(root, NULL);
-       printf("\n");
-       json_free_object(root);
-
-       return 0;
-}
-
-static void ocp_print_c9_log_binary(__u8 *log_data_buf, int total_log_page_size)
-{
-       return d_raw((unsigned char *)log_data_buf, total_log_page_size);
-}
-
 static int get_c9_log_page(struct nvme_dev *dev, char *format)
 {
        int ret = 0;
@@ -2929,20 +2483,7 @@ static int get_c9_log_page(struct nvme_dev *dev, char *format)
 
        ret = get_c9_log_page_data(dev, 1, 0);
        if (!ret) {
-               switch (fmt) {
-               case NORMAL:
-                       ocp_print_c9_log_normal(log_data, pC9_string_buffer);
-                       break;
-               case JSON:
-                       ocp_print_c9_log_json(log_data, pC9_string_buffer);
-                       break;
-               case BINARY:
-                       ocp_print_c9_log_binary(pC9_string_buffer, total_log_page_sz);
-                       break;
-               default:
-                       fprintf(stderr, "unhandled output format\n");
-                       break;
-               }
+               ocp_c9_log(log_data, pC9_string_buffer, total_log_page_sz, fmt);
        } else {
                fprintf(stderr, "ERROR : OCP : Unable to read C9 data from buffer\n");
        }
index 3c24abb6309d1422d6820246c78935a2c53ae1e6..809788876e450e7b94667c9dd4798deeaf50da21 100644 (file)
@@ -27,11 +27,18 @@ static void binary_c4_log(struct ocp_device_capabilities_log_page *log_data)
        d_raw((unsigned char *)log_data, sizeof(*log_data));
 }
 
+static void binary_c9_log(struct telemetry_str_log_format *log_data, __u8 *log_data_buf,
+                         int total_log_page_size)
+{
+       d_raw((unsigned char *)log_data_buf, total_log_page_size);
+}
+
 static struct ocp_print_ops binary_print_ops = {
        .hwcomp_log = binary_hwcomp_log,
        .c5_log = binary_c5_log,
        .c1_log = binary_c1_log,
        .c4_log = binary_c4_log,
+       .c9_log = binary_c9_log,
 };
 
 struct ocp_print_ops *ocp_get_binary_print_ops(nvme_print_flags_t flags)
index 89f309e2a3b00e27d250b9c2366ef9f42d9c94f0..36e298f504f00ee500c6f8a2c223e7555794dfc8 100644 (file)
@@ -520,6 +520,252 @@ static void json_c4_log(struct ocp_device_capabilities_log_page *log_data)
        json_free_object(root);
 }
 
+static int json_c9_log(struct telemetry_str_log_format *log_data, __u8 *log_data_buf,
+                      int total_log_page_size)
+{
+       struct json_object *root = json_create_object();
+       char res_arr[48];
+       char *res = res_arr;
+       char guid_buf[C9_GUID_LENGTH];
+       char *guid = guid_buf;
+       char fifo_arr[16];
+       char *fifo = fifo_arr;
+       char buf[128];
+       //calculating the index value for array
+       __le64 stat_id_index = (log_data->sitsz * 4) / 16;
+       __le64 eve_id_index = (log_data->estsz * 4) / 16;
+       __le64 vu_eve_index = (log_data->vu_eve_st_sz * 4) / 16;
+       __le64 ascii_table_index = (log_data->asctsz * 4);
+       //Calculating the offset for dynamic fields.
+       __le64 stat_id_str_table_ofst = log_data->sits * 4;
+       __le64 event_str_table_ofst = log_data->ests * 4;
+       __le64 vu_event_str_table_ofst = log_data->vu_eve_sts * 4;
+       __le64 ascii_table_ofst = log_data->ascts * 4;
+       struct statistics_id_str_table_entry stat_id_str_table_arr[stat_id_index];
+       struct event_id_str_table_entry event_id_str_table_arr[eve_id_index];
+       struct vu_event_id_str_table_entry vu_event_id_str_table_arr[vu_eve_index];
+       __u8 ascii_table_info_arr[ascii_table_index];
+       char ascii_buf[ascii_table_index];
+       char *ascii = ascii_buf;
+       int j;
+
+       json_object_add_value_int(root, "Log Page Version",
+                                 le16_to_cpu(log_data->log_page_version));
+
+       memset((__u8 *)res, 0, 15);
+       for (j = 0; j < 15; j++)
+               res += sprintf(res, "%d", log_data->reserved1[j]);
+       json_object_add_value_string(root, "Reserved", res_arr);
+
+       memset((void *)guid, 0, C9_GUID_LENGTH);
+       for (j = C9_GUID_LENGTH - 1; j >= 0; j--)
+               guid += sprintf(guid, "%02x", log_data->log_page_guid[j]);
+       json_object_add_value_string(root, "Log page GUID", guid_buf);
+
+       json_object_add_value_int(root, "Telemetry String Log Size", le64_to_cpu(log_data->sls));
+
+       memset((__u8 *)res, 0, 24);
+       for (j = 0; j < 24; j++)
+               res += sprintf(res, "%d", log_data->reserved2[j]);
+       json_object_add_value_string(root, "Reserved", res_arr);
+
+       json_object_add_value_int(root, "Statistics Identifier String Table Start",
+                                 le64_to_cpu(log_data->sits));
+       json_object_add_value_int(root, "Event String Table Start", le64_to_cpu(log_data->ests));
+       json_object_add_value_int(root, "Event String Table Size", le64_to_cpu(log_data->estsz));
+       json_object_add_value_int(root, "VU Event String Table Start",
+                                 le64_to_cpu(log_data->vu_eve_sts));
+       json_object_add_value_int(root, "VU Event String Table Size",
+                                 le64_to_cpu(log_data->vu_eve_st_sz));
+       json_object_add_value_int(root, "ASCII Table Start",
+                                 le64_to_cpu(log_data->ascts));
+       json_object_add_value_int(root, "ASCII Table Size",
+                                 le64_to_cpu(log_data->asctsz));
+
+       memset((void *)fifo, 0, 16);
+       for (j = 0; j < 16; j++)
+               fifo += sprintf(fifo, "%c", log_data->fifo1[j]);
+       json_object_add_value_string(root, "FIFO 1 ASCII String", fifo_arr);
+
+       memset((void *)fifo, 0, 16);
+       for (j = 0; j < 16; j++)
+               fifo += sprintf(fifo, "%c", log_data->fifo2[j]);
+       json_object_add_value_string(root, "FIFO 2 ASCII String", fifo_arr);
+
+       memset((void *)fifo, 0, 16);
+       for (j = 0; j < 16; j++)
+               fifo += sprintf(fifo, "%c", log_data->fifo3[j]);
+       json_object_add_value_string(root, "FIFO 3 ASCII String", fifo_arr);
+
+       memset((void *)fifo, 0, 16);
+       for (j = 0; j < 16; j++)
+               fifo += sprintf(fifo, "%c", log_data->fifo4[j]);
+       json_object_add_value_string(root, "FIFO 4 ASCII String", fifo_arr);
+
+       memset((void *)fifo, 0, 16);
+       for (j = 0; j < 16; j++)
+               fifo += sprintf(fifo, "%c", log_data->fifo5[j]);
+       json_object_add_value_string(root, "FIFO 5 ASCII String", fifo_arr);
+
+       memset((void *)fifo, 0, 16);
+       for (j = 0; j < 16; j++)
+               fifo += sprintf(fifo, "%c", log_data->fifo6[j]);
+       json_object_add_value_string(root, "FIFO 6 ASCII String", fifo_arr);
+
+       memset((void *)fifo, 0, 16);
+       for (j = 0; j < 16; j++)
+               fifo += sprintf(fifo, "%c", log_data->fifo7[j]);
+       json_object_add_value_string(root, "FIFO 7 ASCII String", fifo_arr);
+
+       memset((void *)fifo, 0, 16);
+       for (j = 0; j < 16; j++)
+               fifo += sprintf(fifo, "%c", log_data->fifo8[j]);
+       json_object_add_value_string(root, "FIFO 8 ASCII String", fifo_arr);
+
+       memset((void *)fifo, 0, 16);
+       for (j = 0; j < 16; j++)
+               fifo += sprintf(fifo, "%c", log_data->fifo9[j]);
+       json_object_add_value_string(root, "FIFO 9 ASCII String", fifo_arr);
+
+       memset((void *)fifo, 0, 16);
+       for (j = 0; j < 16; j++)
+               fifo += sprintf(fifo, "%c", log_data->fifo10[j]);
+       json_object_add_value_string(root, "FIFO 10 ASCII String", fifo_arr);
+
+       memset((void *)fifo, 0, 16);
+       for (j = 0; j < 16; j++)
+               fifo += sprintf(fifo, "%c", log_data->fifo11[j]);
+       json_object_add_value_string(root, "FIFO 11 ASCII String", fifo_arr);
+
+       memset((void *)fifo, 0, 16);
+       for (j = 0; j < 16; j++)
+               fifo += sprintf(fifo, "%c", log_data->fifo12[j]);
+       json_object_add_value_string(root, "FIFO 12 ASCII String", fifo_arr);
+
+       memset((void *)fifo, 0, 16);
+       for (j = 0; j < 16; j++)
+               fifo += sprintf(fifo, "%c", log_data->fifo13[j]);
+       json_object_add_value_string(root, "FIFO 13 ASCII String", fifo_arr);
+
+       memset((void *)fifo, 0, 16);
+       for (j = 0; j < 16; j++)
+               fifo += sprintf(fifo, "%c", log_data->fifo14[j]);
+       json_object_add_value_string(root, "FIFO 14 ASCII String", fifo_arr);
+
+       memset((void *)fifo, 0, 16);
+       for (j = 0; j < 16; j++)
+               fifo += sprintf(fifo, "%c", log_data->fifo15[j]);
+       json_object_add_value_string(root, "FIFO 15 ASCII String", fifo_arr);
+
+       memset((void *)fifo, 0, 16);
+       for (j = 0; j < 16; j++)
+               fifo += sprintf(fifo, "%c", log_data->fifo16[j]);
+       json_object_add_value_string(root, "FIFO 16 ASCII String", fifo_arr);
+
+       memset((__u8 *)res, 0, 48);
+       for (j = 0; j < 48; j++)
+               res += sprintf(res, "%d", log_data->reserved3[j]);
+       json_object_add_value_string(root, "Reserved", res_arr);
+
+       if (log_data->sitsz != 0) {
+
+               memcpy(stat_id_str_table_arr,
+               (__u8 *)log_data_buf + stat_id_str_table_ofst,
+               (log_data->sitsz * 4));
+               struct json_object *stat_table = json_create_object();
+
+               for (j = 0; j < stat_id_index; j++) {
+                       struct json_object *entry = json_create_object();
+
+                       json_object_add_value_uint(entry, "Vendor Specific Statistic Identifier",
+                       le16_to_cpu(stat_id_str_table_arr[j].vs_si));
+                       json_object_add_value_uint(entry, "Reserved",
+                       le64_to_cpu(stat_id_str_table_arr[j].reserved1));
+                       json_object_add_value_uint(entry, "ASCII ID Length",
+                       le64_to_cpu(stat_id_str_table_arr[j].ascii_id_len));
+                       json_object_add_value_uint(entry, "ASCII ID offset",
+                       le64_to_cpu(stat_id_str_table_arr[j].ascii_id_ofst));
+                       json_object_add_value_uint(entry, "Reserved2",
+                       le64_to_cpu(stat_id_str_table_arr[j].reserved2));
+                       sprintf(buf, "Statistics Identifier String Table %d", j);
+                       json_object_add_value_object(stat_table, buf, entry);
+               }
+
+               json_object_add_value_object(root,
+               "Statistics Identifier String Table", stat_table);
+       }
+
+       if (log_data->estsz != 0) {
+               struct json_object *eve_table = json_create_object();
+
+               memcpy(event_id_str_table_arr,
+               (__u8 *)log_data_buf + event_str_table_ofst,
+               (log_data->estsz * 4));
+               for (j = 0; j < eve_id_index; j++) {
+                       struct json_object *entry = json_create_object();
+
+                       json_object_add_value_int(entry, "Debug Event Class",
+                       le16_to_cpu(event_id_str_table_arr[j].deb_eve_class));
+                       json_object_add_value_int(entry, "Event Identifier",
+                       le16_to_cpu(event_id_str_table_arr[j].ei));
+                       json_object_add_value_int(entry, "ASCII ID Length",
+                       le64_to_cpu(event_id_str_table_arr[j].ascii_id_len));
+                       json_object_add_value_int(entry, "ASCII ID offset",
+                       le64_to_cpu(event_id_str_table_arr[j].ascii_id_ofst));
+                       json_object_add_value_int(entry, "Reserved",
+                       le64_to_cpu(event_id_str_table_arr[j].reserved2));
+                       sprintf(buf, "Event Identifier String Table Entry %d", j);
+                       json_object_add_value_object(eve_table, buf, entry);
+               }
+               json_object_add_value_object(root,
+               "Event Identifier String Table Entry",
+               eve_table);
+       }
+
+       if (log_data->vu_eve_st_sz != 0) {
+               struct json_object *vu_eve_table = json_create_object();
+
+               memcpy(vu_event_id_str_table_arr,
+               (__u8 *)log_data_buf + vu_event_str_table_ofst,
+               (log_data->vu_eve_st_sz * 4));
+               for (j = 0; j < vu_eve_index; j++) {
+                       struct json_object *entry = json_create_object();
+
+                       json_object_add_value_int(entry, "Debug Event Class",
+                       le16_to_cpu(vu_event_id_str_table_arr[j].deb_eve_class));
+                       json_object_add_value_int(entry, "VU Event Identifier",
+                       le16_to_cpu(vu_event_id_str_table_arr[j].vu_ei));
+                       json_object_add_value_int(entry, "ASCII ID Length",
+                       le64_to_cpu(vu_event_id_str_table_arr[j].ascii_id_len));
+                       json_object_add_value_int(entry, "ASCII ID offset",
+                       le64_to_cpu(vu_event_id_str_table_arr[j].ascii_id_ofst));
+                       json_object_add_value_int(entry, "Reserved",
+                       le64_to_cpu(vu_event_id_str_table_arr[j].reserved));
+                       sprintf(buf, "VU Event Identifier String Table Entry %d", j);
+                       json_object_add_value_object(vu_eve_table, buf, entry);
+               }
+               json_object_add_value_object(root,
+               "VU Event Identifier String Table Entry",
+               vu_eve_table);
+       }
+
+       if (log_data->asctsz != 0) {
+               memcpy(ascii_table_info_arr,
+               (__u8 *)log_data_buf + ascii_table_ofst,
+               (log_data->asctsz * 4));
+               memset((void *)ascii, 0, ascii_table_index);
+               for (j = 0; j < ascii_table_index; j++)
+                       ascii += sprintf(ascii, "%c", ascii_table_info_arr[j]);
+               json_object_add_value_string(root, "ASCII Table", ascii_buf);
+       }
+
+       json_print_object(root, NULL);
+       printf("\n");
+       json_free_object(root);
+
+       return 0;
+}
+
 static struct ocp_print_ops json_print_ops = {
        .hwcomp_log = json_hwcomp_log,
        .fw_act_history = json_fw_activation_history,
@@ -529,6 +775,7 @@ static struct ocp_print_ops json_print_ops = {
        .c5_log = json_c5_log,
        .c1_log = json_c1_log,
        .c4_log = json_c4_log,
+       .c9_log = (void *)json_c9_log,
 };
 
 struct ocp_print_ops *ocp_get_json_print_ops(nvme_print_flags_t flags)
index a15e7ac13d153f95a73f92b12b6efcbc33873655..b1f6e8cc2e18c6e598dd2f9fd7eaa0c6a986c1fc 100644 (file)
@@ -423,6 +423,233 @@ static void stdout_c4_log(struct ocp_device_capabilities_log_page *log_data)
        printf("\n");
 }
 
+static int stdout_c9_log(struct telemetry_str_log_format *log_data, __u8 *log_data_buf,
+                        int total_log_page_size)
+{
+       //calculating the index value for array
+       __le64 stat_id_index = (log_data->sitsz * 4) / 16;
+       __le64 eve_id_index = (log_data->estsz * 4) / 16;
+       __le64 vu_eve_index = (log_data->vu_eve_st_sz * 4) / 16;
+       __le64 ascii_table_index = (log_data->asctsz * 4);
+       //Calculating the offset for dynamic fields.
+       __le64 stat_id_str_table_ofst = log_data->sits * 4;
+       __le64 event_str_table_ofst = log_data->ests * 4;
+       __le64 vu_event_str_table_ofst = log_data->vu_eve_sts * 4;
+       __le64 ascii_table_ofst = log_data->ascts * 4;
+       struct statistics_id_str_table_entry stat_id_str_table_arr[stat_id_index];
+       struct event_id_str_table_entry event_id_str_table_arr[eve_id_index];
+       struct vu_event_id_str_table_entry vu_event_id_str_table_arr[vu_eve_index];
+       int j;
+
+       printf("  Log Page Version                                : 0x%x\n",
+              log_data->log_page_version);
+
+       printf("  Reserved                                        : ");
+       for (j = 0; j < 15; j++)
+               printf("%d", log_data->reserved1[j]);
+       printf("\n");
+
+       printf("  Log page GUID                                   : 0x");
+       for (j = C9_GUID_LENGTH - 1; j >= 0; j--)
+               printf("%02x", log_data->log_page_guid[j]);
+       printf("\n");
+
+       printf("  Telemetry String Log Size                       : 0x%"PRIx64"\n",
+              le64_to_cpu(log_data->sls));
+
+       printf("  Reserved                                        : ");
+       for (j = 0; j < 24; j++)
+               printf("%d", log_data->reserved2[j]);
+       printf("\n");
+
+       printf("  Statistics Identifier String Table Start        : 0x%"PRIx64"\n",
+              le64_to_cpu(log_data->sits));
+       printf("  Statistics Identifier String Table Size         : 0x%"PRIx64"\n",
+              le64_to_cpu(log_data->sitsz));
+       printf("  Event String Table Start                        : 0x%"PRIx64"\n",
+              le64_to_cpu(log_data->ests));
+       printf("  Event String Table Size                         : 0x%"PRIx64"\n",
+              le64_to_cpu(log_data->estsz));
+       printf("  VU Event String Table Start                     : 0x%"PRIx64"\n",
+              le64_to_cpu(log_data->vu_eve_sts));
+       printf("  VU Event String Table Size                      : 0x%"PRIx64"\n",
+              le64_to_cpu(log_data->vu_eve_st_sz));
+       printf("  ASCII Table Start                               : 0x%"PRIx64"\n",
+              le64_to_cpu(log_data->ascts));
+       printf("  ASCII Table Size                                : 0x%"PRIx64"\n",
+              le64_to_cpu(log_data->asctsz));
+
+       printf("  FIFO 1 ASCII String\n");
+       printf("   index    value    ascii_val\n");
+       for (j = 0; j < 16; j++)
+               printf("  %d       %d        %c\n", j, log_data->fifo1[j],
+                      log_data->fifo1[j]);
+
+       printf("  FIFO 2 ASCII String\n");
+       printf("   index    value    ascii_val\n");
+       for (j = 0; j < 16; j++)
+               printf("  %d       %d        %c\n", j, log_data->fifo2[j],
+                      log_data->fifo2[j]);
+
+       printf("  FIFO 3 ASCII String\n");
+       printf("   index    value    ascii_val\n");
+       for (j = 0; j < 16; j++)
+               printf("  %d       %d        %c\n", j, log_data->fifo3[j],
+                      log_data->fifo3[j]);
+
+       printf("  FIFO 4 ASCII String\n");
+       printf("   index    value    ascii_val\n");
+       for (j = 0; j < 16; j++)
+               printf("  %d       %d        %c\n", j, log_data->fifo4[j],
+                      log_data->fifo4[j]);
+
+       printf("  FIFO 5 ASCII String\n");
+       printf("   index    value    ascii_val\n");
+       for (j = 0; j < 16; j++)
+               printf("  %d       %d        %c\n", j, log_data->fifo5[j],
+                      log_data->fifo5[j]);
+
+       printf("  FIFO 6 ASCII String\n");
+       printf("   index    value    ascii_val\n");
+       for (j = 0; j < 16; j++)
+               printf("  %d       %d        %c\n", j, log_data->fifo6[j],
+                      log_data->fifo6[j]);
+
+       printf("  FIFO 7 ASCII String\n");
+       printf("   index    value    ascii_val\n");
+       for (j = 0; j < 16; j++)
+               printf("  %d       %d        %c\n", j, log_data->fifo7[j],
+                      log_data->fifo7[j]);
+
+       printf("  FIFO 8 ASCII String\n");
+       printf("   index    value    ascii_val\n");
+       for (j = 0; j < 16; j++)
+               printf("  %d       %d        %c\n", j, log_data->fifo8[j],
+                      log_data->fifo8[j]);
+
+       printf("  FIFO 9 ASCII String\n");
+       printf("   index    value    ascii_val\n");
+       for (j = 0; j < 16; j++)
+               printf("  %d       %d        %c\n", j, log_data->fifo9[j],
+                      log_data->fifo9[j]);
+
+       printf("  FIFO 10 ASCII String\n");
+       printf("   index    value    ascii_val\n");
+       for (j = 0; j < 16; j++)
+               printf("  %d       %d        %c\n", j, log_data->fifo10[j],
+                      log_data->fifo10[j]);
+
+       printf("  FIFO 11 ASCII String\n");
+       printf("   index    value    ascii_val\n");
+       for (j = 0; j < 16; j++)
+               printf("  %d       %d        %c\n", j, log_data->fifo11[j],
+                      log_data->fifo11[j]);
+
+       printf("  FIFO 12 ASCII String\n");
+       printf("   index    value    ascii_val\n");
+       for (j = 0; j < 16; j++)
+               printf("  %d       %d        %c\n", j,
+                      log_data->fifo12[j], log_data->fifo12[j]);
+
+       printf("  FIFO 13 ASCII String\n");
+       printf("   index    value    ascii_val\n");
+       for (j = 0; j < 16; j++)
+               printf("  %d       %d        %c\n", j,
+                      log_data->fifo13[j], log_data->fifo13[j]);
+
+       printf("  FIFO 14 ASCII String\n");
+       printf("   index    value    ascii_val\n");
+       for (j = 0; j < 16; j++)
+               printf("  %d       %d        %c\n", j,
+                      log_data->fifo14[j], log_data->fifo14[j]);
+
+       printf("  FIFO 15 ASCII String\n");
+       printf("   index    value    ascii_val\n");
+       for (j = 0; j < 16; j++)
+               printf("  %d       %d        %c\n", j,
+                      log_data->fifo15[j], log_data->fifo16[j]);
+
+       printf("  FIFO 16 ASCII String\n");
+       printf("   index    value    ascii_val\n");
+       for (j = 0; j < 16; j++)
+               printf("  %d       %d        %c\n", j,
+                      log_data->fifo16[j], log_data->fifo16[j]);
+
+       printf("  Reserved                                        : ");
+       for (j = 0; j < 48; j++)
+               printf("%d", log_data->reserved3[j]);
+       printf("\n");
+
+
+       if (log_data->sitsz != 0) {
+               memcpy(stat_id_str_table_arr,
+               (__u8 *)log_data_buf + stat_id_str_table_ofst,
+               (log_data->sitsz * 4));
+               printf("  Statistics Identifier String Table\n");
+               for (j = 0; j < stat_id_index; j++) {
+                       printf("   Vendor Specific Statistic Identifier : 0x%x\n",
+                       le16_to_cpu(stat_id_str_table_arr[j].vs_si));
+                       printf("   Reserved                             : 0x%x\n",
+                       stat_id_str_table_arr[j].reserved1);
+                       printf("   ASCII ID Length                      : 0x%x\n",
+                       stat_id_str_table_arr[j].ascii_id_len);
+                       printf("   ASCII ID offset                      : 0x%"PRIx64"\n",
+                              le64_to_cpu(stat_id_str_table_arr[j].ascii_id_ofst));
+                       printf("   Reserved                             : 0x%x\n",
+                       stat_id_str_table_arr[j].reserved2);
+               }
+       }
+
+       if (log_data->estsz != 0) {
+               memcpy(event_id_str_table_arr, (__u8 *)log_data_buf +
+               event_str_table_ofst, (log_data->estsz * 4));
+               printf("  Event Identifier String Table Entry\n");
+               for (j = 0; j < eve_id_index; j++) {
+                       printf("   Debug Event Class        : 0x%x\n",
+                       event_id_str_table_arr[j].deb_eve_class);
+                       printf("   Event Identifier         : 0x%x\n",
+                       le16_to_cpu(event_id_str_table_arr[j].ei));
+                       printf("   ASCII ID Length          : 0x%x\n",
+                       event_id_str_table_arr[j].ascii_id_len);
+                       printf("   ASCII ID offset          : 0x%"PRIx64"\n",
+                              le64_to_cpu(event_id_str_table_arr[j].ascii_id_ofst));
+                       printf("   Reserved                 : 0x%x\n",
+                       event_id_str_table_arr[j].reserved2);
+
+               }
+       }
+
+       if (log_data->vu_eve_st_sz != 0) {
+               memcpy(vu_event_id_str_table_arr, (__u8 *)log_data_buf +
+               vu_event_str_table_ofst, (log_data->vu_eve_st_sz * 4));
+               printf("  VU Event Identifier String Table Entry\n");
+               for (j = 0; j < vu_eve_index; j++) {
+                       printf("   Debug Event Class        : 0x%x\n",
+                       vu_event_id_str_table_arr[j].deb_eve_class);
+                       printf("   VU Event Identifier      : 0x%x\n",
+                       le16_to_cpu(vu_event_id_str_table_arr[j].vu_ei));
+                       printf("   ASCII ID Length          : 0x%x\n",
+                       vu_event_id_str_table_arr[j].ascii_id_len);
+                       printf("   ASCII ID offset          : 0x%"PRIx64"\n",
+                              le64_to_cpu(vu_event_id_str_table_arr[j].ascii_id_ofst));
+                       printf("   Reserved                 : 0x%x\n",
+                       vu_event_id_str_table_arr[j].reserved);
+
+               }
+       }
+
+       if (log_data->asctsz != 0) {
+               printf("  ASCII Table\n");
+               printf("   Byte    Data_Byte    ASCII_Character\n");
+               for (j = 0; j < ascii_table_index; j++)
+                       printf("    %lld        %d             %c\n",
+                       ascii_table_ofst+j, log_data_buf[ascii_table_ofst + j],
+                       (char)log_data_buf[ascii_table_ofst + j]);
+       }
+
+       return 0;
+}
+
 static struct ocp_print_ops stdout_print_ops = {
        .hwcomp_log = stdout_hwcomp_log,
        .fw_act_history = stdout_fw_activation_history,
@@ -432,6 +659,7 @@ static struct ocp_print_ops stdout_print_ops = {
        .c5_log = (void *)stdout_c5_log,
        .c1_log = stdout_c1_log,
        .c4_log = stdout_c4_log,
+       .c9_log = (void *)stdout_c9_log,
 };
 
 struct ocp_print_ops *ocp_get_stdout_print_ops(nvme_print_flags_t flags)
index 575eed36e91401f619a65b759ee6a22ec42acc81..502fa864735c7ea66c80b5272c67b819794ae397 100644 (file)
@@ -67,3 +67,9 @@ void ocp_c4_log(struct ocp_device_capabilities_log_page *log_data, nvme_print_fl
 {
        ocp_print(c4_log, flags, log_data);
 }
+
+void ocp_c9_log(struct telemetry_str_log_format *log_data, __u8 *log_data_buf,
+               int total_log_page_size, nvme_print_flags_t flags)
+{
+       ocp_print(c9_log, flags, log_data, log_data_buf, total_log_page_size);
+}
index ead02acbcbb325a16d5bc31c1c39ee980fd40e14..6df98b63520965d0bee32a27076fa561c5d25d9b 100644 (file)
@@ -16,6 +16,8 @@ struct ocp_print_ops {
        void (*c5_log)(struct nvme_dev *dev, struct unsupported_requirement_log *log_data);
        void (*c1_log)(struct ocp_error_recovery_log_page *log_data);
        void (*c4_log)(struct ocp_device_capabilities_log_page *log_data);
+       void (*c9_log)(struct telemetry_str_log_format *log_data, __u8 *log_data_buf,
+                      int total_log_page_size);
        nvme_print_flags_t flags;
 };
 
@@ -41,4 +43,6 @@ void ocp_c5_log(struct nvme_dev *dev, struct unsupported_requirement_log *log_da
                nvme_print_flags_t flags);
 void ocp_c1_log(struct ocp_error_recovery_log_page *log_data, nvme_print_flags_t flags);
 void ocp_c4_log(struct ocp_device_capabilities_log_page *log_data, nvme_print_flags_t flags);
+void ocp_c9_log(struct telemetry_str_log_format *log_data, __u8 *log_data_buf,
+               int total_log_page_size, nvme_print_flags_t flags);
 #endif /* OCP_PRINT_H */