FreeBSD/sys/dev/bxe/bxe.c
/*
 * FreeBSD Device probe function.
 *
 * Compares the device found to the driver's list of supported devices and
 * reports back to the bsd loader whether this is the right driver for the device.
 * This is the driver entry function called from the "kldload" command.
 *
 * Returns:
 *   BUS_PROBE_DEFAULT on success, positive value on failure.
 */
FreeBSD Device probe function.
Compares the device found to the driver's list of supported devices and
reports back to the bsd loader whether this is the right driver for the device.
This is the driver entry function called from the "kldload" command.

BUS_PROBE_DEFAULT on success, positive value on failure.
FreeBSD Device probe function . Compares the device found to the driver ' s list of supported devices and reports back to the bsd loader whether this is the right driver for the device . This is the driver entry function called from the " kldload " command . BUS_PROBE_DEFAULT on success positive value on failure .
static int
bxe_probe(device_t dev)
{
    struct bxe_device_type *t;
    char *descbuf;
    uint16_t did, sdid, svid, vid;
    t = bxe_devs;
    vid  = pci_get_vendor(dev);
    did  = pci_get_device(dev);
    svid = pci_get_subvendor(dev);
    sdid = pci_get_subdevice(dev);
    while (t->bxe_name != NULL) {
        if ((vid == t->bxe_vid) && (did == t->bxe_did) &&
            ((svid == t->bxe_svid) || (t->bxe_svid == PCI_ANY_ID)) &&
            ((sdid == t->bxe_sdid) || (t->bxe_sdid == PCI_ANY_ID))) {
            descbuf = malloc(BXE_DEVDESC_MAX, M_TEMP, M_NOWAIT);
            if (descbuf == NULL)
                return (ENOMEM);
            snprintf(descbuf, BXE_DEVDESC_MAX,
                     "%s (%c%d) BXE v:%s\n", t->bxe_name,
                     (((pci_read_config(dev, PCIR_REVID, 4) &
                        0xf0) >> 4) + 'A'),
                     (pci_read_config(dev, PCIR_REVID, 4) & 0xf),
                     BXE_DRIVER_VERSION);
            device_set_desc_copy(dev, descbuf);
            free(descbuf, M_TEMP);
            return (BUS_PROBE_DEFAULT);
        }
        t++;
    }
    return (ENXIO);
}
static int bxe_probe ( device_t dev ) { struct bxe_device_type * t ; char * descbuf ; uint16_t did , sdid , svid , vid ; t = bxe_devs ; vid = pci_get_vendor ( dev ) ; did = pci_get_device ( dev ) ; svid = pci_get_subvendor ( dev ) ; sdid = pci_get_subdevice ( dev ) ; while ( t -> bxe_name != NULL ) { if ( ( vid == t -> bxe_vid ) && ( did == t -> bxe_did ) && ( ( svid == t -> bxe_svid ) || ( t -> bxe_svid == PCI_ANY_ID ) ) && ( ( sdid == t -> bxe_sdid ) || ( t -> bxe_sdid == PCI_ANY_ID ) ) ) { descbuf = malloc ( BXE_DEVDESC_MAX , M_TEMP , M_NOWAIT ) ; if ( descbuf == NULL ) return ( ENOMEM ) ; snprintf ( descbuf , BXE_DEVDESC_MAX , " \n " , t -> bxe_name , ( ( ( pci_read_config ( dev , PCIR_REVID , 4 ) & 0xf0 ) >> 4 ) + ' ' ) , ( pci_read_config ( dev , PCIR_REVID , 4 ) & 0xf ) , BXE_DRIVER_VERSION ) ; device_set_desc_copy ( dev , descbuf ) ; free ( descbuf , M_TEMP ) ; return ( BUS_PROBE_DEFAULT ) ; } t ++ ; } return ( ENXIO ) ; }
FreeBSD Device probe function.
FreeBSD Device probe function .
/* Find our device structure */ /* Get the data for the device to be probed. */ /* Look through the list of known devices for a match. */ /* Print out the device identity. */