/*
* 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>
#include "mdi.h"
/* Utils */
static char *client_lb_str[] =
{
"NONE",
"RR",
"LBA",
};
static char *mdi_pathinfo_states[] =
{
"MDI_PATHINFO_STATE_INIT",
"MDI_PATHINFO_STATE_ONLINE",
"MDI_PATHINFO_STATE_STANDBY",
"MDI_PATHINFO_STATE_FAULT",
"MDI_PATHINFO_STATE_OFFLINE",
};
static char *mdi_pathinfo_ext_states[] =
{
"MDI_PATHINFO_STATE_USER_DISABLE",
"MDI_PATHINFO_STATE_DRV_DISABLE",
"MDI_PATHINFO_STATE_DRV_DISABLE_TRANSIENT",
};
static char *mdi_phci_flags[] =
{
"MDI_PHCI_FLAGS_OFFLINE",
"MDI_PHCI_FLAGS_SUSPEND",
"MDI_PHCI_FLAGS_POWER_DOWN",
"MDI_PHCI_FLAGS_DETACH",
"MDI_PHCI_FLAGS_USER_DISABLE",
"MDI_PHCI_FLAGS_D_DISABLE",
"MDI_PHCI_FLAGS_D_DISABLE_TRANS",
"MDI_PHCI_FLAGS_POWER_TRANSITION",
};
/*
* mdipi()
*
* Given a path, dump mdi_pathinfo struct and detailed pi_prop list.
*/
/* ARGSUSED */
int
{
if (!(flags & DCMD_ADDRSPEC)) {
mdb_warn("mdipi: requires an address");
return (DCMD_ERR);
}
sizeof (struct mdi_pathinfo)) {
return (DCMD_ERR);
}
mdb_printf("\n");
mdb_printf("pi_client: %25l#r::print struct mdi_client\n",
mdb_printf("pi_client_link: %20l#r::print struct mdi_pathinfo\n",
mdb_printf("pi_phci_link: %22l#r::print struct mdi_pathinfo\n",
mdb_printf("\n");
dump_state_str("Pathinfo State (pi_state) ",
if (MDI_PI_IS_TRANSIENT(&value)) {
mdb_printf("Pathinfo State is TRANSIENT\n");
}
if (MDI_PI_EXT_STATE(&value)) {
mdb_printf(" Extended (pi_state) : ");
/*
* Need to shift right 20 bits to match mdi_pathinfo_ext_states
* array.
*/
}
dump_state_str("Old Pathinfo State (pi_old_state)",
if (MDI_PI_OLD_EXT_STATE(&value)) {
mdb_printf(" Extended (pi_old_state) : ");
/*
* Need to shift right 20 bits to match mdi_pathinfo_ext_states
* array.
*/
>> 20, mdi_pathinfo_ext_states);
}
mdb_printf("\n");
mdb_printf("\n");
mdb_printf("pi_kstats: %25l#r::print struct mdi_pi_kstats\n",
return (DCMD_OK);
}
/*
* mdiprops()
*
* Given a pi_prop, dump the pi_prop list.
*/
/* ARGSUSED */
int
{
if (!(flags & DCMD_ADDRSPEC)) {
mdb_warn("mdiprops: requires an address");
return (DCMD_ERR);
}
mdb_printf("\n");
return (DCMD_OK);
}
/*
* mdiphci()
*
* Given a phci, dump mdi_phci struct.
*/
/* ARGSUSED */
int
{
if (!(flags & DCMD_ADDRSPEC)) {
mdb_warn("mdiphci: requires an address");
return (DCMD_ERR);
}
sizeof (struct mdi_phci)) {
return (DCMD_ERR);
}
mdb_printf("\nph_path_head: %22l#r::print struct mdi_pathinfo\n",
mdb_printf("ph_path_tail: %22l#r::print struct mdi_pathinfo\n",
mdb_printf("List of paths:\n");
mdb_printf("\n");
}
"Paths in transient state (ph_unstable_cv)");
return (DCMD_OK);
}
/*
* mdivhci()
*
* Given a vhci, dump mdi_vhci struct and list all phcis.
*/
/* ARGSUSED */
int
{
if (!(flags & DCMD_ADDRSPEC)) {
mdb_warn("mdivhci: requires an address");
return (DCMD_ERR);
}
sizeof (struct mdi_vhci)) {
return (DCMD_ERR);
}
mdb_printf("vh_ops: %28l#r::print struct mdi_vhci_ops\n",
mdb_printf("\nvh_phci_head: %22l#r::print struct mdi_phci\n",
mdb_printf("vh_phci_tail: %22l#r::print struct mdi_phci\n",
mdb_printf("vh_client_table: %19l#r::print struct client_hash\n",
mdb_printf("List of pHCIs:\n");
mdb_printf("\n");
return (DCMD_OK);
}
/* mdi_pathinfo client walker */
/* ARGUSED */
int
{
mdb_warn("Address is required");
return (WALK_ERR);
}
return (WALK_NEXT);
}
/* ARGUSED */
int
{
int status = 0;
static int counts = 0;
counts = 0;
return (WALK_DONE);
}
counts = 0;
return (WALK_DONE);
}
return (WALK_DONE);
}
wsp->walk_cbdata);
counts++;
return (status);
}
/* ARGUSED */
void
{
}
/*
* mdiclient_paths()
*
* Given a path, walk through mdi_pathinfo client links.
*/
/* ARGUSED */
int
{
int status;
if (argc != 0)
return (DCMD_USAGE);
if (!(flags & DCMD_ADDRSPEC)) {
mdb_warn("Address needs to be specified");
return (DCMD_ERR);
}
status =
return (status);
}
/* mdi_pathinfo phci walker */
int
{
mdb_warn("Address is required");
return (WALK_ERR);
}
return (WALK_NEXT);
}
int
{
int status;
static int counts = 0;
counts = 0;
return (WALK_DONE);
}
counts = 0;
return (WALK_DONE);
}
return (WALK_DONE);
}
wsp->walk_cbdata);
counts++;
return (status);
}
void
{
}
/*
* mdiphci_paths()
*
* Given a path, walk through mdi_pathinfo phci links.
*/
int
{
int status;
if (argc != 0)
return (DCMD_USAGE);
if (!(flags & DCMD_ADDRSPEC)) {
mdb_warn("Address needs to be specified");
return (DCMD_ERR);
}
status =
return (status);
}
/* mdi_phci walker */
int
{
mdb_warn("Address is required");
return (WALK_ERR);
}
return (WALK_NEXT);
}
int
{
int status;
static int counts = 0;
counts = 0;
return (WALK_DONE);
}
counts = 0;
return (WALK_DONE);
}
== -1) {
return (WALK_DONE);
}
wsp->walk_cbdata);
counts++;
return (status);
}
void
{
}
/*
* mdiphcis()
*
* Given a phci, walk through mdi_phci ph_next links.
*/
int
{
int status;
if (argc != 0)
return (DCMD_USAGE);
if (!(flags & DCMD_ADDRSPEC)) {
mdb_warn("Address needs to be specified");
return (DCMD_ERR);
}
status =
return (status);
}
/*
* 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");
}
static void
{
}
static void
{
}
static int
{
return (1);
}
return (0);
}
static void
{
return;
}
}
static void
{
}
/* ARGSUSED */
static int
{
return (0);
}