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
This commit is contained in:
Andrew Turner 2024-01-09 13:29:47 +00:00
parent b889b90adb
commit a9fc9d6d15

View file

@ -56,6 +56,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;
@ -71,10 +76,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;