git: cc7854e10903 - main - uart: export rclk via sysctl

From: Warner Losh <imp_at_FreeBSD.org>
Date: Mon, 14 Oct 2024 22:17:31 UTC
The branch main has been updated by imp:

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

commit cc7854e10903cd4726a4da6610ebf4dcf69de352
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2024-10-14 21:57:16 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2024-10-14 22:03:58 +0000

    uart: export rclk via sysctl
    
    To help debugging, export the rclk a uart is using as
    dev.uart.X.rclk. It can be opaque when it is wrong since any error
    messages printed to the system console using the wrong rclk aren't
    informative.
    
    Sponsored by:           Netflix
    Reviewed by:            andrew, markj
    Differential Revision:  https://reviews.freebsd.org/D47070
---
 sys/dev/uart/uart_core.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/sys/dev/uart/uart_core.c b/sys/dev/uart/uart_core.c
index 71f39e4c71e7..d0c4a54c8038 100644
--- a/sys/dev/uart/uart_core.c
+++ b/sys/dev/uart/uart_core.c
@@ -752,6 +752,11 @@ uart_bus_attach(device_t dev)
 		    "rx_overruns", CTLFLAG_RD, &sc->sc_rxoverruns, 0,
 		    "Receive overruns");
 
+	SYSCTL_ADD_INT(device_get_sysctl_ctx(dev),
+	    SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO,
+	    "rclk", CTLFLAG_RD, &sc->sc_bas.rclk, 0,
+	    "Baud clock for device");
+
 	return (0);
 
  fail: