Date: Sat, 16 Jul 2011 19:38:09 +0000 (UTC) From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r224111 - stable/8/sys/dev/pci Message-ID: <201107161938.p6GJc9b7041433@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kib Date: Sat Jul 16 19:38:08 2011 New Revision: 224111 URL: http://svn.freebsd.org/changeset/base/224111 Log: MFC r223885: Implement pci_find_class(9), the function to find a pci device by its class. Sponsored by: The FreeBSD Foundation Modified: stable/8/sys/dev/pci/pci.c stable/8/sys/dev/pci/pcivar.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/pci/pci.c ============================================================================== --- stable/8/sys/dev/pci/pci.c Sat Jul 16 19:35:44 2011 (r224110) +++ stable/8/sys/dev/pci/pci.c Sat Jul 16 19:38:08 2011 (r224111) @@ -341,6 +341,21 @@ pci_find_device(uint16_t vendor, uint16_ 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, ...) { Modified: stable/8/sys/dev/pci/pcivar.h ============================================================================== --- stable/8/sys/dev/pci/pcivar.h Sat Jul 16 19:35:44 2011 (r224110) +++ stable/8/sys/dev/pci/pcivar.h Sat Jul 16 19:38:08 2011 (r224111) @@ -450,6 +450,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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201107161938.p6GJc9b7041433>