示例#1
0
文件: spc.c 项目: lacombar/netbsd-alc
static void
spc_intio_attach(device_t parent, device_t self, void *aux)
{
	struct spc_softc *sc = device_private(self);
	struct intio_attach_args *ia = aux;
	bus_space_tag_t iot = ia->ia_bst;
	bus_space_handle_t ioh;

	sc->sc_dev = self;

	intio_map_allocate_region(device_parent(parent), ia,
				  INTIO_MAP_ALLOCATE);
	if (bus_space_map(iot, ia->ia_addr, 0x20, BUS_SPACE_MAP_SHIFTED,
			  &ioh)) {
		aprint_error(": can't map i/o space\n");
		return;
	}
	aprint_normal("\n");

	sc->sc_iot = iot;
	sc->sc_ioh = ioh;
	sc->sc_initiator = IODEVbase->io_sram[0x70] & 0x7; /* XXX */

	if (intio_intr_establish(ia->ia_intr, "spc", spc_intr, sc))
		panic("spcattach: interrupt vector busy");

	spc_attach(sc);
}
示例#2
0
void
spc_mainbus_attach(struct device *parent, struct device *self, void *aux)
{
	struct spc_softc *sc = (void *)self;
	struct mainbus_attach_args *ma = aux;

	printf ("\n");

	sc->sc_iot = &spc_bst;
	sc->sc_ioh = ma->ma_addr;
	sc->sc_initiator = 7;
	sc->sc_dma_start = NULL;
	sc->sc_dma_done = NULL;

	isrlink_autovec(spc_intr, (void *)sc, ma->ma_ilvl, ISRPRI_BIO,
	    self->dv_xname);

	spc_attach(sc, &spc_switch);
}
示例#3
0
void
spc_pcmcia_attach(device_t parent, device_t self, void *aux)
{
    struct spc_pcmcia_softc *sc = device_private(self);
    struct spc_softc *spc = &sc->sc_spc;
    struct pcmcia_attach_args *pa = aux;
    struct pcmcia_config_entry *cfe;
    struct pcmcia_function *pf = pa->pf;
    int error;

    spc->sc_dev = self;
    sc->sc_pf = pf;

    error = pcmcia_function_configure(pf, spc_pcmcia_validate_config);
    if (error) {
        aprint_error_dev(self, "configure failed, error=%d\n", error);
        return;
    }

    cfe = pf->cfe;
    spc->sc_iot = cfe->iospace[0].handle.iot;
    spc->sc_ioh = cfe->iospace[0].handle.ioh;

    error = spc_pcmcia_enable(self, 1);
    if (error)
        goto fail;

    spc->sc_initiator = 7; /* XXX */
    spc->sc_adapter.adapt_enable = spc_pcmcia_enable;
    spc->sc_adapter.adapt_refcnt = 1;

    /*
     *  Initialize nca board itself.
     */
    spc_attach(spc);
    scsipi_adapter_delref(&spc->sc_adapter);
    sc->sc_state = SPC_PCMCIA_ATTACHED;
    return;

fail:
    pcmcia_function_unconfigure(pf);
}