ldc.c revision 3895f3e681d42b8122c8084f114c0d2f88dd7979
/*
* 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 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* This module provides debugging tools for the LDoms channels (ldc)
*/
#include <sys/mdb_modapi.h>
#include <sys/ldc_impl.h>
#include <sys/hypervisor_api.h>
const mdb_bitmask_t ldc_mode_bits[] = {
{ NULL, 0, 0}
};
const mdb_bitmask_t ldc_status_bits[] = {
{ NULL, 0, 0}
};
const mdb_bitmask_t ldc_tstate_bits[] = {
{ NULL, 0, 0}
};
const mdb_bitmask_t ldc_hstate_bits[] = {
{ NULL, 0, 0}
};
const mdb_bitmask_t ldc_class_bits[] = {
{ NULL, 0, 0}
};
const mdb_bitmask_t ldc_intrstate_bits[] = {
{ NULL, 0, 0}
};
const mdb_bitmask_t ldc_linkstate_bits[] = {
{ NULL, 0, 0}
};
const mdb_bitmask_t msg_type_bits[] = {
{ NULL, 0, 0}
};
const mdb_bitmask_t msg_stype_bits[] = {
{ NULL, 0, 0}
};
const mdb_bitmask_t msg_ctrl_bits[] = {
{ NULL, 0, 0}
};
const mdb_bitmask_t mhdl_status_bits[] = {
{ NULL, 0, 0}
};
const mdb_bitmask_t mhdl_type_bits[] = {
{ NULL, 0, 0}
};
const mdb_bitmask_t mhdl_perm_bits[] = {
{ NULL, 0, 0}
};
/*
* Print LDC channel information
*/
int
{
/*
* If no ldc_chan_t address was specified on the command line,
* we can print out all ldc channels by invoking the
* walker, using this dcmd itself as the callback.
*/
if (!(flags & DCMD_ADDRSPEC)) {
mdb_warn("failed to walk 'ldcinfo'");
return (DCMD_ERR);
}
return (DCMD_OK);
}
return (DCMD_ERR);
}
return (DCMD_USAGE);
}
if (DCMD_HDRSPEC(flags)) {
mdb_printf("%-5s %-13s %-6s %-8s %-6s %-6s %-6s %-8s\n",
"ID", "ADDR", "MODE", "DEVCLASS", "STATUS", "TSTATE",
"HSTATE", "HV_LINK");
}
mdb_printf("0x%-3x 0x%p %b %b %b 0x%-4x 0x%-4x %b\n",
if (verbose) {
mdb_printf("Callback: %a(0x%p) - %s\n",
mdb_printf("Tx Info: 0x%p len=0x%lx hd=0x%lx tl=0x%lx "
mdb_printf("Rx Info: 0x%p len=0x%lx intr=%b\n",
mdb_printf("Stream: buf=0x%p off=0x%lx remains=0x%lx\n",
}
mdb_printf("Memory: mtbl=0x%p mhdl_list=0x%p\n",
mdb_printf("Desc Ring: exported=0x%p imported=0x%p\n",
mdb_printf("\n");
}
return (DCMD_OK);
}
/*
* ldcinfo walker initialization
*/
int
{
/* Must have a start addr. */
mdb_warn("failed to read 'ldcssp'");
return (WALK_ERR);
}
return (WALK_DONE);
!= sizeof (softstate)) {
return (WALK_ERR);
}
}
return (WALK_NEXT);
}
/*
* ldcinfo walker step routine.
*/
int
{
int status;
return (WALK_DONE);
return (WALK_ERR);
}
wsp->walk_cbdata);
return (status);
}
/*
* dcmd to print ldc packet information
*
* arg0 - count (number of pkts to print)
*/
int
{
int i;
/*
* If no ldc_msg_t address was specified on the command line,
* print usage.
*/
if (!(flags & DCMD_ADDRSPEC)) {
return (DCMD_USAGE);
}
/* chk if we need to print more that one pkt */
if (argc != 0) {
else
}
/* print header */
mdb_printf("%-13s %-10s %-4s %-5s %-4s %-11s %-4s %-10s\n",
"ADDR", "SEQID", "TYPE", "STYPE", "CTRL", "ENVELOPE",
"SIZE", "ACKID");
/* print pkt */
for (i = 0; i < count; i++) {
return (DCMD_ERR);
}
else
mdb_printf("%-5s %-5s",
/* print size */
else
else
/* next packet */
}
return (DCMD_OK);
}
/*
* Print LDC map table information
*/
int
{
int i;
/*
* If no ldc_mtbl_t address was specified on the command line,
* print usage.
*/
if (!(flags & DCMD_ADDRSPEC)) {
return (DCMD_USAGE);
}
return (DCMD_ERR);
}
mdb_printf("Map Table: addr=0x%p total=%ld free=%ld tbl_base=0x%p\n",
return (DCMD_USAGE);
}
if (!verbose)
return (DCMD_OK);
/* print table header */
mdb_printf("\n%-4s %-13s %-2s %-2s %-2s %-2s %-2s %-2s %-2s %-5s\n",
"IDX", "RA_PFN", "CW", "CR", "IW", "IR", "X", "W", "R", "PGSZC");
/* print each table entry */
for (i = 0; i < mtbl.num_entries; i++) {
return (DCMD_ABORT);
}
/* skip empty entries */
mdb_printf("%-4d 0x%-11x %-2d %-2d %-2d %-2d "
"%-2d %-2d %-2d 0x%-2x\n",
}
}
return (DCMD_OK);
}
/*
* Print LDC channel memory handle information
*/
int
{
int i;
/*
* If no ldc_msg_t address was specified on the command line,
* print usage.
*/
if (!(flags & DCMD_ADDRSPEC)) {
return (DCMD_USAGE);
}
/* chk if we need to print more that one pkt */
if (argc != 0) {
else
}
mdb_printf("%-13s %-7s %-7s %-4s %-13s %-13s %-10s\n",
"ADDR", "STATUS", "MAPTYPE", "PERM", "MEMSEG", "VADDR", "SIZE");
/* print pkt */
for (i = 0; i < count; i++) {
return (DCMD_ERR);
}
mdb_printf("0x%p %b %b %b 0x%p ",
mdb_warn("failed to read ldc_memseg_t at %p",
return (DCMD_ERR);
}
} else {
mdb_printf("\n");
}
break;
}
return (DCMD_OK);
}
/*
* MDB module linkage information:
*/
static const mdb_dcmd_t dcmds[] = {
{ NULL }
};
static const mdb_walker_t walkers[] = {
{ "ldcinfo", "List all LDom channels",
{ NULL }
};
static const mdb_modinfo_t modinfo = {
};
const mdb_modinfo_t *
_mdb_init(void)
{
return (&modinfo);
}