static int ndis_devcompare(interface_type bustype, struct ndis_pccard_type *t, device_t dev) { const char *prodstr, *vendstr; #if !defined(__DragonFly__) int error; #endif if (bustype != PCMCIABus) return(FALSE); #if defined(__DragonFly__) prodstr = pccard_get_product_str(dev); vendstr = pccard_get_vendor_str(dev); #else error = pccard_get_product_str(dev, &prodstr); if (error) return(FALSE); error = pccard_get_vendor_str(dev, &vendstr); if (error) return(FALSE); #endif while(t->ndis_name != NULL) { if (strcasecmp(vendstr, t->ndis_vid) == 0 && strcasecmp(prodstr, t->ndis_did) == 0) { device_set_desc(dev, t->ndis_name); return(TRUE); } t++; } return(FALSE); }
static int ncv_pccard_probe(device_t dev) { const struct ncv_product *pp; const char *vendorstr; const char *prodstr; if ((pp = (const struct ncv_product *) pccard_product_lookup(dev, (const struct pccard_product *) ncv_products, sizeof(ncv_products[0]), NULL)) != NULL) { if (pp->prod.pp_name != NULL) device_set_desc(dev, pp->prod.pp_name); device_set_flags(dev, pp->flags); return(0); } if (pccard_get_vendor_str(dev, &vendorstr)) return(EIO); if (pccard_get_product_str(dev, &prodstr)) return(EIO); if (strcmp(vendorstr, "RATOC System Inc.") == 0 && strncmp(prodstr, "SOUND/SCSI2 CARD", 16) == 0) { device_set_desc(dev, "RATOC REX-5572"); device_set_flags(dev, FLAGS_REX5572); return (BUS_PROBE_DEFAULT); } return(EIO); }
static int puc_pccard_probe(device_t dev) { const char *vendor, *product; int error; error = pccard_get_vendor_str(dev, &vendor); if (error) return(error); error = pccard_get_product_str(dev, &product); if (error) return(error); if (!strcmp(vendor, "PCMCIA") && !strcmp(product, "RS-COM 2P")) return (puc_bfe_probe(dev, &puc_pccard_rscom)); return (ENXIO); }
static int ndis_devcompare(interface_type bustype, struct ndis_pccard_type *t, device_t dev) { const char *prodstr, *vendstr; if (bustype != PCMCIABus) return(FALSE); prodstr = pccard_get_product_str(dev); vendstr = pccard_get_vendor_str(dev); while(t->ndis_name != NULL) { if (strcasecmp(vendstr, t->ndis_vid) == 0 && strcasecmp(prodstr, t->ndis_did) == 0) { device_set_desc(dev, t->ndis_name); return(TRUE); } t++; } return(FALSE); }
/* * Attach the interface. Allocate softc structures, do ifmedia * setup and ethernet/BPF attach. */ static int ndis_attach_pccard(device_t dev) { struct ndis_softc *sc; int unit, error = 0, rid; struct ndis_pccard_type *t; int devidx = 0; const char *prodstr, *vendstr; struct drvdb_ent *db; wlan_serialize_enter(); sc = device_get_softc(dev); unit = device_get_unit(dev); sc->ndis_dev = dev; db = windrv_match((matchfuncptr)ndis_devcompare, dev); if (db == NULL) { wlan_serialize_exit(); return (ENXIO); } sc->ndis_dobj = db->windrv_object; sc->ndis_regvals = db->windrv_regvals; resource_list_init(&sc->ndis_rl); sc->ndis_io_rid = 0; sc->ndis_res_io = bus_alloc_resource_any(dev, SYS_RES_IOPORT, &sc->ndis_io_rid, RF_ACTIVE); if (sc->ndis_res_io == NULL) { device_printf(dev, "couldn't map iospace\n"); error = ENXIO; goto fail; } sc->ndis_rescnt++; resource_list_add(&sc->ndis_rl, SYS_RES_IOPORT, rid, rman_get_start(sc->ndis_res_io), rman_get_end(sc->ndis_res_io), rman_get_size(sc->ndis_res_io), -1); rid = 0; sc->ndis_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, RF_SHAREABLE | RF_ACTIVE); if (sc->ndis_irq == NULL) { device_printf(dev, "couldn't map interrupt\n"); error = ENXIO; goto fail; } sc->ndis_rescnt++; resource_list_add(&sc->ndis_rl, SYS_RES_IRQ, rid, rman_get_start(sc->ndis_irq), rman_get_start(sc->ndis_irq), 1, rman_get_cpuid(sc->ndis_irq)); sc->ndis_iftype = PCMCIABus; /* Figure out exactly which device we matched. */ t = db->windrv_devlist; prodstr = pccard_get_product_str(dev); vendstr = pccard_get_vendor_str(dev); while(t->ndis_name != NULL) { if (strcasecmp(vendstr, t->ndis_vid) == 0 && strcasecmp(prodstr, t->ndis_did) == 0) break; t++; devidx++; } sc->ndis_devidx = devidx; error = ndis_attach(dev); fail: wlan_serialize_exit(); return(error); }