git: 2ea922e9e38f - stable/13 - dev/uart: Support 8-byte register access

From: Andrew Turner <andrew_at_FreeBSD.org>
Date: Mon, 19 Feb 2024 16:45:07 UTC
The branch stable/13 has been updated by andrew:

URL: https://cgit.FreeBSD.org/src/commit/?id=2ea922e9e38f1a8e633617901492fb221305ad5a

commit 2ea922e9e38f1a8e633617901492fb221305ad5a
Author:     Andrew Turner <andrew@FreeBSD.org>
AuthorDate: 2024-01-09 13:29:47 +0000
Commit:     Andrew Turner <andrew@FreeBSD.org>
CommitDate: 2024-02-19 12:45:51 +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 8e31cd49fd52..31d58d829579 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;