static int
sbni_probe_isa(device_t dev)
{
    struct sbni_softc *sc;
    int error;

    error = ISA_PNP_PROBE(device_get_parent(dev), dev, sbni_ids);
    if (error && error != ENOENT)
        return (error);

    sc = device_get_softc(dev);

    sc->io_res = bus_alloc_resource(dev, SYS_RES_IOPORT, &sc->io_rid,
                                    0ul, ~0ul, SBNI_PORTS, RF_ACTIVE);
    if (!sc->io_res) {
        printf("sbni: cannot allocate io ports!\n");
        return (ENOENT);
    }

    if (sbni_probe(sc) != 0) {
        sbni_release_resources(sc);
        return (ENXIO);
    }

    device_set_desc(dev, "Granch SBNI12/ISA adapter");
    return (0);
}
Example #2
0
/*  Statically configured drivers -- order matters here. */
static int __init net_olddevs_init(void)
{
	int num;

#ifdef CONFIG_SBNI
	for (num = 0; num < 8; ++num)
		sbni_probe(num);
#endif
#ifdef CONFIG_TR
	for (num = 0; num < 8; ++num)
		if (!trif_probe(num))
			trif_probe2(num);
#endif
	for (num = 0; num < 8; ++num)
		ethif_probe2(num);

#ifdef CONFIG_COPS
	cops_probe(0);
	cops_probe(1);
	cops_probe(2);
#endif
#ifdef CONFIG_LTPC
	ltpc_probe();
#endif

	return 0;
}
Example #3
0
static int
sbni_probe_isa(device_t dev)
{
	struct sbni_softc *sc;
	int error;

	error = ISA_PNP_PROBE(device_get_parent(dev), dev, sbni_ids);
	if (error && error != ENOENT)
		return (error);

	sc = device_get_softc(dev);
	bzero(sc, sizeof(struct sbni_softc));

 	sc->io_res = bus_alloc_resource(dev, SYS_RES_IOPORT, &sc->io_rid,
					0ul, ~0ul, SBNI_PORTS, RF_ACTIVE);
	if (!sc->io_res) {
		printf("sbni: cannot allocate io ports!\n");
		return (ENOENT);
	}

	sc->base_addr = rman_get_start(sc->io_res);
	if (sbni_probe(sc) != 0) {
		bus_release_resource(dev, SYS_RES_IOPORT,
				     sc->io_rid, sc->io_res);
		return (ENXIO);
	}

	device_quiet(dev);
	return (0);
}
Example #4
0
static int
sbni_pci_probe(device_t dev)
{
	struct sbni_softc  *sc;
	u_int32_t  ports;
   
	ports = SBNI_PORTS;
	if (pci_get_vendor(dev) != SBNI_PCI_VENDOR
	    || pci_get_device(dev) != SBNI_PCI_DEVICE)
		return (ENXIO);

	sc = device_get_softc(dev);
	bzero(sc, sizeof(struct sbni_softc));
	if (pci_get_subdevice(dev) == 2) {
		ports <<= 1;
		sc->slave_sc = malloc(sizeof(struct sbni_softc),
				      M_DEVBUF, M_NOWAIT);
		if (!sc->slave_sc)
			return (ENOMEM);
		bzero(sc->slave_sc, sizeof(struct sbni_softc));
		device_set_desc(dev, "Granch SBNI12/PCI Dual adapter");
	} else
		device_set_desc(dev, "Granch SBNI12/PCI adapter");

	sc->io_rid = PCIR_MAPS;
 	sc->io_res = bus_alloc_resource(dev, SYS_RES_IOPORT, &sc->io_rid,
					0ul, ~0ul, ports, RF_ACTIVE);
	if (!sc->io_res) {
		printf("sbni: cannot allocate io ports!\n");
		if (sc->slave_sc)
			free(sc->slave_sc, M_DEVBUF);
		return (ENOENT);
	}

	sc->base_addr = rman_get_start(sc->io_res);
	if (sc->slave_sc)
		sc->slave_sc->base_addr = sc->base_addr + 4;
	if (sbni_probe(sc) != 0) {
		bus_release_resource(dev, SYS_RES_IOPORT,
				     sc->io_rid, sc->io_res);
		if (sc->slave_sc)
			free(sc->slave_sc, M_DEVBUF);
		return (ENXIO);
	}

	device_quiet(dev);
	return (0);
}
Example #5
0
static int
sbni_pci_probe(device_t dev)
{
	struct sbni_softc  *sc;
	u_int32_t  ports;
 
	ports = SBNI_PORTS;
	if (pci_get_vendor(dev) != SBNI_PCI_VENDOR ||
	    pci_get_device(dev) != SBNI_PCI_DEVICE)
		return (ENXIO);

	sc = device_get_softc(dev);
	if (pci_get_subdevice(dev) == 2) {
		ports <<= 1;
		sc->slave_sc = malloc(sizeof(struct sbni_softc),
				      M_DEVBUF, M_NOWAIT | M_ZERO);
		if (!sc->slave_sc)
			return (ENOMEM);
		device_set_desc(dev, "Granch SBNI12/PCI Dual adapter");
	} else
		device_set_desc(dev, "Granch SBNI12/PCI adapter");

	sc->io_rid = PCIR_BAR(0);
 	sc->io_res = bus_alloc_resource(dev, SYS_RES_IOPORT, &sc->io_rid,
					0ul, ~0ul, ports, RF_ACTIVE);
	if (!sc->io_res) {
		device_printf(dev, "cannot allocate io ports!\n");
		if (sc->slave_sc)
			free(sc->slave_sc, M_DEVBUF);
		return (ENOENT);
	}

	if (sc->slave_sc) {
		sc->slave_sc->io_res = sc->io_res;
		sc->slave_sc->io_off = 4;
	}
	if (sbni_probe(sc) != 0) {
		sbni_release_resources(sc);
		if (sc->slave_sc)
			free(sc->slave_sc, M_DEVBUF);
		return (ENXIO);
	}

	return (0);
}