ao.c revision 7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fe
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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 <mdb/mdb_modapi.h>
#include <amd_opteron/ao.h>
static const mdb_bitmask_t ao_nbcfg_bits[] = {
/* LdtLinkSel handled separately */
/* WdogTmrBaseSel handled separately */
/* WdogTmrCntSel handled separately */
/* WdogTmrDis handled separately */
};
/*ARGSUSED*/
static int
{
const mdb_bitmask_t *bm;
int nbits, i;
return (DCMD_USAGE);
continue;
nbits++;
}
}
if (!(val & AMD_NB_CFG_WDOGTMRDIS)) {
static const uint_t wdogcounts[] = {
4095, 2047, 1023, 511, 255, 127, 63, 31
};
int valid = 1;
const char *units;
else
valid = 0;
switch (basefld) {
units = "ms";
break;
units = "us";
break;
count *= 5;
units = "ns";
break;
default:
units = " (unknown units)";
break;
}
if (valid) {
units);
} else {
mdb_printf("\tInvalid Watchdog: Count %u, Base %u\n",
}
}
return (DCMD_OK);
}
/*ARGSUSED3*/
static int
{
static const char *const whatstrs[] = {
"cyc-err", "poke-err", "unfault"
};
const char *what;
return (DCMD_USAGE);
return (DCMD_ERR);
}
if (DCMD_HDRSPEC(flags)) {
mdb_printf("%<u>%?s%</u> %<u>%?s%</u> %<u>%9s%</u> "
"%<u>%4s%</u>\n", "ADDR", "WHEN", "WHAT", "NERR");
}
else
what = "???";
return (DCMD_OK);
}
typedef struct mptwalk_data {
static int
{
mdb_warn("the address of a poll trace array must be specified");
return (WALK_ERR);
}
mdb_warn("failed to read ao_mca_poll_trace_nent from kernel");
return (WALK_ERR);
}
mw->mw_tracesz) {
mdb_warn("failed to read poll trace array from kernel");
return (WALK_ERR);
}
latest = 0;
mw->mw_curtrace = 0;
mw->mw_curtrace = i;
}
}
if (latest == 0) {
return (WALK_DONE); /* trace array is empty */
}
return (WALK_NEXT);
}
static int
{
return (rv);
return (WALK_DONE);
return (WALK_NEXT);
}
static void
{
}
static const mdb_dcmd_t dcmds[] = {
{ "ao_nbcfg", ":", "decode Northbridge config bits",
{ NULL }
};
static const mdb_walker_t walkers[] = {
{ "ao_poll_trace", "walks poll trace buffers in reverse chronological "
{ NULL }
};
const mdb_modinfo_t *
_mdb_init(void)
{
return (&modinfo);
}