Exemplo n.º 1
0
static int
aic_pccard_attach(device_t dev)
{
	struct aic_pccard_softc *sc = device_get_softc(dev);
	struct aic_softc *aic = &sc->sc_aic;
	int error;

	if (aic_pccard_alloc_resources(dev))
		return (ENXIO);
	if (aic_probe(aic)) {
		aic_pccard_release_resources(dev);
		return (ENXIO);
	}

	device_set_desc(dev, "Adaptec 6260/6360 SCSI controller");

	error = aic_attach(aic);
	if (error) {
		device_printf(dev, "attach failed\n");
		aic_pccard_release_resources(dev);
		return (error);
	}

	error = bus_setup_intr(dev, sc->sc_irq, 0, aic_intr,
			       aic, &sc->sc_ih, NULL);
	if (error) {
		device_printf(dev, "failed to register interrupt handler\n");
		aic_pccard_release_resources(dev);
		return (error);
	}
	return (0);
}
Exemplo n.º 2
0
static int
aic_isa_attach(device_t dev)
{
	struct aic_isa_softc *sc = device_get_softc(dev);
	struct aic_softc *aic = &sc->sc_aic;
	int error;

	error = aic_isa_alloc_resources(dev);
	if (error) {
		device_printf(dev, "resource allocation failed\n");
		return (error);
	}

	error = aic_attach(aic);
	if (error) {
		device_printf(dev, "attach failed\n");
		aic_isa_release_resources(dev);
		return (error);
	}

	error = bus_setup_intr(dev, sc->sc_irq, INTR_TYPE_CAM | INTR_ENTROPY |
	    INTR_MPSAFE, NULL, aic_intr, aic, &sc->sc_ih);
	if (error) {
		device_printf(dev, "failed to register interrupt handler\n");
		aic_isa_release_resources(dev);
		return (error);
	}
	return (0);
}
Exemplo n.º 3
0
static int
aic_isa_attach(struct isa_device *dev)
{
	struct aic_softc *aic = &aic_softcs[dev->id_unit];

	aic->unit = dev->id_unit;
	aic->tag = I386_BUS_SPACE_IO;
	aic->bsh = dev->id_iobase;
#ifdef PC98
	aic->bsh_iat = aicport_generic;
	if (AIC_TYPE98(dev->id_flags) == AIC98_NEC100) {
		/* PC-9801-100 */
		aic->bsh_iat = aicport_100;
	}
#endif

	return (aic_attach(aic) == 0);
}