fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER START
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The contents of this file are subject to the terms of the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Common Development and Distribution License (the "License").
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * You may not use this file except in compliance with the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * See the License for the specific language governing permissions
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * and limitations under the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * When distributing Covered Code, include this CDDL HEADER in each
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * If applicable, add the following below this CDDL HEADER, with the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * fields enclosed by brackets "[]" replaced with your own identifying
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * information: Portions Copyright [yyyy] [name of copyright owner]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER END
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Use is subject to license terms.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Walker for an array of sv_dev_t structures.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * A global walk is assumed to start at sv_devs.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte winfo = mdb_zalloc(sizeof (struct sv_dev_winfo), UM_SLEEP);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_readvar(&sv_max_devices, "sv_max_devices") == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte winfo->end = (uintptr_t)(sv_devs + sv_max_devices);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = wsp->walk_callback(wsp->walk_addr, wsp->walk_data,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_free(wsp->walk_data, sizeof (struct sv_dev_winfo));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Walker for an sv hash chain.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Global walks are disallowed.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_data = mdb_zalloc(sizeof (sv_dev_t), UM_SLEEP);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to read sv_dev at %p", wsp->walk_addr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = wsp->walk_callback(wsp->walk_addr, wsp->walk_data,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_addr = (uintptr_t)(((sv_dev_t *)wsp->walk_data)->sv_hash);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Walker for an array of sv_maj_t structures.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * A global walk is assumed to start at sv_majors.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_readvar(&sv_majors, "sv_majors") == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_data = mdb_zalloc(sizeof (sv_maj_t), UM_SLEEP);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (wsp->walk_addr >= (uintptr_t)&sv_majors[SV_MAJOR_HASH_CNT])
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte addr = (uintptr_t)(((sv_maj_t *)wsp->walk_data)->sm_next)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_vread(wsp->walk_data, sizeof (sv_maj_t), addr)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte != sizeof (sv_maj_t)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = wsp->walk_callback(addr, wsp->walk_data,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Walker for an sv gclient chain.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * A global walk is assumed to start at sv_gclients.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_readvar(&wsp->walk_addr, "sv_gclients") == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_data = mdb_zalloc(sizeof (sv_gclient_t), UM_SLEEP);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to read sv_gclient at %p", wsp->walk_addr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = wsp->walk_callback(wsp->walk_addr, wsp->walk_data,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_addr = (uintptr_t)(((sv_gclient_t *)wsp->walk_data)->sg_next);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Display a single sv_glcient_t structure.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * If called with no address, performs a global walk of all sv_gclients.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortesv_gclient(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * paranoid mode on: qualify walker name with module name
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * using '`' syntax.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_vread(&sg, sizeof (sg), addr) != sizeof (sg)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to read sv_gclient at %p", addr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_readstr(name, sizeof (name), (uintptr_t)sg.sg_name) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to read sv_gclient name at %p", addr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Display a single sv_maj_t structure.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * If called with no address, performs a global walk of all sv_majs.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * -a : all (i.e. display all devices, even if disabled
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * -v : verbose
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortesv_maj(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * paranoid mode on: qualify walker name with module name
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * using '`' syntax.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_walk_dcmd("sv`sv_maj", "sv`sv_maj", argc, argv) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_vread(maj, sizeof (*maj), addr) != sizeof (*maj)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * verbose - print the rest of the structure as well.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("dev_ops: %a (%p)\n", maj->sm_dev_ops, maj->sm_dev_ops);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("flag: %08x %8Tsequence: %d %8Tmajor: %d\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("%-20a%-20a%\n%-20a%-20a%\n%-20a%-20a%\n%-20a%-20a%\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < SV_MINOR_HASH_CNT; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Display a sv_dev_t hash chain.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Requires an address.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Same options as sv_dev().
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortesv_hash(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * paranoid mode on: qualify walker name with module name
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * using '`' syntax.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_pwalk_dcmd("sv`sv_hash", "sv`sv_dev", argc, argv, addr) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Display a single sv_dev_t structure.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * If called with no address, performs a global walk of all sv_devs.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * -a : all (i.e. display all devices, even if disabled
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * -v : verbose
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortesv_dev(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dev_t_chars = sizeof (dev_t) * 2; /* # chars to display dev_t */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * paranoid mode on: qualify walker name with module name
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * using '`' syntax.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_walk_dcmd("sv`sv_dev", "sv`sv_dev", argc, argv) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_vread(svp, sizeof (*svp), addr) != sizeof (*svp)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("%?p %8T%0*lx %8T", addr, dev_t_chars, svp->sv_dev);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * verbose - print the rest of the structure as well.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("hash chain: 0x%p %8Tlock: 0x%p %8Tolock: 0x%p\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("maxfbas: %d %8Tnblocks: %d %8Tstate: %d\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte svp->sv_maxfbas, svp->sv_nblocks, svp->sv_state);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("gclients: 0x%llx %8Tgkernel: 0x%llx\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Display general sv module information.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* ARGSUSED */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortesv(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_readvar(&baseline, "sv_baseline_rev") == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("SV module version: kernel %d.%d.%d.%d; mdb %d.%d.%d.%d\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ISS_VERSION_MAJ, ISS_VERSION_MIN, ISS_VERSION_MIC, ISS_VERSION_NUM);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sv_get_print(sv_config_time, "last config time", "0x%lx", clock);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sv_get_print(sv_max_devices, "max sv devices", "%d", i);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * MDB module linkage information:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { "sv_dev", "?[-av]", "list sv_dev structure", sv_dev },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { "sv_gclient", "?", "list sv_gclient structure", sv_gclient },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { "sv_hash", ":[-av]", "display sv_dev hash chain", sv_hash },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { "sv_maj", "?[-av]", "list sv_maj structure", sv_maj },