diff options
Diffstat (limited to 'usr/src')
-rw-r--r-- | usr/src/cmd/mdb/common/modules/genunix/devinfo.c | 25 | ||||
-rw-r--r-- | usr/src/cmd/mdb/common/modules/genunix/devinfo.h | 10 | ||||
-rw-r--r-- | usr/src/cmd/mdb/common/modules/genunix/genunix.c | 7 |
3 files changed, 26 insertions, 16 deletions
diff --git a/usr/src/cmd/mdb/common/modules/genunix/devinfo.c b/usr/src/cmd/mdb/common/modules/genunix/devinfo.c index 296fa0c414..892d17fe57 100644 --- a/usr/src/cmd/mdb/common/modules/genunix/devinfo.c +++ b/usr/src/cmd/mdb/common/modules/genunix/devinfo.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -99,7 +99,6 @@ devinfo_help(void) " -s print summary of dev_info structures\n"); } -uintptr_t devinfo_root; /* Address of root of devinfo tree */ /* * Devinfo walker. @@ -144,8 +143,14 @@ devinfo_parents_walk_init(mdb_walk_state_t *wsp) { devinfo_parents_walk_data_t *dip; uintptr_t addr; + uintptr_t devinfo_root; /* Address of root of devinfo tree */ int i; + if (mdb_readvar(&devinfo_root, "top_devinfo") == -1) { + mdb_warn("failed to read 'top_devinfo'"); + return (NULL); + } + if (wsp->walk_addr == NULL) wsp->walk_addr = devinfo_root; addr = wsp->walk_addr; @@ -234,6 +239,12 @@ int devinfo_children_walk_init(mdb_walk_state_t *wsp) { devinfo_children_walk_data_t *dic; + uintptr_t devinfo_root; /* Address of root of devinfo tree */ + + if (mdb_readvar(&devinfo_root, "top_devinfo") == -1) { + mdb_warn("failed to read 'top_devinfo'"); + return (NULL); + } if (wsp->walk_addr == NULL) wsp->walk_addr = devinfo_root; @@ -790,7 +801,7 @@ devinfo_print_props(char *name, ddi_prop_t *p) if (prop.prop_len > 0) { prop_value = mdb_alloc(prop.prop_len, UM_SLEEP|UM_GC); if (mdb_vread(prop_value, prop.prop_len, - (uintptr_t)prop.prop_val) == -1) { + (uintptr_t)prop.prop_val) == -1) { mdb_warn("could not read property value at " "0x%p", prop.prop_val); goto next; @@ -972,7 +983,7 @@ devinfo_print(uintptr_t addr, struct dev_info *dev, devinfo_cb_data_t *data) if (dev->devi_global_prop_list != NULL) { ddi_prop_list_t plist; if (mdb_vread((void*)&plist, sizeof (plist), - (uintptr_t)dev->devi_global_prop_list) == -1) { + (uintptr_t)dev->devi_global_prop_list) == -1) { mdb_warn("failed to read global prop_list at %p", (uintptr_t)dev->devi_global_prop_list); return (WALK_ERR); @@ -1019,6 +1030,7 @@ int prtconf(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) { devinfo_cb_data_t data; + uintptr_t devinfo_root; /* Address of root of devinfo tree */ int status; data.di_flags = DEVINFO_PARENT | DEVINFO_CHILD; @@ -1029,6 +1041,11 @@ prtconf(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) 'c', MDB_OPT_CLRBITS, DEVINFO_PARENT, &data.di_flags, NULL) != argc) return (DCMD_USAGE); + if (mdb_readvar(&devinfo_root, "top_devinfo") == -1) { + mdb_warn("failed to read 'top_devinfo'"); + return (NULL); + } + if ((flags & DCMD_ADDRSPEC) == 0) { addr = devinfo_root; if (data.di_flags & DEVINFO_VERBOSE) diff --git a/usr/src/cmd/mdb/common/modules/genunix/devinfo.h b/usr/src/cmd/mdb/common/modules/genunix/devinfo.h index 271d28a962..d17638b185 100644 --- a/usr/src/cmd/mdb/common/modules/genunix/devinfo.h +++ b/usr/src/cmd/mdb/common/modules/genunix/devinfo.h @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -106,8 +106,6 @@ extern int minornodes(uintptr_t, uint_t, int, const mdb_arg_t *); extern void prtconf_help(void); extern void devinfo_help(void); -extern uintptr_t devinfo_root; /* Address of root of devinfo tree */ - #ifdef __cplusplus } #endif diff --git a/usr/src/cmd/mdb/common/modules/genunix/genunix.c b/usr/src/cmd/mdb/common/modules/genunix/genunix.c index 565da6f4a8..36d61da041 100644 --- a/usr/src/cmd/mdb/common/modules/genunix/genunix.c +++ b/usr/src/cmd/mdb/common/modules/genunix/genunix.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -3906,11 +3906,6 @@ static const mdb_modinfo_t modinfo = { MDB_API_VERSION, dcmds, walkers }; const mdb_modinfo_t * _mdb_init(void) { - if (mdb_readvar(&devinfo_root, "top_devinfo") == -1) { - mdb_warn("failed to read 'top_devinfo'"); - return (NULL); - } - if (findstack_init() != DCMD_OK) return (NULL); |