summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjimharris <jimharris@FreeBSD.org>2013-10-08 15:49:14 +0000
committerjimharris <jimharris@FreeBSD.org>2013-10-08 15:49:14 +0000
commit9cdb85e5c10e1d1e964b04d57d17b35b32e55c0c (patch)
tree9df8e9cfe92469ed7e69f30d91be2615b9c87a94
parentbb66cfd2ae8464ce44d16ab33621589703029906 (diff)
downloadFreeBSD-src-9cdb85e5c10e1d1e964b04d57d17b35b32e55c0c.zip
FreeBSD-src-9cdb85e5c10e1d1e964b04d57d17b35b32e55c0c.tar.gz
Do not enable temperature threshold as an asynchronous event notification
on NVMe controllers that do not support it. Sponsored by: Intel Reviewed by: carl Approved by: re (hrs) MFC after: 1 week
-rw-r--r--sys/dev/nvme/nvme_ctrlr.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/sys/dev/nvme/nvme_ctrlr.c b/sys/dev/nvme/nvme_ctrlr.c
index 4845782..33e77a8 100644
--- a/sys/dev/nvme/nvme_ctrlr.c
+++ b/sys/dev/nvme/nvme_ctrlr.c
@@ -708,12 +708,26 @@ nvme_ctrlr_construct_and_submit_aer(struct nvme_controller *ctrlr,
static void
nvme_ctrlr_configure_aer(struct nvme_controller *ctrlr)
{
+ struct nvme_completion_poll_status status;
union nvme_critical_warning_state state;
struct nvme_async_event_request *aer;
uint32_t i;
state.raw = 0xFF;
state.bits.reserved = 0;
+
+ status.done = FALSE;
+ nvme_ctrlr_cmd_get_feature(ctrlr, NVME_FEAT_TEMPERATURE_THRESHOLD,
+ 0, NULL, 0, nvme_completion_poll_cb, &status);
+ while (status.done == FALSE)
+ pause("nvme", 1);
+ if (nvme_completion_is_error(&status.cpl) ||
+ (status.cpl.cdw0 & 0xFFFF) == 0xFFFF ||
+ (status.cpl.cdw0 & 0xFFFF) == 0x0000) {
+ nvme_printf(ctrlr, "temperature threshold not supported\n");
+ state.bits.temperature = 0;
+ }
+
nvme_ctrlr_cmd_set_async_event_config(ctrlr, state, NULL, NULL);
/* aerl is a zero-based value, so we need to add 1 here. */
OpenPOWER on IntegriCloud