diff --git a/sys/dev/firmware/arm/scmi_raw.c b/sys/dev/firmware/arm/scmi_raw.c --- a/sys/dev/firmware/arm/scmi_raw.c +++ b/sys/dev/firmware/arm/scmi_raw.c @@ -45,6 +45,7 @@ #include #include #include +#include #include #include @@ -134,6 +135,7 @@ struct cdev *cdevs[RAW_DEV_MAX]; device_t dev; struct scmi_raw_buf_queue *rbqs[RB_QUEUES_MAX]; + struct sysctl_oid *sysctl_raw; }; static d_read_t scmi_raw_device_read; @@ -340,14 +342,30 @@ struct scmi_softc *sc; sc = device_get_softc(raw->dev); - for (int i = 0; i < RB_QUEUES_MAX; i++) + + raw->sysctl_raw = SYSCTL_ADD_NODE(NULL, SYSCTL_CHILDREN(sc->sysctl_root), + OID_AUTO, "raw", CTLFLAG_RD, 0, "SCMI RAW properties"); + + for (int i = 0; i < RB_QUEUES_MAX; i++) { + struct sysctl_oid *sysctl_rbq; + raw->rbqs[i] = scmi_raw_buf_queue_allocate(raw->dev, rbq_names[i], SCMI_MAX_MSG(sc), SCMI_MAX_MSG_SIZE(sc)); + + sysctl_rbq = SYSCTL_ADD_NODE(NULL, SYSCTL_CHILDREN(raw->sysctl_raw), + OID_AUTO, rbq_names[i], CTLFLAG_RD, 0, "SCMI RAW Queue properties"); + SYSCTL_ADD_INT(NULL, SYSCTL_CHILDREN(sysctl_rbq), OID_AUTO, "frees", + CTLFLAG_RD, &raw->rbqs[i]->cnt[Q_FREE], 0, "SCMI RAW per-queue free bufs"); + SYSCTL_ADD_INT(NULL, SYSCTL_CHILDREN(sysctl_rbq), OID_AUTO, "pending", + CTLFLAG_RD, &raw->rbqs[i]->cnt[Q_READ], 0, "SCMI RAW per-queue pending bufs"); + } } static void scmi_raw_buf_queues_cleanup(struct scmi_raw *raw) { + sysctl_remove_oid(raw->sysctl_raw, 0, 1); + for (int i = 0; i < RB_QUEUES_MAX; i++) scmi_raw_buf_queue_free(raw->rbqs[i]); }