diff --git a/sys/dev/nvd/nvd.c b/sys/dev/nvd/nvd.c --- a/sys/dev/nvd/nvd.c +++ b/sys/dev/nvd/nvd.c @@ -29,6 +29,7 @@ #include #include +#include #include #include #include @@ -47,6 +48,8 @@ #include +#include "nvme_if.h" + #define NVD_STR "nvd" struct nvd_disk; @@ -538,11 +541,55 @@ return (nvdc_fail(dev)); } +static int +nvdc_ns_added(device_t dev, struct nvme_namespace *ns) +{ + struct nvd_controller *sc = device_get_softc(dev); + + nvd_new_disk(ns, sc); + return (0); +} + +static int +nvdc_ns_removed(device_t dev, struct nvme_namespace *ns) +{ + // XXX NOT YET + return ENXIO; +} + +static int +nvdc_ns_changed(device_t dev, struct nvme_namespace *ns) +{ + // XXX NOT YET + return ENXIO; +} + +static int +nvdc_controller_failed(device_t dev) +{ + // XXX NOT YET + return ENXIO; +} + +static int +nvdc_handle_aen(device_t dev, const struct nvme_completion *cpl, + uint32_t pg_nr, void *page, uint32_t page_len) +{ + /* Do nothing */ + return (0); +} + static device_method_t nvdc_methods[] = { /* Device interface */ - DEVMETHOD(device_probe, nvdc_probe), - DEVMETHOD(device_attach, nvdc_attach), - DEVMETHOD(device_detach, nvdc_detach), + DEVMETHOD(device_probe, nvdc_probe), + DEVMETHOD(device_attach, nvdc_attach), + DEVMETHOD(device_detach, nvdc_detach), + /* Nvme controller messages */ + DEVMETHOD(nvme_ns_added, nvdc_ns_added), + DEVMETHOD(nvme_ns_removed, nvdc_ns_removed), + DEVMETHOD(nvme_ns_changed, nvdc_ns_changed), + DEVMETHOD(nvme_controller_failed, nvdc_controller_failed), + DEVMETHOD(nvme_handle_aen, nvdc_handle_aen), { 0, 0 } }; diff --git a/sys/modules/nvd/Makefile b/sys/modules/nvd/Makefile --- a/sys/modules/nvd/Makefile +++ b/sys/modules/nvd/Makefile @@ -1,6 +1,6 @@ .PATH: ${SRCTOP}/sys/dev/nvd KMOD= nvd -SRCS= nvd.c opt_geom.h device_if.h bus_if.h pci_if.h +SRCS= nvd.c opt_geom.h device_if.h bus_if.h nvmec_if.h pci_if.h .include