diff --git a/nvme-print-stdout.c b/nvme-print-stdout.c index 21dc5d8069..b37f2dbf0a 100644 --- a/nvme-print-stdout.c +++ b/nvme-print-stdout.c @@ -246,91 +246,255 @@ static void stdout_add_bitmap(int i, __u8 seb) } } -static void stdout_persistent_event_log_fdp_events(unsigned int cdw11, - unsigned int cdw12, +static void stdout_persistent_event_log_fdp_events(unsigned int cdw11, unsigned int cdw12, unsigned char *buf) { - unsigned int num = (cdw11 >> 16) & 0xff; + unsigned int num = NVME_GET(cdw11, FEAT_FDPE_NOET); for (unsigned int i = 0; i < num; i++) { - printf("\t%-53s: %sEnabled\n", nvme_fdp_event_to_string(buf[0]), - cdw12 & 0x1 ? "" : "Not "); + printf("\t%-53s: %sEnabled\n", nvme_fdp_event_to_string(buf[i]), + NVME_GET(cdw12, FDP_SUPP_EVENT_ENABLED) ? "" : "Not "); } } -static void stdout_persistent_event_log(void *pevent_log_info, - __u8 action, __u32 size, - const char *devname) +static void pel_header(struct nvme_persistent_event_log *pevent_log_head, int human) +{ + printf("Log Identifier: %u\n", pevent_log_head->lid); + printf("Total Number of Events: %u\n", le32_to_cpu(pevent_log_head->tnev)); + printf("Total Log Length : %"PRIu64"\n", le64_to_cpu(pevent_log_head->tll)); + printf("Log Revision: %u\n", pevent_log_head->rv); + printf("Log Header Length: %u\n", pevent_log_head->lhl); + printf("Timestamp: %"PRIu64"\n", le64_to_cpu(pevent_log_head->ts)); + printf("Power On Hours (POH): %s", + uint128_t_to_l10n_string(le128_to_cpu(pevent_log_head->poh))); + printf("Power Cycle Count: %"PRIu64"\n", le64_to_cpu(pevent_log_head->pcc)); + printf("PCI Vendor ID (VID): %u\n", le16_to_cpu(pevent_log_head->vid)); + printf("PCI Subsystem Vendor ID (SSVID): %u\n", le16_to_cpu(pevent_log_head->ssvid)); + printf("Serial Number (SN): %-.*s\n", (int)sizeof(pevent_log_head->sn), + pevent_log_head->sn); + printf("Model Number (MN): %-.*s\n", (int)sizeof(pevent_log_head->mn), pevent_log_head->mn); + printf("NVM Subsystem NVMe Qualified Name (SUBNQN): %-.*s\n", + (int)sizeof(pevent_log_head->subnqn), pevent_log_head->subnqn); + printf("Generation Number: %u\n", le16_to_cpu(pevent_log_head->gen_number)); + printf("Reporting Context Information (RCI): %u\n", le32_to_cpu(pevent_log_head->rci)); + + if (human) + stdout_persistent_event_log_rci(pevent_log_head->rci); + + printf("Supported Events Bitmap:\n"); + for (int i = 0; i < 32; i++) { + if (!pevent_log_head->seb[i]) + continue; + stdout_add_bitmap(i, pevent_log_head->seb[i]); + } +} + +static void pel_event_header(int i, struct nvme_persistent_event_entry *pevent_entry_head, + int human) +{ + printf("Event Number: %u\n", i); + printf("Event Type: %s\n", nvme_pel_event_to_string(pevent_entry_head->etype)); + printf("Event Type Revision: %u\n", pevent_entry_head->etype_rev); + printf("Event Header Length: %u\n", pevent_entry_head->ehl); + printf("Event Header Additional Info: %u\n", pevent_entry_head->ehai); + + if (human) + stdout_persistent_event_entry_ehai(pevent_entry_head->ehai); + + printf("Controller Identifier: %u\n", le16_to_cpu(pevent_entry_head->cntlid)); + printf("Event Timestamp: %"PRIu64"\n", le64_to_cpu(pevent_entry_head->ets)); + printf("Port Identifier: %u\n", le16_to_cpu(pevent_entry_head->pelpid)); + printf("Vendor Specific Information Length: %u\n", le16_to_cpu(pevent_entry_head->vsil)); + printf("Event Length: %u\n", le16_to_cpu(pevent_entry_head->el)); +} + +static void pel_smart_health_event(void *pevent_log_info, __u32 offset, const char *devname) +{ + struct nvme_smart_log *smart_event = pevent_log_info + offset; + + printf("Smart Health Event Entry:\n"); + stdout_smart_log(smart_event, NVME_NSID_ALL, devname); +} + +static void pel_fw_commit_event(void *pevent_log_info, __u32 offset) +{ + struct nvme_fw_commit_event *fw_commit_event = pevent_log_info + offset; + + printf("FW Commit Event Entry:\n"); + printf("Old Firmware Revision: %"PRIu64" (%s)\n", le64_to_cpu(fw_commit_event->old_fw_rev), + util_fw_to_string((char *)&fw_commit_event->old_fw_rev)); + printf("New Firmware Revision: %"PRIu64" (%s)\n", le64_to_cpu(fw_commit_event->new_fw_rev), + util_fw_to_string((char *)&fw_commit_event->new_fw_rev)); + printf("FW Commit Action: %u\n", fw_commit_event->fw_commit_action); + printf("FW Slot: %u\n", fw_commit_event->fw_slot); + printf("Status Code Type for Firmware Commit Command: %u\n", fw_commit_event->sct_fw); + printf("Status Returned for Firmware Commit Command: %u\n", fw_commit_event->sc_fw); + printf("Vendor Assigned Firmware Commit Result Code: %u\n", + le16_to_cpu(fw_commit_event->vndr_assign_fw_commit_rc)); +} + +static void pel_timestamp_event(void *pevent_log_info, __u32 offset) +{ + struct nvme_time_stamp_change_event *ts_change_event = pevent_log_info + offset; + + printf("Time Stamp Change Event Entry:\n"); + printf("Previous Timestamp: %"PRIu64"\n", le64_to_cpu(ts_change_event->previous_timestamp)); + printf("Milliseconds Since Reset: %"PRIu64"\n", + le64_to_cpu(ts_change_event->ml_secs_since_reset)); +} + +static void pel_power_on_reset_event(void *pevent_log_info, __u32 offset, + struct nvme_persistent_event_entry *pevent_entry_head) { - __u32 offset, por_info_len, por_info_list; __u64 *fw_rev; - int fid, cdw11, cdw12, dword_cnt; - unsigned char *mem_buf = NULL; - struct nvme_smart_log *smart_event; - struct nvme_fw_commit_event *fw_commit_event; - struct nvme_time_stamp_change_event *ts_change_event; + __u32 por_info_len = le16_to_cpu(pevent_entry_head->el) - + le16_to_cpu(pevent_entry_head->vsil) - sizeof(*fw_rev); struct nvme_power_on_reset_info_list *por_event; - struct nvme_nss_hw_err_event *nss_hw_err_event; - struct nvme_change_ns_event *ns_event; - struct nvme_format_nvm_start_event *format_start_event; - struct nvme_format_nvm_compln_event *format_cmpln_event; - struct nvme_sanitize_start_event *sanitize_start_event; - struct nvme_sanitize_compln_event *sanitize_cmpln_event; - struct nvme_set_feature_event *set_feat_event; - struct nvme_thermal_exc_event *thermal_exc_event; + __u32 por_info_list = por_info_len / sizeof(*por_event); + + printf("Power On Reset Event Entry:\n"); + fw_rev = pevent_log_info + offset; + printf("Firmware Revision: %"PRIu64" (%s)\n", le64_to_cpu(*fw_rev), + util_fw_to_string((char *)fw_rev)); + printf("Reset Information List:\n"); + + for (int i = 0; i < por_info_list; i++) { + por_event = pevent_log_info + offset + sizeof(*fw_rev) + i * sizeof(*por_event); + printf("Controller ID: %u\n", le16_to_cpu(por_event->cid)); + printf("Firmware Activation: %u\n", por_event->fw_act); + printf("Operation in Progress: %u\n", por_event->op_in_prog); + printf("Controller Power Cycle: %u\n", le32_to_cpu(por_event->ctrl_power_cycle)); + printf("Power on milliseconds: %"PRIu64"\n", + le64_to_cpu(por_event->power_on_ml_seconds)); + printf("Controller Timestamp: %"PRIu64"\n", + le64_to_cpu(por_event->ctrl_time_stamp)); + } +} + +static void pel_nss_hw_error_event(void *pevent_log_info, __u32 offset) +{ + struct nvme_nss_hw_err_event *nss_hw_err_event = pevent_log_info + offset; + + printf("NVM Subsystem Hardware Error Event Code Entry: %u, %s\n", + le16_to_cpu(nss_hw_err_event->nss_hw_err_event_code), + nvme_nss_hw_error_to_string(nss_hw_err_event->nss_hw_err_event_code)); +} + +static void pel_change_ns_event(void *pevent_log_info, __u32 offset) +{ + struct nvme_change_ns_event *ns_event = pevent_log_info + offset; + + printf("Change Namespace Event Entry:\n"); + printf("Namespace Management CDW10: %u\n", le32_to_cpu(ns_event->nsmgt_cdw10)); + printf("Namespace Size: %"PRIu64"\n", le64_to_cpu(ns_event->nsze)); + printf("Namespace Capacity: %"PRIu64"\n", le64_to_cpu(ns_event->nscap)); + printf("Formatted LBA Size: %u\n", ns_event->flbas); + printf("End-to-end Data Protection Type Settings: %u\n", ns_event->dps); + printf("Namespace Multi-path I/O and Namespace Sharing Capabilities: %u\n", ns_event->nmic); + printf("ANA Group Identifier: %u\n", le32_to_cpu(ns_event->ana_grp_id)); + printf("NVM Set Identifier: %u\n", le16_to_cpu(ns_event->nvmset_id)); + printf("Namespace ID: %u\n", le32_to_cpu(ns_event->nsid)); +} + +static void pel_format_start_event(void *pevent_log_info, __u32 offset) +{ + struct nvme_format_nvm_start_event *format_start_event = pevent_log_info + offset; + + printf("Format NVM Start Event Entry:\n"); + printf("Namespace Identifier: %u\n", le32_to_cpu(format_start_event->nsid)); + printf("Format NVM Attributes: %u\n", format_start_event->fna); + printf("Format NVM CDW10: %u\n", le32_to_cpu(format_start_event->format_nvm_cdw10)); +} + +static void pel_format_completion_event(void *pevent_log_info, __u32 offset) +{ + struct nvme_format_nvm_compln_event *format_cmpln_event = pevent_log_info + offset; + + printf("Format NVM Completion Event Entry:\n"); + printf("Namespace Identifier: %u\n", le32_to_cpu(format_cmpln_event->nsid)); + printf("Smallest Format Progress Indicator: %u\n", format_cmpln_event->smallest_fpi); + printf("Format NVM Status: %u\n", format_cmpln_event->format_nvm_status); + printf("Completion Information: %u\n", le16_to_cpu(format_cmpln_event->compln_info)); + printf("Status Field: %u\n", le32_to_cpu(format_cmpln_event->status_field)); +} + +static void pel_sanitize_start_event(void *pevent_log_info, __u32 offset) +{ + struct nvme_sanitize_start_event *sanitize_start_event = pevent_log_info + offset; + + printf("Sanitize Start Event Entry:\n"); + printf("SANICAP: %u\n", sanitize_start_event->sani_cap); + printf("Sanitize CDW10: %u\n", le32_to_cpu(sanitize_start_event->sani_cdw10)); + printf("Sanitize CDW11: %u\n", le32_to_cpu(sanitize_start_event->sani_cdw11)); +} + +static void pel_sanitize_completion_event(void *pevent_log_info, __u32 offset) +{ + struct nvme_sanitize_compln_event *sanitize_cmpln_event = pevent_log_info + offset; + + printf("Sanitize Completion Event Entry:\n"); + printf("Sanitize Progress: %u\n", le16_to_cpu(sanitize_cmpln_event->sani_prog)); + printf("Sanitize Status: %u\n", le16_to_cpu(sanitize_cmpln_event->sani_status)); + printf("Completion Information: %u\n", le16_to_cpu(sanitize_cmpln_event->cmpln_info)); +} + +static void pel_set_feature_event(void *pevent_log_info, __u32 offset) +{ + int fid, cdw11, cdw12, dword_cnt; + unsigned char *mem_buf; + struct nvme_set_feature_event *set_feat_event = pevent_log_info + offset; + + printf("Set Feature Event Entry:\n"); + dword_cnt = NVME_SET_FEAT_EVENT_DW_COUNT(set_feat_event->layout); + fid = NVME_GET(le32_to_cpu(set_feat_event->cdw_mem[0]), FEATURES_CDW10_FID); + cdw11 = le32_to_cpu(set_feat_event->cdw_mem[1]); + + printf("Set Feature ID: 0x%02x (%s), value: 0x%08x\n", fid, nvme_feature_to_string(fid), + cdw11); + + if (!NVME_SET_FEAT_EVENT_MB_COUNT(set_feat_event->layout)) + return; + + mem_buf = (unsigned char *)set_feat_event + 4 + dword_cnt * 4; + if (fid == NVME_FEAT_FID_FDP_EVENTS) { + cdw12 = le32_to_cpu(set_feat_event->cdw_mem[2]); + stdout_persistent_event_log_fdp_events(cdw11, cdw12, mem_buf); + } else { + stdout_feature_show_fields(fid, cdw11, mem_buf); + } +} + +static void pel_thermal_excursion_event(void *pevent_log_info, __u32 offset) +{ + struct nvme_thermal_exc_event *thermal_exc_event = pevent_log_info + offset; + + printf("Thermal Excursion Event Entry:\n"); + printf("Over Temperature: %u\n", thermal_exc_event->over_temp); + printf("Threshold: %u\n", thermal_exc_event->threshold); +} + +static void stdout_persistent_event_log(void *pevent_log_info, __u8 action, __u32 size, + const char *devname) +{ struct nvme_persistent_event_log *pevent_log_head; + __u32 offset = sizeof(*pevent_log_head); struct nvme_persistent_event_entry *pevent_entry_head; - int human = stdout_print_ops.flags & VERBOSE; - offset = sizeof(*pevent_log_head); - printf("Persistent Event Log for device: %s\n", devname); printf("Action for Persistent Event Log: %u\n", action); - if (size >= offset) { - pevent_log_head = pevent_log_info; - printf("Log Identifier: %u\n", pevent_log_head->lid); - printf("Total Number of Events: %u\n", - le32_to_cpu(pevent_log_head->tnev)); - printf("Total Log Length : %"PRIu64"\n", - le64_to_cpu(pevent_log_head->tll)); - printf("Log Revision: %u\n", pevent_log_head->rv); - printf("Log Header Length: %u\n", pevent_log_head->lhl); - printf("Timestamp: %"PRIu64"\n", - le64_to_cpu(pevent_log_head->ts)); - printf("Power On Hours (POH): %s", - uint128_t_to_l10n_string(le128_to_cpu(pevent_log_head->poh))); - printf("Power Cycle Count: %"PRIu64"\n", - le64_to_cpu(pevent_log_head->pcc)); - printf("PCI Vendor ID (VID): %u\n", - le16_to_cpu(pevent_log_head->vid)); - printf("PCI Subsystem Vendor ID (SSVID): %u\n", - le16_to_cpu(pevent_log_head->ssvid)); - printf("Serial Number (SN): %-.*s\n", - (int)sizeof(pevent_log_head->sn), pevent_log_head->sn); - printf("Model Number (MN): %-.*s\n", - (int)sizeof(pevent_log_head->mn), pevent_log_head->mn); - printf("NVM Subsystem NVMe Qualified Name (SUBNQN): %-.*s\n", - (int)sizeof(pevent_log_head->subnqn), - pevent_log_head->subnqn); - printf("Generation Number: %u\n", - le16_to_cpu(pevent_log_head->gen_number)); - printf("Reporting Context Information (RCI): %u\n", - le32_to_cpu(pevent_log_head->rci)); - if (human) - stdout_persistent_event_log_rci(pevent_log_head->rci); - printf("Supported Events Bitmap:\n"); - for (int i = 0; i < 32; i++) { - if (pevent_log_head->seb[i] == 0) - continue; - stdout_add_bitmap(i, pevent_log_head->seb[i]); - } - } else { + + if (size < offset) { printf("No log data can be shown with this log len at least " \ - "512 bytes is required or can be 0 to read the complete "\ - "log page after context established\n"); + "512 bytes is required or can be 0 to read the complete " \ + "log page after context established\n"); return; } + + pevent_log_head = pevent_log_info; + + pel_header(pevent_log_head, human); + printf("\n"); printf("\nPersistent Event Entries:\n"); for (int i = 0; i < le32_to_cpu(pevent_log_head->tnev); i++) { @@ -342,181 +506,50 @@ static void stdout_persistent_event_log(void *pevent_log_info, if ((offset + pevent_entry_head->ehl + 3 + le16_to_cpu(pevent_entry_head->el)) >= size) break; - printf("Event Number: %u\n", i); - printf("Event Type: %s\n", nvme_pel_event_to_string(pevent_entry_head->etype)); - printf("Event Type Revision: %u\n", pevent_entry_head->etype_rev); - printf("Event Header Length: %u\n", pevent_entry_head->ehl); - printf("Event Header Additional Info: %u\n", pevent_entry_head->ehai); - if (human) - stdout_persistent_event_entry_ehai(pevent_entry_head->ehai); - printf("Controller Identifier: %u\n", - le16_to_cpu(pevent_entry_head->cntlid)); - printf("Event Timestamp: %"PRIu64"\n", - le64_to_cpu(pevent_entry_head->ets)); - printf("Port Identifier: %u\n", - le16_to_cpu(pevent_entry_head->pelpid)); - printf("Vendor Specific Information Length: %u\n", - le16_to_cpu(pevent_entry_head->vsil)); - printf("Event Length: %u\n", le16_to_cpu(pevent_entry_head->el)); + + pel_event_header(i, pevent_entry_head, human); offset += pevent_entry_head->ehl + 3; switch (pevent_entry_head->etype) { case NVME_PEL_SMART_HEALTH_EVENT: - smart_event = pevent_log_info + offset; - printf("Smart Health Event Entry:\n"); - stdout_smart_log(smart_event, NVME_NSID_ALL, devname); + pel_smart_health_event(pevent_log_info, offset, devname); break; case NVME_PEL_FW_COMMIT_EVENT: - fw_commit_event = pevent_log_info + offset; - printf("FW Commit Event Entry:\n"); - printf("Old Firmware Revision: %"PRIu64" (%s)\n", - le64_to_cpu(fw_commit_event->old_fw_rev), - util_fw_to_string((char *)&fw_commit_event->old_fw_rev)); - printf("New Firmware Revision: %"PRIu64" (%s)\n", - le64_to_cpu(fw_commit_event->new_fw_rev), - util_fw_to_string((char *)&fw_commit_event->new_fw_rev)); - printf("FW Commit Action: %u\n", - fw_commit_event->fw_commit_action); - printf("FW Slot: %u\n", fw_commit_event->fw_slot); - printf("Status Code Type for Firmware Commit Command: %u\n", - fw_commit_event->sct_fw); - printf("Status Returned for Firmware Commit Command: %u\n", - fw_commit_event->sc_fw); - printf("Vendor Assigned Firmware Commit Result Code: %u\n", - le16_to_cpu(fw_commit_event->vndr_assign_fw_commit_rc)); + pel_fw_commit_event(pevent_log_info, offset); break; case NVME_PEL_TIMESTAMP_EVENT: - ts_change_event = pevent_log_info + offset; - printf("Time Stamp Change Event Entry:\n"); - printf("Previous Timestamp: %"PRIu64"\n", - le64_to_cpu(ts_change_event->previous_timestamp)); - printf("Milliseconds Since Reset: %"PRIu64"\n", - le64_to_cpu(ts_change_event->ml_secs_since_reset)); + pel_timestamp_event(pevent_log_info, offset); break; case NVME_PEL_POWER_ON_RESET_EVENT: - por_info_len = (le16_to_cpu(pevent_entry_head->el) - - le16_to_cpu(pevent_entry_head->vsil) - sizeof(*fw_rev)); - - por_info_list = por_info_len / sizeof(*por_event); - - printf("Power On Reset Event Entry:\n"); - fw_rev = pevent_log_info + offset; - printf("Firmware Revision: %"PRIu64" (%s)\n", le64_to_cpu(*fw_rev), - util_fw_to_string((char *)fw_rev)); - printf("Reset Information List:\n"); - - for (int i = 0; i < por_info_list; i++) { - por_event = pevent_log_info + offset + - sizeof(*fw_rev) + i * sizeof(*por_event); - printf("Controller ID: %u\n", le16_to_cpu(por_event->cid)); - printf("Firmware Activation: %u\n", - por_event->fw_act); - printf("Operation in Progress: %u\n", - por_event->op_in_prog); - printf("Controller Power Cycle: %u\n", - le32_to_cpu(por_event->ctrl_power_cycle)); - printf("Power on milliseconds: %"PRIu64"\n", - le64_to_cpu(por_event->power_on_ml_seconds)); - printf("Controller Timestamp: %"PRIu64"\n", - le64_to_cpu(por_event->ctrl_time_stamp)); - } + pel_power_on_reset_event(pevent_log_info, offset, pevent_entry_head); break; case NVME_PEL_NSS_HW_ERROR_EVENT: - nss_hw_err_event = pevent_log_info + offset; - printf("NVM Subsystem Hardware Error Event Code Entry: %u, %s\n", - le16_to_cpu(nss_hw_err_event->nss_hw_err_event_code), - nvme_nss_hw_error_to_string(nss_hw_err_event->nss_hw_err_event_code)); + pel_nss_hw_error_event(pevent_log_info, offset); break; case NVME_PEL_CHANGE_NS_EVENT: - ns_event = pevent_log_info + offset; - printf("Change Namespace Event Entry:\n"); - printf("Namespace Management CDW10: %u\n", - le32_to_cpu(ns_event->nsmgt_cdw10)); - printf("Namespace Size: %"PRIu64"\n", - le64_to_cpu(ns_event->nsze)); - printf("Namespace Capacity: %"PRIu64"\n", - le64_to_cpu(ns_event->nscap)); - printf("Formatted LBA Size: %u\n", ns_event->flbas); - printf("End-to-end Data Protection Type Settings: %u\n", - ns_event->dps); - printf("Namespace Multi-path I/O and Namespace Sharing" \ - " Capabilities: %u\n", ns_event->nmic); - printf("ANA Group Identifier: %u\n", - le32_to_cpu(ns_event->ana_grp_id)); - printf("NVM Set Identifier: %u\n", le16_to_cpu(ns_event->nvmset_id)); - printf("Namespace ID: %u\n", le32_to_cpu(ns_event->nsid)); + pel_change_ns_event(pevent_log_info, offset); break; case NVME_PEL_FORMAT_START_EVENT: - format_start_event = pevent_log_info + offset; - printf("Format NVM Start Event Entry:\n"); - printf("Namespace Identifier: %u\n", - le32_to_cpu(format_start_event->nsid)); - printf("Format NVM Attributes: %u\n", - format_start_event->fna); - printf("Format NVM CDW10: %u\n", - le32_to_cpu(format_start_event->format_nvm_cdw10)); + pel_format_start_event(pevent_log_info, offset); break; case NVME_PEL_FORMAT_COMPLETION_EVENT: - format_cmpln_event = pevent_log_info + offset; - printf("Format NVM Completion Event Entry:\n"); - printf("Namespace Identifier: %u\n", - le32_to_cpu(format_cmpln_event->nsid)); - printf("Smallest Format Progress Indicator: %u\n", - format_cmpln_event->smallest_fpi); - printf("Format NVM Status: %u\n", - format_cmpln_event->format_nvm_status); - printf("Completion Information: %u\n", - le16_to_cpu(format_cmpln_event->compln_info)); - printf("Status Field: %u\n", - le32_to_cpu(format_cmpln_event->status_field)); + pel_format_completion_event(pevent_log_info, offset); break; case NVME_PEL_SANITIZE_START_EVENT: - sanitize_start_event = pevent_log_info + offset; - printf("Sanitize Start Event Entry:\n"); - printf("SANICAP: %u\n", sanitize_start_event->sani_cap); - printf("Sanitize CDW10: %u\n", - le32_to_cpu(sanitize_start_event->sani_cdw10)); - printf("Sanitize CDW11: %u\n", - le32_to_cpu(sanitize_start_event->sani_cdw11)); + pel_sanitize_start_event(pevent_log_info, offset); break; case NVME_PEL_SANITIZE_COMPLETION_EVENT: - sanitize_cmpln_event = pevent_log_info + offset; - printf("Sanitize Completion Event Entry:\n"); - printf("Sanitize Progress: %u\n", - le16_to_cpu(sanitize_cmpln_event->sani_prog)); - printf("Sanitize Status: %u\n", - le16_to_cpu(sanitize_cmpln_event->sani_status)); - printf("Completion Information: %u\n", - le16_to_cpu(sanitize_cmpln_event->cmpln_info)); + pel_sanitize_completion_event(pevent_log_info, offset); break; case NVME_PEL_SET_FEATURE_EVENT: - set_feat_event = pevent_log_info + offset; - printf("Set Feature Event Entry:\n"); - dword_cnt = NVME_SET_FEAT_EVENT_DW_COUNT(set_feat_event->layout); - fid = NVME_GET(le32_to_cpu(set_feat_event->cdw_mem[0]), FEATURES_CDW10_FID); - cdw11 = le32_to_cpu(set_feat_event->cdw_mem[1]); - - printf("Set Feature ID :%#02x (%s), value:%#08x\n", fid, - nvme_feature_to_string(fid), cdw11); - if (NVME_SET_FEAT_EVENT_MB_COUNT(set_feat_event->layout)) { - mem_buf = (unsigned char *)set_feat_event + 4 + dword_cnt * 4; - if (fid == NVME_FEAT_FID_FDP_EVENTS) { - cdw12 = le32_to_cpu(set_feat_event->cdw_mem[2]); - stdout_persistent_event_log_fdp_events(cdw11, cdw12, - mem_buf); - } else - stdout_feature_show_fields(fid, cdw11, mem_buf); - } + pel_set_feature_event(pevent_log_info, offset); break; case NVME_PEL_TELEMETRY_CRT: d(pevent_log_info + offset, 512, 16, 1); break; case NVME_PEL_THERMAL_EXCURSION_EVENT: - thermal_exc_event = pevent_log_info + offset; - printf("Thermal Excursion Event Entry:\n"); - printf("Over Temperature: %u\n", thermal_exc_event->over_temp); - printf("Threshold: %u\n", thermal_exc_event->threshold); + pel_thermal_excursion_event(pevent_log_info, offset); break; case NVME_PEL_SANITIZE_MEDIA_VERIF_EVENT: printf("Sanitize Media Verification Event\n"); diff --git a/nvme-print.c b/nvme-print.c index 3afc3ce5bf..ffcdfb0a59 100644 --- a/nvme-print.c +++ b/nvme-print.c @@ -875,43 +875,50 @@ void nvme_show_sanitize_log(struct nvme_sanitize_log_page *sanitize, const char *nvme_feature_to_string(enum nvme_features_id feature) { switch (feature) { - case NVME_FEAT_FID_ARBITRATION: return "Arbitration"; - case NVME_FEAT_FID_POWER_MGMT: return "Power Management"; - case NVME_FEAT_FID_LBA_RANGE: return "LBA Range Type"; - case NVME_FEAT_FID_TEMP_THRESH: return "Temperature Threshold"; - case NVME_FEAT_FID_ERR_RECOVERY:return "Error Recovery"; - case NVME_FEAT_FID_VOLATILE_WC: return "Volatile Write Cache"; - case NVME_FEAT_FID_NUM_QUEUES: return "Number of Queues"; - case NVME_FEAT_FID_IRQ_COALESCE:return "Interrupt Coalescing"; - case NVME_FEAT_FID_IRQ_CONFIG: return "Interrupt Vector Configuration"; - case NVME_FEAT_FID_WRITE_ATOMIC:return "Write Atomicity Normal"; - case NVME_FEAT_FID_ASYNC_EVENT: return "Async Event Configuration"; - case NVME_FEAT_FID_AUTO_PST: return "Autonomous Power State Transition"; - case NVME_FEAT_FID_HOST_MEM_BUF:return "Host Memory Buffer"; - case NVME_FEAT_FID_TIMESTAMP: return "Timestamp"; - case NVME_FEAT_FID_KATO: return "Keep Alive Timer"; - case NVME_FEAT_FID_HCTM: return "Host Controlled Thermal Management"; - case NVME_FEAT_FID_NOPSC: return "Non-Operational Power State Config"; - case NVME_FEAT_FID_RRL: return "Read Recovery Level"; - case NVME_FEAT_FID_PLM_CONFIG: return "Predictable Latency Mode Config"; - case NVME_FEAT_FID_PLM_WINDOW: return "Predictable Latency Mode Window"; + case NVME_FEAT_FID_ARBITRATION: return "Arbitration"; + case NVME_FEAT_FID_POWER_MGMT: return "Power Management"; + case NVME_FEAT_FID_LBA_RANGE: return "LBA Range Type"; + case NVME_FEAT_FID_TEMP_THRESH: return "Temperature Threshold"; + case NVME_FEAT_FID_ERR_RECOVERY: return "Error Recovery"; + case NVME_FEAT_FID_VOLATILE_WC: return "Volatile Write Cache"; + case NVME_FEAT_FID_NUM_QUEUES: return "Number of Queues"; + case NVME_FEAT_FID_IRQ_COALESCE: return "Interrupt Coalescing"; + case NVME_FEAT_FID_IRQ_CONFIG: return "Interrupt Vector Configuration"; + case NVME_FEAT_FID_WRITE_ATOMIC: return "Write Atomicity Normal"; + case NVME_FEAT_FID_ASYNC_EVENT: return "Async Event Configuration"; + case NVME_FEAT_FID_AUTO_PST: return "Autonomous Power State Transition"; + case NVME_FEAT_FID_HOST_MEM_BUF: return "Host Memory Buffer"; + case NVME_FEAT_FID_TIMESTAMP: return "Timestamp"; + case NVME_FEAT_FID_KATO: return "Keep Alive Timer"; + case NVME_FEAT_FID_HCTM: return "Host Controlled Thermal Management"; + case NVME_FEAT_FID_NOPSC: return "Non-Operational Power State Config"; + case NVME_FEAT_FID_RRL: return "Read Recovery Level"; + case NVME_FEAT_FID_PLM_CONFIG: return "Predictable Latency Mode Config"; + case NVME_FEAT_FID_PLM_WINDOW: return "Predictable Latency Mode Window"; case NVME_FEAT_FID_LBA_STS_INTERVAL: return "LBA Status Interval"; case NVME_FEAT_FID_HOST_BEHAVIOR: return "Host Behavior"; - case NVME_FEAT_FID_SANITIZE: return "Sanitize"; + case NVME_FEAT_FID_SANITIZE: return "Sanitize"; case NVME_FEAT_FID_ENDURANCE_EVT_CFG: return "Endurance Event Group Configuration"; case NVME_FEAT_FID_IOCS_PROFILE: return "I/O Command Set Profile"; case NVME_FEAT_FID_SPINUP_CONTROL: return "Spinup Control"; + case NVME_FEAT_FID_POWER_LOSS_SIGNAL: return "Power Loss Signaling Config"; + case NVME_FEAT_FID_PERF_CHARACTERISTICS:return "Performance Characteristics"; + case NVME_FEAT_FID_FDP: return "Flexible Direct Placement"; + case NVME_FEAT_FID_FDP_EVENTS: return "Flexible Direct Placement Events"; + case NVME_FEAT_FID_NS_ADMIN_LABEL: return "Namespace Admin Label"; + case NVME_FEAT_FID_KEY_VALUE: return "Key Value Configuration"; + case NVME_FEAT_FID_CTRL_DATA_QUEUE: return "Controller Data Queue"; + case NVME_FEAT_FID_EMB_MGMT_CTRL_ADDR: return "Embedded Management Controller Address"; + case NVME_FEAT_FID_HOST_MGMT_AGENT_ADDR:return "Host Management Agent Address"; case NVME_FEAT_FID_ENH_CTRL_METADATA: return "Enhanced Controller Metadata"; case NVME_FEAT_FID_CTRL_METADATA: return "Controller Metadata"; - case NVME_FEAT_FID_NS_METADATA: return "Namespace Metadata"; - case NVME_FEAT_FID_SW_PROGRESS: return "Software Progress"; - case NVME_FEAT_FID_HOST_ID: return "Host Identifier"; - case NVME_FEAT_FID_RESV_MASK: return "Reservation Notification Mask"; - case NVME_FEAT_FID_RESV_PERSIST:return "Reservation Persistence"; + case NVME_FEAT_FID_NS_METADATA: return "Namespace Metadata"; + case NVME_FEAT_FID_SW_PROGRESS: return "Software Progress"; + case NVME_FEAT_FID_HOST_ID: return "Host Identifier"; + case NVME_FEAT_FID_RESV_MASK: return "Reservation Notification Mask"; + case NVME_FEAT_FID_RESV_PERSIST: return "Reservation Persistence"; case NVME_FEAT_FID_WRITE_PROTECT: return "Namespace Write Protect"; - case NVME_FEAT_FID_FDP: return "Flexible Direct Placement"; - case NVME_FEAT_FID_FDP_EVENTS: return "Flexible Direct Placement Events"; - case NVME_FEAT_FID_CTRL_DATA_QUEUE: return "Controller Data Queue"; + case NVME_FEAT_FID_BP_WRITE_PROTECT: return "Boot Partition Write Protection Config"; } /* * We don't use the "default:" statement to let the compiler warning if diff --git a/subprojects/libnvme.wrap b/subprojects/libnvme.wrap index 5295b56db5..069cf9c3ce 100644 --- a/subprojects/libnvme.wrap +++ b/subprojects/libnvme.wrap @@ -1,6 +1,6 @@ [wrap-git] url = https://github.com/linux-nvme/libnvme.git -revision = 27ed889d0b1917919763816c97a49bb6e29d4547 +revision = e9c6fe62207ed33c9da92e06d18ab15c58bb9c4c [provide] libnvme = libnvme_dep