Page MenuHomeFreeBSD

D15552.id42926.diff
No OneTemporary

D15552.id42926.diff

Index: sys/dev/uart/uart_tty.c
===================================================================
--- sys/dev/uart/uart_tty.c
+++ sys/dev/uart/uart_tty.c
@@ -53,6 +53,7 @@
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_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;
@@ -112,6 +116,13 @@
di->type = UART_DEV_CONSOLE;
uart_add_sysdev(di);
uart_init(di);
+}
+
+static void
+uart_cnresume(struct consdev *cp)
+{
+
+ uart_init(cp->cn_arg);
}
static void
Index: sys/kern/kern_cons.c
===================================================================
--- sys/kern/kern_cons.c
+++ sys/kern/kern_cons.c
@@ -384,6 +384,19 @@
}
}
+void
+cnresume()
+{
+ struct cn_device *cnd;
+ struct consdev *cn;
+
+ STAILQ_FOREACH(cnd, &cn_devlist, cnd_next) {
+ cn = cnd->cnd_cn;
+ if (cn->cn_ops->cn_resume != NULL)
+ cn->cn_ops->cn_resume(cn);
+ }
+}
+
/*
* Low level console routines.
*/
Index: sys/sys/cons.h
===================================================================
--- sys/sys/cons.h
+++ sys/sys/cons.h
@@ -66,6 +66,8 @@
/* grab console for exclusive kernel use */
cn_ungrab_t *cn_ungrab;
/* ungrab console */
+ cn_init_t *cn_resume;
+ /* set up console after sleep, optional */
};
struct consdev {
@@ -105,8 +107,9 @@
}; \
DATA_SET(cons_set, name)
-#define CONSOLE_DRIVER(name) \
+#define CONSOLE_DRIVER(name, ...) \
static const struct consdev_ops name##_consdev_ops = { \
+ /* Mandatory methods. */ \
.cn_probe = name##_cnprobe, \
.cn_init = name##_cninit, \
.cn_term = name##_cnterm, \
@@ -114,6 +117,8 @@
.cn_putc = name##_cnputc, \
.cn_grab = name##_cngrab, \
.cn_ungrab = name##_cnungrab, \
+ /* Optional fields. */ \
+ __VA_ARGS__ \
}; \
CONSOLE_DEVICE(name##_consdev, name##_consdev_ops, NULL)
@@ -126,6 +131,7 @@
void cnselect(struct consdev *);
void cngrab(void);
void cnungrab(void);
+void cnresume(void);
int cncheckc(void);
int cngetc(void);
void cngets(char *, size_t, int);
Index: sys/x86/acpica/acpi_wakeup.c
===================================================================
--- sys/x86/acpica/acpi_wakeup.c
+++ sys/x86/acpica/acpi_wakeup.c
@@ -46,6 +46,7 @@
#include <sys/memrange.h>
#include <sys/smp.h>
#include <sys/systm.h>
+#include <sys/cons.h>
#include <vm/vm.h>
#include <vm/pmap.h>
@@ -296,6 +297,14 @@
for (;;)
ia32_pause();
} else {
+ /*
+ * Re-initialize console hardware as soon as possibe.
+ * No console output (e.g. printf) is allowed before
+ * this point.
+ * At present, only uart console supports resuming and
+ * may actually need it.
+ */
+ cnresume();
#ifdef __amd64__
fpuresume(susppcbs[0]->sp_fpususpend);
#else

File Metadata

Mime Type
text/plain
Expires
Tue, Apr 14, 10:11 AM (16 h, 30 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31467536
Default Alt Text
D15552.id42926.diff (2 KB)

Event Timeline