Пример #1
0
void
com_ssio_attach(device_t parent, device_t self, void *aux)
{
	struct com_ssio_softc *sc_ssio = device_private(self);
	struct com_softc *sc = &sc_ssio->sc_com;
	struct ssio_attach_args *saa = aux;
	int pagezero_cookie;

	bus_addr_t iobase;
	bus_space_handle_t ioh;
	bus_space_tag_t iot;

	sc->sc_dev = self;
	iobase = saa->saa_iobase;
	iot = saa->saa_iot;
	if (bus_space_map(iot, iobase, COM_NPORTS,
	    0, &ioh)) {
		aprint_error(": can't map I/O space\n");
		return;
	}

        /* Test if this is the console. */
	pagezero_cookie = hp700_pagezero_map();
	if (PAGE0->mem_cons.pz_class == PCL_DUPLEX &&
	    PAGE0->mem_cons.pz_hpa == (struct iomod *)ioh) {
		bus_space_unmap(iot, ioh, COM_NPORTS);
		if (comcnattach(iot, iobase, B9600, COM_SSIO_FREQ,
		    COM_TYPE_NORMAL, 
		    (TTYDEF_CFLAG & ~(CSIZE | PARENB)) | CS8) != 0) {
			aprint_error(": can't comcnattach\n");
			hp700_pagezero_unmap(pagezero_cookie);
			return;
		}
	}
	hp700_pagezero_unmap(pagezero_cookie);

	sc->sc_frequency = COM_SSIO_FREQ;
	COM_INIT_REGS(sc->sc_regs, iot, ioh, iobase);
	com_attach_subr(sc);

	sc_ssio->sc_ih = ssio_intr_establish(IPL_TTY, saa->saa_irq,
	    comintr, sc, device_xname(self));
}
Пример #2
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");
}