diff options
author | Andriy Gapon <avg@FreeBSD.org> | 2018-05-29 16:16:24 +0000 |
---|---|---|
committer | Andriy Gapon <avg@FreeBSD.org> | 2018-05-29 16:16:24 +0000 |
commit | ec6faf94c489e4217207bb2cbc1c36d73f07b522 (patch) | |
tree | 7b1cf67a643f8cef8c74f85dc6a05351b36325ee /sys/dev | |
parent | fe1ba25039bd4c230fab01d37031e09d19ee6cbe (diff) | |
download | src-ec6faf94c489e4217207bb2cbc1c36d73f07b522.tar.gz src-ec6faf94c489e4217207bb2cbc1c36d73f07b522.zip |
add support for console resuming, implement it for uart, use on x86
This change adds a new optional console method cn_resume and a kernel
console interface cnresume. Consoles that may need to re-initialize
their hardware after suspend (e.g., because firmware does not care to do
it) will implement cn_resume. Note that it is called in rather early
environment not unlike early boot, so the same restrictions apply.
Platform specific code, for platforms that support hardware suspend,
should call cnresume early after resume, before any console output is
expected.
This change fixes a problem with a system of mine failing to resume when
a serial console is used. I found that the serial port was in a strange
configuration and an attempt to write to it likely resulted in an
infinite loop.
To avoid adding cn_resume method to every console driver, CONSOLE_DRIVER
macro has been extended to support optional methods.
Reviewed by: imp, mav
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D15552
Notes
Notes:
svn path=/head/; revision=334340
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/uart/uart_tty.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/sys/dev/uart/uart_tty.c b/sys/dev/uart/uart_tty.c index 7eaf2f7745c2..1bef6384678e 100644 --- a/sys/dev/uart/uart_tty.c +++ b/sys/dev/uart/uart_tty.c @@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$"); static cn_probe_t uart_cnprobe; static cn_init_t uart_cninit; +static cn_init_t uart_cnresume; static cn_term_t uart_cnterm; static cn_getc_t uart_cngetc; static cn_putc_t uart_cnputc; @@ -69,7 +70,10 @@ static tsw_modem_t uart_tty_modem; static tsw_free_t uart_tty_free; static tsw_busy_t uart_tty_busy; -CONSOLE_DRIVER(uart); +CONSOLE_DRIVER( + uart, + .cn_resume = uart_cnresume, +); static struct uart_devinfo uart_console; @@ -115,6 +119,13 @@ uart_cninit(struct consdev *cp) } static void +uart_cnresume(struct consdev *cp) +{ + + uart_init(cp->cn_arg); +} + +static void uart_cnterm(struct consdev *cp) { |