intr.c revision 09b1eac246a4e627fcbd1ce5bf8005746cbe45ea
/*
* 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 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <sys/mdb_modapi.h>
#include <sys/ddi_subrdefs.h>
#include "px_obj.h"
static int intr_pci_walk_step(mdb_walk_state_t *);
static int intr_px_walk_step(mdb_walk_state_t *);
static void intr_pci_print_items(mdb_walk_state_t *);
static void intr_px_print_items(mdb_walk_state_t *);
static void intr_print_banner(void);
typedef struct intr_info {
int instance;
int shared;
char driver_name[12];
char pathname[MAXNAMELEN];
}
#define PX_MAX_ENTRIES 32
static void intr_print_elements(intr_info_t);
static int detailed = 0; /* Print detailed view */
static int
{
return (WALK_NEXT);
}
static int
{
/* read globally declared structures in the pci driver */
}
/* read globally declared structures in the px driver */
}
return (WALK_DONE);
}
static int
{
/* Read start of state structure array */
mdb_warn("intr: failed to read the initial pci_per_p "
"structure\n");
return (WALK_ERR);
}
/* Figure out how many items are here */
/* Read until nothing is left */
return (WALK_DONE);
}
start_addr += sizeof (uintptr_t);
}
return (WALK_DONE);
}
static int
{
int x;
/* Read start of state structure array */
mdb_warn("intr: failed to read the initial px_per_p "
"structure\n");
return (WALK_ERR);
}
/* Figure out how many items are here */
for (x = 0; x < PX_MAX_ENTRIES; x++) {
start_addr += sizeof (uintptr_t);
/* Read if anything is there */
continue;
}
}
return (WALK_DONE);
}
static void
{
int count;
mdb_warn("intr: failed to read pci interrupt block "
"structure\n");
return;
}
/* Read in ib_ino_info_t structure at address */
/* Nothing here to read from */
return;
}
do {
mdb_warn("intr: failed to read pci interrupt "
"ib_ino_pil_t structure\n");
return;
}
do {
mdb_warn("intr: failed to read pci interrupt "
"ih_t structure\n");
return;
}
count = 0;
do {
}
/* Get instance */
mdb_warn("intr: failed to read DIP "
"structure\n");
return;
}
/* Make sure the name doesn't over run */
count++;
}
static void
{
int count;
return;
}
/* Read in px_ino_t structure at address */
/* Nothing here to read from */
return;
}
do { /* ino_next_p loop */
continue;
}
do { /* ipil_next_p loop */
continue;
}
count = 0;
do { /* ipil_ih_size loop */
/* Get instance */
mdb_warn("intr: failed to read DIP "
"structure\n");
return;
}
/* Make sure the name doesn't over run */
/*
* Read the type used, keep PCIe messages
* separate.
*/
sizeof (devinfo_intr_t),
}
}
count++;
}
static char *
{
switch (type) {
case DDI_INTR_TYPE_FIXED:
return ("Fixed");
case DDI_INTR_TYPE_MSI:
return ("MSI");
case DDI_INTR_TYPE_MSIX:
return ("MSI-X");
default:
return ("PCIe");
}
}
static void
intr_print_banner(void)
{
if (!detailed) {
mdb_printf("\n%<u>\tDevice\t"
" Shared\t"
" Type\t"
" MSG #\t"
" State\t"
" INO\t"
" Mondo\t"
" Pil\t"
" CPU %</u>"
"\n");
}
}
static void
{
if (!detailed) {
mdb_printf(" %5s\t",
mdb_printf(" --- \t");
} else {
}
mdb_printf(" %2s\t",
} else {
mdb_printf("\n-------------------------------------------\n");
mdb_printf("Interrupt Type:\t%s\n",
}
mdb_printf("Shared Intr:\t%s\n",
}
}
/*ARGSUSED*/
static void
{
/* Nothing to do here */
}
/*ARGSUSED*/
static int
{
detailed = 0;
return (DCMD_USAGE);
if (!(flags & DCMD_ADDRSPEC)) {
== -1) {
return (DCMD_ERR);
}
return (DCMD_OK);
}
return (DCMD_OK);
}
/*
* MDB module linkage information:
*/
static const mdb_dcmd_t dcmds[] = {
{ "interrupts", "[-d]", "display the interrupt info registered with "
{ NULL }
};
static const mdb_walker_t walkers[] = {
{ NULL }
};
static const mdb_modinfo_t modinfo = {
};
const mdb_modinfo_t *
_mdb_init(void)
{
return (&modinfo);
}