diff options
author | imp <imp@FreeBSD.org> | 2014-03-01 04:16:54 +0000 |
---|---|---|
committer | imp <imp@FreeBSD.org> | 2014-03-01 04:16:54 +0000 |
commit | 33b9ca9ab1e84f2fbd3154eb278624e7f535e144 (patch) | |
tree | f4dec5665294aedbe5d1458dcc6ef4f5938bc1af /sys/dev/uart/uart_cpu.h | |
parent | 1135c91d00efe0ccd2baec70e62034511c5310f8 (diff) | |
download | FreeBSD-src-33b9ca9ab1e84f2fbd3154eb278624e7f535e144.zip FreeBSD-src-33b9ca9ab1e84f2fbd3154eb278624e7f535e144.tar.gz |
MFC: r260889, r260890, r260911:
r260911 | imp | 2014-01-20 10:45:36 -0700 (Mon, 20 Jan 2014) | 5 lines
Don't lock in the generic grab just to lock again in the specific grabs.
r260890 | imp | 2014-01-19 12:39:13 -0700 (Sun, 19 Jan 2014) | 11 lines
Introduce grab and ungrab upcalls. When the kernel desires to grab the
console, it calls the grab functions. These functions should turn off
the RX interrupts, and any others that interfere. This makes mountroot
prompt work again. If there's more generalized need other than
prompting, many of these routines should be expanded to do those new
things.
Reviewed by: bde (with reservations)
Diffstat (limited to 'sys/dev/uart/uart_cpu.h')
-rw-r--r-- | sys/dev/uart/uart_cpu.h | 30 |
1 files changed, 6 insertions, 24 deletions
diff --git a/sys/dev/uart/uart_cpu.h b/sys/dev/uart/uart_cpu.h index 99ced1a..2db0412 100644 --- a/sys/dev/uart/uart_cpu.h +++ b/sys/dev/uart/uart_cpu.h @@ -33,6 +33,8 @@ #include <sys/lock.h> #include <sys/mutex.h> +struct uart_softc; + /* * Low-level operations for use by console and/or debug port support. */ @@ -43,8 +45,6 @@ struct uart_ops { void (*putc)(struct uart_bas *, int); int (*rxready)(struct uart_bas *); int (*getc)(struct uart_bas *, struct mtx *); - void (*grab)(struct uart_bas *); - void (*ungrab)(struct uart_bas *); }; extern bus_space_tag_t uart_bus_space_io; @@ -53,7 +53,6 @@ extern bus_space_tag_t uart_bus_space_mem; /* * Console and debug port device info. */ -struct uart_softc; struct uart_devinfo { SLIST_ENTRY(uart_devinfo) next; struct uart_ops *ops; @@ -70,6 +69,7 @@ struct uart_devinfo { int (*detach)(struct uart_softc*); void *cookie; /* Type dependent use. */ struct mtx *hwmtx; + struct uart_softc *sc; /* valid only from start of attach */ }; int uart_cpu_eqres(struct uart_bas *, struct uart_bas *); @@ -137,27 +137,6 @@ uart_putc(struct uart_devinfo *di, int c) uart_unlock(di->hwmtx); } -static __inline void -uart_grab(struct uart_devinfo *di) -{ - - uart_lock(di->hwmtx); - if (di->ops->grab) - di->ops->grab(&di->bas); - uart_unlock(di->hwmtx); -} - -static __inline void -uart_ungrab(struct uart_devinfo *di) -{ - - uart_lock(di->hwmtx); - if (di->ops->ungrab) - di->ops->ungrab(&di->bas); - uart_unlock(di->hwmtx); -} - - static __inline int uart_rxready(struct uart_devinfo *di) { @@ -190,4 +169,7 @@ uart_getc(struct uart_devinfo *di) return (di->ops->getc(&di->bas, di->hwmtx)); } +void uart_grab(struct uart_devinfo *di); +void uart_ungrab(struct uart_devinfo *di); + #endif /* _DEV_UART_CPU_H_ */ |