- 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.
This commit is contained in:
John Baldwin 2007-04-16 21:09:03 +00:00
parent e86582d1e9
commit 2248f68064
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=168791

View File

@ -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