summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2007-04-16 21:09:03 +0000
committerjhb <jhb@FreeBSD.org>2007-04-16 21:09:03 +0000
commit84f8e133d5518313892727075c5c44d94f57aa14 (patch)
tree32406622f0821986b4feb287bae2984357da8920 /sys/kern
parent187fb99f5ac82ef69134b6e014f9aa19f3a9238d (diff)
downloadFreeBSD-src-84f8e133d5518313892727075c5c44d94f57aa14.zip
FreeBSD-src-84f8e133d5518313892727075c5c44d94f57aa14.tar.gz
- Add a 'show rman <rm>' DDB command to dump the resources in a resource
manager similar to 'devinfo -u'. - Add a 'show allrman' DDB command that effectively does 'show rman' on all resource managers in the system.
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/subr_rman.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/sys/kern/subr_rman.c b/sys/kern/subr_rman.c
index 609814e..becf47e 100644
--- a/sys/kern/subr_rman.c
+++ b/sys/kern/subr_rman.c
@@ -55,6 +55,8 @@
* permitted.
*/
+#include "opt_ddb.h"
+
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
@@ -70,6 +72,10 @@ __FBSDID("$FreeBSD$");
#include <sys/rman.h>
#include <sys/sysctl.h>
+#ifdef DDB
+#include <ddb/ddb.h>
+#endif
+
/*
* We use a linked list rather than a bitmap because we need to be able to
* represent potentially huge objects (like all of a processor's physical
@@ -911,3 +917,47 @@ sysctl_rman(SYSCTL_HANDLER_ARGS)
SYSCTL_NODE(_hw_bus, OID_AUTO, rman, CTLFLAG_RD, sysctl_rman,
"kernel resource manager");
+
+#ifdef DDB
+static void
+dump_rman(struct rman *rm)
+{
+ struct resource_i *r;
+ const char *devname;
+
+ if (db_pager_quit)
+ return;
+ db_printf("rman: %s\n", rm->rm_descr);
+ db_printf(" 0x%lx-0x%lx (full range)\n", rm->rm_start, rm->rm_end);
+ TAILQ_FOREACH(r, &rm->rm_list, r_link) {
+ if (r->r_dev != NULL) {
+ devname = device_get_nameunit(r->r_dev);
+ if (devname == NULL)
+ devname = "nomatch";
+ } else
+ devname = NULL;
+ db_printf(" 0x%lx-0x%lx ", r->r_start, r->r_end);
+ if (devname != NULL)
+ db_printf("(%s)\n", devname);
+ else
+ db_printf("----\n");
+ if (db_pager_quit)
+ return;
+ }
+}
+
+DB_SHOW_COMMAND(rman, db_show_rman)
+{
+
+ if (have_addr)
+ dump_rman((struct rman *)addr);
+}
+
+DB_SHOW_COMMAND(allrman, db_show_all_rman)
+{
+ struct rman *rm;
+
+ TAILQ_FOREACH(rm, &rman_head, rm_link)
+ dump_rman(rm);
+}
+#endif
OpenPOWER on IntegriCloud