fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER START
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
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 *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * or http://www.opensolaris.org/os/licensing.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * See the License for the specific language governing permissions
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * and limitations under the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
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 *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER END
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Use is subject to license terms.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/mdb_modapi.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/nsc_thread.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* needed to maintain identical _sd_bitmap_t sizes */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define _SD_8K_BLKSIZE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/nsctl/sd_bcache.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <ns/sdbc/sd_io.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <ns/sdbc/sd_ft.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <ns/sdbc/safestore.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * initialize cd filter options to this
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * to differentiate with kernel values in range [-1, sdbc_max_devs]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define MDB_CD ((uintptr_t)~1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define OPT_C_SELECTED (opt_c != MDB_CD)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* initialize block filters to this */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define MDB_BLKNUM ((uintptr_t)~1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define OPT_B_SELECTED (opt_b != MDB_BLKNUM)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteenum vartype { UINTTYPE = 0, ADDRTYPE, LOCKTYPE, CVTYPE };
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void display_var(char *, enum vartype);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef SAFESTORE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void print_wrq(_sd_writeq_t *, uint_t);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestruct walk_info {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uintptr_t w_start;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uintptr_t w_end;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte};
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortemdb_bitmask_t host_states[] = {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { "HOST_NONE", 0xff, _SD_HOST_NONE },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { "HOST_CONFIGURED", 0xff, _SD_HOST_CONFIGURED },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { "HOST_DECONFIGURED", 0xff, _SD_HOST_DECONFIGURED },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { "HOST_NOCACHE", 0xff, _SD_HOST_NOCACHE },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { NULL, 0, 0 }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte};
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortemdb_bitmask_t cache_hints[] = {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { "WRTHRU", NSC_WRTHRU, NSC_WRTHRU },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { "FORCED_WRTHRU", NSC_FORCED_WRTHRU, NSC_FORCED_WRTHRU },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { "NOCACHE", NSC_NOCACHE, NSC_NOCACHE },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { "QUEUE", NSC_QUEUE, NSC_QUEUE },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { "RDAHEAD", NSC_RDAHEAD, NSC_RDAHEAD },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { "NO_FORCED_WRTHRU", NSC_NO_FORCED_WRTHRU, NSC_NO_FORCED_WRTHRU },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { "METADATA", NSC_METADATA, NSC_METADATA },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { "SEQ_IO", NSC_SEQ_IO, NSC_SEQ_IO },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { NULL, 0, 0 }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte};
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * some cache general dcmds that do not use walkers
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*ARGSUSED*/
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortesdbc_config(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _sd_cache_param_t _sd_cache_config;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _sd_net_t _sd_net_config;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _sd_ft_info_t _sd_ft_data;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint_t _sd_node_hint;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char sdbc_version[17];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_readvar(sdbc_version, "sdbc_version") == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to read sdbc_version symbol");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sdbc_version[16] = '\0'; /* make sure string is terminated */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("sdbc_version %s\n", sdbc_version);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_readvar(&_sd_cache_config, "_sd_cache_config") == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to read _sd_cache_config symbol");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("SDBC Configuration:\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_inc_indent(4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("user magic: %X kernel magic: %X (should match)\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _SD_MAGIC, _sd_cache_config.magic);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "mirror host: %2d Block size: %4d threads %4d "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "write cache: %4dM\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _sd_cache_config.mirror_host,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _sd_cache_config.blk_size,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _sd_cache_config.threads,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _sd_cache_config.write_cache);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("num_handles %4-d cache_mem %4dM prot_lru %d\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _sd_cache_config.num_handles,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _sd_cache_config.cache_mem[0],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _sd_cache_config.prot_lru);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("gen_pattern %d fill_pattern %?-p num_nodes %d\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _sd_cache_config.gen_pattern,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _sd_cache_config.fill_pattern,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _sd_cache_config.num_nodes);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_dec_indent(4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_readvar(&_sd_net_config, "_sd_net_config") == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to read _sd_net_config symbol");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_inc_indent(4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "psize %4-d configured %d csize %10-d wsize %10-d cpages %6d\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _sd_net_config.sn_psize,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _sd_net_config.sn_configured,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _sd_net_config.sn_csize,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _sd_net_config.sn_wsize,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _sd_net_config.sn_cpages);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_dec_indent(4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef SAFESTORE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte print_wrq(&(_sd_net_config.sn_wr_queue), FALSE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_readvar(&_sd_ft_data, "_sd_ft_data") == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to read _sd_ft_data symbol");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("FT data:\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_inc_indent(4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("crashed %d host_state <%b> numio %d\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _sd_ft_data.fi_crashed,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _sd_ft_data.fi_host_state, host_states,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _sd_ft_data.fi_numio);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("lock %?-p (owner) rem_sv %h-x sleep %?-p (owner)\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _sd_ft_data.fi_lock._opaque[0],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _sd_ft_data.fi_rem_sv._opaque,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _sd_ft_data.fi_sleep._opaque[0]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_dec_indent(4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_readvar(&_sd_node_hint, "_sd_node_hint") == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to read _sd_node_hint symbol");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("Node Hints: %08x <%b>\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _sd_node_hint, cache_hints);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte display_var("sdbc_wrthru_len", UINTTYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte display_var("_sd_debug_level", UINTTYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte display_var("_sdbc_attached", UINTTYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_OK);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortesdbc_hit_percent(uint_t hits, uint_t misses, char *type)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint64_t dhits, dmisses;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint64_t hit_rate = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("%s hits: %u\t %s misses: %u\n", type, hits, type, misses);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* a little crude. anything less than 1 percent will show as 0 */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (hits > 0 || misses > 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dhits = (uint64_t)hits;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dmisses = (uint64_t)misses;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte hit_rate = (dhits * 100)/ (dhits + dmisses);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("%s hit rate: %lld %%\n", type, hit_rate);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*ARGSUSED*/
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortesdbc_stats(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char *fn;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _sd_stats_t *_sd_cache_stats; /* local memory */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uintptr_t _sd_cache_statsp; /* kernel pointer */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _sd_shared_t *sh;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int statssize;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GElf_Sym sym;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int maxdevs;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (argc != 0)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_USAGE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* get the number of volumes */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_readvar(&maxdevs, "sdbc_max_devs") == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to read sdbc_max_devs");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte statssize = sizeof (_sd_stats_t) + (maxdevs - 1) *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (_sd_shared_t);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _sd_cache_stats = mdb_zalloc(statssize, UM_SLEEP);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_lookup_by_obj("sdbc", "_sd_cache_stats", &sym) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to lookup _sd_cache_stats symbol");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_vread(&_sd_cache_statsp, sizeof (uintptr_t),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sym.st_value) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to read _sd_stats_t pointer");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_vread(_sd_cache_stats, statssize, _sd_cache_statsp) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to read _sd_stats_t structure");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("Storage Device Block Cache Statistics\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("-------------------------------------\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte i = _sd_cache_stats->st_blksize;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("Blocksize: 0x%x (%d)\n", i, i);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sdbc_hit_percent(_sd_cache_stats->st_rdhits, _sd_cache_stats->st_rdmiss,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Read");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sdbc_hit_percent(_sd_cache_stats->st_wrhits, _sd_cache_stats->st_wrmiss,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Write");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("%3s %10s %8s %8s %8s %8s %8s %7s %4s %4s %s\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Cd", "Dev", "Size",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "CacheRd", "CacheWr", "DiskRd", "DiskWr",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "DirtyBl", "#IO", "Fail", "F");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < maxdevs; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sh = &_sd_cache_stats->st_shared[i];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!sh->sh_alloc)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fn = strrchr(sh->sh_filename, '/');
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fn = fn ? fn+1 : sh->sh_filename;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("%3d %10s %7d %8d %8d %8d %8d %7d %4d %4d %d\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sh->sh_cd, fn, sh->sh_filesize,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sh->sh_cache_read, sh->sh_cache_write,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sh->sh_disk_read, sh->sh_disk_write,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sh->sh_numdirty, sh->sh_numio, sh->sh_numfail,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sh->sh_failed);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_free(_sd_cache_stats, statssize);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_OK);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * display some variables and counters
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortedisplay_var(char *name, enum vartype type)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint_t uintval;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uintptr_t addrval;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kmutex_t lockval;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kcondvar_t cvval;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte switch (type) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case UINTTYPE:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_readvar(&uintval, name) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to read %s variable", name);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("%s =\t%8x %12u\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte name, uintval, uintval);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case ADDRTYPE:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_readvar(&addrval, name) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to read %s variable", name);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("%s =\t%?-p\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte name, addrval);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case LOCKTYPE:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_readvar(&lockval, name) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to read %s lock variable",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte name);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("%s =\t%-p (owner)\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte name, lockval._opaque[0]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case CVTYPE:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_readvar(&cvval, name) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to read %s condvar variable",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte name);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("%s = \t%h-x\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte name, cvval._opaque);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte default:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("display_var: unknown type");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortemdb_bitmask_t dealloc_flag_vals[] = {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { "PROCESS_CACHE_DM", (u_longlong_t)~0, PROCESS_CACHE_DM },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { "CACHE_SHUTDOWN_DM", (u_longlong_t)~0, CACHE_SHUTDOWN_DM },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { "CACHE_THREAD_TERMINATED_DM",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (u_longlong_t)~0, CACHE_THREAD_TERMINATED_DM },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { "TIME_DELAY_LVL0", (u_longlong_t)~0, TIME_DELAY_LVL0 },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { "TIME_DELAY_LVL1", (u_longlong_t)~0, TIME_DELAY_LVL1 },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { "TIME_DELAY_LVL2", (u_longlong_t)~0, TIME_DELAY_LVL2 },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { NULL, 0, 0 }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte};
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortemdb_bitmask_t mdp_bits[] = {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { "MONITOR_DYNMEM_PROCESS_DEFAULT",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (u_longlong_t)~0, MONITOR_DYNMEM_PROCESS_DEFAULT},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { "RPT_SHUTDOWN_PROCESS_DM",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte RPT_SHUTDOWN_PROCESS_DM, RPT_SHUTDOWN_PROCESS_DM },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { "RPT_DEALLOC_STATS1_DM",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte RPT_DEALLOC_STATS1_DM, RPT_DEALLOC_STATS1_DM },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { "RPT_DEALLOC_STATS2_DM",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte RPT_DEALLOC_STATS2_DM, RPT_DEALLOC_STATS2_DM },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { NULL, 0, 0 }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte};
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortemdb_bitmask_t process_directive_bits[] = {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { "PROCESS_DIRECTIVE_DEFAULT",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (u_longlong_t)~0, PROCESS_DIRECTIVE_DEFAULT },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { "WAKE_DEALLOC_THREAD_DM",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte WAKE_DEALLOC_THREAD_DM, WAKE_DEALLOC_THREAD_DM },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { "MAX_OUT_ACCEL_HIST_FLAG_DM",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MAX_OUT_ACCEL_HIST_FLAG_DM, MAX_OUT_ACCEL_HIST_FLAG_DM},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { NULL, 0, 0 }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte};
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*ARGSUSED*/
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortesdbc_vars(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int sd_dealloc_flag_dm;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _dm_process_vars_t dynmem_processing_dm;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (argc != 0)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_USAGE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("counters and other variables:\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_inc_indent(4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte display_var("xmem_inval_hit", UINTTYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte display_var("xmem_inval_miss", UINTTYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte display_var("xmem_inval_inuse", UINTTYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte display_var("sdbc_allocb_pageio1", UINTTYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte display_var("sdbc_allocb_pageio2", UINTTYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte display_var("sdbc_allocb_inuse", UINTTYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte display_var("sdbc_allocb_hit", UINTTYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte display_var("sdbc_allocb_lost", UINTTYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte display_var("sdbc_pageio_always", UINTTYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte display_var("sdbc_do_page", UINTTYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte display_var("sdbc_flush_pageio", UINTTYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte display_var("sdbc_centry_hit", UINTTYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte display_var("sdbc_centry_inuse", UINTTYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte display_var("sdbc_centry_lost", UINTTYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte display_var("sdbc_centry_deallocd", UINTTYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte display_var("_sd_prefetch_opt", UINTTYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte display_var("sdbc_ra_hash", UINTTYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte display_var("sdbc_ra_none", UINTTYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte display_var("sdbc_static_cache", UINTTYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte display_var("sdbc_use_dmchain", UINTTYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* in no particular order ... */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte display_var("sdbc_check_cot", UINTTYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte display_var("_sd_cctl_groupsz", UINTTYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte display_var("CBLOCKS", UINTTYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte display_var("_SD_SELF_HOST", UINTTYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte display_var("_SD_MIRROR_HOST", UINTTYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte display_var("sdbc_bio_count", UINTTYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte display_var("_sd_cblock_shift", UINTTYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte display_var("_sd_nodes_configured", UINTTYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte display_var("nv_alloc_factor", UINTTYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte display_var("_sd_ft_exit", UINTTYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte display_var("_sd_flush_exit", UINTTYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte display_var("_sd_node_recovery", UINTTYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte display_var("_sd_async_recovery", UINTTYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte display_var("_sdbc_ft_hold_io", UINTTYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte display_var("mirror_clean_shutdown", UINTTYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte display_var("_sd_ft_warm_start", UINTTYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_dec_indent(4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* some addresses of various lists and tables */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("Addresses:\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_inc_indent(4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte display_var("_sd_htable", ADDRTYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte display_var("_sdbc_gl_centry_info", ADDRTYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte display_var("_sdbc_gl_centry_info_nvmem", ADDRTYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte display_var("_sdbc_gl_centry_info_size", ADDRTYPE); /* size_t */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte display_var("_sdbc_gl_file_info", ADDRTYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte display_var("_sdbc_gl_file_info_size", ADDRTYPE); /* size_t */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_dec_indent(4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* dynamic memory variables */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("Dynamic Memory variables and stats:\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_inc_indent(4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte display_var("_sdbc_memtype_deconfigure_delayed", UINTTYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_readvar(&sd_dealloc_flag_dm, "sd_dealloc_flag_dm") == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to read sd_dealloc_flag_dm symbol");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("sd_dealloc_flag_dm %08x <%b>\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sd_dealloc_flag_dm,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sd_dealloc_flag_dm, dealloc_flag_vals);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_readvar(&dynmem_processing_dm, "dynmem_processing_dm") == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to read dynmem_processing_dm structure");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _dm_process_vars_t *dp;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dp = &dynmem_processing_dm;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "thread_dm_cv %h-x thread_dm_lock %?-p (owner)\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dp->thread_dm_cv._opaque,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dp->thread_dm_lock._opaque[0]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("sd_dealloc_flagx %x %8Tmax_dyn_list %3-d\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dp->sd_dealloc_flagx,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dp->max_dyn_list);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("monitor_dynmem_process <%b>\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dp->monitor_dynmem_process, mdp_bits);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "cache_aging_ct1 %3-d %8Tcache_aging_ct2 %3-d cache_aging_ct3 %3-d\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dp->cache_aging_ct1,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dp->cache_aging_ct2,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dp->cache_aging_ct3);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "cache_aging_sec1 %3-d %8Tcache_aging_sec2 %3-d"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " cache_aging_sec3 %3-d\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dp->cache_aging_sec1,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dp->cache_aging_sec2,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dp->cache_aging_sec3);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("cache_aging_pcnt1 %3-d %8Tcache_aging_pcnt2 %3-d\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dp->cache_aging_pcnt1,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dp->cache_aging_pcnt2);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "max_holds_pcnt %3-d %8Talloc_ct %8-d dealloc_ct %8-d\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dp->max_holds_pcnt,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dp->alloc_ct,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dp->dealloc_ct);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "history %4x %8Tnodatas %8-d notavail %8-d candidates %8-d\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dp->history,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dp->nodatas,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dp->notavail,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dp->candidates);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "deallocs %8-d %8Thosts %8-d pests %8-d metas %8-d\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dp->deallocs,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dp->hosts,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dp->pests,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dp->metas);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("holds %8-d %8Tothers %8-d\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dp->holds,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dp->others);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("process_directive <%b>\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dp->process_directive, process_directive_bits);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("read_hits %8-d %8Tread_misses %8-d\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dp->read_hits,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dp->read_misses);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "write_thru %8-d %8Twrite_hits %8-d write_misses %8-d\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dp->write_hits,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dp->write_misses,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dp->write_thru);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("prefetch_hits %8-d prefetch_misses %8-d\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dp->prefetch_hits,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dp->prefetch_misses);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_dec_indent(4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* some locks and condition variables */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("Locks:\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_inc_indent(4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte display_var("mutex_and_condvar_flag", UINTTYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte display_var("_sd_cache_lock", LOCKTYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte display_var("_sd_block_lk", LOCKTYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte display_var("_sdbc_config_lock", LOCKTYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte display_var("_sdbc_ft_hold_io_lk", LOCKTYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte display_var("_sd_flush_cv", CVTYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte display_var("_sdbc_ft_hold_io_cv", CVTYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_dec_indent(4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_OK);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteconst mdb_bitmask_t nsc_buf_bits[] = {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"HALLOCATED", NSC_HALLOCATED, NSC_HALLOCATED},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"HACTIVE", NSC_HACTIVE, NSC_HACTIVE},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"RDBUF", NSC_RDBUF, NSC_RDBUF},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"WRBUF", NSC_WRBUF, NSC_WRBUF},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"NOBLOCK", NSC_NOBLOCK, NSC_NOBLOCK},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"WRTHRU", NSC_WRTHRU, NSC_WRTHRU},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"NOCACHE", NSC_NOCACHE, NSC_NOCACHE},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"BCOPY", NSC_BCOPY, NSC_BCOPY},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"PAGEIO", NSC_PAGEIO, NSC_PAGEIO},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"PINNABLE", NSC_PINNABLE, NSC_PINNABLE},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"FORCED_WRTHRU", NSC_FORCED_WRTHRU, NSC_FORCED_WRTHRU},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"METADATA", NSC_METADATA, NSC_METADATA},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"MIXED", NSC_MIXED, NSC_MIXED},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {NULL, 0, 0}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte};
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * HELP functions for cache ctl type dcmds
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortecctl_help_common(char *name)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_inc_indent(4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("-c cd displays cctls for cache descriptor 'cd'\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_dec_indent(4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("inclusive filters:\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_inc_indent(4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("-b blk displays cctls for cache block number 'blk'\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("-d displays cctls with dirty bits\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("-h displays cctls that are hashed\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("-i displays cctls that are inuse\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("-o displays cctls that have I/O in progress\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("-p displays cctls that have pagio set\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("-B displays cctls that are marked BAD\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("-H displays cctls that are HOSTS\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("-P displays cctls that are PARASITES\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("-R displays cctls that are explicit (NSC_RDAHEAD) "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Prefetch bufs\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("-r displays cctls that are implicit Prefetch bufs\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("-V displays cctls that have valid bits set\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("-v verbose\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_dec_indent(4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("Default: %s displays all cctls in the list\n", name);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("Example:\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_inc_indent(4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("%s -io -c 5 displays all cctls for cd 5 that are\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "in use or have I/O in progress\n", name);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_dec_indent(4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define CCTL_OPTIONSTRING "[-vdhiopBHPV][-c cd][-b blknum]"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortecctl_help()
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("sdbc_cctl displays cache ctl structures\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("Usage: [address]::sdbc_cctl " CCTL_OPTIONSTRING "\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cctl_help_common("sdbc_cctl");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortecchain_help()
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("sdbc_cchain displays cache ctl structures in a"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " (alloc) cc_chain\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("Usage: address::sdbc_cchain " CCTL_OPTIONSTRING "\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cctl_help_common("sdbc_cchain");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortedchain_help()
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("sdbc_dchain displays cache ctl structures in a"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " dirty chain\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("Usage: address::sdbc_dchain " CCTL_OPTIONSTRING "\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cctl_help_common("sdbc_dchain");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortedmchain_help()
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("sdbc_dmchain displays cache ctl structures in a"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " dynamic memory allocation chain\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("order of display is:\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "the cctl represented by the given address,\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "the cc_head_dm cctl,\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "the chain starting at cc_next_dm of the head cctl\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("Usage: address::sdbc_dmchain " CCTL_OPTIONSTRING "\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cctl_help_common("sdbc_dmchain");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortehashchain_help()
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("sdbc_hashchain displays cache ctl structures in a"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " hash chain\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("Usage: address::sdbc_hashchain " CCTL_OPTIONSTRING "\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cctl_help_common("sdbc_hashchain");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortehashtable_help()
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("sdbc_hashtable displays the hash table and its chains\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("Usage: address::sdbc_hashtable " CCTL_OPTIONSTRING "\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cctl_help_common("sdbc_hashtable");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortelru_help()
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("sdbc_lru displays cache ctl structures in the LRU queue\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("Usage: [address]::sdbc_lru " CCTL_OPTIONSTRING "\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cctl_help_common("sdbc_lru");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * help functions for write ctl dcmds
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortewctl_help_common(char *name)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_inc_indent(4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("-v verbose\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("-c cd show ctl structs for cache descriptor 'cd'\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("-d show ctl structs that have dirty bits set\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_dec_indent(4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("Default: %s displays all write ctl in the list\n", name);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortewctl_help()
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "sdbc_wctl displays the allocated array of write ctl structures\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("Usage: [address]::sdbc_wctl [-vd][-c cd]\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wctl_help_common("sdbc_wctl");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortewrq_help()
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("sdbc_wrq displays the write ctl queue (wctl free list)\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("Usage: [address]::sdbc_wrq [-vd][-c cd]\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wctl_help_common("sdbc_wrq");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* help function for the sdbc_cdinfo dcmd */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortecdinfo_help()
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "sdbc_cdinfo displays cd information from the _sd_cache_files table\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("Usage: [address]::sdbc_cdfinfo [-av][-c cd]\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_inc_indent(4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("-a displays info for all cd_info structures\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("-c cd displays info for cache descriptor 'cd'\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("-v verbose\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_dec_indent(4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("Default: display info for cd's that are allocated\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteftctl_help()
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "sdbc_ftctl displays the array of fault tolerant structures \n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("Usage: [address]::sdbc_ftctl [-vd][-c cd]\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wctl_help_common("sdbc_ftctl");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * help function for the sdbc_handles dcmd
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortehandle_help()
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("sdbc_handles displays active or allocated"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " cache buffer handles\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("Usage: [address]::sdbc_handles [-avC][-c cd]\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_inc_indent(4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("-a displays all handles\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("-c n displays handle for cd n\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("-v displays detailed handle data\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("-C displays the handle cc_chain\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_dec_indent(4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("Default: display only allocated or active handles\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * help functions for the "global" memory dcmds
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteglcinfo_help()
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("sdbc_glcinfo displays the global cache entry info\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("Usage: [address]::sdbc_glcinfo [-adC][-c cd][-b fbapos]\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_inc_indent(4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("-a displays all global info structs\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("-b fbapos displays structs that match FBA block"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "(not cache block) 'fbapos'\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("-c cd displays structs that match cache descriptor 'cd'\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("-d displays structs with dirty bits set\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("-C does consistency check against nvram copy\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_dec_indent(4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("Default: display entries with a valid cd\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteglfinfo_help()
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("sdbc_glfinfo displays the global file info\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("Usage: [address]::sdbc_glfinfo [-aptC]\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_inc_indent(4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("-a displays all global info structs\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("-p displays structs for pinned volumes\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("-t displays structs for attached volumes\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("-C does consistency check against nvram copy\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_dec_indent(4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("Default: display entries with non-null filename\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * WALKERS
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * walker for the cctl list using the cc_link_list_dm pointers
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortesdbc_cctl_winit(mdb_walk_state_t *wsp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _sd_cctl_t *_sd_cctl[_SD_CCTL_GROUPS]; /* for getting first entry */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte struct walk_info *winfo;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte winfo = mdb_zalloc(sizeof (struct walk_info), UM_SLEEP);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (wsp->walk_addr == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * we get the "first" cctl from memory and then traverse
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * the cc_link_list_dm pointers.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * this traversal could start from any cctl. here we start with
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * the first cctl in the _sd_cctl[] array.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_readvar(_sd_cctl, "_sd_cctl") == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to read _sd_cctl array");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_addr = (uintptr_t)_sd_cctl[0];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte winfo->w_start = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte winfo->w_end = wsp->walk_addr;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_data = winfo;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_NEXT);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortesdbc_cctl_wstep(mdb_walk_state_t *wsp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte struct walk_info *winfo = wsp->walk_data;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _sd_cctl_t centry;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (wsp->walk_addr == NULL) /* should not happen */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_DONE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * w_start is 0 on the first iteration so the test
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * will fail, allowing the first centry to be processed
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (wsp->walk_addr == winfo->w_start)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_DONE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = wsp->walk_callback(wsp->walk_addr, wsp->walk_data,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_cbdata);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_vread(&centry, sizeof (_sd_cctl_t), wsp->walk_addr) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to read centry at %p", wsp->walk_addr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_addr = (uintptr_t)(centry.cc_link_list_dm);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* set termination condition. only needs to be done once */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte winfo->w_start = winfo->w_end;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortesdbc_cctl_wfini(mdb_walk_state_t *wsp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_free(wsp->walk_data, sizeof (struct walk_info));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * walk the cc_chain list of a _sd_cctl_t
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * no global walks -- must be called with an address
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortesdbc_cchain_winit(mdb_walk_state_t *wsp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (wsp->walk_addr == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_data = mdb_zalloc(sizeof (_sd_cctl_t), UM_SLEEP);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_NEXT);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortesdbc_cchain_wstep(mdb_walk_state_t *wsp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (wsp->walk_addr == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_DONE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_vread(wsp->walk_data, sizeof (_sd_cctl_t), wsp->walk_addr)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("sdbc_cchain_wstep failed to read centry at %p",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_addr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = wsp->walk_callback(wsp->walk_addr, wsp->walk_data,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_cbdata);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_addr = (uintptr_t)(((_sd_cctl_t *)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (wsp->walk_data))->cc_chain);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortesdbc_cchain_wfini(mdb_walk_state_t *wsp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_free(wsp->walk_data, sizeof (_sd_cctl_t));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * walk the dirty chain list of a _sd_cctl_t
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * no global walks -- must be called with an address
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortesdbc_dchain_winit(mdb_walk_state_t *wsp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (wsp->walk_addr == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_data = mdb_zalloc(sizeof (_sd_cctl_t), UM_SLEEP);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* walk data stores the first and subsequent cc_dirty_link */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_vread(wsp->walk_data, sizeof (_sd_cctl_t), wsp->walk_addr)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("sdbc_dchain_winit failed to read centry at %p",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_addr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_NEXT);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortesdbc_dchain_wstep(mdb_walk_state_t *wsp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _sd_cctl_t centry;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (wsp->walk_addr == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_DONE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = wsp->walk_callback(wsp->walk_addr, wsp->walk_data,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_cbdata);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_vread(&centry, sizeof (_sd_cctl_t), wsp->walk_addr)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("sdbc_dchain_wstep failed to read centry at %p",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_addr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_addr =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (uintptr_t)(centry.cc_dirty_next);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* end of dirty_next chain? start on subsequent dirty_link */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (wsp->walk_addr == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_addr =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (uintptr_t)(((_sd_cctl_t *)(wsp->walk_data))->cc_dirty_link);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* update dirty link */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* walk data stores the first and subsequent cc_dirty_link */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (wsp->walk_addr) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_vread(wsp->walk_data, sizeof (_sd_cctl_t),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_addr) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "sdbc_dchain_wstep failed to read centry at %p",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_addr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortesdbc_dchain_wfini(mdb_walk_state_t *wsp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_free(wsp->walk_data, sizeof (_sd_cctl_t));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* for stepping thru the dynmem chain */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define GET_HEAD_DM 0x1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define GET_NEXT_DM 0x2
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * walk the dm chain of a cctl
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * start with current address, then cc_head_dm, then the cc_next_dm chain
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortesdbc_dmchain_winit(mdb_walk_state_t *wsp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (wsp->walk_addr == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_data = (void *)GET_HEAD_DM;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_NEXT);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortesdbc_dmchain_wstep(mdb_walk_state_t *wsp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _sd_cctl_t centry;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (wsp->walk_addr == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_DONE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_vread(&centry, sizeof (_sd_cctl_t), wsp->walk_addr)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("sdbc_dmchain_wstep failed to read centry at %p",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_addr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = wsp->walk_callback(wsp->walk_addr, wsp->walk_data,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_cbdata);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (wsp->walk_data == (void *)GET_HEAD_DM) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_addr = (uintptr_t)centry.cc_head_dm;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_data = (void *)GET_NEXT_DM;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_addr = (uintptr_t)centry.cc_next_dm;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*ARGSUSED*/
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortesdbc_dmchain_wfini(mdb_walk_state_t *wsp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * walk a hash chain
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * requires an address
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*ARGSUSED*/
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortesdbc_hashchain_winit(mdb_walk_state_t *wsp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (wsp->walk_addr == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_NEXT);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortesdbc_hashchain_wstep(mdb_walk_state_t *wsp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _sd_hash_hd_t hash_entry;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (wsp->walk_addr == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_DONE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = wsp->walk_callback(wsp->walk_addr, wsp->walk_data,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_cbdata);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_vread(&hash_entry, sizeof (_sd_hash_hd_t),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_addr) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "sdbc_hashchain_wstep failed to read hash_entry at %p",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_addr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_ERR); /* will upper layer continue ? */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_addr = (uintptr_t)hash_entry.hh_next;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*ARGSUSED*/
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortesdbc_hashchain_wfini(mdb_walk_state_t *wsp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * walk the sdbc lru list
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortesdbc_lru_winit(mdb_walk_state_t *wsp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte struct walk_info *winfo;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GElf_Sym sym;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte winfo = mdb_zalloc(sizeof (struct walk_info), UM_SLEEP);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* if called without an address, start at the head of the queue */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (wsp->walk_addr == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_lookup_by_obj("sdbc", "_sd_lru_q", &sym) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to lookup _sd_lru_q symbol");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* &(_sd_lru_q.sq_qhead) */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_addr = (uintptr_t)(sym.st_value);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte winfo->w_start = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte winfo->w_end = wsp->walk_addr;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_data = winfo;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_NEXT);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortesdbc_lru_wstep(mdb_walk_state_t *wsp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte struct walk_info *winfo = wsp->walk_data;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _sd_cctl_t centry;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (wsp->walk_addr == NULL) /* should not happen */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_DONE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * w_start is 0 on the first iteration so the test
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * will fail, allowing the first centry to be processed
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (wsp->walk_addr == winfo->w_start)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_DONE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = wsp->walk_callback(wsp->walk_addr, wsp->walk_data,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_cbdata);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_vread(&centry, sizeof (_sd_cctl_t), wsp->walk_addr) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to read centry at %p", wsp->walk_addr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_addr = (uintptr_t)(centry.cc_next);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* set termination condition. only needs to be done once */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte winfo->w_start = winfo->w_end;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortesdbc_lru_wfini(mdb_walk_state_t *wsp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_free(wsp->walk_data, sizeof (struct walk_info));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef SAFESTORE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * walk the array of allocated write control structures
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortesdbc_wctl_winit(mdb_walk_state_t *wsp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _sd_net_t _sd_net_config;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _sd_writeq_t wrq;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte struct walk_info *winfo;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int blk_shft;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int count;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte winfo = mdb_zalloc(sizeof (struct walk_info), UM_SLEEP);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* need to calculate the end of the array */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_readvar(&_sd_net_config, "_sd_net_config") == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to read _sd_net_config structure");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (wsp->walk_addr == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_addr = (uintptr_t)(_sd_net_config.sn_wr_cctl);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * this module assumes 8k block size so this code can
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * be commented out if necessary.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_readvar(&blk_shft, "_sd_cblock_shift") == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to read _sd_cblock_shift."
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "assuming 8k cache block size");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte blk_shft = 13;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte count = (_sd_net_config.sn_wpages * _sd_net_config.sn_psize) /
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (1 << blk_shft);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte winfo->w_end = (uintptr_t)(_sd_net_config.sn_wr_cctl + count);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_data = winfo;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_NEXT);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortesdbc_wctl_wstep(mdb_walk_state_t *wsp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte struct walk_info *winfo = wsp->walk_data;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (wsp->walk_addr == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_DONE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (wsp->walk_addr >= winfo->w_end)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_DONE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = wsp->walk_callback(wsp->walk_addr, wsp->walk_data,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_cbdata);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_addr += sizeof (_sd_wr_cctl_t);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortesdbc_wctl_wfini(mdb_walk_state_t *wsp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_free(wsp->walk_data, sizeof (struct walk_info));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * walk the queue (free list) of write control structures
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortesdbc_wrq_winit(mdb_walk_state_t *wsp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _sd_net_t _sd_net_config;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _sd_writeq_t wrq;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* if called without an address, start at the head of the queue */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (wsp->walk_addr == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_readvar(&_sd_net_config, "_sd_net_config") == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to read _sd_net_config structure");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_addr = (uintptr_t)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (_sd_net_config.sn_wr_queue.wq_qtop);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_NEXT);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortesdbc_wrq_wstep(mdb_walk_state_t *wsp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _sd_wr_cctl_t wctl;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (wsp->walk_addr == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_DONE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = wsp->walk_callback(wsp->walk_addr, wsp->walk_data,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_cbdata);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_vread(&wctl, sizeof (_sd_wr_cctl_t), wsp->walk_addr)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("sdbc_cchain_wstep failed to read wctl at %p",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_addr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* special case -- mini-DSP fake wr_cctl */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (wsp->walk_addr == (uintptr_t)wctl.wc_next)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_DONE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_addr = (uintptr_t)(wctl.wc_next);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_NEXT);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortesdbc_wrq_wfini(mdb_walk_state_t *wsp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* SAFESTORE */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * walk the _sd_cache_files array of cd_info structures
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortesdbc_cdinfo_winit(mdb_walk_state_t *wsp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte struct walk_info *winfo;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _sd_cd_info_t *_sd_cache_files_addr;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int maxdevs;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte winfo = mdb_zalloc(sizeof (struct walk_info), UM_SLEEP);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* get the address of the cdinfo table */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_readvar(&_sd_cache_files_addr, "_sd_cache_files") == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to read _sd_cache_files address\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* if called without an address, start at the head of the queue */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (wsp->walk_addr == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* address of first _sd_cd_info_t */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_addr = (uintptr_t)(_sd_cache_files_addr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* get the number of volumes */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_readvar(&maxdevs, "sdbc_max_devs") == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to read sdbc_max_devs");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte winfo->w_end = (uintptr_t)(_sd_cache_files_addr + maxdevs);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_data = winfo;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_NEXT);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortesdbc_cdinfo_wstep(mdb_walk_state_t *wsp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte struct walk_info *winfo = wsp->walk_data;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (wsp->walk_addr >= winfo->w_end)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_DONE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = wsp->walk_callback(wsp->walk_addr, wsp->walk_data,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_cbdata);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_addr += sizeof (_sd_cd_info_t);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortesdbc_cdinfo_wfini(mdb_walk_state_t *wsp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_free(wsp->walk_data, sizeof (struct walk_info));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef SAFESTORE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * walk the array of allocated fault tolerant control structures
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortesdbc_ftctl_winit(mdb_walk_state_t *wsp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _sd_net_t _sd_net_config;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte struct walk_info *winfo;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int blk_shft = 13; /* 8k default */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int count;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte winfo = mdb_zalloc(sizeof (struct walk_info), UM_SLEEP);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* need to calculate the end of the array */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_readvar(&_sd_net_config, "_sd_net_config") == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to read _sd_net_config structure");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (wsp->walk_addr == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_addr = (uintptr_t)(_sd_net_config.sn_ft_cctl);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * this module assumes 8k block size so this code can
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * be commented out if necessary.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_readvar(&blk_shft, "_sd_cblock_shift") == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to read _sd_cblock_shift."
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "assuming 8k cache block size");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte blk_shft = 13;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte count = (_sd_net_config.sn_wpages * _sd_net_config.sn_psize) /
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (1 << blk_shft);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte winfo->w_end = (uintptr_t)(_sd_net_config.sn_ft_cctl + count);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_data = winfo;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_NEXT);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortesdbc_ftctl_wstep(mdb_walk_state_t *wsp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte struct walk_info *winfo = wsp->walk_data;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (wsp->walk_addr == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_DONE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (wsp->walk_addr >= winfo->w_end)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_DONE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = wsp->walk_callback(wsp->walk_addr, wsp->walk_data,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_cbdata);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_addr += sizeof (_sd_ft_cctl_t);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortesdbc_ftctl_wfini(mdb_walk_state_t *wsp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_free(wsp->walk_data, sizeof (struct walk_info));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* SAFESTORE */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * walk the handle list
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortesdbc_handle_winit(mdb_walk_state_t *wsp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _sd_buf_hlist_t hl;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte struct walk_info *winfo;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GElf_Sym sym;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_readvar(&hl, "_sd_handle_list") == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to read _sd_handle_list structure");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_lookup_by_obj("sdbc", "_sd_handle_list", &sym) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to lookup _sd_handle_list symbol");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* if called without an address, start at first element in list */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (wsp->walk_addr == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_addr = (uintptr_t)(hl.hl_top.bh_next);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte winfo = mdb_zalloc(sizeof (struct walk_info), UM_SLEEP);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte winfo->w_end = (uintptr_t)(sym.st_value); /* &_sd_handle_list.hl_top */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_data = winfo;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_NEXT);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortesdbc_handle_wstep(mdb_walk_state_t *wsp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte struct walk_info *winfo = wsp->walk_data;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _sd_buf_handle_t handle;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (wsp->walk_addr == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_DONE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (wsp->walk_addr == winfo->w_end)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_DONE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = wsp->walk_callback(wsp->walk_addr, wsp->walk_data,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_cbdata);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_vread(&handle, sizeof (_sd_buf_handle_t), wsp->walk_addr)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to read handle at %p", wsp->walk_addr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_addr = (uintptr_t)(handle.bh_next);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortesdbc_handle_wfini(mdb_walk_state_t *wsp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_free(wsp->walk_data, sizeof (struct walk_info));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * walk the global info array (dirty bits)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortesdbc_glcinfo_winit(mdb_walk_state_t *wsp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ss_centry_info_t *gl_centry_info;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte size_t gl_centry_info_size;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte struct walk_info *winfo;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte winfo = mdb_zalloc(sizeof (struct walk_info), UM_SLEEP);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* get start of the cache entry metadata */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_readvar(&gl_centry_info, "_sdbc_gl_centry_info") == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to read _sdbc_gl_centry_info");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* need to calculate the end of the array */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_readvar(&gl_centry_info_size,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "_sdbc_gl_centry_info_size") == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to read _sdbc_gl_centry_info_size");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (wsp->walk_addr == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_addr = (uintptr_t)(gl_centry_info);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte winfo->w_end = ((uintptr_t)(gl_centry_info)) + gl_centry_info_size;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_data = winfo;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_NEXT);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortesdbc_glcinfo_wstep(mdb_walk_state_t *wsp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte struct walk_info *winfo = wsp->walk_data;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (wsp->walk_addr == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_DONE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (wsp->walk_addr >= winfo->w_end)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_DONE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = wsp->walk_callback(wsp->walk_addr, wsp->walk_data,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_cbdata);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_addr += sizeof (ss_centry_info_t);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortesdbc_glcinfo_wfini(mdb_walk_state_t *wsp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_free(wsp->walk_data, sizeof (struct walk_info));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * walk the global file info array
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortesdbc_glfinfo_winit(mdb_walk_state_t *wsp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ss_voldata_t *gl_file_info;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte struct walk_info *winfo;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int maxdevs;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte winfo = mdb_zalloc(sizeof (struct walk_info), UM_SLEEP);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* get start of the cache entry metadata */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_readvar(&gl_file_info, "_sdbc_gl_file_info") == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to read _sdbc_gl_file_info");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (wsp->walk_addr == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_addr = (uintptr_t)(gl_file_info);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* get the number of volumes */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_readvar(&maxdevs, "sdbc_max_devs") == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to read sdbc_max_devs");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* end of the array */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte winfo->w_end = (uintptr_t)((gl_file_info) + maxdevs);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_data = winfo;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_NEXT);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortesdbc_glfinfo_wstep(mdb_walk_state_t *wsp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte struct walk_info *winfo = wsp->walk_data;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (wsp->walk_addr == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_DONE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (wsp->walk_addr >= winfo->w_end)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_DONE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = wsp->walk_callback(wsp->walk_addr, wsp->walk_data,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_cbdata);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_addr += sizeof (ss_voldata_t);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortesdbc_glfinfo_wfini(mdb_walk_state_t *wsp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_free(wsp->walk_data, sizeof (struct walk_info));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* end of WALKERS section */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteconst mdb_bitmask_t cc_flag_bits[] = {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"PEND_DIRTY", CC_PEND_DIRTY, CC_PEND_DIRTY},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"PINNED", CC_PINNED, CC_PINNED},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"PINNABLE", CC_PINNABLE, CC_PINNABLE},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"QHEAD", CC_QHEAD, CC_QHEAD},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {NULL, 0, 0}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte};
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteconst mdb_bitmask_t io_status_bits[] = {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"IO_NONE", 0xff, _SD_IO_NONE},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"IO_INITIATE", 0xff, _SD_IO_INITIATE},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"IO_DONE", 0xff, _SD_IO_DONE},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"IO_FAILED", 0xff, _SD_IO_FAILED},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"IO_DISCARDED", 0xff, _SD_IO_DISCARDED},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {NULL, 0, 0}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte};
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteconst mdb_bitmask_t cc_aging_bits[] = {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"FOUND_IN_HASH", FOUND_IN_HASH_DM, FOUND_IN_HASH_DM},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"FOUND_HOLD_OVER", FOUND_HOLD_OVER_DM, FOUND_HOLD_OVER_DM},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"HOST_ENTRY", HOST_ENTRY_DM, HOST_ENTRY_DM},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"PARASITIC_ENTRY", PARASITIC_ENTRY_DM, PARASITIC_ENTRY_DM},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"STICKY_METADATA", STICKY_METADATA_DM, STICKY_METADATA_DM},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"ELIGIBLE_ENTRY", ELIGIBLE_ENTRY_DM, ELIGIBLE_ENTRY_DM},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"HASH_ENTRY", HASH_ENTRY_DM, HASH_ENTRY_DM},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"HOLD_ENTRY", HOLD_ENTRY_DM, HOLD_ENTRY_DM},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"AVAIL_ENTRY", AVAIL_ENTRY_DM, AVAIL_ENTRY_DM},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"BAD_CHAIN", BAD_CHAIN_DM, BAD_CHAIN_DM},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"BAD_ENTRY", BAD_ENTRY_DM, BAD_ENTRY_DM},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"PREFETCH_I", PREFETCH_BUF_I, PREFETCH_BUF_I},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"PREFETCH_E", PREFETCH_BUF_E, PREFETCH_BUF_E},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {NULL, 0, 0}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte};
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* DCMDS that use walkers */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * dcmd to display cache entry control structures
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortesdbc_cctl(uintptr_t addr, uint_t flags, int argc,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte const mdb_arg_t *argv)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint_t opt_a = FALSE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uintptr_t opt_c = MDB_CD; /* cd */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uintptr_t opt_b = MDB_BLKNUM; /* block num */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint_t opt_B = FALSE; /* BAD CHAIN or ENTRY */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint_t opt_d = FALSE; /* dirty */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint_t opt_H = FALSE; /* HOST */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint_t opt_h = FALSE; /* hashed */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint_t opt_i = FALSE; /* inuse */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint_t opt_p = FALSE; /* pageio */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint_t opt_P = FALSE; /* PARASITE */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint_t opt_R = FALSE; /* explicit read-ahead (prefetch) */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint_t opt_r = FALSE; /* implicit read-ahead (prefetch) */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint_t opt_o = FALSE; /* io in progress */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint_t opt_m = FALSE; /* has memory allocated */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint_t opt_V = FALSE; /* valid bits */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint_t opt_v = FALSE; /* verbose */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint_t nofilter = FALSE; /* true if b, d, h, i, o, p, V are all false */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _sd_cctl_t centry;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _sd_cctl_sync_t cc_sync;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * possible enhancements -- option to filter on flag bits
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * option that toggles other options.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_getopts(argc, argv,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 'a', MDB_OPT_SETBITS, TRUE, &opt_a,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 'B', MDB_OPT_SETBITS, TRUE, &opt_B,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 'b', MDB_OPT_UINTPTR, &opt_b,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 'c', MDB_OPT_UINTPTR, &opt_c,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 'd', MDB_OPT_SETBITS, TRUE, &opt_d,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 'H', MDB_OPT_SETBITS, TRUE, &opt_H,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 'h', MDB_OPT_SETBITS, TRUE, &opt_h,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 'i', MDB_OPT_SETBITS, TRUE, &opt_i,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 'o', MDB_OPT_SETBITS, TRUE, &opt_o,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 'm', MDB_OPT_SETBITS, TRUE, &opt_m,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 'P', MDB_OPT_SETBITS, TRUE, &opt_P,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 'p', MDB_OPT_SETBITS, TRUE, &opt_p,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 'R', MDB_OPT_SETBITS, TRUE, &opt_R,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 'r', MDB_OPT_SETBITS, TRUE, &opt_r,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 'V', MDB_OPT_SETBITS, TRUE, &opt_V,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 'v', MDB_OPT_SETBITS, TRUE, &opt_v) != argc)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_USAGE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte nofilter = (!OPT_B_SELECTED && !opt_d && !opt_h && !opt_i &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte !opt_o && !opt_m && !opt_p && !opt_V && !opt_B &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte !opt_P && !opt_H && !opt_R && !opt_r); /* no options */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!(flags & DCMD_ADDRSPEC)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_walk_dcmd("sdbc`sdbc_cctl", "sdbc`sdbc_cctl",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte argc, argv) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to walk 'cctl' list");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_OK);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (DCMD_HDRSPEC(flags)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("sdbc cache ctl structures:\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_vread(&centry, sizeof (_sd_cctl_t), addr) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("dcmd failed to read centry at %p", addr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* filter exclusively on a cd number if specified */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (OPT_C_SELECTED && (centry.cc_head.hh_cd != opt_c))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_OK);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* all other filters are inclusive */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((nofilter) ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (OPT_B_SELECTED && (centry.cc_head.hh_blk_num == opt_b)) ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (opt_B && (centry.cc_aging_dm &
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (BAD_ENTRY_DM | BAD_CHAIN_DM))) ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (opt_d && (centry.cc_dirty)) ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (opt_H && (centry.cc_aging_dm & HOST_ENTRY_DM)) ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (opt_h && (centry.cc_head.hh_hashed)) ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (opt_i && (centry.cc_inuse)) ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (opt_p && (centry.cc_pageio)) ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (opt_P && (centry.cc_aging_dm & PARASITIC_ENTRY_DM)) ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (opt_R && (centry.cc_aging_dm & PREFETCH_BUF_E)) ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (opt_r && (centry.cc_aging_dm & PREFETCH_BUF_I)) ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (opt_V && (centry.cc_valid)) ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (opt_m && (centry.cc_alloc_size_dm)) ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (opt_o && (centry.cc_iostatus != _SD_IO_NONE)))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*EMPTY*/;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_OK);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_inc_indent(4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "%-?p cd %3-d blk_num %10-d valid %04hx dirty %04hx flag %02x\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte addr, centry.cc_head.hh_cd,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte centry.cc_head.hh_blk_num, centry.cc_valid,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte centry.cc_dirty, centry.cc_flag);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_dec_indent(4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!opt_v)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_OK);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* verbose */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_inc_indent(4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "hashed %d seq %4-d toflush %04hx %8Tawait_use %4-d await_page %4-d\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte centry.cc_head.hh_hashed, centry.cc_seq,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte centry.cc_toflush, centry.cc_await_use,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte centry.cc_await_page);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("inuse %d pageio %d cc_flag <%b>\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte centry.cc_inuse, centry.cc_pageio,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte centry.cc_flag, cc_flag_bits);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("iocount %2d iostatus <%b>\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte centry.cc_iocount, centry.cc_iostatus, io_status_bits);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_vread(&cc_sync, sizeof (struct _sd_cctl_sync),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (uintptr_t)centry.cc_sync)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to read cc_sync"); /* not catastophic */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("cc_sync blkcv: %h-x %8Tlock: 0x%p (owner)\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cc_sync._cc_blkcv._opaque,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cc_sync._cc_lock._opaque[0]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("dynamic memory allocation:\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_inc_indent(4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("aging_dm age %3d %4Tage flags: <%b> 0x%x\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte centry.cc_aging_dm & 0xff,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte centry.cc_aging_dm, cc_aging_bits, centry.cc_aging_dm);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("alloc_size_dm %10-d head_dm %?-p\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte centry.cc_alloc_size_dm, centry.cc_head_dm);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("next_dm %?-p link_list_dm %?-p\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte centry.cc_next_dm, centry.cc_link_list_dm);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("alloc_ct_dm %10-d dealloc_ct_dm %10-d\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte centry.cc_alloc_ct_dm, centry.cc_dealloc_ct_dm);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_dec_indent(4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* pointers */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("cctl pointers:\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_inc_indent(4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("next %?-p prev %?-p chain %?-p\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte centry.cc_next, centry.cc_prev, centry.cc_chain);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("dirty_next %?-p dirty_link %?-p\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte centry.cc_dirty_next, centry.cc_dirty_link);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("data %?-p write ctl %?-p\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte centry.cc_data, centry.cc_write);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_dec_indent(4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* dynmem chain */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("cctl dmqueue index cc_blocks %4-d\n", centry.cc_cblocks);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("anon_addr %?-p anon_len %8-d\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte centry.cc_anon_addr.sa_virt, centry.cc_anon_len);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* stats */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("cctl stats: ");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_inc_indent(4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("hits %8-d creat time %?-p\n", centry.cc_hits,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte centry.cc_creat);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_dec_indent(4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_dec_indent(4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_OK);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * convenience dcmd to display the _sd_cctl cc_chain list (alloc list)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Must be called with an address of a cache entry (_sd_cctl_t)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * same options as sdbc_cctl().
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * alternatively the user can call the sdbc_cchain walker
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * and pipe the addresses to sdbc_cctl dcmd.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortesdbc_cchain(uintptr_t addr, uint_t flags, int argc,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte const mdb_arg_t *argv)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!(flags & DCMD_ADDRSPEC))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_USAGE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_pwalk_dcmd("sdbc`sdbc_cchain", "sdbc`sdbc_cctl",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte argc, argv, addr)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to walk cc_chain at addr %p", addr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_OK);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * convenience dcmd to cdisplay the _sd_cctl dirty chain
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * (which is really a 2d chain).
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Must be called with an address of a cache entry (_sd_cctl_t)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * same options as sdbc_cctl().
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * alternatively the user can call the sdbc_dchain walker
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * and pipe the addresses to sdbc_cctl dcmd.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortesdbc_dchain(uintptr_t addr, uint_t flags, int argc,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte const mdb_arg_t *argv)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!(flags & DCMD_ADDRSPEC))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_USAGE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_pwalk_dcmd("sdbc`sdbc_dchain", "sdbc`sdbc_cctl",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte argc, argv, addr)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to walk dirty chain at addr %p", addr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_OK);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * convenience dcmd to display the _sd_cctl dm chain list
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Must be called with an address of a cache entry (_sd_cctl_t)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * same options as sdbc_cctl().
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * alternatively the user can call the sdbc_dmchain walker
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * and pipe the addresses to sdbc_cctl dcmd.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortesdbc_dmchain(uintptr_t addr, uint_t flags, int argc,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte const mdb_arg_t *argv)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!(flags & DCMD_ADDRSPEC))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_USAGE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_pwalk_dcmd("sdbc`sdbc_dmchain", "sdbc`sdbc_cctl",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte argc, argv, addr)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to walk dm chain at addr %p", addr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_OK);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * dcmd to walk a hash chain
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * requires an address. same options as sdbc_cctl dcmd
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortesdbc_hashchain(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!(flags & DCMD_ADDRSPEC))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_USAGE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_pwalk_dcmd("sdbc`sdbc_hashchain", "sdbc`sdbc_cctl",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte argc, argv, addr) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to walk hashchain at %p", addr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_OK);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortedisplay_hash_table(_sd_hash_table_t *addr, _sd_hash_table_t *ht)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("hash table (%p):\n", addr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_inc_indent(4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("size %7-d bits %2-d mask %8-x nmask %8-x buckets %p\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ht->ht_size, ht->ht_bits, ht->ht_mask,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ht->ht_nmask, ht->ht_buckets);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_dec_indent(4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortedisplay_hash_bucket(_sd_hash_bucket_t *addr, _sd_hash_bucket_t *hb)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kmutex_t lock;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int rc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((rc = mdb_vread(&lock, sizeof (kmutex_t),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (uintptr_t)hb->hb_lock)) == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to read bucket lock at %p", hb->hb_lock);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("hash bucket (%p):\n", addr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_inc_indent(4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("head %?-p tail %?-p lock %?-p %s\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte hb->hb_head, hb->hb_tail,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (rc == -1) ? hb->hb_lock : lock._opaque[0],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (rc == -1) ? "" : "(owner)");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("inlist %d seq %d\n", hb->hb_inlist, hb->hb_seq);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_dec_indent(4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * dcmd to walk the hash table
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * defaults to _sd_htable the cache hash table,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * but wil accept an address which is probably only useful
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * in the event that other hash tables are implemented in
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * the cache.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * calls sdbc_hashchain dcmd. same options as sdbc_cctl dcmd.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortesdbc_hashtable(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _sd_hash_table_t *sd_htable_addr;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _sd_hash_table_t _sd_htable;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _sd_hash_bucket_t hash_bucket;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!(flags & DCMD_ADDRSPEC)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* get the address of the standard cache hash table */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_readvar(&sd_htable_addr, "_sd_htable") == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to read _sd_htable address\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sd_htable_addr = (_sd_hash_table_t *)addr;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* read in the hash table structure */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_vread(&_sd_htable, sizeof (_sd_hash_table_t),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (uintptr_t)sd_htable_addr) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to read _sd_htable structure at %p\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sd_htable_addr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte display_hash_table(sd_htable_addr, &_sd_htable);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * read in the hash buckets
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * and display chains if there are any
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < _sd_htable.ht_size; ++i) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_vread(&hash_bucket, sizeof (_sd_hash_bucket_t),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (uintptr_t)(_sd_htable.ht_buckets + i)) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to read ht_buckets at %p\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _sd_htable.ht_buckets + i);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (hash_bucket.hb_head != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte display_hash_bucket(_sd_htable.ht_buckets + i,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &hash_bucket);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * if this walk fails, continue trying
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * to read hash buckets
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_call_dcmd("sdbc`sdbc_hashchain",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (uintptr_t)hash_bucket.hb_head,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte flags|DCMD_ADDRSPEC, argc, argv)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "failed to walk hash chain at %p",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte hash_bucket.hb_head);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_OK);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * dcmd to display the sdbc lru queue
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * same options as sdbc_cctl().
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * alternatively the user can call the sdbc_lru walker
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * and pipe the addresses to sdbc_cctl dcmd.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortesdbc_lru(uintptr_t addr, uint_t flags, int argc,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte const mdb_arg_t *argv)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _sd_queue_t _sd_lru_q;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GElf_Sym sym;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!(flags & DCMD_ADDRSPEC)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_lookup_by_obj("sdbc", "_sd_lru_q", &sym) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to lookup _sd_lru_q symbol");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_vread(&_sd_lru_q, sizeof (_sd_queue_t),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sym.st_value) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to read _sd_lru_q structure");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("Cache LRU Queue\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_inc_indent(4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "qlock: 0x%-p (owner) await %d seq %d inq %d req %d noreq %d\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _sd_lru_q.sq_qlock._opaque[0],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _sd_lru_q.sq_await,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _sd_lru_q.sq_seq,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _sd_lru_q.sq_inq,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _sd_lru_q.sq_req_stat,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _sd_lru_q.sq_noreq_stat);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte addr = (uintptr_t)(sym.st_value);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_pwalk_dcmd("sdbc`sdbc_lru", "sdbc`sdbc_cctl",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte argc, argv, addr) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to walk lru at addr %p", addr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_OK);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef SAFESTORE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteprint_wrq(_sd_writeq_t *wrq, uint_t verbose)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("Cache Write Ctl Queue:\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_inc_indent(4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("qtop %-p qlock: %-p (owner) inq %d\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wrq->wq_qtop,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wrq->wq_qlock._opaque[0],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wrq->wq_inq);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("slp_top %3-d slp_index %3-d slp_inq %3-d\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wrq->wq_slp_top,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wrq->wq_slp_index,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wrq->wq_slp_inq);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; verbose && i < SD_WR_SLP_Q_MAX; i += 2) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("%3d: cv %h-x wq_need %3-d wq_held %3-d%4T",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte i,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wrq->wq_slp[i].slp_wqcv._opaque,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wrq->wq_slp[i].slp_wqneed,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wrq->wq_slp[i].slp_wqheld);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (SD_WR_SLP_Q_MAX > (i + 1)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "%3d: cv %h-x wq_need %3-d wq_held %3-d%\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte i+1,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wrq->wq_slp[i+1].slp_wqcv._opaque,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wrq->wq_slp[i+1].slp_wqneed,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wrq->wq_slp[i+1].slp_wqheld);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_dec_indent(4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * dcmd to display write control structures
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortesdbc_wctl(uintptr_t addr, uint_t flags, int argc,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte const mdb_arg_t *argv)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _sd_wr_cctl_t wctl;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ss_centry_info_t gl_info;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ss_centry_info_t nv_gl_info;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uintptr_t opt_c = MDB_CD;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint_t opt_d = FALSE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint_t opt_v = FALSE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* TODO option for fba pos */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_getopts(argc, argv,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 'd', MDB_OPT_SETBITS, TRUE, &opt_d,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 'c', MDB_OPT_UINTPTR, &opt_c,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 'v', MDB_OPT_SETBITS, TRUE, &opt_v) != argc)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_USAGE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!(flags & DCMD_ADDRSPEC)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_walk_dcmd("sdbc`sdbc_wctl", "sdbc`sdbc_wctl",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte argc, argv) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to walk write ctl array");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_OK);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (DCMD_HDRSPEC(flags)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("write control block structures:\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_vread(&wctl, sizeof (_sd_wr_cctl_t), addr) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to read wctl at 0x%p", addr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * print "all" is the default.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * filter conditions can only be checked by reading in wc_gl_info
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (opt_c || opt_d || opt_v)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_vread(&gl_info, sizeof (ss_centry_info_t),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (uintptr_t)wctl.wc_gl_info) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to read at wc_gl_info 0x%p", addr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (OPT_C_SELECTED && (gl_info.gl_cd != opt_c))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_OK);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (opt_d && !(gl_info.gl_dirty))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_OK);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_inc_indent(4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("%-p data %-p gl_info %-p Ngl_info %-p flg %02x\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte addr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wctl.wc_data,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wctl.wc_gl_info,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wctl.wc_nvmem_gl_info,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wctl.wc_flag);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_dec_indent(4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* verbose */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!opt_v)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_OK);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_inc_indent(4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("next %?-p prev %?-p\n", wctl.wc_next, wctl.wc_prev);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(" gl_info: ");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("cd %3-d fpos %10-d dirty %04x flag <%b>\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte gl_info.gl_cd, gl_info.gl_fpos, gl_info.gl_dirty & 0xffff,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte gl_info.gl_flag, cc_flag_bits);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (wctl.wc_nvmem_gl_info) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_vread(&nv_gl_info, sizeof (ss_centry_info_t),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (uintptr_t)wctl.wc_nvmem_gl_info) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to read at wc_nvmem_gl_info 0x%p",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wctl.wc_nvmem_gl_info); /* not catastophic, continue */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* consistency check */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (memcmp(&gl_info, &nv_gl_info,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (ss_centry_info_t) != 0)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("nvram and host memory are NOT identical!");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("nvmem_gl_info: ");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("cd %3-d fpos %10-d dirty %04x flag <%b>\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte nv_gl_info.gl_cd, nv_gl_info.gl_fpos,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte nv_gl_info.gl_dirty & 0xffff,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte nv_gl_info.gl_flag, cc_flag_bits);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_dec_indent(4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_OK);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * dcmd to display write control structures in the free list
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * same options as sdbc_wctl
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortesdbc_wrq(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _sd_net_t _sd_net_config;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uintptr_t opt_c = MDB_CD;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint_t opt_d = FALSE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint_t opt_v = FALSE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* look for verbose option */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_getopts(argc, argv,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 'd', MDB_OPT_SETBITS, TRUE, &opt_d,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 'c', MDB_OPT_UINTPTR, &opt_c,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 'v', MDB_OPT_SETBITS, TRUE, &opt_v) != argc)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_USAGE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!(flags & DCMD_ADDRSPEC)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_readvar(&_sd_net_config, "_sd_net_config") == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to read _sd_net_config structure");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte print_wrq(&(_sd_net_config.sn_wr_queue), opt_v);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte addr = (uintptr_t)(_sd_net_config.sn_wr_queue.wq_qtop);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_pwalk_dcmd("sdbc`sdbc_wrq", "sdbc`sdbc_wctl",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte argc, argv, addr) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to walk write ctl queue at addr %p", addr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_OK);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * dcmd to display the dm queues
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * use sdbc_lru walker to walk each queue.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*ARGSUSED*/
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortesdbc_dmqueues(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _sd_queue_t *sdbc_dm_queues; /* kernel address of dm queues */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int max_dm_queues;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _sd_queue_t *queues = NULL; /* local copy */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (argc != 0)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_USAGE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!(flags & DCMD_ADDRSPEC)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_readvar(&sdbc_dm_queues, "sdbc_dm_queues") == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to read sdbc_dm_queues address\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_readvar(&max_dm_queues, "max_dm_queues") == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to read max_dm_queues variable\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte queues = mdb_zalloc(max_dm_queues * sizeof (_sd_queue_t),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte UM_SLEEP);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortemdb_printf("max_dm_queues %d sdbc_dm_queues %p queues %p\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte max_dm_queues, sdbc_dm_queues, queues);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_vread(queues, max_dm_queues * sizeof (_sd_queue_t),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (uintptr_t)sdbc_dm_queues) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to read sdbc_dm_queues");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < max_dm_queues; ++i) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("Cache DM Queue %d %p\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte queues[i].sq_dmchain_cblocks,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sdbc_dm_queues +i);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_inc_indent(4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("qlock: 0x%-p (owner) await %d "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "seq %d inq %d req %d noreq %d\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte queues[i].sq_qlock._opaque[0],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte queues[i].sq_await,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte queues[i].sq_seq,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte queues[i].sq_inq,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte queues[i].sq_req_stat,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte queues[i].sq_noreq_stat);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_dec_indent(4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_OK);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortemdb_bitmask_t cd_writer_bits[] = {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { "NONE ", (u_longlong_t)~0, _SD_WRITER_NONE },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { "CREATE ", (u_longlong_t)~0, _SD_WRITER_CREATE },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { "RUNNING", (u_longlong_t)~0, _SD_WRITER_RUNNING },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { NULL, 0, 0 }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte};
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortemdb_bitmask_t sh_failed_status[] = {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { "STATUS OK", (u_longlong_t)~0, 0 },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { "I/O ERROR", (u_longlong_t)~0, 1 },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { "OPEN FAIL", (u_longlong_t)~0, 2 },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { NULL, 0, 0 }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte};
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortemdb_bitmask_t sh_flag_bits[] = {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { "ATTACHED", CD_ATTACHED, CD_ATTACHED },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { NULL, 0, 0 }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte};
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortemdb_bitmask_t sh_alloc_bits[] = {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { "ALLOC_IN_PROGRESS", CD_ALLOC_IN_PROGRESS, CD_ALLOC_IN_PROGRESS },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { "ALLOCATED", CD_ALLOCATED, CD_ALLOCATED },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { "CLOSE_IN_PROGRESS", CD_CLOSE_IN_PROGRESS, CD_CLOSE_IN_PROGRESS },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { NULL, 0, 0 }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte};
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * dcmd to display cd information
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortesdbc_cdinfo(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _sd_shared_t sd_shared;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _sd_cd_info_t cdi;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ss_voldata_t gl_file;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char *fn = "nopath"; /* filename if sd_shared info cannot be read */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t sh_alloc = 0; /* assume not alloc'd if sd_shared info unavail */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uintptr_t opt_c = MDB_CD;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint_t opt_a = FALSE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint_t opt_v = FALSE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int dev_t_chars;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dev_t_chars = sizeof (dev_t) * 2; /* # chars to display dev_t */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_getopts(argc, argv,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 'a', MDB_OPT_SETBITS, TRUE, &opt_a,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 'c', MDB_OPT_UINTPTR, &opt_c,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 'v', MDB_OPT_SETBITS, TRUE, &opt_v) != argc)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_USAGE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!(flags & DCMD_ADDRSPEC)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_walk_dcmd("sdbc`sdbc_cdinfo", "sdbc`sdbc_cdinfo",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte argc, argv) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to walk cd info array");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_OK);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (DCMD_HDRSPEC(flags)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("cd info structures:\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_vread(&cdi, sizeof (_sd_cd_info_t), addr) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to read cd info at 0x%p", addr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * need to do this read even for non-verbose option to
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * get the filename and the sh_alloc field
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (cdi.cd_info) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_vread(&sd_shared, sizeof (_sd_shared_t),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (uintptr_t)cdi.cd_info) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to read shared cd info at 0x%p",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cdi.cd_info);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* not catastrophic, keep truckin' */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fn = sd_shared.sh_filename;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sh_alloc = sd_shared.sh_alloc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!opt_a && (sh_alloc == 0))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_OK);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (OPT_C_SELECTED && (opt_c != cdi.cd_desc))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_OK);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_inc_indent(4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("%p cd %3-d filename %s\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte addr, cdi.cd_desc, fn);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("alloc <%b> hint <%b>\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sh_alloc, sh_alloc_bits,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cdi.cd_hint, cache_hints);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_dec_indent(4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!opt_v)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_OK);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* verbose */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_inc_indent(4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("rawfd %?-p crdev %0*lx iodev %?-p\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cdi.cd_rawfd,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dev_t_chars,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cdi.cd_crdev,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cdi.cd_iodev);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("flag %x %8Tlock %?-p writer <%b>\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cdi.cd_flag,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cdi.cd_lock._opaque[0],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cdi.cd_writer, cd_writer_bits);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("global %?-p dirty_head %?-p\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cdi.cd_global, cdi.cd_dirty_head);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("last_ent %?-p lastchain_ptr %?-p lastchain %d\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cdi.cd_last_ent, cdi.cd_lastchain_ptr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cdi.cd_lastchain);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("io_head %?-p io_tail %?-p fail_head %?-p\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cdi.cd_io_head, cdi.cd_io_tail, cdi.cd_fail_head);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "cd_info %?-p failover %d recovering %d write_inprogress %d\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cdi.cd_info, cdi.cd_failover,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cdi.cd_recovering,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cdi.cd_write_inprogress);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (cdi.cd_global != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_vread(&gl_file, sizeof (ss_voldata_t),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (uintptr_t)cdi.cd_global) == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to read cd_global at %p",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cdi.cd_global);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("cd_global: %s\n", gl_file.sv_volname);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("pinned %2-d attached %2-d devidsz %3-d\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte gl_file.sv_pinned, gl_file.sv_attached,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte gl_file.sv_devidsz);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("devid %s\n", gl_file.sv_devid);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("vol %?p\n", gl_file.sv_vol);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* TODO do a consistency check here against the nvram copy */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (cdi.cd_info == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("no shared info\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("shared:\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("failed <%b> cd %3-d",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sd_shared.sh_failed, sh_failed_status,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sd_shared.sh_cd);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("cache_read %10-d cache_write %10-d\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sd_shared.sh_cache_read, sd_shared.sh_cache_write);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("disk_read %10-d disk_write %10-d filesize %10-d\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sd_shared.sh_disk_read, sd_shared.sh_disk_write,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sd_shared.sh_filesize);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("numdirty %8-d numio %8-d numfail %8-d\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sd_shared.sh_numdirty,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sd_shared.sh_numio,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sd_shared.sh_numfail);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("flushloop %2-d sh_flag <%b>\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sd_shared.sh_flushloop, sd_shared.sh_flag, sh_flag_bits);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* this can be really verbose */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (cdi.cd_dirty_head) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("Dirty Chain (cd_dirty_head):");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* TODO reconstruct argv without opt_a */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!opt_a)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_call_dcmd("sdbc_dchain",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (uintptr_t)cdi.cd_dirty_head,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte flags, argc, argv);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else /* print with no options */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_call_dcmd("sdbc_dchain",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (uintptr_t)cdi.cd_dirty_head,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte flags, 0, NULL);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (cdi.cd_io_head) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("I/O Pending Chain (cd_io_head):");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* TODO reconstruct argv without opt_a */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!opt_a)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_call_dcmd("sdbc_dchain",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (uintptr_t)cdi.cd_io_head,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte flags, argc, argv);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else /* print with no options */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_call_dcmd("sdbc_dchain",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (uintptr_t)cdi.cd_dirty_head,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte flags, 0, NULL);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (cdi.cd_fail_head) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("Failed Chain (cd_fail_head):");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* TODO reconstruct argv without opt_a */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!opt_a)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_call_dcmd("sdbc_dchain",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (uintptr_t)cdi.cd_fail_head,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte flags, argc, argv);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else /* print with no options */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_call_dcmd("sdbc_dchain",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (uintptr_t)cdi.cd_dirty_head,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte flags, 0, NULL);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_dec_indent(4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_OK);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef SAFESTORE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * dcmd to display fault tolerant control structures
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortesdbc_ftctl(uintptr_t addr, uint_t flags, int argc,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte const mdb_arg_t *argv)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _sd_ft_cctl_t ft_cent;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ss_centry_info_t gl_info;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ss_centry_info_t nv_gl_info;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uintptr_t opt_c = MDB_CD;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint_t opt_d = FALSE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint_t opt_v = FALSE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* TODO option to select on fpos */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_getopts(argc, argv,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 'd', MDB_OPT_SETBITS, TRUE, &opt_d,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 'c', MDB_OPT_UINTPTR, &opt_c,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 'v', MDB_OPT_SETBITS, TRUE, &opt_v) != argc)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_USAGE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!(flags & DCMD_ADDRSPEC)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_walk_dcmd("sdbc`sdbc_ftctl", "sdbc`sdbc_ftctl",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte argc, argv) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to walk write ctl array");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_OK);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (DCMD_HDRSPEC(flags)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("Ft control block structures:\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_vread(&ft_cent, sizeof (_sd_ft_cctl_t), addr) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to read ft_cent at 0x%p", addr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * print "all" is the default.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * filter conditions can only be checked by reading in wc_gl_info
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (opt_c || opt_d || opt_v)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_vread(&gl_info, sizeof (ss_centry_info_t),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (uintptr_t)ft_cent.ft_gl_info) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to read at wc_gl_info 0x%p", addr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (OPT_C_SELECTED && (gl_info.gl_cd != opt_c))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_OK);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (opt_d && !(gl_info.gl_dirty))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_OK);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_inc_indent(4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("%-p data %?-p qnext %?-p\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte addr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ft_cent.ft_qnext,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ft_cent.ft_data);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("gl_info %?-p nvmem_gl_info %?-p\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ft_cent.ft_gl_info,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ft_cent.ft_nvmem_gl_info);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_dec_indent(4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* verbose */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!opt_v) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_OK);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_inc_indent(4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(" gl_info: ");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("cd %3-d fpos %10-d dirty %04x flag <%b>\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte gl_info.gl_cd, gl_info.gl_fpos, gl_info.gl_dirty & 0xffff,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte gl_info.gl_flag, cc_flag_bits);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ft_cent.ft_nvmem_gl_info) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_vread(&nv_gl_info, sizeof (ss_centry_info_t),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (uintptr_t)ft_cent.ft_nvmem_gl_info) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to read at ft_nvmem_gl_info 0x%p",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ft_cent.ft_nvmem_gl_info); /* not catastophic, continue */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("nvmem_gl_info: ");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("cd %3-d fpos %10-d dirty %04x flag <%b>\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte nv_gl_info.gl_cd, nv_gl_info.gl_fpos,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte nv_gl_info.gl_dirty & 0xffff,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte nv_gl_info.gl_flag, cc_flag_bits);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* consistency check */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (memcmp(&gl_info, &nv_gl_info, sizeof (ss_centry_info_t))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("nvram and host memory are NOT identical!");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_dec_indent(4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_OK);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* SAFESTORE */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* dcmd to display buffer handles */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortesdbc_handles(uintptr_t addr, uint_t flags, int argc,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte const mdb_arg_t *argv)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint_t opt_a = FALSE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uintptr_t opt_c = MDB_CD;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint_t opt_v = FALSE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint_t opt_C = FALSE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _sd_buf_hlist_t hl;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _sd_buf_handle_t bh;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_getopts(argc, argv,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 'a', MDB_OPT_SETBITS, TRUE, &opt_a,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 'c', MDB_OPT_UINTPTR, &opt_c,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 'C', MDB_OPT_SETBITS, TRUE, &opt_C,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 'v', MDB_OPT_SETBITS, TRUE, &opt_v) != argc)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_USAGE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_readvar(&hl, "_sd_handle_list") == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to read _sd_handle_list structure");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!(flags & DCMD_ADDRSPEC)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_walk_dcmd("sdbc`sdbc_handles", "sdbc`sdbc_handles",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte argc, argv) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to walk 'sdbc_handle_list'");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_OK);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (DCMD_HDRSPEC(flags)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("Handle List Info:\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_inc_indent(4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("hl_top.bh_next: 0x%p\n", hl.hl_top.bh_next);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("hl_lock: 0x%p (owner)\n", hl.hl_lock._opaque[0]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("hl_count: %hd\n", hl.hl_count);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_dec_indent(4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("buf handles:\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_vread(&bh, sizeof (bh), addr) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to read buf handle at 0x%p", addr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!opt_a && !(bh.bh_flag & (NSC_HALLOCATED | NSC_HACTIVE)))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_OK);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * may get false matches on cd option --
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * a cleared bh_cd field will match if user specified cd 0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (OPT_C_SELECTED && (bh.bh_cd != opt_c))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_OK);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_inc_indent(4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("%p %8T cd %3-d %4T<%b> %x\n", addr, bh.bh_cd,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bh.bh_flag, nsc_buf_bits, bh.bh_flag);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* check for verbose, avoid printing twice */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!opt_v && opt_C) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("cc_chain: ");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (bh.bh_centry)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_call_dcmd("sdbc`sdbc_cchain",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (uintptr_t)bh.bh_centry, DCMD_ADDRSPEC, 0, NULL);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_dec_indent(4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!opt_v)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_OK);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* verbose */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_inc_indent(4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("callbacks: %-20a%-20a%-20a\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bh.bh_disconnect_cb, bh.bh_read_cb, bh.bh_write_cb);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("centry %?p %8T next %?p\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bh.bh_centry, bh.bh_next);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("buffer:\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_inc_indent(4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("fd 0x%p pos %10d len %6d flag 0x%x\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bh.bh_buf.sb_fd, bh.bh_fba_pos, bh.bh_fba_len, bh.bh_flag);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("alloc_thread %p busy_thread %p\n", bh.bh_alloc_thread,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bh.bh_busy_thread);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("err %4d %8T bh_vec 0x%p\n", bh.bh_error, bh.bh_vec);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_dec_indent(4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("bufvec (scatter gather list): %-?s %8T%-s\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "ADDR", "LEN");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _sd_bufvec_t *bv, *endvec;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* todo check for (bh_vec != bh_bufvec) => readahead? */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bv = bh.bh_bufvec;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte endvec = bv + _SD_MAX_BLKS;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_inc_indent(30);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while (bv->bufaddr) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("%p %8T%d\n", bv->bufaddr, bv->buflen);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ++bv;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (bv > endvec) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("END of bh_bufvec ARRAY");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_dec_indent(30);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (opt_C) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("cc_chain: ");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (bh.bh_centry)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_call_dcmd("sdbc`sdbc_cchain",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (uintptr_t)bh.bh_centry, DCMD_ADDRSPEC, 0, NULL);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_dec_indent(4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_OK);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * dcmd to display ss_centry_info_t structures and
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * do optional consistency check with the nvram copy
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * if configured for nvram safe storage.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortesdbc_glcinfo(uintptr_t addr, uint_t flags, int argc,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte const mdb_arg_t *argv)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ss_centry_info_t gl_centry_info;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* for doing consistency check */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ss_centry_info_t *gl_centry_info_start;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ss_centry_info_t *nv_gl_centry_info_start;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uintptr_t nv_addr;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ss_centry_info_t nv_gl_centry_info;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* options */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint_t opt_a = FALSE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uintptr_t opt_b = MDB_BLKNUM; /* fba pos match */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uintptr_t opt_c = MDB_CD;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uintptr_t opt_C = FALSE; /* consistency check */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint_t opt_d = FALSE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_getopts(argc, argv,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 'a', MDB_OPT_SETBITS, TRUE, &opt_a,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 'b', MDB_OPT_UINTPTR, &opt_b,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 'c', MDB_OPT_UINTPTR, &opt_c,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 'C', MDB_OPT_SETBITS, TRUE, &opt_C,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 'd', MDB_OPT_SETBITS, TRUE, &opt_d) != argc)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_USAGE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!(flags & DCMD_ADDRSPEC)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_walk_dcmd("sdbc`sdbc_glcinfo", "sdbc`sdbc_glcinfo",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte argc, argv) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to walk global centry info array");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_OK);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (DCMD_HDRSPEC(flags)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("global cache entry info:\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_vread(&gl_centry_info, sizeof (ss_centry_info_t), addr) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to read gl_centry_info at 0x%p", addr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * default is to print entries initialized with a cd. return if
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * no options are selected and cd is invalid.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!opt_a && (!OPT_B_SELECTED) && (!OPT_C_SELECTED) && !opt_d &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (gl_centry_info.sc_cd == -1))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_OK);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * opt_c is exclusive filter. if opt_c is selected and there
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * is no match on the cd then return
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!opt_a &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (OPT_C_SELECTED && (gl_centry_info.sc_cd != opt_c)))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_OK);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * opt_d and opt_b are inclusive. print if either one is chosen
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * and the selection condition is true.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (opt_a ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (!opt_d && (!OPT_B_SELECTED)) || /* no options chosen */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (opt_d && gl_centry_info.sc_dirty) ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (OPT_B_SELECTED && (gl_centry_info.sc_fpos == opt_b)))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*EMPTY*/;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_OK);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_inc_indent(4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("%?-p cd %3-d fpos %10-d dirty %04x flag <%b>\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte addr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte gl_centry_info.sc_cd,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte gl_centry_info.sc_fpos,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte gl_centry_info.sc_dirty & 0xffff,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte gl_centry_info.sc_flag, cc_flag_bits);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (opt_C) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* get start of the cache entry metadata */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_readvar(&gl_centry_info_start,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "_sdbc_gl_centry_info") == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to read _sdbc_gl_centry_info");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* not catastrophic */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte goto end;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* get start of the nvram copy cache entry metadata */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_readvar(&nv_gl_centry_info_start,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "_sdbc_gl_centry_info_nvmem") == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to read _sdbc_gl_centry_info_nvmem");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* not catastrophic */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte goto end;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte nv_addr = (addr - (uintptr_t)gl_centry_info_start) +
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (uintptr_t)nv_gl_centry_info_start;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_vread(&nv_gl_centry_info, sizeof (ss_centry_info_t),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte nv_addr) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to read at nvmem_gl_info 0x%p",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte nv_addr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* not catastophic, continue */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* consistency check */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_inc_indent(4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (memcmp(&gl_centry_info, &nv_gl_centry_info,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (ss_centry_info_t) != 0)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "nvram and host memory are NOT identical!");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("nvmem_gl_centry_info: ");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "%?-p cd %3-d fpos %10-d dirty %04x flag <%b>\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte nv_addr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte nv_gl_centry_info.sc_cd,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte nv_gl_centry_info.sc_fpos,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte nv_gl_centry_info.sc_dirty & 0xffff,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte nv_gl_centry_info.sc_flag, cc_flag_bits);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("NVRAM ok\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_dec_indent(4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte end:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_dec_indent(4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_OK);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * dcmd to display ss_voldata_t structures and
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * do optional consistency check with the nvram copy
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * if configured for nvram safe storage.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortesdbc_glfinfo(uintptr_t addr, uint_t flags, int argc,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte const mdb_arg_t *argv)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ss_voldata_t gl_file_info;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* for doing consistency check */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ss_voldata_t *gl_file_info_start;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ss_voldata_t *nv_gl_file_info_start;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uintptr_t nv_addr;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ss_voldata_t nv_gl_file_info;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* options default: valid filename */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint_t opt_a = FALSE; /* all */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint_t opt_p = FALSE; /* PINNED */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint_t opt_t = FALSE; /* attached */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint_t opt_C = FALSE; /* consistency check */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * possible enhancement -- match on filename,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * or filename part (e.g. controller number)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_getopts(argc, argv,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 'a', MDB_OPT_SETBITS, TRUE, &opt_a,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 'C', MDB_OPT_SETBITS, TRUE, &opt_C,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 'p', MDB_OPT_SETBITS, TRUE, &opt_p,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 't', MDB_OPT_SETBITS, TRUE, &opt_t) != argc)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_USAGE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!(flags & DCMD_ADDRSPEC)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_walk_dcmd("sdbc`sdbc_glfinfo", "sdbc`sdbc_glfinfo",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte argc, argv) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to walk global file info array");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_OK);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (DCMD_HDRSPEC(flags)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("global file entry info:\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_vread(&gl_file_info, sizeof (ss_voldata_t), addr) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to read gl_file_info at 0x%p", addr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * default is to print entries initialized with non-null filename.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * return if no options are selected and filename is invalid.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!opt_a && !opt_p && !opt_t &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (strlen(gl_file_info.sv_volname) == 0))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_OK);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (opt_a ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (!opt_p && !opt_t) || /* no options chosen */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (opt_p && (gl_file_info.sv_pinned != _SD_NO_HOST)) ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (opt_t && (gl_file_info.sv_attached != _SD_NO_HOST)))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*EMPTY*/;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_OK);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_inc_indent(4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("%?-p %s\n", addr, gl_file_info.sv_volname);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("pinned %2-d attached %2-d devidsz %3-d\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte gl_file_info.sv_pinned,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte gl_file_info.sv_attached,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte gl_file_info.sv_devidsz);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("devid %s\n", gl_file_info.sv_devid);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (opt_C) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* get start of the cache entry metadata */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_readvar(&gl_file_info_start,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "_sdbc_gl_file_info") == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to read _sdbc_gl_file_info");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* not catastrophic */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte goto end;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* get start of the nvram copy cache entry metadata */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_readvar(&nv_gl_file_info_start,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "_sdbc_gl_file_info_nvmem") == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to read _sdbc_gl_file_info_nvmem");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* not catastrophic */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte goto end;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte nv_addr = (addr - (uintptr_t)gl_file_info_start) +
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (uintptr_t)nv_gl_file_info_start;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_vread(&nv_gl_file_info, sizeof (ss_voldata_t),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte nv_addr) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to read nvmem_gl_info at 0x%p",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte nv_addr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* not catastophic, continue */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* consistency check */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_inc_indent(4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (memcmp(&gl_file_info, &nv_gl_file_info,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (ss_centry_info_t) != 0)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("nvram and host memory are NOT identical!");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("nvmem_gl_file_info: ");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("%?-p %s\n", nv_addr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte nv_gl_file_info.sv_volname);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("pinned %2-d attached %2-d devidsz %3-d\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte nv_gl_file_info.sv_pinned,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte nv_gl_file_info.sv_attached,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte nv_gl_file_info.sv_devidsz);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("devid %s\n", nv_gl_file_info.sv_devid);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("NVRAM ok\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_dec_indent(4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte end:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_dec_indent(4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_OK);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * MDB module linkage information:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * We declare a list of structures describing our dcmds, and a function
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * named _mdb_init to return a pointer to our module information.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic const mdb_dcmd_t dcmds[] = {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* general dcmds */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { "sdbc_config", NULL,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "display sdbc configuration information",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sdbc_config },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { "sdbc_stats", NULL,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "display sdbc stats information",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sdbc_stats },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { "sdbc_vars", NULL,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "display some sdbc variables, counters and addresses",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sdbc_vars },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* cctl dcmds */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"sdbc_cctl", "?[-vdhioV][-c cd][-b blknum]",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "display sdbc cache ctl structures",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sdbc_cctl, cctl_help },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"sdbc_cchain", ":[-vdhioV][-c cd][-b blknum]",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "display cache ctl structure cc_chain",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sdbc_cchain, cchain_help },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"sdbc_dchain", ":[-vdhioV][-c cd][-b blknum]",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "display cache ctl structure dirty chain",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sdbc_dchain, dchain_help },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"sdbc_dmchain", ":[-vdhioV][-c cd][-b blknum]",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "display dynamic memory cache ctl chain",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sdbc_dmchain, dmchain_help },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"sdbc_hashchain", ":[-vdhioV][-c cd][-b blknum]",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "display a hash chain", sdbc_hashchain, hashchain_help },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"sdbc_hashtable", "?[-vdhioV][-c cd][-b blknum]",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "display hash table", sdbc_hashtable, hashtable_help },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"sdbc_lru", "?[-vdhioV][-c cd][-b blknum]",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "display the cache lru queue",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sdbc_lru, lru_help },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef SAFESTORE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* wctl dcmds */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"sdbc_wctl", "?[-vd][-c cd]",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "display the write control structures",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sdbc_wctl, wctl_help },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"sdbc_wrq", "?[-vd][-c cd]",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "display the write control queue",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sdbc_wrq, wrq_help },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* SAFESTORE */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* others */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"sdbc_cdinfo", "?[-av][-c cd]",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "display cache descriptor information",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sdbc_cdinfo, cdinfo_help },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef SAFESTORE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"sdbc_ftctl", "?[-vd][-c cd]",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "display the fault tolerant control structures",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sdbc_ftctl, ftctl_help },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* SAFESTORE */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"sdbc_handles", "?[-avC][-c cd]",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "display sdbc buffer handle information",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sdbc_handles, handle_help },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { "sdbc_dmqueues", NULL,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "display sdbc dynamic memory buffer queues information",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sdbc_dmqueues },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* "global" metadata dcmds */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"sdbc_glcinfo", "?[-adC][-c cd][-b fbapos]",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "display the global cache entry info structures",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sdbc_glcinfo, glcinfo_help },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"sdbc_glfinfo", "?[-aptC]",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "display the global file info structures",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sdbc_glfinfo, glfinfo_help },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { NULL }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte};
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic const mdb_walker_t walkers[] = {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* walkers of cctl list and arrays */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { "sdbc_cchain", "walk the cc_chain (alloc chain) of a cache ctl",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sdbc_cchain_winit, sdbc_cchain_wstep, sdbc_cchain_wfini },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { "sdbc_cctl", "walk the cache ctl structure list",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sdbc_cctl_winit, sdbc_cctl_wstep, sdbc_cctl_wfini },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { "sdbc_dchain", "walk the dirty chain of a cache ctl",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sdbc_dchain_winit, sdbc_dchain_wstep, sdbc_dchain_wfini },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { "sdbc_dmchain", "walk the dynamic memory chain of a cache cctl",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sdbc_dmchain_winit, sdbc_dmchain_wstep, sdbc_dmchain_wfini },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { "sdbc_hashchain", "walk a hash chain",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sdbc_hashchain_winit, sdbc_hashchain_wstep,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sdbc_hashchain_wfini },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { "sdbc_lru", "walk the cache lru queue",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sdbc_lru_winit, sdbc_lru_wstep, sdbc_lru_wfini },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef SAFESTORE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* walkers of wctl lists and arrays */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { "sdbc_wctl", "walk the allocated write ctl array",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sdbc_wctl_winit, sdbc_wctl_wstep, sdbc_wctl_wfini },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { "sdbc_wrq", "walk the write ctl queue (free list)",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sdbc_wrq_winit, sdbc_wrq_wstep, sdbc_wrq_wfini },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* SAFESTORE */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* others */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { "sdbc_cdinfo",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "walk the _sd_cache_files array of cache descriptor information",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sdbc_cdinfo_winit, sdbc_cdinfo_wstep, sdbc_cdinfo_wfini },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef SAFESTORE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { "sdbc_ftctl",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "walk the allocated array of fault tolerant structures",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sdbc_ftctl_winit, sdbc_ftctl_wstep, sdbc_ftctl_wfini },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* SAFESTORE */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { "sdbc_handles", "walk array of _sd_buf_handle_t structures",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sdbc_handle_winit, sdbc_handle_wstep, sdbc_handle_wfini },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* walkers for metadata arrays */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { "sdbc_glcinfo", "walk the allocated global cache entry info array",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sdbc_glcinfo_winit, sdbc_glcinfo_wstep, sdbc_glcinfo_wfini },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { "sdbc_glfinfo", "walk the allocated global file info array",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sdbc_glfinfo_winit, sdbc_glfinfo_wstep, sdbc_glfinfo_wfini },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { NULL }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte};
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic const mdb_modinfo_t modinfo = {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MDB_API_VERSION, dcmds, walkers
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte};
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteconst mdb_modinfo_t *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte_mdb_init(void)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (&modinfo);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}