aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2025-12-10 22:52:10 +0000
committerWarner Losh <imp@FreeBSD.org>2025-12-10 22:52:10 +0000
commite5c770dc7ff3fa71189addcafd30c333ff496de1 (patch)
treef2e1484eb0ced8b9fd84da4be7bd09c7406aae49
parenta8d8bf4affa95d3939442a65ea5c8f73785903e5 (diff)
nvme: Nvme controller generated events
Interface for the nvme driver notifying its children of different events: async notifications, namespace events and device failure. These aren't yet connected. Sponsored by: Netflix Reviewed by: dab Differential Revision: https://reviews.freebsd.org/D51386
-rw-r--r--sys/conf/files1
-rw-r--r--sys/dev/nvme/nvme_if.m55
2 files changed, 56 insertions, 0 deletions
diff --git a/sys/conf/files b/sys/conf/files
index 3314274b47a8..9c5220c7befa 100644
--- a/sys/conf/files
+++ b/sys/conf/files
@@ -2571,6 +2571,7 @@ dev/nvme/nvme_sim.c optional nvme scbus
dev/nvme/nvme_sysctl.c optional nvme
dev/nvme/nvme_test.c optional nvme
dev/nvme/nvme_util.c optional nvme | scbus
+dev/nvme/nvme_if.m optional nvme
dev/nvmem/nvmem.c optional nvmem fdt
dev/nvmem/nvmem_if.m optional nvmem
dev/nvmf/controller/ctl_frontend_nvmf.c optional nvmft
diff --git a/sys/dev/nvme/nvme_if.m b/sys/dev/nvme/nvme_if.m
new file mode 100644
index 000000000000..a89381d165f7
--- /dev/null
+++ b/sys/dev/nvme/nvme_if.m
@@ -0,0 +1,55 @@
+# Copyright (c) 2025 Netlix, Inc
+#
+# SPDX-License-Identifier: BSD-2-Clause
+#
+
+# Interface from the NVME controller to its children to notify it of certain
+# interesting events.
+
+INTERFACE nvme;
+
+HEADER {
+ #include "dev/nvme/nvme_private.h"
+};
+
+#
+# A new namespace is now available
+#
+METHOD int ns_added {
+ device_t dev; /* nvme device */
+ struct nvme_namespace *ns; /* information about the namespace */
+};
+
+#
+# A namespace has been removed
+#
+METHOD int ns_removed {
+ device_t dev; /* nvme device */
+ struct nvme_namespace *ns; /* information about the namespace */
+};
+
+#
+# A namespace has been changed somehow
+#
+METHOD int ns_changed {
+ device_t dev; /* nvme device */
+ struct nvme_namespace *ns; /* information about the namespace */
+};
+
+#
+# The controller has failed
+#
+METHOD int controller_failed {
+ device_t dev; /* nvme device */
+};
+
+#
+# Async completion
+#
+METHOD int handle_aen {
+ device_t dev; /* nvme device */
+ const struct nvme_completion *cpl; /* Completion for this async event */
+ uint32_t pg_nr; /* Page number reported by async event */
+ void *page; /* Contents of the page */
+ uint32_t page_len; /* Length of the page */
+};