mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-12-04 05:58:57 +00:00
Implement pci_find_class(9), the function to find a pci device by its class.
Sponsored by: The FreeBSD Foundation Reviewed by: jhb MFC after: 1 week
This commit is contained in:
parent
b03c679527
commit
141c08f9c0
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=223885
@ -347,6 +347,21 @@ pci_find_device(uint16_t vendor, uint16_t device)
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
device_t
|
||||
pci_find_class(uint8_t class, uint8_t subclass)
|
||||
{
|
||||
struct pci_devinfo *dinfo;
|
||||
|
||||
STAILQ_FOREACH(dinfo, &pci_devq, pci_links) {
|
||||
if (dinfo->cfg.baseclass == class &&
|
||||
dinfo->cfg.subclass == subclass) {
|
||||
return (dinfo->cfg.dev);
|
||||
}
|
||||
}
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
static int
|
||||
pci_printf(pcicfgregs *cfg, const char *fmt, ...)
|
||||
{
|
||||
|
@ -457,6 +457,7 @@ pci_msix_count(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);
|
||||
device_t pci_find_class(uint8_t class, uint8_t subclass);
|
||||
|
||||
/* Can be used by drivers to manage the MSI-X table. */
|
||||
int pci_pending_msix(device_t dev, u_int index);
|
||||
|
Loading…
Reference in New Issue
Block a user