diff options
author | Ian Moffett <ian@osmora.org> | 2025-09-19 18:00:05 -0400 |
---|---|---|
committer | Ian Moffett <ian@osmora.org> | 2025-09-19 18:00:05 -0400 |
commit | 1330e1e54c38d6ba0391d556b694813ae389daa1 (patch) | |
tree | 679f34f4092fc0091cc5cf42fac60181e6f67e87 /src/sys/include/io | |
parent | bfe26529fc77755dc5dd9e41473ebbe84044c5f3 (diff) |
kernel: pci: Add PCI lookup routine
This commit adds a new 'lookup_type_t' for representing the various
kinds of lookups one can perform on the PCI bus. The actual code to
drive the lookups is exposed as the pci_bus_lookup() routine.
When doing a lookup of a PCI device, you must specify the kind of lookup
to perform. If a PCI_LU_CLASSREV is requested, only the PCI class and
subclass fields in the PCI lookup are used.
If the PCI_LU_VENDEV is requested, only the PCI vendor ID and device ID
are used in the lookup.
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'src/sys/include/io')
-rw-r--r-- | src/sys/include/io/pci/pci.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/sys/include/io/pci/pci.h b/src/sys/include/io/pci/pci.h index bc39647..cff5f0a 100644 --- a/src/sys/include/io/pci/pci.h +++ b/src/sys/include/io/pci/pci.h @@ -58,6 +58,20 @@ struct pci_device { TAILQ_ENTRY(pci_device) link; }; +typedef enum { + PCI_LU_VENDEV, /* Vendor / device */ + PCI_LU_CLASSREV, /* Class / subclass */ +} lookup_type_t; + +/* + * Lookup a device on the PCI(e) bus by using the pci_descriptor + * as a lookup key. + * + * @lookup: Lookup descriptor that must match a device + * @type: Lookup type + */ +int pci_bus_lookup(struct pci_device *lookup, lookup_type_t type); + /* * Read from a specific register on a specific PCI * enabled device. |