svn commit: r248740 - head/sys/dev/nvme

Jim Harris jimharris at FreeBSD.org
Tue Mar 26 18:43:54 UTC 2013


Author: jimharris
Date: Tue Mar 26 18:43:53 2013
New Revision: 248740
URL: http://svnweb.freebsd.org/changeset/base/248740

Log:
  Create a generic nvme_ctrlr_cmd_get_log_page function, and change the
  health information log page function to use it.
  
  Sponsored by:	Intel

Modified:
  head/sys/dev/nvme/nvme.h
  head/sys/dev/nvme/nvme_ctrlr_cmd.c

Modified: head/sys/dev/nvme/nvme.h
==============================================================================
--- head/sys/dev/nvme/nvme.h	Tue Mar 26 18:42:05 2013	(r248739)
+++ head/sys/dev/nvme/nvme.h	Tue Mar 26 18:43:53 2013	(r248740)
@@ -713,6 +713,10 @@ void	nvme_ctrlr_cmd_get_feature(struct n
 				   uint8_t feature, uint32_t cdw11,
 				   void *payload, uint32_t payload_size,
 				   nvme_cb_fn_t cb_fn, void *cb_arg);
+void	nvme_ctrlr_cmd_get_log_page(struct nvme_controller *ctrlr,
+				    uint8_t log_page, uint32_t nsid,
+				    void *payload, uint32_t payload_size,
+				    nvme_cb_fn_t cb_fn, void *cb_arg);
 
 /* NVM I/O functions */
 int	nvme_ns_cmd_write(struct nvme_namespace *ns, void *payload,

Modified: head/sys/dev/nvme/nvme_ctrlr_cmd.c
==============================================================================
--- head/sys/dev/nvme/nvme_ctrlr_cmd.c	Tue Mar 26 18:42:05 2013	(r248739)
+++ head/sys/dev/nvme/nvme_ctrlr_cmd.c	Tue Mar 26 18:43:53 2013	(r248740)
@@ -249,24 +249,35 @@ nvme_ctrlr_cmd_set_interrupt_coalescing(
 }
 
 void
-nvme_ctrlr_cmd_get_health_information_page(struct nvme_controller *ctrlr,
-    uint32_t nsid, struct nvme_health_information_page *payload,
-    nvme_cb_fn_t cb_fn, void *cb_arg)
+nvme_ctrlr_cmd_get_log_page(struct nvme_controller *ctrlr, uint8_t log_page,
+    uint32_t nsid, void *payload, uint32_t payload_size, nvme_cb_fn_t cb_fn,
+    void *cb_arg)
 {
 	struct nvme_request *req;
 	struct nvme_command *cmd;
 
-	req = nvme_allocate_request(payload, sizeof(*payload), cb_fn, cb_arg);
+	req = nvme_allocate_request(payload, payload_size, cb_fn, cb_arg);
 
 	cmd = &req->cmd;
 	cmd->opc = NVME_OPC_GET_LOG_PAGE;
 	cmd->nsid = nsid;
-	cmd->cdw10 = ((sizeof(*payload)/sizeof(uint32_t)) - 1) << 16;
-	cmd->cdw10 |= NVME_LOG_HEALTH_INFORMATION;
+	cmd->cdw10 = ((payload_size/sizeof(uint32_t)) - 1) << 16;
+	cmd->cdw10 |= log_page;
 
 	nvme_ctrlr_submit_admin_request(ctrlr, req);
 }
 
+
+void
+nvme_ctrlr_cmd_get_health_information_page(struct nvme_controller *ctrlr,
+    uint32_t nsid, struct nvme_health_information_page *payload,
+    nvme_cb_fn_t cb_fn, void *cb_arg)
+{
+
+	nvme_ctrlr_cmd_get_log_page(ctrlr, NVME_LOG_HEALTH_INFORMATION,
+	    nsid, payload, sizeof(*payload), cb_fn, cb_arg);
+}
+
 void
 nvme_ctrlr_cmd_abort(struct nvme_controller *ctrlr, uint16_t cid,
     uint16_t sqid, nvme_cb_fn_t cb_fn, void *cb_arg)


More information about the svn-src-all mailing list