示例#1
0
static int
ed_pci_attach(device_t dev)
{
	struct	ed_softc *sc = device_get_softc(dev);
	int	error = ENXIO;

	/*
	 * Probe RTL8029 cards, but allow failure and try as a generic
	 * ne-2000.  QEMU 0.9 and earlier use the RTL8029 PCI ID, but
	 * are areally just generic ne-2000 cards.
	 */
	if (pci_get_devid(dev) == ED_RTL8029_PCI_ID)
		error = ed_probe_RTL80x9(dev, PCIR_BAR(0), 0);
	if (error)
		error = ed_probe_Novell(dev, PCIR_BAR(0),
		    ED_FLAGS_FORCE_16BIT_MODE);
	if (error) {
		ed_release_resources(dev);
		return (error);
	}
	ed_Novell_read_mac(sc);

	error = ed_alloc_irq(dev, 0, RF_SHAREABLE);
	if (error) {
		ed_release_resources(dev);
		return (error);
	}
	if (sc->sc_media_ioctl == NULL)
		ed_gen_ifmedia_init(sc);
	error = ed_attach(dev);
	if (error) {
		ed_release_resources(dev);
		return (error);
	}
	error = bus_setup_intr(dev, sc->irq_res, INTR_TYPE_NET | INTR_MPSAFE,
	    NULL, edintr, sc, &sc->irq_handle);
	if (error)
		ed_release_resources(dev);
	return (error);
}
示例#2
0
static int
ed_isa_probe(device_t dev)
{
	struct ed_softc *sc = device_get_softc(dev);
	int flags = device_get_flags(dev);
	int error = 0;

	/* Check isapnp ids */
	error = ISA_PNP_PROBE(device_get_parent(dev), dev, ed_ids);

	/* If the card had a PnP ID that didn't match any we know about */
	if (error == ENXIO)
		goto end;

	/* If we had some other problem. */
	if (!(error == 0 || error == ENOENT))
		goto end;

	/* Heuristic probes */

	error = ed_probe_WD80x3(dev, 0, flags);
	if (error == 0)
		goto end;
	ed_release_resources(dev);

	error = ed_probe_RTL80x9(dev, 0, flags);
	if (error == 0) {
		ed_Novell_read_mac(sc);
		goto end;
	}
	ed_release_resources(dev);
	
#ifdef ED_3C503
	error = ed_probe_3Com(dev, 0, flags);
	if (error == 0)
		goto end;
	ed_release_resources(dev);
#endif

#ifdef ED_SIC
	error = ed_probe_SIC(dev, 0, flags);
	if (error == 0)
		goto end;
	ed_release_resources(dev);
#endif
	error = ed_isa_probe_Novell(dev);
	if (error == 0)
		goto end;
	ed_release_resources(dev);

#ifdef ED_HPP
	error = ed_probe_HP_pclanp(dev, 0, flags);
	if (error == 0)
		goto end;
	ed_release_resources(dev);
#endif
end:
	if (error == 0)
		error = ed_alloc_irq(dev, 0, 0);

	ed_release_resources(dev);
	return (error);
}