git: b803000263ba - main - uart: Add a flags field to struct uart_bas
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 20 Nov 2026 01:13:40 UTC
The branch main has been updated by hayzam:
URL: https://cgit.FreeBSD.org/src/commit/?id=b803000263ba77b341b0950d0350c4a6bc481822
commit b803000263ba77b341b0950d0350c4a6bc481822
Author: Hayzam Sherif <hayzam@FreeBSD.org>
AuthorDate: 2026-11-16 12:41:25 +0000
Commit: Hayzam Sherif <hayzam@FreeBSD.org>
CommitDate: 2026-11-20 01:10:53 +0000
uart: Add a flags field to struct uart_bas
uart_bus_probe() sets UART_BAS_IN_PROBE in it while the hardware driver
probes. The softc is then still a plain struct uart_softc, so code that
the probe method shares with attached devices can check the flag before
using the class specific fields.
No functional change.
Reviewed by: mmel
Approved by: markj (mentor)
Sponsored by: Alchemilla Ventures Private Limited
Differential Revision: https://reviews.freebsd.org/D61620
---
sys/dev/uart/uart.h | 3 +++
sys/dev/uart/uart_core.c | 3 +++
2 files changed, 6 insertions(+)
diff --git a/sys/dev/uart/uart.h b/sys/dev/uart/uart.h
index b9401996e655..31deb53d451c 100644
--- a/sys/dev/uart/uart.h
+++ b/sys/dev/uart/uart.h
@@ -47,8 +47,11 @@ struct uart_bas {
u_int regiowidth;
u_int busy_detect;
u_int rclk_guess;/* if rclk == 0, use baud + divisor to compute rclk */
+ u_int flags;
};
+#define UART_BAS_IN_PROBE 0x0001 /* softc is still a plain uart_softc */
+
#define uart_regofs(bas, reg) ((reg) << (bas)->regshft)
#define uart_regiowidth(bas) ((bas)->regiowidth)
diff --git a/sys/dev/uart/uart_core.c b/sys/dev/uart/uart_core.c
index 0ee43f6d2d94..2337ade0b79d 100644
--- a/sys/dev/uart/uart_core.c
+++ b/sys/dev/uart/uart_core.c
@@ -569,7 +569,10 @@ uart_bus_probe(device_t dev, int regshft, int regiowidth, int rclk, int rid, int
}
}
+ /* The class specific fields of the softc can't be used yet. */
+ sc->sc_bas.flags |= UART_BAS_IN_PROBE;
error = UART_PROBE(sc);
+ sc->sc_bas.flags &= ~UART_BAS_IN_PROBE;
bus_release_resource(dev, sc->sc_rtype, sc->sc_rrid, sc->sc_rres);
return ((error) ? error : 0);
}