Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F157241730
D56996.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
D56996.diff
View Options
diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile
--- a/share/man/man9/Makefile
+++ b/share/man/man9/Makefile
@@ -1803,7 +1803,8 @@
osd.9 osd_set_reserved.9
MLINKS+=panic.9 vpanic.9 \
panic.9 KERNEL_PANICKED.9
-MLINKS+=pci.9 pci_alloc_msi.9 \
+MLINKS+=pci.9 is_pci_device.9 \
+ pci.9 pci_alloc_msi.9 \
pci.9 pci_alloc_msix.9 \
pci.9 pci_clear_pme.9 \
pci.9 pci_disable_busmaster.9 \
diff --git a/share/man/man9/pci.9 b/share/man/man9/pci.9
--- a/share/man/man9/pci.9
+++ b/share/man/man9/pci.9
@@ -23,11 +23,12 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd March 27, 2025
+.Dd May 18, 2026
.Dt PCI 9
.Os
.Sh NAME
.Nm pci ,
+.Nm is_pci_device ,
.Nm pci_alloc_msi ,
.Nm pci_alloc_msix ,
.Nm pci_clear_pme ,
@@ -80,6 +81,8 @@
.In sys/bus.h
.In dev/pci/pcireg.h
.In dev/pci/pcivar.h
+.Ft bool
+.Fn is_pci_device "device_t dev"
.Ft int
.Fn pci_alloc_msi "device_t dev" "int *count"
.Ft int
@@ -202,6 +205,12 @@
device configuration,
and
message signaled interrupts.
+.Pp
+The
+.Fn is_pci_device
+function can be used to determine if
+.Fa dev
+is a PCI device.
.Ss Raw Configuration Access
The
.Fn pci_read_config
diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c
--- a/sys/dev/pci/pci.c
+++ b/sys/dev/pci/pci.c
@@ -6993,6 +6993,17 @@
}
}
+bool
+is_pci_device(device_t dev)
+{
+ devclass_t pci_class;
+
+ if (device_get_parent(dev) == NULL)
+ return (false);
+ pci_class = devclass_find("pci");
+ return (device_get_devclass(device_get_parent(dev)) == pci_class);
+}
+
#ifdef DDB
DB_SHOW_COMMAND_FLAGS(pcierr, pci_print_faulted_dev_db, DB_CMD_MEMSAFE)
{
diff --git a/sys/dev/pci/pcivar.h b/sys/dev/pci/pcivar.h
--- a/sys/dev/pci/pcivar.h
+++ b/sys/dev/pci/pcivar.h
@@ -676,6 +676,7 @@
return (PCI_CHILD_ADDED(device_get_parent(dev), dev));
}
+bool is_pci_device(device_t dev);
device_t pci_find_bsf(uint8_t, uint8_t, uint8_t);
device_t pci_find_dbsf(uint32_t, uint8_t, uint8_t, uint8_t);
device_t pci_find_device(uint16_t, uint16_t);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, May 20, 3:14 PM (6 h, 37 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33328973
Default Alt Text
D56996.diff (2 KB)
Attached To
Mode
D56996: pci: Add is_pci_device helper function
Attached
Detach File
Event Timeline
Log In to Comment