static int ed_pccard_probe(device_t dev) { const struct ed_product *pp, *pp2; int error, first = 1; uint32_t fcn = PCCARD_FUNCTION_UNSPEC; /* Make sure we're a network function */ error = pccard_get_function(dev, &fcn); if (error != 0) return (error); if ((pp = (const struct ed_product *) pccard_product_lookup(dev, (const struct pccard_product *) ed_pccard_products, sizeof(ed_pccard_products[0]), NULL)) != NULL) { if (pp->prod.pp_name != NULL) device_set_desc(dev, pp->prod.pp_name); /* * Some devices don't ID themselves as network, but * that's OK if the flags say so. */ if (!(pp->flags & NE2000DVF_ANYFUNC) && fcn != PCCARD_FUNCTION_NETWORK) return (ENXIO); /* * Some devices match multiple entries. Report that * as a warning to help cull the table */ pp2 = pp; while ((pp2 = (const struct ed_product *)pccard_product_lookup( dev, (const struct pccard_product *)(pp2 + 1), sizeof(ed_pccard_products[0]), NULL)) != NULL) { if (first) { device_printf(dev, "Warning: card matches multiple entries. Report to [email protected]\n"); ed_pccard_print_entry(pp); first = 0; } ed_pccard_print_entry(pp2); } return (0); } return (ENXIO); }
static int sio_pccard_probe(device_t dev) { int error = 0; u_int32_t fcn = PCCARD_FUNCTION_UNSPEC; error = pccard_get_function(dev, &fcn); if (error != 0) return (error); /* * If a serial card, we are likely the right driver. However, * some serial cards are better servered by other drivers, so * allow other drivers to claim it, if they want. */ if (fcn == PCCARD_FUNCTION_SERIAL) return (-100); return (ENXIO); }
static int cs_pccard_probe(device_t dev) { const struct pccard_product *pp; uint32_t fcn = PCCARD_FUNCTION_UNSPEC; /* Make sure we're a network function */ pccard_get_function(dev, &fcn); if (fcn != PCCARD_FUNCTION_NETWORK) return (ENXIO); if ((pp = pccard_product_lookup(dev, cs_pccard_products, sizeof(cs_pccard_products[0]), NULL)) != NULL) { if (pp->pp_name != NULL) device_set_desc(dev, pp->pp_name); return 0; } return EIO; }
static int uart_pccard_probe(device_t dev) { int error; uint32_t fcn; fcn = PCCARD_FUNCTION_UNSPEC; error = pccard_get_function(dev, &fcn); if (error != 0) return (error); /* * If a serial card, we are likely the right driver. However, * some serial cards are better serviced by other drivers, so * allow other drivers to claim it, if they want. */ if (fcn == uart_pccard_function) return (BUS_PROBE_GENERIC); return (ENXIO); }
static int ep_pccard_probe(device_t dev) { const struct ep_pccard_product *pp; int error; uint32_t fcn = PCCARD_FUNCTION_UNSPEC; /* Make sure we're a network function */ error = pccard_get_function(dev, &fcn); if (error != 0) return (error); if (fcn != PCCARD_FUNCTION_NETWORK) return (ENXIO); /* Check to see if we know about this card */ if ((pp = ep_pccard_lookup(dev)) == NULL) return EIO; if (pp->prod.pp_name != NULL) device_set_desc(dev, pp->prod.pp_name); return 0; }
static int wi_pccard_probe(device_t dev) { const struct pccard_product *pp; u_int32_t fcn = PCCARD_FUNCTION_UNSPEC; int error; /* Make sure we're a network driver */ error = pccard_get_function(dev, &fcn); if (error != 0) return error; if (fcn != PCCARD_FUNCTION_NETWORK) return ENXIO; pp = pccard_product_lookup(dev, wi_pccard_products, sizeof(wi_pccard_products[0]), NULL); if (pp != NULL) { if (pp->pp_name != NULL) device_set_desc(dev, pp->pp_name); return 0; } return ENXIO; }
static int ata_pccard_probe(device_t dev) { const struct pccard_product *pp; u_int32_t fcn = PCCARD_FUNCTION_UNSPEC; int error = 0; if ((error = pccard_get_function(dev, &fcn))) return error; /* if it says its a disk we should register it */ if (fcn == PCCARD_FUNCTION_DISK) return 0; /* match other devices here, primarily cdrom/dvd rom */ if ((pp = pccard_product_lookup(dev, ata_pccard_products, sizeof(ata_pccard_products[0]), NULL))) { if (pp->pp_name) device_set_desc(dev, pp->pp_name); return 0; } return ENXIO; }
static int fe_pccard_probe(device_t dev) { int error; uint32_t fcn = PCCARD_FUNCTION_UNSPEC; const struct fe_pccard_product *pp; int i; if ((pp = (const struct fe_pccard_product *)pccard_product_lookup(dev, (const struct pccard_product *)fe_pccard_products, sizeof(fe_pccard_products[0]), NULL)) != NULL) { if (pp->mpp_product.pp_name != NULL) device_set_desc(dev, pp->mpp_product.pp_name); if (pp->mpp_flags & MPP_ANYFUNC) return (0); /* Make sure we're a network function */ error = pccard_get_function(dev, &fcn); if (error != 0) return (error); if (fcn != PCCARD_FUNCTION_NETWORK) return (ENXIO); if (pp->mpp_flags & MPP_SKIP_TO_CFE) { for (i = pp->mpp_cfe; i < 32; i++) { if (pccard_select_cfe(dev, i) == 0) goto good; } device_printf(dev, "Failed to map CFE %d or higher\n", pp->mpp_cfe); return ENXIO; } good: ; return (0); } return (ENXIO); }
static int ex_pccard_probe(device_t dev) { const struct pccard_product *pp; int error, i, j; uint32_t fcn = PCCARD_FUNCTION_UNSPEC; if ((pp = pccard_product_lookup(dev, ex_pccard_products, sizeof(ex_pccard_products[0]), NULL)) == NULL) return (EIO); if (pp->pp_name != NULL) device_set_desc(dev, pp->pp_name); /* * Olicom 22.8k and 33.6k modems need to activate the right * CFE. The odd formula below replicates the sequence of cfes * that have multiple resources: * 9, 11, 13, 15, 0 + 9 * 25, 27, 29, 31, 16 + 9 * 41, 43, 45, 47, 32 + 9 * 57, 59, 61, 63 48 + 9 * (entries 8, 24, 40 and 56 are single resoruce cfes) * Fortunately the code that enables and disables the multiple * fuctions of the card won't mess with the lower bit for cards * that aren't stanards conforming MFC cards (which these olicom * cards aren't). * * Note: These cards still don't get interrupts for reasons * unknown, even when the right cfe is selected. There's likely * something in the CCR that needs to be manually tweaked, but * the COR bits seem to all be used. Bit 0 and 3 are always set * and the other bits select the config to use. Maybe one of those * two bits needs to be cleared, or there's something else in the * CCR that needs tweaking. The pattern of resources suggests * bit 0 turns on the ethernet, however... */ if (pp->pp_vendor == PCMCIA_VENDOR_OLICOM && (pp->pp_product == PCMCIA_PRODUCT_OLICOM_OC2231 || pp->pp_product == PCMCIA_PRODUCT_OLICOM_OC2232)) { if (pccard_select_cfe(dev, 1) == 0) goto good; for (i = 0; i < 4; i++) { for (j = 0; j < 4; j++) { printf("Trying %d %d\n", i, j); if (pccard_select_cfe(dev, (i << 4) + (j << 1) + 9) == 0) goto good; } } /* Can't activate the net entries, punt */ return (EIO); } /* * All other cards supported by this driver don't need specail * treatment, so just filter based on the type of card. The * special treatment ones are setup to 'fail safe' to a modem so * this check would effectively filter them out as well. */ error = pccard_get_function(dev, &fcn); if (error != 0) return (error); if (fcn != PCCARD_FUNCTION_NETWORK) return (EIO); good:; return (0); }