Beispiel #1
0
void
lpt_jensenio_attach(struct device *parent, struct device *self, void *aux)
{
	struct lpt_jensenio_softc *jsc = (void *)self;
	struct lpt_softc *sc = &jsc->sc_lpt;
	struct jensenio_attach_args *ja = aux;
	const char *intrstr;

	sc->sc_iot = ja->ja_iot;

	if (bus_space_map(sc->sc_iot, ja->ja_ioaddr, LPT_NPORTS, 0,
	    &sc->sc_ioh) != 0) {
		printf(": can't map i/o space\n");
		return;
	}

	printf("\n");

	lpt_attach_subr(sc);

	intrstr = eisa_intr_string(ja->ja_ec, ja->ja_irq[0]);
	jsc->sc_ih = eisa_intr_establish(ja->ja_ec, ja->ja_irq[0],
	    IST_EDGE, IPL_TTY, lptintr, sc);
	if (jsc->sc_ih == NULL) {
		printf("%s: unable to establish interrupt",
		    sc->sc_dev.dv_xname);
		if (intrstr != NULL)
			printf(" at %s", intrstr);
		printf("\n");
		return;
	}
	printf("%s: interrupting at %s\n", sc->sc_dev.dv_xname, intrstr);
}
Beispiel #2
0
void
lpt_mainbus_attach(struct device *parent, struct device *self, void *aux)
{
	struct lpt_mainbus_softc *msc = (void *)self;
	struct lpt_softc *sc = &msc->sc_lpt;
	struct mainbus_attach_args *ma = aux;

	sc->sc_iot = ma->ma_st;

	if (bus_space_map(sc->sc_iot, ma->ma_addr, LPT_NPORTS, 0,
	    &sc->sc_ioh) != 0) {
		printf(": can't map i/o space\n");
		return;
	}

	printf("\n");

	lpt_attach_subr(sc);

	sc->sc_ih = (*algor_intr_establish)(ma->ma_irq, lptintr, sc);
	if (msc->sc_ih == NULL) {
		printf("%s: unable to establish interrupt\n",
		    sc->sc_dev.dv_xname);
		return;
	}
}
Beispiel #3
0
void
lpt_supio_attach(device_t parent, device_t self, void *aux)
{
	struct lptsupio_softc *sc = device_private(self);
	struct lpt_softc *lsc = &sc->sc_lpt;
	int iobase;
	bus_space_tag_t iot;
	struct supio_attach_args *supa = aux;

	/*
	 * We're living on a superio chip.
	 */
	lsc->sc_dev = self;
	iobase = supa->supio_iobase;
	iot = lsc->sc_iot = supa->supio_iot;
	sc->sc_intack = (void *)supa->supio_arg;

	aprint_normal(" port 0x%04x ipl %d\n", iobase, supa->supio_ipl);
        if (bus_space_map(iot, iobase, LPT_NPORTS, 0, &lsc->sc_ioh)) {
		aprint_error_dev(self, "io mapping failed\n");
		return;
	}

	lpt_attach_subr(lsc);

	sc->sc_isr.isr_intr = lpt_supio_intr;
	sc->sc_isr.isr_arg = sc;
	sc->sc_isr.isr_ipl = supa->supio_ipl;
	add_isr(&sc->sc_isr);
}
static void
lpt_puc_attach(device_t parent, device_t self, void *aux)
{
	struct lpt_softc *sc = device_private(self);
	struct puc_attach_args *aa = aux;
	const char *intrstr;

	sc->sc_dev = self;
	sc->sc_iot = aa->t;
	sc->sc_ioh = aa->h;

	intrstr = pci_intr_string(aa->pc, aa->intrhandle);
	sc->sc_ih = pci_intr_establish(aa->pc, aa->intrhandle, IPL_TTY,
	    lptintr, sc);
	if (sc->sc_ih == NULL) {
		aprint_error(": couldn't establish interrupt");
		if (intrstr != NULL)
			aprint_error(" at %s", intrstr);
		aprint_error("\n");
		return;
	}
	aprint_normal(": interrupting at %s\n", intrstr);

	lpt_attach_subr(sc);
}
Beispiel #5
0
static void
lpt_upc_attach(device_t parent, device_t self, void *aux)
{
	struct lpt_softc *sc = device_private(self);
	struct upc_attach_args *ua = aux;

	sc->sc_dev = self;
	sc->sc_iot = ua->ua_iot;
	sc->sc_ioh = ua->ua_ioh;

	lpt_attach_subr(sc);
	upc_intr_establish(ua->ua_irqhandle, IPL_TTY, lptintr, sc);
	aprint_normal("\n");
}
Beispiel #6
0
static void
lpt_puc_attach(device_t parent, device_t self, void *aux)
{
	struct lpt_softc *sc = device_private(self);
	struct puc_attach_args *aa = aux;
	const char *intrstr;
	char intrbuf[PCI_INTRSTR_LEN];

	sc->sc_dev = self;
	sc->sc_iot = aa->t;
	sc->sc_ioh = aa->h;

	aprint_naive(": Parallel port");
	aprint_normal(": ");

	intrstr = pci_intr_string(aa->pc, aa->intrhandle, intrbuf, sizeof(intrbuf));
	sc->sc_ih = pci_intr_establish(aa->pc, aa->intrhandle, IPL_TTY,
	    lptintr, sc);
	if (sc->sc_ih == NULL) {
		aprint_error("couldn't establish interrupt");
		if (intrstr != NULL)
			aprint_error(" at %s", intrstr);
		aprint_error("\n");
		return;
	}

#if defined(amd64) || defined(i386)
	/*
	 * Parallel ports are sometimes used for improvised GPIO by
	 * userspace programs which need to know the port's I/O address.
	 * Print the address here so the user doesn't have to dig through
	 * PCI configuration space to find it.
	*/
	if (aa->h < 0x10000)
		aprint_normal("ioaddr 0x%04lx, ", aa->h);
#endif
	aprint_normal("interrupting at %s\n", intrstr);

	if (!pmf_device_register(self, NULL, NULL))
		aprint_error_dev(self, "couldn't establish power handler\n");

	lpt_attach_subr(sc);
}
Beispiel #7
0
void
lpt_ssio_attach(device_t parent, device_t self, void *aux)
{
	struct lpt_softc *sc = device_private(self);
	struct ssio_attach_args *saa = aux;

	sc->sc_dev = self;
	sc->sc_iot = saa->saa_iot;
	if (bus_space_map(sc->sc_iot, saa->saa_iobase, LPT_NPORTS,
	    0, &sc->sc_ioh)) {
		aprint_error(": can't map i/o ports\n");
		return;
	}

	lpt_attach_subr(sc);

	sc->sc_ih = ssio_intr_establish(IPL_TTY, saa->saa_irq,
	    lptintr, sc, device_xname(self));

	aprint_normal("\n");
}
Beispiel #8
0
void
lpt_pnpbios_attach(device_t parent, device_t self, void *aux)
{
	struct lpt_pnpbios_softc *psc = device_private(self);
	struct lpt_softc *sc = &psc->sc_lpt;
	struct pnpbiosdev_attach_args *aa = aux;

	sc->sc_dev = self;

	if (pnpbios_io_map(aa->pbt, aa->resc, 0, &sc->sc_iot, &sc->sc_ioh)) { 	
		printf(": can't map i/o space\n");
		return;
	}

	printf("\n");
	pnpbios_print_devres(self, aa);

	lpt_attach_subr(sc);

	sc->sc_ih = pnpbios_intr_establish(aa->pbt, aa->resc, 0, IPL_TTY,
					    lptintr, sc);
}
Beispiel #9
0
void
lpt_ebus_attach(device_t parent, device_t self, void *aux)
{
	struct lpt_softc *sc = device_private(self);
	struct ebus_attach_args *ea = aux;
	int i;

	sc->sc_dev = self;
	sc->sc_iot = ea->ea_bustag;
	/*
	 * Addresses that should be supplied by the prom:
	 *	- normal lpt registers
	 *	- ns873xx configuration registers
	 *	- DMA space
	 * The `lpt' driver does not use DMA accesses, so we can
	 * ignore that for now.  We should enable the lpt port in
	 * the ns873xx registers here. XXX
	 *
	 * Use the prom address if there.
	 */
	if (ea->ea_nvaddr)
		sparc_promaddr_to_handle(sc->sc_iot, ea->ea_vaddr[0],
			&sc->sc_ioh);
	else if (bus_space_map(sc->sc_iot,
			      EBUS_ADDR_FROM_REG(&ea->ea_reg[0]),
			      ea->ea_reg[0].size,
			      0,
			      &sc->sc_ioh) != 0) {
		aprint_error(": can't map register space\n");
                return;
	}

	for (i = 0; i < ea->ea_nintr; i++)
		bus_intr_establish(ea->ea_bustag, ea->ea_intr[i],
				   IPL_SERIAL, lptintr, sc);
	aprint_normal("\n");

	lpt_attach_subr(sc);
}