Author: jimharris Date: Tue Mar 26 21:01:53 2013 New Revision: 248757 URL: http://svnweb.freebsd.org/changeset/base/248757
Log: Add structure definitions and a controller command function for error log pages. Sponsored by: Intel Reviewed by: carl Modified: head/sys/dev/nvme/nvme.h head/sys/dev/nvme/nvme_ctrlr_cmd.c head/sys/dev/nvme/nvme_private.h Modified: head/sys/dev/nvme/nvme.h ============================================================================== --- head/sys/dev/nvme/nvme.h Tue Mar 26 21:00:18 2013 (r248756) +++ head/sys/dev/nvme/nvme.h Tue Mar 26 21:01:53 2013 (r248757) @@ -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; Modified: head/sys/dev/nvme/nvme_ctrlr_cmd.c ============================================================================== --- head/sys/dev/nvme/nvme_ctrlr_cmd.c Tue Mar 26 21:00:18 2013 (r248756) +++ head/sys/dev/nvme/nvme_ctrlr_cmd.c Tue Mar 26 21:01:53 2013 (r248757) @@ -267,6 +267,25 @@ nvme_ctrlr_cmd_get_log_page(struct nvme_ 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, Modified: head/sys/dev/nvme/nvme_private.h ============================================================================== --- head/sys/dev/nvme/nvme_private.h Tue Mar 26 21:00:18 2013 (r248756) +++ head/sys/dev/nvme/nvme_private.h Tue Mar 26 21:01:53 2013 (r248757) @@ -342,6 +342,11 @@ void nvme_ctrlr_cmd_set_interrupt_coales 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, _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"