git: f8c7bbd1c93f - stable/14 - dev/uart: Support 8-byte register access
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 19 Feb 2024 16:45:34 UTC
The branch stable/14 has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=f8c7bbd1c93fc46610e2757760a0b55a31371780 commit f8c7bbd1c93fc46610e2757760a0b55a31371780 Author: Andrew Turner <andrew@FreeBSD.org> AuthorDate: 2024-01-09 13:29:47 +0000 Commit: Andrew Turner <andrew@FreeBSD.org> CommitDate: 2024-02-19 13:17:56 +0000 dev/uart: Support 8-byte register access While we only support 4-byte registers in the uart code the physical access may be to an 8-byte register. Support this as an option on non-i386. On i386 we lack the needed 8-byte bus_space functions. ACPI has an option for 8-byte register io width, and FDT can be given any size. Support these sizes, even if we don't expect to see hardware with an 8-byte io width. Reviewed by: imp Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D43374 (cherry picked from commit a9fc9d6d15f006feb6d7ddb036e020d5f9d19fce) --- sys/dev/uart/uart.h | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/sys/dev/uart/uart.h b/sys/dev/uart/uart.h index 5eae06ceba6f..213f8eca457c 100644 --- a/sys/dev/uart/uart.h +++ b/sys/dev/uart/uart.h @@ -54,6 +54,11 @@ uart_getreg(struct uart_bas *bas, int reg) uint32_t ret; switch (uart_regiowidth(bas)) { +#if !defined(__i386__) + case 8: + ret = bus_space_read_8(bas->bst, bas->bsh, uart_regofs(bas, reg)); + break; +#endif case 4: ret = bus_space_read_4(bas->bst, bas->bsh, uart_regofs(bas, reg)); break; @@ -69,10 +74,15 @@ uart_getreg(struct uart_bas *bas, int reg) } static inline void -uart_setreg(struct uart_bas *bas, int reg, int value) +uart_setreg(struct uart_bas *bas, int reg, uint32_t value) { switch (uart_regiowidth(bas)) { +#if !defined(__i386__) + case 8: + bus_space_write_8(bas->bst, bas->bsh, uart_regofs(bas, reg), value); + break; +#endif case 4: bus_space_write_4(bas->bst, bas->bsh, uart_regofs(bas, reg), value); break;