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; }
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); }
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; }
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"); }
void sunkbd_attach(device_t parent, device_t self, void *aux) { struct kbd_sun_softc *k = device_private(self); struct kbd_ms_tty_attach_args *args = aux; struct tty *tp = args->kmta_tp; struct cons_channel *cc; k->k_kbd.k_dev = self; /* Set up the proper line discipline. */ if (ttyldisc_attach(&sunkbd_disc) != 0) panic("sunkbd_attach: sunkbd_disc"); ttyldisc_release(tp->t_linesw); tp->t_linesw = ttyldisc_lookup(sunkbd_disc.l_name); KASSERT(tp->t_linesw == &sunkbd_disc); tp->t_oflag &= ~OPOST; tp->t_dev = args->kmta_dev; /* link the structures together. */ k->k_priv = tp; tp->t_sc = k; /* provide our middle layer with a link to the lower layer (i.e. us) */ k->k_deviopen = sunkbdiopen; k->k_deviclose = NULL; k->k_write_data = sunkbd_write_data; /* provide upper layer with a link to our middle layer */ k->k_kbd.k_ops = &kbd_ops_sun; /* alloc console input channel */ if ((cc = kbd_cc_alloc(&k->k_kbd)) == NULL) return; if (args->kmta_consdev) { char magic[4]; /* * Hookup ourselves as the console input channel */ args->kmta_baud = sunkbd_bps; args->kmta_cflag = CLOCAL|CS8; cons_attach_input(cc, args->kmta_consdev); /* Tell our parent what the console should be. */ args->kmta_consdev = cn_tab; k->k_kbd.k_isconsole = 1; aprint_normal(" (console input)"); /* Set magic to "L1-A" */ magic[0] = KBD_L1; magic[1] = KBD_A; magic[2] = 0; cn_set_magic(magic); } else { extern void kd_attach_input(struct cons_channel *); kd_attach_input(cc); } aprint_normal("\n"); #if NWSKBD > 0 kbd_wskbd_attach(&k->k_kbd, args->kmta_consdev != NULL); #endif /* Do this before any calls to kbd_rint(). */ kbd_xlate_init(&k->k_kbd.k_state); /* Magic sequence. */ k->k_magic1 = KBD_L1; k->k_magic2 = KBD_A; }