/* ARGSUSED */ void bcspattach(int num __unused) { int error; error = ttyldisc_attach(&bcsp_disc); if (error) { aprint_error("%s: unable to register line discipline, " "error = %d\n", bcsp_cd.cd_name, error); return; } error = config_cfattach_attach(bcsp_cd.cd_name, &bcsp_ca); if (error) { aprint_error("%s: unable to register cfattach, error = %d\n", bcsp_cd.cd_name, error); config_cfdriver_detach(&bcsp_cd); (void) ttyldisc_detach(&bcsp_disc); } }
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; }