/*
* 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
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/ddi_impldefs.h>
#include <sys/mdi_impldefs.h>
#include <sys/mdb_modapi.h>
struct i_ddi_soft_state *sp);
/* Utils */
{ "vhci_states", "[ -v ]", "dump all the vhci state pointers",
vhci_states },
vhciguid },
{ NULL }
};
};
static char *client_lb_str[] =
{
"NONE",
"RR",
"LBA",
};
static char *mdi_client_states[] =
{
NULL,
"OPTIMAL",
"DEGRADED",
"FAILED",
};
static char *client_flags[] =
{
"MDI_CLIENT_FLAGS_OFFLINE",
"MDI_CLIENT_FLAGS_SUSPEND",
"MDI_CLIENT_FLAGS_POWER_DOWN",
"MDI_CLIENT_FLAGS_DETACH",
"MDI_CLIENT_FLAGS_FAILOVER",
"MDI_CLIENT_FLAGS_REPORT_DEV",
"MDI_CLIENT_FLAGS_PATH_FREE_IN_PROGRESS",
"MDI_CLIENT_FLAGS_ASYNC_FREE",
"MDI_CLIENT_FLAGS_DEV_NOT_SUPPORTED",
};
static char *vhci_conf_flags[] =
{
"VHCI_CONF_FLAGS_AUTO_FAILBACK",
};
static char *svlun_flags[] =
{
"VLUN_TASK_D_ALIVE_FLG",
"VLUN_RESERVE_ACTIVE_FLG",
"VLUN_QUIESCED_FLG",
};
const mdb_modinfo_t *
_mdb_init(void)
{
return (&modinfo);
}
/*
* mdiclient()
*
* Dump mdi_client_t info and list all paths.
*/
/* ARGSUSED */
static int
{
if (!(flags & DCMD_ADDRSPEC)) {
mdb_warn("mdiclient: requires an address");
return (DCMD_ERR);
}
!= sizeof (struct mdi_client)) {
return (DCMD_ERR);
}
mdb_printf("\n");
mdb_printf("ct_hnext: %26l#r::print struct mdi_client\n",
mdb_printf("ct_hprev: %26l#r::print struct mdi_client\n",
mdb_printf("\nct_path_head: %22l#r::print struct mdi_pathinfo\n",
mdb_printf("ct_path_tail: %22l#r::print struct mdi_pathinfo\n",
mdb_printf("ct_path_last: %22l#r::print struct mdi_pathfinfo\n",
mdb_printf("List of paths:\n");
mdb_printf("\n");
}
mdb_printf("\n");
;
;
return (DCMD_OK);
}
/*
* vhcilun()
*
* Get client info given a guid.
*/
/* ARGSUSED */
static int
{
if (!(flags & DCMD_ADDRSPEC)) {
mdb_warn("sv_lun: requires an address");
return (DCMD_ERR);
}
}
/*
* vhciguid()
*
* List all the clients.
*/
/* ARGSUSED */
static int
{
int i;
int ct_hash_count = 0;
char *class;
int found = 0;
if (flags & DCMD_ADDRSPEC)
mdb_warn("This command doesn't use an address\n");
return (DCMD_ERR);
mdb_warn("mdi driver variable mdi_vhci_head not found.\n");
mdb_warn("Is the driver loaded ?\n");
return (DCMD_ERR);
}
return (DCMD_ERR);
}
!= strlen(MDI_HCI_CLASS_SCSI)) {
mdb_warn("vhciguid: Failed read of class %l#r\n",
return (DCMD_ERR);
}
while (class) {
found = 1;
break;
}
break;
}
!= mdi_vhci_len) {
mdb_warn("vhciguid: Failed read on vh->next %l#r\n",
break;
}
mdb_warn("vhciguid: Failed read on vh->next %l#r\n",
break;
}
}
if (found == 0) {
mdb_warn("vhciguid: No scsi_vhci class found");
return (DCMD_ERR);
}
mdb_printf("----- Number of devices found %d ----------\n",
for (i = 0; i < CLIENT_HASH_TABLE_SIZE; i++) {
if (ct_hash_table_val == NULL)
continue;
/* Read client_hash structure */
mdb_warn("Failed read on hash %l#r\n",
break;
}
mdb_printf("----hash[%d] %l#r: devices mapped = %d --\n",
if (ct_hash_val->ct_hash_count == 0) {
continue;
}
/* Read mdi_client structures */
!= mdi_client_len) {
mdb_warn("Failed read on client %l#r\n",
break;
}
mdb_printf("mdi_client %l#r %l#r ------\n",
DCMD_ADDRSPEC, 0, 0);
while (--ct_hash_count) {
temp) != mdi_client_len) {
mdb_warn("Failed read on client %l#r\n",
break;
}
DCMD_ADDRSPEC, 0, 0);
}
}
mdb_printf("----------done----------\n");
return (DCMD_OK);
}
/*
* Print the flag name by comparing flags to the mask variable.
*/
static void
{
for (i = 0; i < 64; i++) {
break;
if (!first) {
mdb_printf(" | ");
} else {
first = 0;
}
/* make output pretty */
if (linel > 80) {
mdb_printf("\n\t");
}
}
mask <<= 1;
}
mdb_printf("\n");
}
/* ARGSUSED */
static int
{
}
/*
* dump_states()
*
* Print the state information for vhci_states().
*/
static int
{
int i;
int array_size;
} else {
}
mdb_warn("Cannot read softstate struct (Invalid pointer?).\n");
return (DCMD_ERR);
}
mdb_warn("Corrupted softstate struct.\n");
return (DCMD_ERR);
}
return (DCMD_OK);
if (verbose) {
/*
* ss->size is of type size_t which is 4 bytes and 8 bytes
* on 32-bit and 64-bit systems respectively.
*/
#ifdef _LP64
mdb_printf("Softstate size is %lld(0x%llx) bytes.\n\n",
#else
mdb_printf("Softstate size is %ld(0x%lx) bytes.\n\n",
#endif
mdb_printf("state pointer\t\t\t\t\tinstance\n");
mdb_printf("=============\t\t\t\t\t========\n");
}
continue;
!= sizeof (vhci)) {
mdb_warn("Corrupted softstate struct.\n");
return (DCMD_ERR);
}
if (verbose) {
mdb_printf("%l#r::print struct scsi_vhci\t\t %d\n",
mdb_printf("\nvhci_conf_flags: %d\n",
if (vhci.vhci_conf_flags) {
mdb_printf("\t");
dump_flags((unsigned long long)
}
} else {
}
}
return (DCMD_OK);
}
static int
{
return (1);
}
return (0);
}
static void
{
}
/* VHCI UTILS */
/*
* i_vhci_states()
*
* Internal routine for vhci_states() to check for -v arg and then
* print state info.
*/
/* ARGSUSED */
static int
struct i_ddi_soft_state *sp)
{
int verbose = 0;
mdb_warn("vhci driver variable vhci_softstate not found.\n");
mdb_warn("Is the driver loaded ?\n");
return (DCMD_ERR);
}
return (DCMD_USAGE);
}
}
}
/*
* i_vhcilun()
*
* Internal routine for vhciguid() to print client info.
*/
static int
{
int found = 0;
do {
sizeof (scsi_vhci_lun_t)) {
return (DCMD_ERR);
}
if (display_single_guid) {
found = 1;
} else continue;
}
}
mdb_warn("svl_dip: Failed read on %l#r",
return (DCMD_ERR);
}
string_val)) {
}
} else {
mdb_printf(" No active pclass");
}
if (display_single_guid) {
}
mdb_printf("\n%t%l#r::print struct mdi_client",
mdb_printf("\t");
} else {
mdb_printf("\n");
}
if (found) {
DCMD_ADDRSPEC, 0, 0);
} else {
sizeof (struct mdi_client)) {
mdb_warn("mdiclient: Failed read on %l#r",
return (DCMD_ERR);
}
mdb_printf("\t");
dump_flags((unsigned long long)
}
mdb_printf("%t");
mdb_printf("\n");
}
return (DCMD_OK);
}
static void
{
}
static void
{
}
static void
{
return;
}
}
/* ARGSUSED */
static int
{
return (0);
}