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 @@ -131,6 +132,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; @@ -337,9 +339,19 @@ struct scmi_softc *sc; sc = device_get_softc(raw->dev); - for (int i = 0; i < RB_QUEUES_MAX; i++) + 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 @@ -549,6 +561,9 @@ raw->coex = SCMI_RAW_COEX; raw->dev = dev; + raw->sysctl_raw = SYSCTL_ADD_NODE(NULL, SYSCTL_CHILDREN(sc->sysctl_root), + OID_AUTO, "raw", CTLFLAG_RD, 0, "SCMI RAW properties"); + scmi_raw_buf_queues_init(raw); for (int i = RAW_DEV_MESG; i < RAW_DEV_MAX; i++) {