svn commit: r257589 - stable/9/sys/dev/nvme

Jim Harris jimharris at FreeBSD.org
Sun Nov 3 20:53:46 UTC 2013


Author: jimharris
Date: Sun Nov  3 20:53:45 2013
New Revision: 257589
URL: http://svnweb.freebsd.org/changeset/base/257589

Log:
  MFC r256153:
  
  Do not enable temperature threshold as an asynchronous event notification
  on NVMe controllers that do not support it.
  
  Sponsored by:	Intel

Modified:
  stable/9/sys/dev/nvme/nvme_ctrlr.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/dev/   (props changed)

Modified: stable/9/sys/dev/nvme/nvme_ctrlr.c
==============================================================================
--- stable/9/sys/dev/nvme/nvme_ctrlr.c	Sun Nov  3 20:52:13 2013	(r257588)
+++ stable/9/sys/dev/nvme/nvme_ctrlr.c	Sun Nov  3 20:53:45 2013	(r257589)
@@ -708,12 +708,26 @@ nvme_ctrlr_construct_and_submit_aer(stru
 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. */


More information about the svn-src-stable-9 mailing list