Exemple #1
0
int
gtmpsccnattach(bus_space_tag_t iot, bus_dma_tag_t dmat, bus_addr_t base,
	       int unit, int brg, int speed, tcflag_t tcflag)
{
	struct gtmpsc_softc *sc = &gtmpsc_cn_softc;
	int i, res;
	const unsigned char cp[] = "\r\nMPSC Lives!\r\n";

	res = gtmpsc_hackinit(sc, iot, dmat, base, unit, brg, speed, tcflag);
	if (res != 0)
		return res;

	gtmpscinit_stop(sc);
	gtmpscinit_start(sc);

	/*
	 * enable SDMA receive
	 */
	GT_SDMA_WRITE(sc, SDMA_SDCM, SDMA_SDCM_ERD);

	for (i = 0; i < sizeof(cp); i++) {
		if (*(cp + i) == 0)
			break;
		gtmpsc_common_putc(sc, *(cp + i));
	}

	cn_tab = &gtmpsc_consdev;
	cn_init_magic(&gtmpsc_cnm_state);

	return 0;
}
Exemple #2
0
void
xenconscn_attach(void)
{

    cn_tab = &xencons;

    /* console ring mapped in locore.S */

    cn_init_magic(&xencons_cnm_state);
    cn_set_magic("+++++");

    xencons_isconsole = 1;
}
Exemple #3
0
static void 
pconsattach(device_t parent, device_t self, void *aux)
{
	struct pconssoftc *sc = device_private(self);

	aprint_normal("\n");
	if (!pconsprobe())
		return;

	cn_init_magic(&pcons_cnm_state);
	cn_set_magic("+++++");
	callout_init(&sc->sc_poll_ch, 0);
}
Exemple #4
0
void
at91dbgu_cn_attach(bus_space_tag_t iot, bus_addr_t iobase, bus_space_handle_t ioh,
		   int ospeed, tcflag_t cflag)
{
	cn_tab = &at91dbgu_cons;
	cn_init_magic(&at91dbgu_cnm_state);
	cn_set_magic("\047\001");

	dbgu_cn_sc.sc_iot = iot;
	dbgu_cn_sc.sc_ioh = ioh;
	dbgu_cn_sc.sc_hwbase = iobase;
	dbgu_cn_sc.sc_ospeed = ospeed;
	dbgu_cn_sc.sc_cflag = cflag;

	DBGU_INIT(AT91_MSTCLK, ospeed);
}
int
at91usart_cn_attach(bus_space_tag_t iot, bus_addr_t iobase, bus_space_handle_t ioh,
		    uint32_t mstclk, int ospeed, tcflag_t cflag)
{
	cn_tab = &at91usart_cons;
	cn_init_magic(&at91usart_cnm_state);
	cn_set_magic("\047\001");

	usart_cn_sc.sc_iot = iot;
	usart_cn_sc.sc_ioh = ioh;
	usart_cn_sc.sc_hwbase = iobase;
	usart_cn_sc.sc_ospeed = ospeed;
	usart_cn_sc.sc_cflag = cflag;

	USART_INIT(mstclk, ospeed);

	return (0);
}
int
sscom_cnattach(bus_space_tag_t iot, bus_space_handle_t ioh,
    const struct sscom_uart_info *config,
    int rate, int frequency, tcflag_t cflag)
{
	int res;

	res = sscom_init(iot, ioh, config, rate, frequency, cflag,
	    &sscomconsioh);
	if (res)
		return res;

	cn_tab = &sscomcons;
	cn_init_magic(&sscom_cnm_state);
	cn_set_magic("\047\001"); /* default magic is BREAK */

	sscomconstag = iot;
	sscomconsunit = config->unit;
	sscomconsrate = rate;
	sscomconscflag = cflag;

	return 0;
}
Exemple #7
0
void
sabtty_attach(struct device *parent, struct device *self, void *aux)
{
	struct sabtty_softc *sc = (struct sabtty_softc *)self;
	struct sabtty_attach_args *sa = aux;
	int r;
	int maj;
	int is_kgdb = 0;

#ifdef KGDB
	is_kgdb = sab_kgdb_check(sc);
#endif

	if (!is_kgdb) {
		sc->sc_tty = ttymalloc();
		if (sc->sc_tty == NULL) {
			aprint_normal(": failed to allocate tty\n");
			return;
		}
		tty_attach(sc->sc_tty);
		sc->sc_tty->t_oproc = sabtty_start;
		sc->sc_tty->t_param = sabtty_param;
	}

	sc->sc_parent = (struct sab_softc *)parent;
	sc->sc_bt = sc->sc_parent->sc_bt;
	sc->sc_portno = sa->sbt_portno;
	sc->sc_rend = sc->sc_rbuf + SABTTY_RBUF_SIZE;

	switch (sa->sbt_portno) {
	case 0:	/* port A */
		sc->sc_pvr_dtr = SAB_PVR_DTR_A;
		sc->sc_pvr_dsr = SAB_PVR_DSR_A;
		r = bus_space_subregion(sc->sc_bt, sc->sc_parent->sc_bh,
		    SAB_CHAN_A, SAB_CHANLEN, &sc->sc_bh);
		break;
	case 1:	/* port B */
		sc->sc_pvr_dtr = SAB_PVR_DTR_B;
		sc->sc_pvr_dsr = SAB_PVR_DSR_B;
		r = bus_space_subregion(sc->sc_bt, sc->sc_parent->sc_bh,
		    SAB_CHAN_B, SAB_CHANLEN, &sc->sc_bh);
		break;
	default:
		aprint_normal(": invalid channel: %u\n", sa->sbt_portno);
		return;
	}
	if (r != 0) {
		aprint_normal(": failed to allocate register subregion\n");
		return;
	}

	sabtty_console_flags(sc);

	if (sc->sc_flags & (SABTTYF_CONS_IN | SABTTYF_CONS_OUT)) {
		struct termios t;
		const char *acc;

		/* Let residual prom output drain */
		DELAY(100000);

		switch (sc->sc_flags & (SABTTYF_CONS_IN | SABTTYF_CONS_OUT)) {
		case SABTTYF_CONS_IN:
			acc = "input";
			break;
		case SABTTYF_CONS_OUT:
			acc = "output";
			break;
		case SABTTYF_CONS_IN|SABTTYF_CONS_OUT:
		default:
			acc = "i/o";
			break;
		}

		t.c_ispeed= 0;
		t.c_ospeed = 9600;
		t.c_cflag = CREAD | CS8 | HUPCL;
		sc->sc_tty->t_ospeed = 0;
		sabttyparam(sc, sc->sc_tty, &t);

		if (sc->sc_flags & SABTTYF_CONS_IN) {
			sabtty_cons_input = sc;
			cn_tab->cn_pollc = sab_cnpollc;
			cn_tab->cn_getc = sab_cngetc;
			maj = cdevsw_lookup_major(&sabtty_cdevsw);
			cn_tab->cn_dev = makedev(maj, device_unit(self));
			shutdownhook_establish(sabtty_shutdown, sc);
			cn_init_magic(&sabtty_cnm_state);
			cn_set_magic("\047\001"); /* default magic is BREAK */
		}

		if (sc->sc_flags & SABTTYF_CONS_OUT) {
			sabtty_tec_wait(sc);
			sabtty_cons_output = sc;
			cn_tab->cn_putc = sab_cnputc;
			maj = cdevsw_lookup_major(&sabtty_cdevsw);
			cn_tab->cn_dev = makedev(maj, device_unit(self));
		}
		aprint_normal(": console %s", acc);
	} else {
		/* Not a console... */
		sabtty_reset(sc);

#ifdef KGDB
		if (is_kgdb) {
			sab_kgdb_init(sc);
			aprint_normal(": kgdb");
		}
#endif
	}

	aprint_normal("\n");
}