Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/nvme/nvme_ctrlr.c
| Show First 20 Lines • Show All 690 Lines • ▼ Show 20 Lines | nvme_ctrlr_async_event_log_page_cb(void *arg, const struct nvme_completion *cpl) | ||||
| int i; | int i; | ||||
| /* | /* | ||||
| * If the log page fetch for some reason completed with an error, | * If the log page fetch for some reason completed with an error, | ||||
| * don't pass log page data to the consumers. In practice, this case | * don't pass log page data to the consumers. In practice, this case | ||||
| * should never happen. | * should never happen. | ||||
| */ | */ | ||||
| if (nvme_completion_is_error(cpl)) | if (nvme_completion_is_error(cpl)) | ||||
| nvme_notify_async_consumers(aer->ctrlr, &aer->cpl, | nvme_notify_async(aer->ctrlr, &aer->cpl, aer->log_page_id, | ||||
| aer->log_page_id, NULL, 0); | NULL, 0); | ||||
| else { | else { | ||||
| /* Convert data to host endian */ | /* Convert data to host endian */ | ||||
| switch (aer->log_page_id) { | switch (aer->log_page_id) { | ||||
| case NVME_LOG_ERROR: | case NVME_LOG_ERROR: | ||||
| err = (struct nvme_error_information_entry *)aer->log_page_buffer; | err = (struct nvme_error_information_entry *)aer->log_page_buffer; | ||||
| for (i = 0; i < (aer->ctrlr->cdata.elpe + 1); i++) | for (i = 0; i < (aer->ctrlr->cdata.elpe + 1); i++) | ||||
| nvme_error_information_entry_swapbytes(err++); | nvme_error_information_entry_swapbytes(err++); | ||||
| break; | break; | ||||
| ▲ Show 20 Lines • Show All 60 Lines • ▼ Show 20 Lines | if (aer->log_page_id == NVME_LOG_HEALTH_INFORMATION) { | ||||
| } | } | ||||
| free(children, M_TEMP); | free(children, M_TEMP); | ||||
| } | } | ||||
| /* | /* | ||||
| * Pass the cpl data from the original async event completion, | * Pass the cpl data from the original async event completion, | ||||
| * not the log page fetch. | * not the log page fetch. | ||||
| */ | */ | ||||
| nvme_notify_async_consumers(aer->ctrlr, &aer->cpl, | nvme_notify_async(aer->ctrlr, &aer->cpl, aer->log_page_id, | ||||
| aer->log_page_id, aer->log_page_buffer, aer->log_page_size); | aer->log_page_buffer, aer->log_page_size); | ||||
| } | } | ||||
| /* | /* | ||||
| * Repost another asynchronous event request to replace the one | * Repost another asynchronous event request to replace the one | ||||
| * that just completed. | * that just completed. | ||||
| */ | */ | ||||
| nvme_ctrlr_construct_and_submit_aer(aer->ctrlr, aer); | nvme_ctrlr_construct_and_submit_aer(aer->ctrlr, aer); | ||||
| } | } | ||||
| Show All 26 Lines | aer->log_page_size = nvme_ctrlr_get_log_page_size(aer->ctrlr, | ||||
| aer->log_page_id); | aer->log_page_id); | ||||
| memcpy(&aer->cpl, cpl, sizeof(*cpl)); | memcpy(&aer->cpl, cpl, sizeof(*cpl)); | ||||
| nvme_ctrlr_cmd_get_log_page(aer->ctrlr, aer->log_page_id, | nvme_ctrlr_cmd_get_log_page(aer->ctrlr, aer->log_page_id, | ||||
| NVME_GLOBAL_NAMESPACE_TAG, aer->log_page_buffer, | NVME_GLOBAL_NAMESPACE_TAG, aer->log_page_buffer, | ||||
| aer->log_page_size, nvme_ctrlr_async_event_log_page_cb, | aer->log_page_size, nvme_ctrlr_async_event_log_page_cb, | ||||
| aer); | aer); | ||||
| /* Wait to notify consumers until after log page is fetched. */ | /* Wait to notify consumers until after log page is fetched. */ | ||||
| } else { | } else { | ||||
| nvme_notify_async_consumers(aer->ctrlr, cpl, aer->log_page_id, | nvme_notify_async(aer->ctrlr, cpl, aer->log_page_id, | ||||
| NULL, 0); | NULL, 0); | ||||
| /* | /* | ||||
| * Repost another asynchronous event request to replace the one | * Repost another asynchronous event request to replace the one | ||||
| * that just completed. | * that just completed. | ||||
| */ | */ | ||||
| nvme_ctrlr_construct_and_submit_aer(aer->ctrlr, aer); | nvme_ctrlr_construct_and_submit_aer(aer->ctrlr, aer); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 1,047 Lines • Show Last 20 Lines | |||||