diff options
author | Jim Harris <jimharris@FreeBSD.org> | 2013-03-26 21:01:53 +0000 |
---|---|---|
committer | Jim Harris <jimharris@FreeBSD.org> | 2013-03-26 21:01:53 +0000 |
commit | 089277825674289bf325e6ebd722401595f1f869 (patch) | |
tree | f2ac54c182b8f5da298dfa2293238868b08e9805 /sys/dev/nvme | |
parent | cf81529ce39c2f772229cd228cbace17c6669fb3 (diff) | |
download | src-089277825674289bf325e6ebd722401595f1f869.tar.gz src-089277825674289bf325e6ebd722401595f1f869.zip |
Add structure definitions and a controller command function for
error log pages.
Sponsored by: Intel
Reviewed by: carl
Notes
Notes:
svn path=/head/; revision=248757
Diffstat (limited to 'sys/dev/nvme')
-rw-r--r-- | sys/dev/nvme/nvme.h | 13 | ||||
-rw-r--r-- | sys/dev/nvme/nvme_ctrlr_cmd.c | 19 | ||||
-rw-r--r-- | sys/dev/nvme/nvme_private.h | 5 |
3 files changed, 37 insertions, 0 deletions
diff --git a/sys/dev/nvme/nvme.h b/sys/dev/nvme/nvme.h index 748261f08ee8..6983e125bc43 100644 --- a/sys/dev/nvme/nvme.h +++ b/sys/dev/nvme/nvme.h @@ -622,6 +622,19 @@ enum nvme_log_page { /* 0xC0-0xFF - vendor specific */ }; +struct nvme_error_information_entry { + + uint64_t error_count; + uint16_t sqid; + uint16_t cid; + struct nvme_status status; + uint16_t error_location; + uint64_t lba; + uint32_t nsid; + uint8_t vendor_specific; + uint8_t reserved[35]; +} __packed __aligned(4); + union nvme_critical_warning_state { uint8_t raw; diff --git a/sys/dev/nvme/nvme_ctrlr_cmd.c b/sys/dev/nvme/nvme_ctrlr_cmd.c index f56f9e084bf4..240b15f4a6e9 100644 --- a/sys/dev/nvme/nvme_ctrlr_cmd.c +++ b/sys/dev/nvme/nvme_ctrlr_cmd.c @@ -267,6 +267,25 @@ nvme_ctrlr_cmd_get_log_page(struct nvme_controller *ctrlr, uint8_t log_page, nvme_ctrlr_submit_admin_request(ctrlr, req); } +void +nvme_ctrlr_cmd_get_error_page(struct nvme_controller *ctrlr, + struct nvme_error_information_entry *payload, uint32_t num_entries, + nvme_cb_fn_t cb_fn, void *cb_arg) +{ + + KASSERT(num_entries > 0, ("%s called with num_entries==0\n", __func__)); + + /* Controller's error log page entries is 0-based. */ + if (num_entries > (ctrlr->cdata.elpe + 1)) { + printf("%s num_entries=%d cdata.elpe=%d\n", + __func__, num_entries, ctrlr->cdata.elpe); + num_entries = ctrlr->cdata.elpe + 1; + } + + nvme_ctrlr_cmd_get_log_page(ctrlr, NVME_LOG_ERROR, + NVME_GLOBAL_NAMESPACE_TAG, payload, sizeof(*payload) * num_entries, + cb_fn, cb_arg); +} void nvme_ctrlr_cmd_get_health_information_page(struct nvme_controller *ctrlr, diff --git a/sys/dev/nvme/nvme_private.h b/sys/dev/nvme/nvme_private.h index 406a2e0c4ce3..d988be53dd98 100644 --- a/sys/dev/nvme/nvme_private.h +++ b/sys/dev/nvme/nvme_private.h @@ -342,6 +342,11 @@ void nvme_ctrlr_cmd_set_interrupt_coalescing(struct nvme_controller *ctrlr, uint32_t threshold, nvme_cb_fn_t cb_fn, void *cb_arg); +void nvme_ctrlr_cmd_get_error_page(struct nvme_controller *ctrlr, + struct nvme_error_information_entry *payload, + uint32_t num_entries, /* 0 = max */ + nvme_cb_fn_t cb_fn, + void *cb_arg); void nvme_ctrlr_cmd_get_health_information_page(struct nvme_controller *ctrlr, uint32_t nsid, struct nvme_health_information_page *payload, |