Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F171013459
D56994.id179929.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D56994.id179929.diff
View Options
diff --git a/sys/dev/nvme/nvme_if.m b/sys/dev/nvme/nvme_if.m
--- a/sys/dev/nvme/nvme_if.m
+++ b/sys/dev/nvme/nvme_if.m
@@ -12,6 +12,14 @@
#include "dev/nvme/nvme_private.h"
};
+CODE {
+ static bool
+ default_is_storage_device(device_t dev)
+ {
+ return (true);
+ }
+}
+
#
# A new namespace is now available
#
@@ -53,3 +61,10 @@
void *page; /* Contents of the page */
uint32_t page_len; /* Length of the page */
};
+
+#
+# is this device a storage device or not.
+#
+METHOD bool is_storage_device {
+ device_t dev;
+} default default_is_storage_device;
diff --git a/sys/dev/nvme/nvme_pci.c b/sys/dev/nvme/nvme_pci.c
--- a/sys/dev/nvme/nvme_pci.c
+++ b/sys/dev/nvme/nvme_pci.c
@@ -38,11 +38,15 @@
#include "nvme_private.h"
+#include "nvme_if.h"
+
static int nvme_pci_probe(device_t);
static int nvme_pci_attach(device_t);
static int nvme_pci_detach(device_t);
static int nvme_pci_suspend(device_t);
static int nvme_pci_resume(device_t);
+static bool nvme_pci_is_storage_device(device_t);
+
static int nvme_ctrlr_setup_interrupts(struct nvme_controller *ctrlr);
@@ -54,6 +58,7 @@
DEVMETHOD(device_suspend, nvme_pci_suspend),
DEVMETHOD(device_resume, nvme_pci_resume),
DEVMETHOD(device_shutdown, nvme_shutdown),
+ DEVMETHOD(nvme_is_storage_device, nvme_pci_is_storage_device),
DEVMETHOD_END
};
@@ -421,3 +426,13 @@
ctrlr = DEVICE2SOFTC(dev);
return (nvme_ctrlr_resume(ctrlr));
}
+
+static bool
+nvme_pci_is_storage_device(device_t dev)
+{
+ /*
+ * NVMHCI 1.0 interfaces are the only devices that
+ * have namespaces with LBA ranges.
+ */
+ return (pci_get_progif(dev) == PCIP_STORAGE_NVM_ENTERPRISE_NVMHCI_1_0);
+}
diff --git a/sys/dev/nvme/nvme_sim.c b/sys/dev/nvme/nvme_sim.c
--- a/sys/dev/nvme/nvme_sim.c
+++ b/sys/dev/nvme/nvme_sim.c
@@ -324,6 +324,9 @@
if (nvme_use_nvd)
return (ENXIO);
+ if (!NVME_IS_STORAGE_DEVICE(device_get_parent(dev)))
+ return (ENXIO);
+
device_set_desc(dev, "nvme cam");
return (BUS_PROBE_DEFAULT);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Sep 9, 4:49 AM (2 m, 29 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
37804371
Default Alt Text
D56994.id179929.diff (2 KB)
Attached To
Mode
D56994: nvme: Use newbus to ask if a device is storage
Attached
Detach File
Event Timeline
Log In to Comment