damap.c revision 5d562cec9a5c49bc665980c775f32f708cb2f3e9
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
*/
#include <mdb/mdb_modapi.h>
#include <sys/sysmacros.h>
#include <sys/damap_impl.h>
#include "damap.h"
void
damap_help(void)
{
mdb_printf("Print the damap at the address given.\n");
mdb_printf("\n");
mdb_printf("EXAMPLE: SCSI: To display the SCSI tgtmap damaps ");
mdb_printf("associated with a scsi HBA driver iport dip:\n");
mdb_printf("\n");
mdb_printf("::devbindings -q <driver_name>\n");
mdb_printf("\n");
mdb_printf("<iport-dip>::print struct dev_info devi_driver_data|");
mdb_printf("::print scsi_hba_tran_t tran_tgtmap|");
mdb_printf("::print impl_scsi_tgtmap_t ");
mdb_printf("tgtmap_dam[0] tgtmap_dam[1]|::damap\n");
}
static char *
local_strdup(const char *s)
{
if (s)
else
return (NULL);
}
static void
local_strfree(const char *s)
{
if (s)
}
static void
{
return;
if (!embedded)
}
static bitset_t *
{
bitset_free(bs, 0);
return (NULL);
}
bitset_free(bs, 0);
return (NULL);
}
return (bs);
}
static void
{
int i;
struct i_ddi_soft_state *ss;
if (dam) {
/* free in dam_da_t softstate */
if (ss) {
continue;
}
}
}
/* free dam_active/stable/report_set embedded in dam */
/* free dam_name */
/* free dam */
}
if (kdamda)
}
/*
* The dam implementation uses a number of different abstractions. Given a
* pointer to a damap_t, this function make an mdb instantiation of the dam -
* many, but not all, of the different abstractions used in the dam
* implementation are also instantiated in mdb. This means that callers of
* damap_get can perform some (but not all) types of structure pointer
* traversals.
*/
struct dam *
{
/* variables that hold instantiation read from kernel */
char kstring[MAXPATHLEN];
struct i_ddi_soft_state kss;
int array_sz = 0;
/* variables that hold mdb instantiation */
struct i_ddi_soft_state *ss;
int i;
/* read kernel: dam */
goto err;
}
/* read kernel: dam->dam_name */
/* read kernel: dam->dam_da (softstate) */
mdb_warn("couldn't read dam dam_da 0x%p",
goto err;
}
/* read kernel ((struct i_ddi_soft_state *)dam->dam_da)->array */
mdb_warn("couldn't read dam dam_da array 0x%p",
goto err;
}
/*
* Produce mdb instantiation of kernel data structures.
*
* Structure copy kdam to dam, then clear out pointers in dam (some
* will be filled in by mdb instantiation code below).
*/
/* dam_addr_hash, dam_taskqp, dam_kstatp left as kernel addresses */
/* fill in dam_name */
/* fill in dam_active/stable/report_set embedded in the dam */
if (bs) {
}
if (bs) {
}
if (bs) {
}
/* fill in dam_da_t softstate */
continue;
mdb_warn("couldn't read dam dam_da %d 0x%p", i,
goto err;
}
/* da_nvl, da_ppriv_rpt, da_nvl_rpt left as kernel addresses */
/* read kernel: da->da_addr */
}
/* return array of kernel dam_da_t pointers associated with each id */
/* return pointer to mdb instantiation of the dam */
return (dam);
*pkdamda_n = 0;
return (NULL);
}
/*ARGSUSED*/
static void
{
struct i_ddi_soft_state *ss;
int i;
return;
return;
mdb_printf(" #: %-20s [ASR] ref config-private provider-private\n",
"address");
continue;
/* Print index and address. */
mdb_printf("A");
else
mdb_printf(".");
mdb_printf("S");
else
mdb_printf(".");
mdb_printf("R");
else
mdb_printf(".");
/* Print the reference count and priv */
mdb_printf("] %-3d %0?lx %0?lx\n",
}
}
/*ARGSUSED*/
int
{
void **kdamda;
int kdamda_n;
if (!(flags & DCMD_ADDRSPEC)) {
return (DCMD_ERR);
}
return (DCMD_ERR);
return (DCMD_OK);
}