Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/xen/console/xen_console.c
| Show First 20 Lines • Show All 511 Lines • ▼ Show 20 Lines | |||||
| xencons_tx(struct tty *tp) | xencons_tx(struct tty *tp) | ||||
| { | { | ||||
| bool cons_full; | bool cons_full; | ||||
| char c; | char c; | ||||
| struct xencons_priv *cons; | struct xencons_priv *cons; | ||||
| cons = tty_softc(tp); | cons = tty_softc(tp); | ||||
| tty_assert_locked(tp); | ttydisc_assert_locked(tp); | ||||
| /* | /* | ||||
| * Don't transmit any character if the buffer is full. Otherwise, | * Don't transmit any character if the buffer is full. Otherwise, | ||||
| * characters may be lost | * characters may be lost | ||||
| */ | */ | ||||
| if (xencons_tx_full(cons)) | if (xencons_tx_full(cons)) | ||||
| return (false); | return (false); | ||||
| Show All 23 Lines | xencons_intr(void *arg) | ||||
| /* | /* | ||||
| * It's not necessary to retrieve input when the tty is not opened | * It's not necessary to retrieve input when the tty is not opened | ||||
| */ | */ | ||||
| if (!cons->opened) | if (!cons->opened) | ||||
| return; | return; | ||||
| xencons_rx(cons); | xencons_rx(cons); | ||||
| tty_lock(tp); | ttydisc_lock(tp); | ||||
| while ((ret = xencons_getc(cons)) != -1) { | while ((ret = xencons_getc(cons)) != -1) { | ||||
| #ifdef KDB | #ifdef KDB | ||||
| kdb_alt_break(ret, &cons->altbrk); | kdb_alt_break(ret, &cons->altbrk); | ||||
| #endif | #endif | ||||
| ttydisc_rint(tp, ret, 0); | ttydisc_rint(tp, ret, 0); | ||||
| } | } | ||||
| ttydisc_rint_done(tp); | ttydisc_rint_done(tp); | ||||
| tty_unlock(tp); | ttydisc_unlock(tp); | ||||
| /* Try to flush remaining characters if necessary */ | /* Try to flush remaining characters if necessary */ | ||||
| xencons_tx_flush(cons, 0); | xencons_tx_flush(cons, 0); | ||||
| } | } | ||||
| /* | /* | ||||
| * Helpers to call while shutting down: | * Helpers to call while shutting down: | ||||
| * - Force flush all output | * - Force flush all output | ||||
| ▲ Show 20 Lines • Show All 102 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| static void | static void | ||||
| xencons_tty_outwakeup(struct tty *tp) | xencons_tty_outwakeup(struct tty *tp) | ||||
| { | { | ||||
| struct xencons_priv *cons; | struct xencons_priv *cons; | ||||
| cons = tty_softc(tp); | cons = tty_softc(tp); | ||||
| ttydisc_assert_locked(tp); | |||||
| callout_stop(&cons->callout); | callout_stop(&cons->callout); | ||||
| if (!xencons_tx(tp)) | if (!xencons_tx(tp)) | ||||
| callout_reset(&cons->callout, XC_POLLTIME, | callout_reset(&cons->callout, XC_POLLTIME, | ||||
| xencons_timeout, tp); | xencons_timeout, tp); | ||||
| } | } | ||||
| Show All 36 Lines | xencons_attach(device_t dev) | ||||
| int err; | int err; | ||||
| cons = &main_cons; | cons = &main_cons; | ||||
| tp = tty_alloc(&xencons_ttydevsw, cons); | tp = tty_alloc(&xencons_ttydevsw, cons); | ||||
| tty_makedev(tp, NULL, "%s%r", driver_name, 0); | tty_makedev(tp, NULL, "%s%r", driver_name, 0); | ||||
| device_set_softc(dev, tp); | device_set_softc(dev, tp); | ||||
| callout_init_mtx(&cons->callout, tty_getlock(tp), 0); | callout_init_mtx(&cons->callout, ttydisc_getlock(tp), 0); | ||||
| err = cons->ops->init(dev, tp, xencons_intr); | err = cons->ops->init(dev, tp, xencons_intr); | ||||
| if (err != 0) { | if (err != 0) { | ||||
| device_printf(dev, "Unable to initialize the console (%d)\n", | device_printf(dev, "Unable to initialize the console (%d)\n", | ||||
| err); | err); | ||||
| return (err); | return (err); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 44 Lines • Show Last 20 Lines | |||||